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

Version Description

  • Upgrade highly recommended. Several bug fixes, improvements, and some new features.

=

Download this release

Release Info

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

Code changes from version 3.0.4 to 3.0.5

Files changed (111) hide show
  1. images/brand-upsell-pro.fla +0 -0
  2. images/brand-upsell-pro.png +0 -0
  3. images/logo.fla +0 -0
  4. images/logo.png +0 -0
  5. images/paypal-logo.png +0 -0
  6. images/promos/590x300.jpg +0 -0
  7. images/promos/900x285.jpg +0 -0
  8. images/promos/900x385.jpg +0 -0
  9. images/promos/shots/00_preview-590x300.jpg +0 -0
  10. images/promos/shots/00_preview-900x285.jpg +0 -0
  11. images/promos/shots/00_preview-900x385.jpg +0 -0
  12. includes/codes.inc.php +1 -1
  13. includes/funcs.inc.php +1 -1
  14. includes/functions/activate-deactivate.inc.php +44 -8
  15. includes/functions/admin-lockout.inc.php +3 -3
  16. includes/functions/admin-notices.inc.php +1 -1
  17. includes/functions/auto-eots.inc.php +55 -72
  18. includes/functions/catg-level-access.inc.php +40 -23
  19. includes/functions/constants.inc.php +11 -9
  20. includes/functions/css-js-w-globals.inc.php +212 -0
  21. includes/functions/demotions.inc.php +29 -0
  22. includes/functions/email-configs.inc.php +1 -1
  23. includes/functions/extend-cron.inc.php +33 -0
  24. includes/functions/file-download-access.inc.php +73 -29
  25. includes/functions/force-ssl.inc.php +71 -0
  26. includes/functions/hide-some-systematics.inc.php +1 -1
  27. includes/functions/ip-restrictions.inc.php +2 -2
  28. includes/functions/is-systematic.inc.php +4 -4
  29. includes/functions/js-globals.inc.php +0 -161
  30. includes/functions/list-servers.inc.php +1 -1
  31. includes/functions/login-customizations.inc.php +1 -1
  32. includes/functions/login-redirection.inc.php +5 -7
  33. includes/functions/menu-pages.inc.php +21 -11
  34. includes/functions/nocache.inc.php +1 -1
  35. includes/functions/page-level-access.inc.php +20 -14
  36. includes/functions/paypal-button.inc.php +144 -0
  37. includes/functions/paypal-notify.inc.php +381 -193
  38. includes/functions/paypal-return.inc.php +48 -39
  39. includes/functions/paypal-utilities.inc.php +208 -18
  40. includes/functions/post-level-access.inc.php +17 -11
  41. includes/functions/profile-modifications.inc.php +29 -17
  42. includes/functions/ptag-level-access.inc.php +31 -19
  43. includes/functions/readme-parsing.inc.php +22 -16
  44. includes/functions/register-access.inc.php +153 -121
  45. includes/functions/ruri-level-access.inc.php +13 -8
  46. includes/functions/shortcodes.inc.php +0 -142
  47. includes/functions/sp-access.inc.php +3 -3
  48. includes/functions/tracking-codes.inc.php +3 -3
  49. includes/functions/translations.inc.php +1 -1
  50. includes/functions/user-access-level.inc.php +5 -3
  51. includes/functions/user-deletions.inc.php +6 -8
  52. includes/functions/user-has-wp-role.inc.php +1 -1
  53. includes/functions/user-notes.inc.php +1 -1
  54. includes/functions/users-list.inc.php +77 -81
  55. includes/functions/utilities.inc.php +87 -1
  56. includes/hooks.inc.php +7 -1
  57. includes/menu-pages/api-ops.inc.php +32 -31
  58. includes/menu-pages/buttons.inc.php +0 -647
  59. includes/menu-pages/code-samples/ccap-file-downloads.php +2 -0
  60. includes/menu-pages/code-samples/current-user-access-label.php +1 -1
  61. includes/menu-pages/code-samples/current-user-can-specific-content.php +1 -1
  62. includes/menu-pages/code-samples/level0-file-downloads-allowed-days.php +3 -0
  63. includes/menu-pages/code-samples/level0-file-downloads-allowed.php +3 -0
  64. includes/menu-pages/code-samples/level0-label.php +3 -0
  65. includes/menu-pages/code-samples/level1-file-downloads-allowed-days.php +1 -1
  66. includes/menu-pages/code-samples/level1-file-downloads-allowed.php +1 -1
  67. includes/menu-pages/code-samples/level1-label.php +1 -1
  68. includes/menu-pages/code-samples/level2-file-downloads-allowed-days.php +1 -1
  69. includes/menu-pages/code-samples/level2-file-downloads-allowed.php +1 -1
  70. includes/menu-pages/code-samples/level2-label.php +1 -1
  71. includes/menu-pages/code-samples/level3-file-downloads-allowed-days.php +1 -1
  72. includes/menu-pages/code-samples/level3-file-downloads-allowed.php +1 -1
  73. includes/menu-pages/code-samples/level3-label.php +1 -1
  74. includes/menu-pages/code-samples/level4-file-downloads-allowed-days.php +1 -1
  75. includes/menu-pages/code-samples/level4-file-downloads-allowed.php +1 -1
  76. includes/menu-pages/code-samples/level4-label.php +1 -1
  77. includes/menu-pages/down-ops.inc.php +53 -12
  78. includes/menu-pages/els-ops.inc.php +2 -1
  79. includes/menu-pages/info.inc.php +2 -1
  80. includes/menu-pages/menu-pages-s.js +100 -68
  81. includes/menu-pages/options.inc.php +200 -70
  82. includes/menu-pages/paypal-buttons.inc.php +650 -0
  83. includes/menu-pages/paypal-ops.inc.php +28 -17
  84. includes/menu-pages/scripting.inc.php +50 -9
  85. includes/menu-pages/start.inc.php +2 -1
  86. includes/menu-pages/trk-ops.inc.php +14 -13
  87. includes/profile.inc.php +22 -16
  88. includes/s2member-min.js +0 -1
  89. includes/s2member.css +12 -0
  90. includes/s2member.js +23 -32
  91. includes/syscon.inc.php +27 -33
  92. includes/templates/buttons/{c-button.html → paypal-cancellation-button.html} +0 -0
  93. includes/templates/buttons/{button.html → paypal-checkout-button.html} +1 -1
  94. includes/templates/buttons/{sp-button.html → paypal-sp-checkout-button.html} +1 -1
  95. includes/templates/options/{currencies.html → paypal-currencies.html} +0 -0
  96. includes/templates/options/{membership-modification-levels.html → paypal-membership-modification-levels.html} +6 -0
  97. includes/templates/options/{membership-regular-terms.html → paypal-membership-regular-terms.html} +4 -7
  98. includes/templates/options/{membership-trial-terms.html → paypal-membership-trial-terms.html} +0 -0
  99. includes/templates/options/{sp-hours.html → paypal-sp-hours.html} +8 -0
  100. includes/templates/shortcodes/c-shortcode.html +0 -1
  101. includes/templates/shortcodes/paypal-cancellation-button-shortcode.html +1 -0
  102. includes/templates/shortcodes/paypal-checkout-button-shortcode.html +1 -0
  103. includes/templates/shortcodes/paypal-sp-checkout-button-shortcode.html +1 -0
  104. includes/templates/shortcodes/shortcode.html +0 -1
  105. includes/templates/shortcodes/sp-shortcode.html +0 -1
  106. licensing/license.txt +1 -5
  107. readme.txt +85 -81
  108. s2member.php +28 -14
  109. screenshot-10.png +0 -0
  110. screenshot-5.png +0 -0
  111. screenshot-9.png +0 -0
images/brand-upsell-pro.fla ADDED
Binary file
images/brand-upsell-pro.png ADDED
Binary file
images/logo.fla CHANGED
Binary file
images/logo.png CHANGED
Binary file
images/paypal-logo.png ADDED
Binary file
images/promos/590x300.jpg CHANGED
Binary file
images/promos/900x285.jpg CHANGED
Binary file
images/promos/900x385.jpg CHANGED
Binary file
images/promos/shots/00_preview-590x300.jpg CHANGED
Binary file
images/promos/shots/00_preview-900x285.jpg CHANGED
Binary file
images/promos/shots/00_preview-900x385.jpg CHANGED
Binary file
includes/codes.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
  /*
17
  Add WordPress® Editor Shortcodes.
18
  http://codex.wordpress.org/Shortcode_API
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
  /*
17
  Add WordPress® Editor Shortcodes.
18
  http://codex.wordpress.org/Shortcode_API
includes/funcs.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
  /*
17
  Include all of the functions that came with this plugin.
18
  */
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
  /*
17
  Include all of the functions that came with this plugin.
18
  */
includes/functions/activate-deactivate.inc.php CHANGED
@@ -12,7 +12,22 @@ If not, see: <http://www.gnu.org/licenses/>.
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  /*
17
  Function for handling activation routines.
18
  This function should match the array key for this plugin:
@@ -29,6 +44,9 @@ if (!function_exists ("ws_plugin__s2member_activate"))
29
  {
30
  do_action ("ws_plugin__s2member_before_activation", get_defined_vars ());
31
  /**/
 
 
 
32
  add_role ("s2member_level1", "s2Member Level 1");
33
  add_role ("s2member_level2", "s2Member Level 2");
34
  add_role ("s2member_level3", "s2Member Level 3");
@@ -37,48 +55,56 @@ if (!function_exists ("ws_plugin__s2member_activate"))
37
  $role = &get_role ("s2member_level1");
38
  $role->add_cap ("read");
39
  $role->add_cap ("level_0");
 
40
  $role->add_cap ("access_s2member_level1");
41
  /**/
42
  $role = &get_role ("s2member_level2");
43
  $role->add_cap ("read");
44
  $role->add_cap ("level_0");
45
- $role->add_cap ("access_s2member_level2");
46
  $role->add_cap ("access_s2member_level1");
 
47
  /**/
48
  $role = &get_role ("s2member_level3");
49
  $role->add_cap ("read");
50
  $role->add_cap ("level_0");
51
- $role->add_cap ("access_s2member_level3");
52
- $role->add_cap ("access_s2member_level2");
53
  $role->add_cap ("access_s2member_level1");
 
 
54
  /**/
55
  $role = &get_role ("s2member_level4");
56
  $role->add_cap ("read");
57
  $role->add_cap ("level_0");
58
- $role->add_cap ("access_s2member_level4");
59
- $role->add_cap ("access_s2member_level3");
60
- $role->add_cap ("access_s2member_level2");
61
  $role->add_cap ("access_s2member_level1");
 
 
 
62
  /**/
63
  $role = &get_role ("administrator");
 
64
  $role->add_cap ("access_s2member_level1");
65
  $role->add_cap ("access_s2member_level2");
66
  $role->add_cap ("access_s2member_level3");
67
  $role->add_cap ("access_s2member_level4");
68
  /**/
69
  $role = &get_role ("editor");
 
70
  $role->add_cap ("access_s2member_level1");
71
  $role->add_cap ("access_s2member_level2");
72
  $role->add_cap ("access_s2member_level3");
73
  $role->add_cap ("access_s2member_level4");
74
  /**/
75
  $role = &get_role ("author");
 
76
  $role->add_cap ("access_s2member_level1");
77
  $role->add_cap ("access_s2member_level2");
78
  $role->add_cap ("access_s2member_level3");
79
  $role->add_cap ("access_s2member_level4");
80
  /**/
81
  $role = &get_role ("contributor");
 
82
  $role->add_cap ("access_s2member_level1");
83
  $role->add_cap ("access_s2member_level2");
84
  $role->add_cap ("access_s2member_level3");
@@ -112,9 +138,11 @@ if (!function_exists ("ws_plugin__s2member_activate"))
112
  if (!is_array (get_option ("ws_plugin__s2member_options")))
113
  update_option ("ws_plugin__s2member_options", array ());
114
  /**/
 
 
115
  if (get_option ("ws_plugin__s2member_configured")) /* If they already have s2Member configured, read the Changelog. */
116
  {
117
- $notice = '<strong>s2Member</strong> has been <strong>re-activated</strong>, with the latest version. Your existing configuration remains intact.<br />';
118
  $notice .= 'Have fun, <a href="admin.php?page=ws-plugin--s2member-info">read the Changelog</a>, and make some money! :-)';
119
  ws_plugin__s2member_enqueue_admin_notice ($notice, array ("plugins.php", "ws-plugin--s2member-options"));
120
  }
@@ -143,30 +171,37 @@ if (!function_exists ("ws_plugin__s2member_deactivate"))
143
  /**/
144
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["run_deactivation_routines"])
145
  {
 
 
 
146
  remove_role ("s2member_level1");
147
  remove_role ("s2member_level2");
148
  remove_role ("s2member_level3");
149
  remove_role ("s2member_level4");
150
  /**/
151
  $role = &get_role ("administrator");
 
152
  $role->remove_cap ("access_s2member_level1");
153
  $role->remove_cap ("access_s2member_level2");
154
  $role->remove_cap ("access_s2member_level3");
155
  $role->remove_cap ("access_s2member_level4");
156
  /**/
157
  $role = &get_role ("editor");
 
158
  $role->remove_cap ("access_s2member_level1");
159
  $role->remove_cap ("access_s2member_level2");
160
  $role->remove_cap ("access_s2member_level3");
161
  $role->remove_cap ("access_s2member_level4");
162
  /**/
163
  $role = &get_role ("author");
 
164
  $role->remove_cap ("access_s2member_level1");
165
  $role->remove_cap ("access_s2member_level2");
166
  $role->remove_cap ("access_s2member_level3");
167
  $role->remove_cap ("access_s2member_level4");
168
  /**/
169
  $role = &get_role ("contributor");
 
170
  $role->remove_cap ("access_s2member_level1");
171
  $role->remove_cap ("access_s2member_level2");
172
  $role->remove_cap ("access_s2member_level3");
@@ -198,6 +233,7 @@ if (!function_exists ("ws_plugin__s2member_deactivate"))
198
  @rmdir ($logs_dir);
199
  }
200
  /**/
 
201
  delete_option ("ws_plugin__s2member_configured");
202
  delete_option ("ws_plugin__s2member_cache");
203
  delete_option ("ws_plugin__s2member_notices");
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
+ /*
17
+ Check existing installations that have not been re-activated.
18
+ Attach to: add_action("admin_init");
19
+ */
20
+ if (!function_exists ("ws_plugin__s2member_check_activation"))
21
+ {
22
+ function ws_plugin__s2member_check_activation () /* Re-activated? */
23
+ {
24
+ $v = get_option ("ws_plugin__s2member_activated_version");
25
+ if (!$v || !version_compare ($v, WS_PLUGIN__S2MEMBER_VERSION, ">="))
26
+ ws_plugin__s2member_activate ();
27
+ /**/
28
+ return;
29
+ }
30
+ }
31
  /*
32
  Function for handling activation routines.
33
  This function should match the array key for this plugin:
44
  {
45
  do_action ("ws_plugin__s2member_before_activation", get_defined_vars ());
46
  /**/
47
+ $role = &get_role ("subscriber");
48
+ $role->add_cap ("access_s2member_level0");
49
+ /**/
50
  add_role ("s2member_level1", "s2Member Level 1");
51
  add_role ("s2member_level2", "s2Member Level 2");
52
  add_role ("s2member_level3", "s2Member Level 3");
55
  $role = &get_role ("s2member_level1");
56
  $role->add_cap ("read");
57
  $role->add_cap ("level_0");
58
+ $role->add_cap ("access_s2member_level0");
59
  $role->add_cap ("access_s2member_level1");
60
  /**/
61
  $role = &get_role ("s2member_level2");
62
  $role->add_cap ("read");
63
  $role->add_cap ("level_0");
64
+ $role->add_cap ("access_s2member_level0");
65
  $role->add_cap ("access_s2member_level1");
66
+ $role->add_cap ("access_s2member_level2");
67
  /**/
68
  $role = &get_role ("s2member_level3");
69
  $role->add_cap ("read");
70
  $role->add_cap ("level_0");
71
+ $role->add_cap ("access_s2member_level0");
 
72
  $role->add_cap ("access_s2member_level1");
73
+ $role->add_cap ("access_s2member_level2");
74
+ $role->add_cap ("access_s2member_level3");
75
  /**/
76
  $role = &get_role ("s2member_level4");
77
  $role->add_cap ("read");
78
  $role->add_cap ("level_0");
79
+ $role->add_cap ("access_s2member_level0");
 
 
80
  $role->add_cap ("access_s2member_level1");
81
+ $role->add_cap ("access_s2member_level2");
82
+ $role->add_cap ("access_s2member_level3");
83
+ $role->add_cap ("access_s2member_level4");
84
  /**/
85
  $role = &get_role ("administrator");
86
+ $role->add_cap ("access_s2member_level0");
87
  $role->add_cap ("access_s2member_level1");
88
  $role->add_cap ("access_s2member_level2");
89
  $role->add_cap ("access_s2member_level3");
90
  $role->add_cap ("access_s2member_level4");
91
  /**/
92
  $role = &get_role ("editor");
93
+ $role->add_cap ("access_s2member_level0");
94
  $role->add_cap ("access_s2member_level1");
95
  $role->add_cap ("access_s2member_level2");
96
  $role->add_cap ("access_s2member_level3");
97
  $role->add_cap ("access_s2member_level4");
98
  /**/
99
  $role = &get_role ("author");
100
+ $role->add_cap ("access_s2member_level0");
101
  $role->add_cap ("access_s2member_level1");
102
  $role->add_cap ("access_s2member_level2");
103
  $role->add_cap ("access_s2member_level3");
104
  $role->add_cap ("access_s2member_level4");
105
  /**/
106
  $role = &get_role ("contributor");
107
+ $role->add_cap ("access_s2member_level0");
108
  $role->add_cap ("access_s2member_level1");
109
  $role->add_cap ("access_s2member_level2");
110
  $role->add_cap ("access_s2member_level3");
138
  if (!is_array (get_option ("ws_plugin__s2member_options")))
139
  update_option ("ws_plugin__s2member_options", array ());
140
  /**/
141
+ update_option ("ws_plugin__s2member_activated_version", WS_PLUGIN__S2MEMBER_VERSION);
142
+ /**/
143
  if (get_option ("ws_plugin__s2member_configured")) /* If they already have s2Member configured, read the Changelog. */
144
  {
145
+ $notice = '<strong>s2Member</strong> has been <strong>re-activated</strong>, with the latest version. Your existing configuration remains.<br />';
146
  $notice .= 'Have fun, <a href="admin.php?page=ws-plugin--s2member-info">read the Changelog</a>, and make some money! :-)';
147
  ws_plugin__s2member_enqueue_admin_notice ($notice, array ("plugins.php", "ws-plugin--s2member-options"));
148
  }
171
  /**/
172
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["run_deactivation_routines"])
173
  {
174
+ $role = &get_role ("subscriber");
175
+ $role->remove_cap ("access_s2member_level0");
176
+ /**/
177
  remove_role ("s2member_level1");
178
  remove_role ("s2member_level2");
179
  remove_role ("s2member_level3");
180
  remove_role ("s2member_level4");
181
  /**/
182
  $role = &get_role ("administrator");
183
+ $role->remove_cap ("access_s2member_level0");
184
  $role->remove_cap ("access_s2member_level1");
185
  $role->remove_cap ("access_s2member_level2");
186
  $role->remove_cap ("access_s2member_level3");
187
  $role->remove_cap ("access_s2member_level4");
188
  /**/
189
  $role = &get_role ("editor");
190
+ $role->remove_cap ("access_s2member_level0");
191
  $role->remove_cap ("access_s2member_level1");
192
  $role->remove_cap ("access_s2member_level2");
193
  $role->remove_cap ("access_s2member_level3");
194
  $role->remove_cap ("access_s2member_level4");
195
  /**/
196
  $role = &get_role ("author");
197
+ $role->remove_cap ("access_s2member_level0");
198
  $role->remove_cap ("access_s2member_level1");
199
  $role->remove_cap ("access_s2member_level2");
200
  $role->remove_cap ("access_s2member_level3");
201
  $role->remove_cap ("access_s2member_level4");
202
  /**/
203
  $role = &get_role ("contributor");
204
+ $role->remove_cap ("access_s2member_level0");
205
  $role->remove_cap ("access_s2member_level1");
206
  $role->remove_cap ("access_s2member_level2");
207
  $role->remove_cap ("access_s2member_level3");
233
  @rmdir ($logs_dir);
234
  }
235
  /**/
236
+ delete_option ("ws_plugin__s2member_activated_version");
237
  delete_option ("ws_plugin__s2member_configured");
238
  delete_option ("ws_plugin__s2member_cache");
239
  delete_option ("ws_plugin__s2member_notices");
includes/functions/admin-lockout.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
  /*
17
  Function for handling admin lockouts.
18
  Attach to: add_action("admin_init");
@@ -25,9 +25,9 @@ if (!function_exists ("ws_plugin__s2member_admin_lockout"))
25
  /**/
26
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["force_admin_lockouts"]/**/
27
  && !current_user_can ("edit_posts") /* In other words: Subscribers and Members. */
28
- && apply_filters ("ws_plugin__s2member_admin_lockout", true, get_defined_vars ()) && /* Give filters a chance. */
29
  wp_redirect (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"])) !== "nill")
30
- exit;
31
  /**/
32
  do_action ("ws_plugin__s2member_after_admin_lockouts", get_defined_vars ());
33
  /**/
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
  /*
17
  Function for handling admin lockouts.
18
  Attach to: add_action("admin_init");
25
  /**/
26
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["force_admin_lockouts"]/**/
27
  && !current_user_can ("edit_posts") /* In other words: Subscribers and Members. */
28
+ && apply_filters ("ws_plugin__s2member_admin_lockout", true, get_defined_vars ()) && /* Filter. */
29
  wp_redirect (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"])) !== "nill")
30
+ exit ();
31
  /**/
32
  do_action ("ws_plugin__s2member_after_admin_lockouts", get_defined_vars ());
33
  /**/
includes/functions/admin-notices.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
  /*
17
  Function displays an admin notice immediately.
18
  */
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
  /*
17
  Function displays an admin notice immediately.
18
  */
includes/functions/auto-eots.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
  /*
17
  Function processed by WP-Cron. This handles Auto-EOTs.
18
  If you have a HUGE user-base, increase the max eots per process.
@@ -32,70 +32,70 @@ if (!function_exists ("ws_plugin__s2member_auto_eot_system"))
32
  {
33
  $per_process = apply_filters ("ws_plugin__s2member_auto_eot_system_per_process", $per_process, get_defined_vars ());
34
  /**/
35
- if ($eots = $wpdb->get_results ("SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = 's2member_auto_eot_time' AND `meta_value` <= '" . $wpdb->escape (strtotime ("now")) . "' LIMIT " . $per_process))
36
  {
37
  foreach ($eots as $eot) /* Go through the array of eots. We need to (demote|delete) each of them. */
38
  {
39
- $user_id = $eot->user_id; /* Grab the user ID value from the query. */
40
- /**/
41
- $user = new WP_User ($user_id); /* Acquire user object. */
42
- /**/
43
- delete_usermeta ($user_id, "s2member_auto_eot_time"); /* Always delete this. */
44
- /* Removing this prevents re-runs on non WP Roles. Which are scanned for next. */
45
- /**/
46
- if (!ws_plugin__s2member_user_has_wp_role ($user)) /* Non WP Roles. */
47
  {
48
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_eot_behavior"] === "demote")
 
 
 
49
  {
50
- $user->set_role ("subscriber");
51
- /**/
52
- $subscr_id = get_usermeta ($user_id, "s2member_subscr_id");
53
- $custom = get_usermeta ($user_id, "s2member_custom");
54
- /**/
55
- delete_usermeta ($user_id, "s2member_custom");
56
- delete_usermeta ($user_id, "s2member_subscr_id");
57
- delete_usermeta ($user_id, "s2member_last_payment_time");
58
- delete_usermeta ($user_id, "s2member_auto_eot_time");
59
- /**/
60
- foreach ($user->allcaps as $cap => $cap_enabled)
61
- if (preg_match ("/^access_s2member_ccap_/", $cap))
62
- $user->remove_cap ($ccap = $cap);
63
- /**/
64
- delete_usermeta ($user_id, "s2member_file_download_access_arc");
65
- delete_usermeta ($user_id, "s2member_file_download_access_log");
66
- /**/
67
- ws_plugin__s2member_append_user_notes ($user_id, "Demoted by s2Member: " . date ("D M j, Y g:i a T"));
68
- /**/
69
- if ($subscr_id && $custom && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"] && is_array ($cv = preg_split ("/\|/", $custom)))
70
  {
71
- foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"]) as $url) /* Handle EOT Notifications. */
72
- /**/
73
- if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)) && ($url = preg_replace ("/%%subscr_id%%/i", urlencode ($subscr_id), $url)))
74
- if (($url = preg_replace ("/%%user_first_name%%/i", urlencode ($user->first_name), $url)) && ($url = preg_replace ("/%%user_last_name%%/i", urlencode ($user->last_name), $url)))
75
- if (($url = preg_replace ("/%%user_full_name%%/i", urlencode (trim ($user->first_name . " " . $user->last_name)), $url)))
76
- if (($url = preg_replace ("/%%user_email%%/i", urlencode ($user->user_email), $url)))
77
- /**/
78
- if (($url = trim ($url))) /* Empty? */
79
- ws_plugin__s2member_remote ($url);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
  }
81
  /**/
82
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
83
- do_action ("ws_plugin__s2member_during_auto_eot_system_during_demote", get_defined_vars ());
84
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
85
- }
86
- else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_eot_behavior"] === "delete")
87
- {
88
- wp_delete_user ($user_id); /* Triggers: `ws_plugin__s2member_handle_user_deletions()` */
89
- /* `ws_plugin__s2member_handle_user_deletions()` triggers `eot_del_notification_urls` */
90
- /**/
91
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
92
- do_action ("ws_plugin__s2member_during_auto_eot_system_during_delete", get_defined_vars ());
93
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
94
  }
95
- /**/
96
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
97
- do_action ("ws_plugin__s2member_during_auto_eot_system", get_defined_vars ());
98
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
99
  }
100
  }
101
  }
@@ -128,30 +128,13 @@ if (!function_exists ("ws_plugin__s2member_auto_eot_system_via_cron"))
128
  do_action ("ws_plugin__s2member_during_auto_eot_system_via_cron", get_defined_vars ());
129
  }
130
  /**/
131
- exit; /* Exit. */
132
  }
133
  /**/
134
  do_action ("ws_plugin__s2member_after_auto_eot_system_via_cron", get_defined_vars ());
135
  }
136
  }
137
  /*
138
- Extends the WP-Cron schedules to support 10 minute intervals.
139
- Attach to: add_filter("cron_schedules");
140
- */
141
- if (!function_exists ("ws_plugin__s2member_extend_cron_schedules"))
142
- {
143
- function ws_plugin__s2member_extend_cron_schedules ($schedules = array ())
144
- {
145
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
146
- do_action ("ws_plugin__s2member_before_extend_cron_schedules", get_defined_vars ());
147
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
148
- /**/
149
- $array = array ("every10m" => array ("interval" => 600, "display" => "Every 10 Minutes"));
150
- /**/
151
- return apply_filters ("ws_plugin__s2member_extend_cron_schedules", array_merge ($array, $schedules), get_defined_vars ());
152
- }
153
- }
154
- /*
155
  Adds a scheduled task for s2Member's Auto-EOT System.
156
  */
157
  if (!function_exists ("ws_plugin__s2member_add_auto_eot_system"))
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
  /*
17
  Function processed by WP-Cron. This handles Auto-EOTs.
18
  If you have a HUGE user-base, increase the max eots per process.
32
  {
33
  $per_process = apply_filters ("ws_plugin__s2member_auto_eot_system_per_process", $per_process, get_defined_vars ());
34
  /**/
35
+ if ($eots = $wpdb->get_results ("SELECT `user_id` AS `ID` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = 's2member_auto_eot_time' AND `meta_value` <= '" . $wpdb->escape (strtotime ("now")) . "' LIMIT " . $per_process))
36
  {
37
  foreach ($eots as $eot) /* Go through the array of eots. We need to (demote|delete) each of them. */
38
  {
39
+ if (($user_id = $eot->ID) && is_object ($user = new WP_User ($user_id)) && $user->ID)
 
 
 
 
 
 
 
40
  {
41
+ delete_usermeta ($user_id, "s2member_auto_eot_time"); /* Always delete this. */
42
+ /* Removing this prevents re-runs on non WP Roles. Which are scanned for next. */
43
+ /**/
44
+ if (!ws_plugin__s2member_user_has_wp_role ($user)) /* Non WP Roles ( Subscriber excluded ). */
45
  {
46
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_eot_behavior"] === "demote")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  {
48
+ $demotion_role = ws_plugin__s2member_force_demotion_role ("subscriber");
49
+ $user->set_role ($demotion_role); /* Defaults to Free Subscriber. */
50
+ /**/
51
+ $subscr_id = get_usermeta ($user_id, "s2member_subscr_id");
52
+ $custom = get_usermeta ($user_id, "s2member_custom");
53
+ /**/
54
+ delete_usermeta ($user_id, "s2member_custom");
55
+ delete_usermeta ($user_id, "s2member_subscr_id");
56
+ delete_usermeta ($user_id, "s2member_last_payment_time");
57
+ delete_usermeta ($user_id, "s2member_auto_eot_time");
58
+ /**/
59
+ foreach ($user->allcaps as $cap => $cap_enabled)
60
+ if (preg_match ("/^access_s2member_ccap_/", $cap))
61
+ $user->remove_cap ($ccap = $cap);
62
+ /**/
63
+ delete_usermeta ($user_id, "s2member_file_download_access_arc");
64
+ delete_usermeta ($user_id, "s2member_file_download_access_log");
65
+ /**/
66
+ ws_plugin__s2member_append_user_notes ($user_id, "Demoted by s2Member: " . date ("D M j, Y g:i a T"));
67
+ /**/
68
+ if ($subscr_id && $custom && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"] && is_array ($cv = preg_split ("/\|/", $custom)))
69
+ {
70
+ foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"]) as $url) /* Handle EOT Notifications. */
71
+ /**/
72
+ if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)) && ($url = preg_replace ("/%%subscr_id%%/i", ws_plugin__s2member_esc_ds (urlencode ($subscr_id)), $url)))
73
+ if (($url = preg_replace ("/%%user_first_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($user->first_name)), $url)) && ($url = preg_replace ("/%%user_last_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($user->last_name)), $url)))
74
+ if (($url = preg_replace ("/%%user_full_name%%/i", ws_plugin__s2member_esc_ds (urlencode (trim ($user->first_name . " " . $user->last_name))), $url)))
75
+ if (($url = preg_replace ("/%%user_email%%/i", ws_plugin__s2member_esc_ds (urlencode ($user->user_email)), $url)))
76
+ /**/
77
+ if (($url = trim ($url))) /* Empty? */
78
+ ws_plugin__s2member_remote ($url);
79
+ }
80
+ /**/
81
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
82
+ do_action ("ws_plugin__s2member_during_auto_eot_system_during_demote", get_defined_vars ());
83
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
84
+ }
85
+ else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_eot_behavior"] === "delete")
86
+ {
87
+ wp_delete_user ($user_id); /* Triggers: `ws_plugin__s2member_handle_user_deletions()` */
88
+ /* `ws_plugin__s2member_handle_user_deletions()` triggers `eot_del_notification_urls` */
89
+ /**/
90
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
91
+ do_action ("ws_plugin__s2member_during_auto_eot_system_during_delete", get_defined_vars ());
92
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
93
  }
94
  /**/
95
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
96
+ do_action ("ws_plugin__s2member_during_auto_eot_system", get_defined_vars ());
 
 
 
 
 
 
 
 
 
97
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
98
  }
 
 
 
 
99
  }
100
  }
101
  }
128
  do_action ("ws_plugin__s2member_during_auto_eot_system_via_cron", get_defined_vars ());
129
  }
130
  /**/
131
+ exit ();
132
  }
133
  /**/
134
  do_action ("ws_plugin__s2member_after_auto_eot_system_via_cron", get_defined_vars ());
135
  }
136
  }
137
  /*
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
138
  Adds a scheduled task for s2Member's Auto-EOT System.
139
  */
140
  if (!function_exists ("ws_plugin__s2member_add_auto_eot_system"))
includes/functions/catg-level-access.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
  /*
17
  Function for handling category level access permissions.
18
  Attach to: add_action("template_redirect");
@@ -35,75 +35,92 @@ if (!function_exists ("ws_plugin__s2member_check_catg_level_access"))
35
  /**/
36
  if (is_category () && $cat_ID) /* We also check if this is a child category of a restricted category. */
37
  {
38
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_catgs"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level1")) && wp_redirect (add_query_arg ("s2member_level_req", "1", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
39
- exit;
 
 
 
 
 
 
40
  /**/
41
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_catgs"] && in_array ($cat_ID, ($level1_catgs = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_catgs"]))) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level1")) && wp_redirect (add_query_arg ("s2member_level_req", "1", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
42
- exit;
43
  /**/
44
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_catgs"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level2")) && wp_redirect (add_query_arg ("s2member_level_req", "2", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
45
- exit;
46
  /**/
47
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_catgs"] && in_array ($cat_ID, ($level2_catgs = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_catgs"]))) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level2")) && wp_redirect (add_query_arg ("s2member_level_req", "2", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
48
- exit;
49
  /**/
50
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_catgs"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level3")) && wp_redirect (add_query_arg ("s2member_level_req", "3", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
51
- exit;
52
  /**/
53
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_catgs"] && in_array ($cat_ID, ($level3_catgs = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_catgs"]))) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level3")) && wp_redirect (add_query_arg ("s2member_level_req", "3", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
54
- exit;
55
  /**/
56
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_catgs"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level4")) && wp_redirect (add_query_arg ("s2member_level_req", "4", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
57
- exit;
58
  /**/
59
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_catgs"] && in_array ($cat_ID, ($level4_catgs = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_catgs"]))) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level4")) && wp_redirect (add_query_arg ("s2member_level_req", "4", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
60
- exit;
 
 
 
 
 
61
  /**/
62
  if ($level1_catgs)
63
  foreach ($level1_catgs as $catg)
64
  if ($catg && cat_is_ancestor_of ($catg, $cat_ID) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level1")) && wp_redirect (add_query_arg ("s2member_level_req", "1", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
65
- exit;
66
  /**/
67
  if ($level2_catgs)
68
  foreach ($level2_catgs as $catg)
69
  if ($catg && cat_is_ancestor_of ($catg, $cat_ID) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level2")) && wp_redirect (add_query_arg ("s2member_level_req", "2", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
70
- exit;
71
  /**/
72
  if ($level3_catgs)
73
  foreach ($level3_catgs as $catg)
74
  if ($catg && cat_is_ancestor_of ($catg, $cat_ID) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level3")) && wp_redirect (add_query_arg ("s2member_level_req", "3", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
75
- exit;
76
  /**/
77
  if ($level4_catgs)
78
  foreach ($level4_catgs as $catg)
79
  if ($catg && cat_is_ancestor_of ($catg, $cat_ID) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level4")) && wp_redirect (add_query_arg ("s2member_level_req", "4", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
80
- exit;
81
  }
82
  else if (is_single () && !is_page () && $post_ID)
83
  {
84
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_catgs"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level1")) && wp_redirect (add_query_arg ("s2member_level_req", "1", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
85
- exit;
 
 
 
 
 
 
86
  /**/
87
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_catgs"] && (in_category (($level1_catgs = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_catgs"])), $post_ID) || ws_plugin__s2member_in_descendant_category ($level1_catgs, $post_ID)) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level1")) && wp_redirect (add_query_arg ("s2member_level_req", "1", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
88
- exit;
89
  /**/
90
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_catgs"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level2")) && wp_redirect (add_query_arg ("s2member_level_req", "2", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
91
- exit;
92
  /**/
93
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_catgs"] && (in_category (($level2_catgs = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_catgs"])), $post_ID) || ws_plugin__s2member_in_descendant_category ($level2_catgs, $post_ID)) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level2")) && wp_redirect (add_query_arg ("s2member_level_req", "2", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
94
- exit;
95
  /**/
96
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_catgs"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level3")) && wp_redirect (add_query_arg ("s2member_level_req", "3", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
97
- exit;
98
  /**/
99
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_catgs"] && (in_category (($level3_catgs = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_catgs"])), $post_ID) || ws_plugin__s2member_in_descendant_category ($level3_catgs, $post_ID)) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level3")) && wp_redirect (add_query_arg ("s2member_level_req", "3", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
100
- exit;
101
  /**/
102
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_catgs"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level4")) && wp_redirect (add_query_arg ("s2member_level_req", "4", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
103
- exit;
104
  /**/
105
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_catgs"] && (in_category (($level4_catgs = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_catgs"])), $post_ID) || ws_plugin__s2member_in_descendant_category ($level4_catgs, $post_ID)) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level4")) && wp_redirect (add_query_arg ("s2member_level_req", "4", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
106
- exit;
107
  }
108
  /**/
109
  do_action ("ws_plugin__s2member_during_check_catg_level_access", get_defined_vars ());
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit("Do not access this file directly.");
16
  /*
17
  Function for handling category level access permissions.
18
  Attach to: add_action("template_redirect");
35
  /**/
36
  if (is_category () && $cat_ID) /* We also check if this is a child category of a restricted category. */
37
  {
38
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_catgs"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level0")) && wp_redirect (add_query_arg ("s2member_level_req", "0", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
39
+ exit ();
40
+ /**/
41
+ else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_catgs"] && in_array ($cat_ID, ($level0_catgs = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_catgs"]))) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level0")) && wp_redirect (add_query_arg ("s2member_level_req", "0", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
42
+ exit ();
43
+ /**/
44
+ else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_catgs"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level1")) && wp_redirect (add_query_arg ("s2member_level_req", "1", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
45
+ exit ();
46
  /**/
47
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_catgs"] && in_array ($cat_ID, ($level1_catgs = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_catgs"]))) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level1")) && wp_redirect (add_query_arg ("s2member_level_req", "1", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
48
+ exit ();
49
  /**/
50
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_catgs"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level2")) && wp_redirect (add_query_arg ("s2member_level_req", "2", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
51
+ exit ();
52
  /**/
53
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_catgs"] && in_array ($cat_ID, ($level2_catgs = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_catgs"]))) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level2")) && wp_redirect (add_query_arg ("s2member_level_req", "2", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
54
+ exit ();
55
  /**/
56
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_catgs"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level3")) && wp_redirect (add_query_arg ("s2member_level_req", "3", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
57
+ exit ();
58
  /**/
59
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_catgs"] && in_array ($cat_ID, ($level3_catgs = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_catgs"]))) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level3")) && wp_redirect (add_query_arg ("s2member_level_req", "3", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
60
+ exit ();
61
  /**/
62
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_catgs"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level4")) && wp_redirect (add_query_arg ("s2member_level_req", "4", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
63
+ exit ();
64
  /**/
65
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_catgs"] && in_array ($cat_ID, ($level4_catgs = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_catgs"]))) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level4")) && wp_redirect (add_query_arg ("s2member_level_req", "4", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
66
+ exit ();
67
+ /**/
68
+ if ($level0_catgs)
69
+ foreach ($level0_catgs as $catg)
70
+ if ($catg && cat_is_ancestor_of ($catg, $cat_ID) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level0")) && wp_redirect (add_query_arg ("s2member_level_req", "0", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
71
+ exit ();
72
  /**/
73
  if ($level1_catgs)
74
  foreach ($level1_catgs as $catg)
75
  if ($catg && cat_is_ancestor_of ($catg, $cat_ID) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level1")) && wp_redirect (add_query_arg ("s2member_level_req", "1", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
76
+ exit ();
77
  /**/
78
  if ($level2_catgs)
79
  foreach ($level2_catgs as $catg)
80
  if ($catg && cat_is_ancestor_of ($catg, $cat_ID) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level2")) && wp_redirect (add_query_arg ("s2member_level_req", "2", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
81
+ exit ();
82
  /**/
83
  if ($level3_catgs)
84
  foreach ($level3_catgs as $catg)
85
  if ($catg && cat_is_ancestor_of ($catg, $cat_ID) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level3")) && wp_redirect (add_query_arg ("s2member_level_req", "3", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
86
+ exit ();
87
  /**/
88
  if ($level4_catgs)
89
  foreach ($level4_catgs as $catg)
90
  if ($catg && cat_is_ancestor_of ($catg, $cat_ID) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level4")) && wp_redirect (add_query_arg ("s2member_level_req", "4", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
91
+ exit ();
92
  }
93
  else if (is_single () && !is_page () && $post_ID)
94
  {
95
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_catgs"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level0")) && wp_redirect (add_query_arg ("s2member_level_req", "0", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
96
+ exit ();
97
+ /**/
98
+ else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_catgs"] && (in_category (($level0_catgs = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_catgs"])), $post_ID) || ws_plugin__s2member_in_descendant_category ($level0_catgs, $post_ID)) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level0")) && wp_redirect (add_query_arg ("s2member_level_req", "0", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
99
+ exit ();
100
+ /**/
101
+ else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_catgs"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level1")) && wp_redirect (add_query_arg ("s2member_level_req", "1", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
102
+ exit ();
103
  /**/
104
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_catgs"] && (in_category (($level1_catgs = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_catgs"])), $post_ID) || ws_plugin__s2member_in_descendant_category ($level1_catgs, $post_ID)) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level1")) && wp_redirect (add_query_arg ("s2member_level_req", "1", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
105
+ exit ();
106
  /**/
107
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_catgs"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level2")) && wp_redirect (add_query_arg ("s2member_level_req", "2", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
108
+ exit ();
109
  /**/
110
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_catgs"] && (in_category (($level2_catgs = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_catgs"])), $post_ID) || ws_plugin__s2member_in_descendant_category ($level2_catgs, $post_ID)) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level2")) && wp_redirect (add_query_arg ("s2member_level_req", "2", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
111
+ exit ();
112
  /**/
113
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_catgs"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level3")) && wp_redirect (add_query_arg ("s2member_level_req", "3", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
114
+ exit ();
115
  /**/
116
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_catgs"] && (in_category (($level3_catgs = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_catgs"])), $post_ID) || ws_plugin__s2member_in_descendant_category ($level3_catgs, $post_ID)) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level3")) && wp_redirect (add_query_arg ("s2member_level_req", "3", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
117
+ exit ();
118
  /**/
119
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_catgs"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level4")) && wp_redirect (add_query_arg ("s2member_level_req", "4", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
120
+ exit ();
121
  /**/
122
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_catgs"] && (in_category (($level4_catgs = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_catgs"])), $post_ID) || ws_plugin__s2member_in_descendant_category ($level4_catgs, $post_ID)) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level4")) && wp_redirect (add_query_arg ("s2member_level_req", "4", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
123
+ exit ();
124
  }
125
  /**/
126
  do_action ("ws_plugin__s2member_during_check_catg_level_access", get_defined_vars ());
includes/functions/constants.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
  /*
17
  Define several API Constants for s2Member.
18
  Note that these are duplicated into the JavaScript API as well.
@@ -29,7 +29,8 @@ if (!function_exists ("ws_plugin__s2member_constants"))
29
  $level = ws_plugin__s2member_user_access_level ();
30
  $current_user = (is_user_logged_in ()) ? wp_get_current_user () : false;
31
  $file_downloads = ws_plugin__s2member_user_downloads ("", $metas["s2member_file_download_access_log"]);
32
- $login_redirection_override = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"];
 
33
  /**/
34
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
35
  do_action ("ws_plugin__s2member_during_constants", get_defined_vars ());
@@ -43,8 +44,8 @@ if (!function_exists ("ws_plugin__s2member_constants"))
43
  define ("S2MEMBER_CURRENT_USER_ACCESS_LABEL", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_label"]); /* This will always be a (string). Empty if not logged in. */
44
  define ("S2MEMBER_CURRENT_USER_SUBSCR_ID", (($current_user) ? (($metas["s2member_subscr_id"]) ? $metas["s2member_subscr_id"] : $current_user->ID) : "")); /* Empty if not logged in. */
45
  define ("S2MEMBER_CURRENT_USER_CUSTOM", (($current_user) ? $metas["s2member_custom"] : "")); /* This will always a (string). However, it will be empty if not logged in. */
46
- define ("S2MEMBER_CURRENT_USER_REGISTRATION_TIME", (($current_user) ? strtotime ($current_user->user_registered) : 0)); /* Always an (int). Or 0 if they're not logged in. */
47
- define ("S2MEMBER_CURRENT_USER_REGISTRATION_DAYS", (($current_user) ? floor ((strtotime ("now") - strtotime ($current_user->user_registered)) / 86400) : 0)); /* (int). */
48
  define ("S2MEMBER_CURRENT_USER_DISPLAY_NAME", (($current_user) ? $current_user->display_name : "")); /* This will always be a (string). Empty if not logged in. */
49
  define ("S2MEMBER_CURRENT_USER_FIRST_NAME", (($current_user) ? $current_user->user_firstname : "")); /* This will always be a (string). Empty if not logged in. */
50
  define ("S2MEMBER_CURRENT_USER_LAST_NAME", (($current_user) ? $current_user->user_lastname : "")); /* This will always be a (string). Empty if not logged in. */
@@ -73,16 +74,19 @@ if (!function_exists ("ws_plugin__s2member_constants"))
73
  define ("S2MEMBER_LOGOUT_PAGE_URL", wp_logout_url ()); /* This is always the same, it is the default wordpress action=logout url generated by wp_logout_url(). */
74
  define ("S2MEMBER_LOGIN_PAGE_URL", wp_login_url ()); /* This is always the same, it is the default wordpress login url that is generated by wp_login_url(). */
75
  /**/
 
76
  define ("S2MEMBER_LEVEL1_LABEL", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_label"]); /* This is the (string) label that you created for membership level number 1. */
77
  define ("S2MEMBER_LEVEL2_LABEL", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_label"]); /* This is the (string) label that you created for membership level number 2. */
78
  define ("S2MEMBER_LEVEL3_LABEL", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_label"]); /* This is the (string) label that you created for membership level number 3. */
79
  define ("S2MEMBER_LEVEL4_LABEL", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_label"]); /* This is the (string) label that you created for membership level number 4. */
80
  /**/
 
81
  define ("S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_file_downloads_allowed"]); /* This is the (int) allowed downloads. */
82
  define ("S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_file_downloads_allowed"]); /* This is the (int) allowed downloads. */
83
  define ("S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_file_downloads_allowed"]); /* This is the (int) allowed downloads. */
84
  define ("S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_file_downloads_allowed"]); /* This is the (int) allowed downloads. */
85
  /**/
 
86
  define ("S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED_DAYS", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_file_downloads_allowed_days"]); /* This is (int) allowed days. */
87
  define ("S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED_DAYS", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_file_downloads_allowed_days"]); /* This is (int) allowed days. */
88
  define ("S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED_DAYS", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_file_downloads_allowed_days"]); /* This is (int) allowed days. */
@@ -98,12 +102,10 @@ if (!function_exists ("ws_plugin__s2member_constants"))
98
  define ("S2MEMBER_PAYPAL_ENDPOINT", (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "www.sandbox.paypal.com" : "www.paypal.com")); /* Using sandbox? */
99
  define ("S2MEMBER_PAYPAL_BUSINESS", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"]); /* This is the email address that identifies your paypal business. */
100
  /**/
101
- define ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0", ((S2MEMBER_CURRENT_USER_SUBSCR_ID && !ws_plugin__s2member_user_has_wp_role ($current_user)) ? "Updating Subscr. ID" : ""));
102
- define ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0", ((S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0) ? S2MEMBER_CURRENT_USER_SUBSCR_ID : "")); /* ^ Not for built-in WP Roles. */
103
  /**/
104
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
105
  do_action ("ws_plugin__s2member_after_constants", get_defined_vars ());
106
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
107
  /**/
108
  return;
109
  }
@@ -200,7 +202,7 @@ if (!function_exists ("ws_plugin__s2member_constant_metas"))
200
  /**/
201
  if (($current_user = (is_user_logged_in ()) ? wp_get_current_user () : false))
202
  {
203
- if (is_array ($results = $wpdb->get_results ("SELECT `meta_key`, `meta_value` FROM `" . $wpdb->usermeta . "` WHERE `user_id` = '" . $current_user->ID . "' AND (meta_key = 's2member_file_download_access_log' OR meta_key = 's2member_subscr_id' OR meta_key = 's2member_custom') LIMIT 3")))
204
  {
205
  foreach ($results as $r) /* Fill in the array we need. */
206
  if ($r->meta_key === "s2member_file_download_access_log")
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
  /*
17
  Define several API Constants for s2Member.
18
  Note that these are duplicated into the JavaScript API as well.
29
  $level = ws_plugin__s2member_user_access_level ();
30
  $current_user = (is_user_logged_in ()) ? wp_get_current_user () : false;
31
  $file_downloads = ws_plugin__s2member_user_downloads ("", $metas["s2member_file_download_access_log"]);
32
+ $login_redirection_override = ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"]) ? /* Only when applicable. */
33
+ ws_plugin__s2member_fill_login_redirect_rc_vars ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"], $current_user) : "";
34
  /**/
35
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
36
  do_action ("ws_plugin__s2member_during_constants", get_defined_vars ());
44
  define ("S2MEMBER_CURRENT_USER_ACCESS_LABEL", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_label"]); /* This will always be a (string). Empty if not logged in. */
45
  define ("S2MEMBER_CURRENT_USER_SUBSCR_ID", (($current_user) ? (($metas["s2member_subscr_id"]) ? $metas["s2member_subscr_id"] : $current_user->ID) : "")); /* Empty if not logged in. */
46
  define ("S2MEMBER_CURRENT_USER_CUSTOM", (($current_user) ? $metas["s2member_custom"] : "")); /* This will always a (string). However, it will be empty if not logged in. */
47
+ define ("S2MEMBER_CURRENT_USER_REGISTRATION_TIME", (($current_user) ? (int)strtotime ($current_user->user_registered) : 0)); /* Always an (int). Or 0 if they're not logged in. */
48
+ define ("S2MEMBER_CURRENT_USER_REGISTRATION_DAYS", (($current_user) ? (int)floor ((strtotime ("now") - strtotime ($current_user->user_registered)) / 86400) : 0)); /* (int). */
49
  define ("S2MEMBER_CURRENT_USER_DISPLAY_NAME", (($current_user) ? $current_user->display_name : "")); /* This will always be a (string). Empty if not logged in. */
50
  define ("S2MEMBER_CURRENT_USER_FIRST_NAME", (($current_user) ? $current_user->user_firstname : "")); /* This will always be a (string). Empty if not logged in. */
51
  define ("S2MEMBER_CURRENT_USER_LAST_NAME", (($current_user) ? $current_user->user_lastname : "")); /* This will always be a (string). Empty if not logged in. */
74
  define ("S2MEMBER_LOGOUT_PAGE_URL", wp_logout_url ()); /* This is always the same, it is the default wordpress action=logout url generated by wp_logout_url(). */
75
  define ("S2MEMBER_LOGIN_PAGE_URL", wp_login_url ()); /* This is always the same, it is the default wordpress login url that is generated by wp_login_url(). */
76
  /**/
77
+ define ("S2MEMBER_LEVEL0_LABEL", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_label"]); /* This is the (string) label that you created for membership level number 0. */
78
  define ("S2MEMBER_LEVEL1_LABEL", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_label"]); /* This is the (string) label that you created for membership level number 1. */
79
  define ("S2MEMBER_LEVEL2_LABEL", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_label"]); /* This is the (string) label that you created for membership level number 2. */
80
  define ("S2MEMBER_LEVEL3_LABEL", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_label"]); /* This is the (string) label that you created for membership level number 3. */
81
  define ("S2MEMBER_LEVEL4_LABEL", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_label"]); /* This is the (string) label that you created for membership level number 4. */
82
  /**/
83
+ define ("S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_file_downloads_allowed"]); /* This is the (int) allowed downloads. */
84
  define ("S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_file_downloads_allowed"]); /* This is the (int) allowed downloads. */
85
  define ("S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_file_downloads_allowed"]); /* This is the (int) allowed downloads. */
86
  define ("S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_file_downloads_allowed"]); /* This is the (int) allowed downloads. */
87
  define ("S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_file_downloads_allowed"]); /* This is the (int) allowed downloads. */
88
  /**/
89
+ define ("S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED_DAYS", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_file_downloads_allowed_days"]); /* This is (int) allowed days. */
90
  define ("S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED_DAYS", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_file_downloads_allowed_days"]); /* This is (int) allowed days. */
91
  define ("S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED_DAYS", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_file_downloads_allowed_days"]); /* This is (int) allowed days. */
92
  define ("S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED_DAYS", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_file_downloads_allowed_days"]); /* This is (int) allowed days. */
102
  define ("S2MEMBER_PAYPAL_ENDPOINT", (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "www.sandbox.paypal.com" : "www.paypal.com")); /* Using sandbox? */
103
  define ("S2MEMBER_PAYPAL_BUSINESS", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"]); /* This is the email address that identifies your paypal business. */
104
  /**/
105
+ define ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0", ((S2MEMBER_CURRENT_USER_SUBSCR_ID) ? "Updating Subscr. ID" : "")); /* Subscr. ID or $user->ID. Either will work. */
106
+ define ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0", ((S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0) ? S2MEMBER_CURRENT_USER_SUBSCR_ID : "")); /* Subscr. ID or $user->ID. */
107
  /**/
 
108
  do_action ("ws_plugin__s2member_after_constants", get_defined_vars ());
 
109
  /**/
110
  return;
111
  }
202
  /**/
203
  if (($current_user = (is_user_logged_in ()) ? wp_get_current_user () : false))
204
  {
205
+ if (is_array ($results = $wpdb->get_results ("SELECT `meta_key`, `meta_value` FROM `" . $wpdb->usermeta . "` WHERE `user_id` = '" . $current_user->ID . "' AND (meta_key = 's2member_file_download_access_log' OR meta_key = 's2member_custom_fields' OR meta_key = 's2member_subscr_id' OR meta_key = 's2member_custom') LIMIT 3")))
206
  {
207
  foreach ($results as $r) /* Fill in the array we need. */
208
  if ($r->meta_key === "s2member_file_download_access_log")
includes/functions/css-js-w-globals.inc.php ADDED
@@ -0,0 +1,212 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Copyright: © 2009 WebSharks, Inc. ( coded in the USA )
4
+ <mailto:support@websharks-inc.com> <http://www.websharks-inc.com/>
5
+
6
+ Released under the terms of the GNU General Public License.
7
+ You should have received a copy of the GNU General Public License,
8
+ along with this software. In the main directory, see: /licensing/
9
+ If not, see: <http://www.gnu.org/licenses/>.
10
+ */
11
+ /*
12
+ Direct access denial.
13
+ */
14
+ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit("Do not access this file directly.");
16
+ /*
17
+ Function adds styles to the header.
18
+ This function is also fired in the admin area.
19
+ Do NOT enqueue styles in the admin area.
20
+ Attach to: add_action("wp_print_styles");
21
+ */
22
+ if (!function_exists ("ws_plugin__s2member_add_css"))
23
+ {
24
+ function ws_plugin__s2member_add_css ()
25
+ {
26
+ do_action ("ws_plugin__s2member_before_add_css", get_defined_vars ());
27
+ /**/
28
+ if (!is_admin () /* Not in the admin. */ && (has_action ("ws_plugin__s2member_during_add_css") || has_action ("ws_plugin__s2member_during_css"))) /* Framework support here. Currently this is NOT used unless hooks are attached, in which case it needs to be enqueued. */
29
+ {
30
+ wp_enqueue_style ("ws-plugin--s2member", get_bloginfo ("url") . "/?ws_plugin__s2member_css=1&qcABC=1", array (), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["options_version"] . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["filemtime"], "all");
31
+ /**/
32
+ do_action ("ws_plugin__s2member_during_add_css", get_defined_vars ());
33
+ }
34
+ /**/
35
+ do_action ("ws_plugin__s2member_after_add_css", get_defined_vars ());
36
+ /**/
37
+ return;
38
+ }
39
+ }
40
+ /*
41
+ Function for adding s2member.css.
42
+ Attach to: add_action("init");
43
+ */
44
+ if (!function_exists ("ws_plugin__s2member_css"))
45
+ {
46
+ function ws_plugin__s2member_css ()
47
+ {
48
+ do_action ("ws_plugin__s2member_before_css", get_defined_vars ());
49
+ /**/
50
+ if ($_GET["ws_plugin__s2member_css"])
51
+ {
52
+ header("Content-Type: text/css; charset=utf-8");
53
+ header("Expires: " . gmdate ("D, d M Y H:i:s", strtotime ("+1 week")) . " GMT");
54
+ header("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
55
+ header("Cache-Control: max-age=604800");
56
+ header("Pragma: public");
57
+ /**/
58
+ $u = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"];
59
+ $i = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images";
60
+ /**/
61
+ include_once dirname (dirname (__FILE__)) . "/s2member.css";
62
+ /**/
63
+ do_action ("ws_plugin__s2member_during_css", get_defined_vars ());
64
+ /**/
65
+ exit ();
66
+ }
67
+ /**/
68
+ do_action ("ws_plugin__s2member_after_css", get_defined_vars ());
69
+ }
70
+ }
71
+ /*
72
+ Function for adding scripts to the header.
73
+ This function is fired in the admin area also.
74
+ Do NOT enqueue scripts in the admin area.
75
+ Attach to: add_action("wp_print_scripts");
76
+ */
77
+ if (!function_exists ("ws_plugin__s2member_add_js_w_globals"))
78
+ {
79
+ function ws_plugin__s2member_add_js_w_globals ()
80
+ {
81
+ do_action ("ws_plugin__s2member_before_add_js_w_globals", get_defined_vars ());
82
+ /**/
83
+ if (!is_admin ()) /* Not in the admin. */
84
+ {
85
+ if (is_user_logged_in ())
86
+ {
87
+ $a = get_defined_constants (true);
88
+ $c = (array)$a["user"];
89
+ unset($a);
90
+ /**/
91
+ foreach ($c as $k => $v)
92
+ if (preg_match ("/^S2MEMBER_/i", $k))
93
+ $s2member[$k] = $v;
94
+ /**/
95
+ $md5 = md5 (serialize ($s2member)); /* This is a hash based on the global key => values. */
96
+ /* The md5 hash allows the script to be cached in the browser until the globals happen to change. */
97
+ /* For instance, the global variables may change when a user who is logged-in changes their profile. */
98
+ wp_enqueue_script ("ws-plugin--s2member", get_bloginfo ("url") . "/?ws_plugin__s2member_js_w_globals=1&qcABC=1&" . $md5, array ("jquery"), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["options_version"] . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["filemtime"]);
99
+ }
100
+ else /* Else if they are not logged in, we distinguish the script by not including the md5 hash. */
101
+ { /* This essentially creates 2 versions of the script. One while logged in & another when not. */
102
+ wp_enqueue_script ("ws-plugin--s2member", get_bloginfo ("url") . "/?ws_plugin__s2member_js_w_globals=1&qcABC=1", array ("jquery"), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["options_version"] . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["filemtime"]);
103
+ }
104
+ /**/
105
+ do_action ("ws_plugin__s2member_during_add_js_w_globals", get_defined_vars ());
106
+ }
107
+ /**/
108
+ do_action ("ws_plugin__s2member_after_add_js_w_globals", get_defined_vars ());
109
+ /**/
110
+ return;
111
+ }
112
+ }
113
+ /*
114
+ Function for adding s2member.js with globals.
115
+ Attach to: add_action("init");
116
+ */
117
+ if (!function_exists ("ws_plugin__s2member_js_w_globals"))
118
+ {
119
+ function ws_plugin__s2member_js_w_globals ()
120
+ {
121
+ do_action ("ws_plugin__s2member_before_js_w_globals", get_defined_vars ());
122
+ /**/
123
+ if ($_GET["ws_plugin__s2member_js_w_globals"])
124
+ {
125
+ header("Content-Type: text/javascript; charset=utf-8");
126
+ header("Expires: " . gmdate ("D, d M Y H:i:s", strtotime ("+1 week")) . " GMT");
127
+ header("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
128
+ header("Cache-Control: max-age=604800");
129
+ header("Pragma: public");
130
+ /**/
131
+ $g = "var S2MEMBER_VERSION = '" . ws_plugin__s2member_esc_sq (S2MEMBER_VERSION) . "',"; /* Since 3.0. */
132
+ /**/
133
+ $g .= "S2MEMBER_CURRENT_USER_IS_LOGGED_IN = " . ((S2MEMBER_CURRENT_USER_IS_LOGGED_IN) ? "true" : "false") . ",";
134
+ $g .= "S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER = " . ((S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER) ? "true" : "false") . ",";
135
+ $g .= "S2MEMBER_CURRENT_USER_ACCESS_LEVEL = " . S2MEMBER_CURRENT_USER_ACCESS_LEVEL . ",";
136
+ $g .= "S2MEMBER_CURRENT_USER_ACCESS_LABEL = '" . ws_plugin__s2member_esc_sq (S2MEMBER_CURRENT_USER_ACCESS_LABEL) . "',";
137
+ $g .= "S2MEMBER_CURRENT_USER_SUBSCR_ID = '" . ws_plugin__s2member_esc_sq (S2MEMBER_CURRENT_USER_SUBSCR_ID) . "',";
138
+ $g .= "S2MEMBER_CURRENT_USER_CUSTOM = '" . ws_plugin__s2member_esc_sq (S2MEMBER_CURRENT_USER_CUSTOM) . "',";
139
+ $g .= "S2MEMBER_CURRENT_USER_REGISTRATION_TIME = " . S2MEMBER_CURRENT_USER_REGISTRATION_TIME . ",";
140
+ $g .= "S2MEMBER_CURRENT_USER_REGISTRATION_DAYS = " . S2MEMBER_CURRENT_USER_REGISTRATION_DAYS . ",";
141
+ $g .= "S2MEMBER_CURRENT_USER_DISPLAY_NAME = '" . ws_plugin__s2member_esc_sq (S2MEMBER_CURRENT_USER_DISPLAY_NAME) . "',";
142
+ $g .= "S2MEMBER_CURRENT_USER_FIRST_NAME = '" . ws_plugin__s2member_esc_sq (S2MEMBER_CURRENT_USER_FIRST_NAME) . "',";
143
+ $g .= "S2MEMBER_CURRENT_USER_LAST_NAME = '" . ws_plugin__s2member_esc_sq (S2MEMBER_CURRENT_USER_LAST_NAME) . "',";
144
+ $g .= "S2MEMBER_CURRENT_USER_LOGIN = '" . ws_plugin__s2member_esc_sq (S2MEMBER_CURRENT_USER_LOGIN) . "',";
145
+ $g .= "S2MEMBER_CURRENT_USER_EMAIL = '" . ws_plugin__s2member_esc_sq (S2MEMBER_CURRENT_USER_EMAIL) . "',";
146
+ $g .= "S2MEMBER_CURRENT_USER_IP = '" . ws_plugin__s2member_esc_sq (S2MEMBER_CURRENT_USER_IP) . "',";
147
+ $g .= "S2MEMBER_CURRENT_USER_ID = " . S2MEMBER_CURRENT_USER_ID . ",";
148
+ $g .= "S2MEMBER_CURRENT_USER_FIELDS = " . S2MEMBER_CURRENT_USER_FIELDS . ",";
149
+ /**/
150
+ $g .= "S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED = " . S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED . ",";
151
+ $g .= "S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED = " . ((S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED) ? "true" : "false") . ",";
152
+ $g .= "S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY = " . S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY . ",";
153
+ $g .= "S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS = " . S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS . ",";
154
+ /**/
155
+ $g .= "S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID = " . S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID . ",";
156
+ $g .= "S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID = " . S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID . ",";
157
+ $g .= "S2MEMBER_LOGIN_WELCOME_PAGE_ID = " . S2MEMBER_LOGIN_WELCOME_PAGE_ID . ",";
158
+ /**/
159
+ $g .= "S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL = '" . ws_plugin__s2member_esc_sq (S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL) . "',";
160
+ $g .= "S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL = '" . ws_plugin__s2member_esc_sq (S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL) . "',";
161
+ $g .= "S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL = '" . ws_plugin__s2member_esc_sq (S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL) . "',";
162
+ $g .= "S2MEMBER_LOGIN_WELCOME_PAGE_URL = '" . ws_plugin__s2member_esc_sq (S2MEMBER_LOGIN_WELCOME_PAGE_URL) . "',";
163
+ $g .= "S2MEMBER_LOGOUT_PAGE_URL = '" . ws_plugin__s2member_esc_sq (S2MEMBER_LOGOUT_PAGE_URL) . "',";
164
+ $g .= "S2MEMBER_LOGIN_PAGE_URL = '" . ws_plugin__s2member_esc_sq (S2MEMBER_LOGIN_PAGE_URL) . "',";
165
+ /**/
166
+ $g .= "S2MEMBER_LEVEL0_LABEL = '" . ws_plugin__s2member_esc_sq (S2MEMBER_LEVEL0_LABEL) . "',";
167
+ $g .= "S2MEMBER_LEVEL1_LABEL = '" . ws_plugin__s2member_esc_sq (S2MEMBER_LEVEL1_LABEL) . "',";
168
+ $g .= "S2MEMBER_LEVEL2_LABEL = '" . ws_plugin__s2member_esc_sq (S2MEMBER_LEVEL2_LABEL) . "',";
169
+ $g .= "S2MEMBER_LEVEL3_LABEL = '" . ws_plugin__s2member_esc_sq (S2MEMBER_LEVEL3_LABEL) . "',";
170
+ $g .= "S2MEMBER_LEVEL4_LABEL = '" . ws_plugin__s2member_esc_sq (S2MEMBER_LEVEL4_LABEL) . "',";
171
+ /**/
172
+ $g .= "S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED = " . S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED . ",";
173
+ $g .= "S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED = " . S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED . ",";
174
+ $g .= "S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED = " . S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED . ",";
175
+ $g .= "S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED = " . S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED . ",";
176
+ $g .= "S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED = " . S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED . ",";
177
+ /**/
178
+ $g .= "S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED_DAYS = " . S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED_DAYS . ",";
179
+ $g .= "S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED_DAYS = " . S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED_DAYS . ",";
180
+ $g .= "S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED_DAYS = " . S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED_DAYS . ",";
181
+ $g .= "S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED_DAYS = " . S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED_DAYS . ",";
182
+ $g .= "S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED_DAYS = " . S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED_DAYS . ",";
183
+ /**/
184
+ $g .= "S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS = '" . ws_plugin__s2member_esc_sq (S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS) . "',";
185
+ /**/
186
+ $g .= "S2MEMBER_REG_EMAIL_FROM_NAME = '" . ws_plugin__s2member_esc_sq (S2MEMBER_REG_EMAIL_FROM_NAME) . "',";
187
+ $g .= "S2MEMBER_REG_EMAIL_FROM_EMAIL = '" . ws_plugin__s2member_esc_sq (S2MEMBER_REG_EMAIL_FROM_EMAIL) . "',";
188
+ /**/
189
+ $g .= "S2MEMBER_PAYPAL_NOTIFY_URL = '" . ws_plugin__s2member_esc_sq (S2MEMBER_PAYPAL_NOTIFY_URL) . "',";
190
+ $g .= "S2MEMBER_PAYPAL_RETURN_URL = '" . ws_plugin__s2member_esc_sq (S2MEMBER_PAYPAL_RETURN_URL) . "',";
191
+ $g .= "S2MEMBER_PAYPAL_ENDPOINT = '" . ws_plugin__s2member_esc_sq (S2MEMBER_PAYPAL_ENDPOINT) . "',";
192
+ $g .= "S2MEMBER_PAYPAL_BUSINESS = '" . ws_plugin__s2member_esc_sq (S2MEMBER_PAYPAL_BUSINESS) . "',";
193
+ /**/
194
+ $g .= "S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0 = '" . ws_plugin__s2member_esc_sq (S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0) . "',";
195
+ $g .= "S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0 = '" . ws_plugin__s2member_esc_sq (S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0) . "',";
196
+ /**/
197
+ $g = trim ($g, " ,") . ";" . "\n"; /* Trim & add semicolon. */
198
+ /**/
199
+ $u = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"];
200
+ $i = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images";
201
+ /**/
202
+ include_once dirname (dirname (__FILE__)) . "/s2member.js";
203
+ /**/
204
+ do_action ("ws_plugin__s2member_during_js_w_globals", get_defined_vars ());
205
+ /**/
206
+ exit ();
207
+ }
208
+ /**/
209
+ do_action ("ws_plugin__s2member_after_js_w_globals", get_defined_vars ());
210
+ }
211
+ }
212
+ ?>
includes/functions/demotions.inc.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Copyright: © 2009 WebSharks, Inc. ( coded in the USA )
4
+ <mailto:support@websharks-inc.com> <http://www.websharks-inc.com/>
5
+
6
+ Released under the terms of the GNU General Public License.
7
+ You should have received a copy of the GNU General Public License,
8
+ along with this software. In the main directory, see: /licensing/
9
+ If not, see: <http://www.gnu.org/licenses/>.
10
+ */
11
+ /*
12
+ Direct access denial.
13
+ */
14
+ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
+ /*
17
+ Forces a specific Role to demote to; whenever a Member is demoted in one way or another.
18
+ Use by PayPal® IPN routines, and also by the Auto-EOT system.
19
+ */
20
+ if (!function_exists ("ws_plugin__s2member_force_demotion_role"))
21
+ {
22
+ function ws_plugin__s2member_force_demotion_role ($demotion_role = FALSE)
23
+ {
24
+ do_action ("ws_plugin__s2member_before_force_demotion_role", get_defined_vars ());
25
+ /**/
26
+ return apply_filters ("ws_plugin__s2member_force_demotion_role", ($demotion_role = "subscriber"), get_defined_vars ());
27
+ }
28
+ }
29
+ ?>
includes/functions/email-configs.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
  /*
17
  Functions that modify the email From: name/address.
18
  */
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
  /*
17
  Functions that modify the email From: name/address.
18
  */
includes/functions/extend-cron.inc.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Copyright: © 2009 WebSharks, Inc. ( coded in the USA )
4
+ <mailto:support@websharks-inc.com> <http://www.websharks-inc.com/>
5
+
6
+ Released under the terms of the GNU General Public License.
7
+ You should have received a copy of the GNU General Public License,
8
+ along with this software. In the main directory, see: /licensing/
9
+ If not, see: <http://www.gnu.org/licenses/>.
10
+ */
11
+ /*
12
+ Direct access denial.
13
+ */
14
+ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit("Do not access this file directly.");
16
+ /*
17
+ Extends the WP-Cron schedules to support 10 minute intervals.
18
+ Attach to: add_filter("cron_schedules");
19
+ */
20
+ if (!function_exists ("ws_plugin__s2member_extend_cron_schedules"))
21
+ {
22
+ function ws_plugin__s2member_extend_cron_schedules ($schedules = array ())
23
+ {
24
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
25
+ do_action ("ws_plugin__s2member_before_extend_cron_schedules", get_defined_vars ());
26
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
27
+ /**/
28
+ $array = array ("every10m" => array ("interval" => 600, "display" => "Every 10 Minutes"));
29
+ /**/
30
+ return apply_filters ("ws_plugin__s2member_extend_cron_schedules", array_merge ($array, $schedules), get_defined_vars ());
31
+ }
32
+ }
33
+ ?>
includes/functions/file-download-access.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
  /*
17
  Function determines the max period in days for download access.
18
  Returns number of days, where 0 means no access to files has been allowed.
@@ -61,6 +61,12 @@ if (!function_exists ("ws_plugin__s2member_user_downloads"))
61
  /**/
62
  if (($current_user = (is_user_logged_in ()) ? wp_get_current_user () : false))
63
  {
 
 
 
 
 
 
64
  if (current_user_can ("access_s2member_level1") && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_file_downloads_allowed"])
65
  {
66
  $allowed = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_file_downloads_allowed"];
@@ -97,7 +103,8 @@ if (!function_exists ("ws_plugin__s2member_user_downloads"))
97
  }
98
  /*
99
  Function determines the minimum level required for file download access.
100
- Returns 0-4, where 0 means no access to file downloads has been allowed.
 
101
  */
102
  if (!function_exists ("ws_plugin__s2member_min_level_4_downloads"))
103
  {
@@ -105,7 +112,13 @@ if (!function_exists ("ws_plugin__s2member_min_level_4_downloads"))
105
  {
106
  do_action ("ws_plugin__s2member_before_min_level_4_downloads", get_defined_vars ());
107
  /**/
108
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_file_downloads_allowed"] && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_file_downloads_allowed_days"])
 
 
 
 
 
 
109
  {
110
  $file_download_access_is_allowed = $min_level_4_downloads = 1;
111
  }
@@ -122,7 +135,7 @@ if (!function_exists ("ws_plugin__s2member_min_level_4_downloads"))
122
  $file_download_access_is_allowed = $min_level_4_downloads = 4;
123
  }
124
  /**/
125
- return apply_filters ("ws_plugin__s2member_min_level_4_downloads", (int)$min_level_4_downloads, get_defined_vars ());
126
  }
127
  }
128
  /*
@@ -137,35 +150,44 @@ if (!function_exists ("ws_plugin__s2member_check_file_download_access"))
137
  /**/
138
  if ($_GET["s2member_file_download"]) /* Filter $excluded to force free downloads. */
139
  {
140
- $excluded = apply_filters ("ws_plugin__s2member_check_file_download_access_excluded", false, get_defined_vars ()); /* Or use $_GET["s2member_free_file_download_key"]. */
141
- /**/
142
- if (!$excluded && (!$_GET["s2member_free_file_download_key"] || ($_GET["s2member_free_file_download_key"] !== md5 (ws_plugin__s2member_xencrypt ($_GET["s2member_file_download"])))))
 
143
  {
144
- $_GET["s2member_file_download"] = trim ($_GET["s2member_file_download"], "/");
145
- /**/
146
- $file_download_access_is_allowed = $minimum_level_required_to_download_files = ws_plugin__s2member_min_level_4_downloads ();
147
  /**/
148
- if (!($current_user = (is_user_logged_in ()) ? wp_get_current_user () : false) /* Redirect Users who are not logged in. */
149
- && wp_redirect (add_query_arg (array ("s2member_level_req" => $minimum_level_required_to_download_files, "s2member_file_download_req" => $_GET["s2member_file_download"]), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
150
- exit;
151
  /**/
152
- else if (!$file_download_access_is_allowed) /* Have file downloads even been enabled? */
153
  {
154
- header ("HTTP/1.0 503 Service Temporarily Unavailable");
155
- echo '503: File Downloads Are Not Enabled.';
156
- exit;
157
  }
158
  /**/
 
 
 
 
159
  else if (!file_exists ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"] . "/" . $_GET["s2member_file_download"]))
160
  {
161
- header ("HTTP/1.0 404 Not Found"); /* The file does not even exist. */
162
- echo '404: File Download Not Found.';
163
- exit;
164
  }
165
  /**/
166
  else if ((!is_array ($file_downloads = ws_plugin__s2member_user_downloads ()) || !$file_downloads["allowed"] || !$file_downloads["allowed_days"])/**/
167
  && wp_redirect (add_query_arg (array ("s2member_file_download_req" => $_GET["s2member_file_download"]), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"]))) !== "nill")
168
- exit;
 
 
 
 
 
 
 
 
 
 
169
  /**/
170
  $previous_file_downloads = 0; /* Here we're going to count how many downloads they've performed. */
171
  $max_days_logged = ws_plugin__s2member_max_download_period (); /* The longest period in days. */
@@ -190,7 +212,7 @@ if (!function_exists ("ws_plugin__s2member_check_file_download_access"))
190
  /**/
191
  if (!$already_downloaded && $previous_file_downloads >= $file_downloads["allowed"] /* They have NOT already downloaded this file, and they're over their limit. */
192
  && wp_redirect (add_query_arg (array ("s2member_file_download_req" => $_GET["s2member_file_download"]), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"]))) !== "nill")
193
- exit;
194
  /**/
195
  if (!$already_downloaded) /* Only add this file to the log if they have not already downloaded it. */
196
  $file_download_access_log[] = array ("date" => date ("Y-m-d"), "file" => $_GET["s2member_file_download"]);
@@ -198,15 +220,14 @@ if (!function_exists ("ws_plugin__s2member_check_file_download_access"))
198
  update_usermeta ($current_user->ID, "s2member_file_download_access_arc", ws_plugin__s2member_array_unique ($file_download_access_arc));
199
  update_usermeta ($current_user->ID, "s2member_file_download_access_log", ws_plugin__s2member_array_unique ($file_download_access_log));
200
  }
201
- else /* This is a free download that we just need to check on the existence of. */
202
  {
203
  $_GET["s2member_file_download"] = trim ($_GET["s2member_file_download"], "/");
204
  /**/
205
  if (!file_exists ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"] . "/" . $_GET["s2member_file_download"]))
206
  {
207
- header ("HTTP/1.0 404 Not Found"); /* The file does not exist. */
208
- echo '404: File Download Not Found.';
209
- exit;
210
  }
211
  }
212
  /*
@@ -226,7 +247,8 @@ if (!function_exists ("ws_plugin__s2member_check_file_download_access"))
226
  /*
227
  Now send the file to the browser. Be sure to turn off output compression.
228
  */
229
- ini_set ("zlib.output_compression", 0); /* Must be turned off. */
 
230
  /**/
231
  header ("Content-Encoding: none");
232
  header ("Content-Type: " . $mimetype);
@@ -241,12 +263,34 @@ if (!function_exists ("ws_plugin__s2member_check_file_download_access"))
241
  header ("Cache-Control: post-check=0, pre-check=0", false);
242
  header ("Pragma: no-cache");
243
  /**/
244
- readfile ($file);
245
  /**/
246
- exit;
247
  }
248
  /**/
249
  do_action ("ws_plugin__s2member_after_file_download_access", get_defined_vars ());
250
  }
251
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
252
  ?>
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
  /*
17
  Function determines the max period in days for download access.
18
  Returns number of days, where 0 means no access to files has been allowed.
61
  /**/
62
  if (($current_user = (is_user_logged_in ()) ? wp_get_current_user () : false))
63
  {
64
+ if (current_user_can ("access_s2member_level0") && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_file_downloads_allowed"])
65
+ {
66
+ $allowed = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_file_downloads_allowed"];
67
+ $allowed_days = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_file_downloads_allowed_days"];
68
+ }
69
+ /**/
70
  if (current_user_can ("access_s2member_level1") && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_file_downloads_allowed"])
71
  {
72
  $allowed = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_file_downloads_allowed"];
103
  }
104
  /*
105
  Function determines the minimum level required for file download access.
106
+ Test === false to see if no access is allowed.
107
+ This returns false, or (int)[0-1].
108
  */
109
  if (!function_exists ("ws_plugin__s2member_min_level_4_downloads"))
110
  {
112
  {
113
  do_action ("ws_plugin__s2member_before_min_level_4_downloads", get_defined_vars ());
114
  /**/
115
+ $file_download_access_is_allowed = $min_level_4_downloads = false; /* Test with === false, which means no access is allowed at all. */
116
+ /**/
117
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_file_downloads_allowed"] && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_file_downloads_allowed_days"])
118
+ {
119
+ $file_download_access_is_allowed = $min_level_4_downloads = 0;
120
+ }
121
+ else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_file_downloads_allowed"] && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_file_downloads_allowed_days"])
122
  {
123
  $file_download_access_is_allowed = $min_level_4_downloads = 1;
124
  }
135
  $file_download_access_is_allowed = $min_level_4_downloads = 4;
136
  }
137
  /**/
138
+ return apply_filters ("ws_plugin__s2member_min_level_4_downloads", ($file_download_access_is_allowed = $min_level_4_downloads), get_defined_vars ());
139
  }
140
  }
141
  /*
150
  /**/
151
  if ($_GET["s2member_file_download"]) /* Filter $excluded to force free downloads. */
152
  {
153
+ $excluded = apply_filters ("ws_plugin__s2member_check_file_download_access_excluded", false, get_defined_vars ());
154
+ $_GET["s2member_file_download_key"] = (!$_GET["s2member_file_download_key"] && $_GET["s2member_free_file_download_key"]) ? $_GET["s2member_free_file_download_key"] : $_GET["s2member_file_download_key"];
155
+ /* The use of `md5(s2member_xencrypt("locaton of file"))` was deprecated in v3.0.5 in favor of `s2member_file_download_key()` - because it provides better security and greater flexibility. Also, $_GET["s2member_free_file_download_key"] is deprecated, in favor of $_GET["s2member_file_download_key"]. */
156
+ if (!$excluded && (!$_GET["s2member_file_download_key"] || ($_GET["s2member_file_download_key"] && !($_GET["s2member_file_download_key"] === ws_plugin__s2member_file_download_key ($_GET["s2member_file_download"]) || /* Deprecated « */ $_GET["s2member_file_download_key"] === md5 (ws_plugin__s2member_xencrypt ($_GET["s2member_file_download"])) /* » */))))
157
  {
158
+ $_GET["s2member_file_download"] = trim ($_GET["s2member_file_download"], "/"); /* Now trim slashes after key comparison. */
 
 
159
  /**/
160
+ $file_download_access_is_allowed = $min_level_4_downloads = ws_plugin__s2member_min_level_4_downloads ();
 
 
161
  /**/
162
+ if ($file_download_access_is_allowed === false) /* Have file downloads even been enabled? */
163
  {
164
+ header ("HTTP/1.0 503 Service Temporarily Unavailable"); /* Not yet configured? */
165
+ 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`.");
 
166
  }
167
  /**/
168
+ else if (!($current_user = (is_user_logged_in ()) ? wp_get_current_user () : false) /* Redirect Users who are not logged in. */
169
+ && wp_redirect (add_query_arg (array ("s2member_level_req" => (string)$min_level_4_downloads, "s2member_file_download_req" => $_GET["s2member_file_download"]), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
170
+ exit ();
171
+ /**/
172
  else if (!file_exists ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"] . "/" . $_GET["s2member_file_download"]))
173
  {
174
+ header ("HTTP/1.0 404 Not Found"); /* The file does not even exist? */
175
+ exit ("404: Sorry, file download not found. Please contact Support for assistance.");
 
176
  }
177
  /**/
178
  else if ((!is_array ($file_downloads = ws_plugin__s2member_user_downloads ()) || !$file_downloads["allowed"] || !$file_downloads["allowed_days"])/**/
179
  && wp_redirect (add_query_arg (array ("s2member_file_download_req" => $_GET["s2member_file_download"]), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"]))) !== "nill")
180
+ exit ();
181
+ /**/
182
+ else if (preg_match ("/^access[_\-]s2member[_\-](.+?)\//", $_GET["s2member_file_download"])) /* Custom Capability? */
183
+ {
184
+ list ($cap_req) = preg_split ("/\//", $_GET["s2member_file_download"], 2); /* Which Capability does this require? */
185
+ $cap_req = preg_replace ("/-/", "_", $cap_req); /* Supports (optional) dashed sub-folders instead of underscores. */
186
+ /**/
187
+ if (!$current_user->has_cap ($cap_req) /* Ok, so we've got a Custom Capability required. Do they have permission? */
188
+ && wp_redirect (add_query_arg (array ("s2member_cap_req" => $cap_req, "s2member_file_download_req" => $_GET["s2member_file_download"]), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
189
+ exit ();
190
+ }
191
  /**/
192
  $previous_file_downloads = 0; /* Here we're going to count how many downloads they've performed. */
193
  $max_days_logged = ws_plugin__s2member_max_download_period (); /* The longest period in days. */
212
  /**/
213
  if (!$already_downloaded && $previous_file_downloads >= $file_downloads["allowed"] /* They have NOT already downloaded this file, and they're over their limit. */
214
  && wp_redirect (add_query_arg (array ("s2member_file_download_req" => $_GET["s2member_file_download"]), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"]))) !== "nill")
215
+ exit ();
216
  /**/
217
  if (!$already_downloaded) /* Only add this file to the log if they have not already downloaded it. */
218
  $file_download_access_log[] = array ("date" => date ("Y-m-d"), "file" => $_GET["s2member_file_download"]);
220
  update_usermeta ($current_user->ID, "s2member_file_download_access_arc", ws_plugin__s2member_array_unique ($file_download_access_arc));
221
  update_usermeta ($current_user->ID, "s2member_file_download_access_log", ws_plugin__s2member_array_unique ($file_download_access_log));
222
  }
223
+ else /* Else, this is a download that is either $excluded, or has been granted exclusive permission with a key. */
224
  {
225
  $_GET["s2member_file_download"] = trim ($_GET["s2member_file_download"], "/");
226
  /**/
227
  if (!file_exists ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"] . "/" . $_GET["s2member_file_download"]))
228
  {
229
+ header ("HTTP/1.0 404 Not Found"); /* The file does not even exist? */
230
+ exit ("404: Sorry, file download not found. Please contact Support for assistance.");
 
231
  }
232
  }
233
  /*
247
  /*
248
  Now send the file to the browser. Be sure to turn off output compression.
249
  */
250
+ set_time_limit (0); /* Make time. */
251
+ ini_set ("zlib.output_compression", 0);
252
  /**/
253
  header ("Content-Encoding: none");
254
  header ("Content-Type: " . $mimetype);
263
  header ("Cache-Control: post-check=0, pre-check=0", false);
264
  header ("Pragma: no-cache");
265
  /**/
266
+ ob_clean () . flush () . readfile ($file);
267
  /**/
268
+ exit ();
269
  }
270
  /**/
271
  do_action ("ws_plugin__s2member_after_file_download_access", get_defined_vars ());
272
  }
273
  }
274
+ /*
275
+ Function creates a special file download key.
276
+ This replaces the old way of doing things: using md5(s2member_xencrypt("location of file")).
277
+ This new function adds date("Y-m-d").$HTTP_USER_AGENT.$REMOTE_ADDR to the salt used in hash creation.
278
+ */
279
+ if (!function_exists ("ws_plugin__s2member_file_download_key"))
280
+ {
281
+ function ws_plugin__s2member_file_download_key ($file = FALSE)
282
+ {
283
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
284
+ do_action ("ws_plugin__s2member_before_file_download_key", get_defined_vars ());
285
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
286
+ /**/
287
+ $key = md5 (ws_plugin__s2member_encrypt (date ("Y-m-d") . $_SERVER["REMOTE_ADDR"] . $_SERVER["HTTP_USER_AGENT"] . $file));
288
+ /**/
289
+ return apply_filters ("ws_plugin__s2member_file_download_key", $key, get_defined_vars ());
290
+ }
291
+ function s2member_file_download_key ($file = FALSE) /* Alias for API usage. */
292
+ {
293
+ return ws_plugin__s2member_file_download_key ($file);
294
+ }
295
+ }
296
  ?>
includes/functions/force-ssl.inc.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Copyright: © 2009 WebSharks, Inc. ( coded in the USA )
4
+ <mailto:support@websharks-inc.com> <http://www.websharks-inc.com/>
5
+
6
+ Released under the terms of the GNU General Public License.
7
+ You should have received a copy of the GNU General Public License,
8
+ along with this software. In the main directory, see: /licensing/
9
+ If not, see: <http://www.gnu.org/licenses/>.
10
+ */
11
+ /*
12
+ Direct access denial.
13
+ */
14
+ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
+ /*
17
+ Function that forces SSL on specific Posts/Pages.
18
+ Attach to: add_action("template_redirect");
19
+
20
+ Triggered by Custom Field:
21
+ s2member_force_ssl = 1
22
+ */
23
+ if (!function_exists ("ws_plugin__s2member_check_force_ssl"))
24
+ {
25
+ function ws_plugin__s2member_check_force_ssl () /* Forces SSL. */
26
+ {
27
+ global $post; /* We need the global $post variable here. */
28
+ /**/
29
+ do_action ("ws_plugin__s2member_before_check_force_ssl", get_defined_vars ());
30
+ /**/
31
+ if (is_singular () && get_post_meta ($post->ID, "s2member_force_ssl", true))
32
+ {
33
+ if (!preg_match ("/^on$/i", $_SERVER["HTTPS"]))
34
+ {
35
+ wp_redirect ("https://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]);
36
+ exit (); /* Redirect to SSL enabled Post/Page. Site must have SSL cert. */
37
+ }
38
+ else /* Otherwise, we buffer the output, and switch everything to https. */
39
+ {
40
+ function _ws_plugin__s2member_force_ssl_buffer ($buffer = FALSE)
41
+ {
42
+ $o_pcre = ini_get ("pcre.backtrack_limit");
43
+ /**/
44
+ ini_set ("pcre.backtrack_limit", 10000000);
45
+ /**/
46
+ $tags = "script|style|link|img|input|iframe|object|embed"; /* Specific tags. */
47
+ /**/
48
+ $tags = apply_filters ("_ws_plugin__s2member_force_ssl_buffer_tags", $tags, get_defined_vars ());
49
+ /**/
50
+ $buffer = preg_replace_callback ("/\<(" . $tags . ")[^\>]+/i", "_ws_plugin__s2member_force_ssl_buffer_callback", $buffer);
51
+ /**/
52
+ ini_set ("pcre.backtrack_limit", $o_pcre);
53
+ /**/
54
+ return apply_filters ("_ws_plugin__s2member_force_ssl_buffer", $buffer, get_defined_vars ());
55
+ }
56
+ /**/
57
+ function _ws_plugin__s2member_force_ssl_buffer_callback ($m = FALSE)
58
+ {
59
+ return preg_replace ("/http\:\/\//i", "https://", $m[0]);
60
+ }
61
+ /**/
62
+ ob_start ("_ws_plugin__s2member_force_ssl_buffer");
63
+ }
64
+ }
65
+ /**/
66
+ do_action ("ws_plugin__s2member_after_check_force_ssl", get_defined_vars ());
67
+ /**/
68
+ return;
69
+ }
70
+ }
71
+ ?>
includes/functions/hide-some-systematics.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
  /*
17
  Function that hides some of the systematic use pages.
18
  Attach to: add_filter("posts_where");
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
  /*
17
  Function that hides some of the systematic use pages.
18
  Attach to: add_filter("posts_where");
includes/functions/ip-restrictions.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
  /*
17
  Function for handling IP Restrictions.
18
  IP addresses are stored in a Transient field.
@@ -51,7 +51,7 @@ if (!function_exists ("ws_plugin__s2member_ip_restrictions_ok"))
51
  echo 'Too many IP addresses accessing one account/link!<br />' . "\n";
52
  echo 'Please contact Support if you need assistance.';
53
  /**/
54
- exit; /* Exit now. */
55
  }
56
  else /* Looks legit. Continue updating the Transient array of IP addresses. */
57
  {
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
  /*
17
  Function for handling IP Restrictions.
18
  IP addresses are stored in a Transient field.
51
  echo 'Too many IP addresses accessing one account/link!<br />' . "\n";
52
  echo 'Please contact Support if you need assistance.';
53
  /**/
54
+ exit ();
55
  }
56
  else /* Looks legit. Continue updating the Transient array of IP addresses. */
57
  {
includes/functions/is-systematic.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
  /*
17
  Function that determines whether we are on a systematic use page.
18
  */
@@ -24,9 +24,9 @@ if (!function_exists ("ws_plugin__s2member_is_systematic_use_page"))
24
  /**/
25
  if (isset ($is_systematic)) /* Already cached? This saves time. */
26
  {
27
- return apply_filters ("ws_plugin__s2member_is_systematic_use_page", $is_systematic, get_defined_vars ());
28
  }
29
- else if (is_admin ()) /* In the admin area? */
30
  {
31
  return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ()));
32
  }
@@ -56,7 +56,7 @@ if (!function_exists ("ws_plugin__s2member_is_systematic_use_page"))
56
  }
57
  else if (preg_match ("/^s2member/", $_SERVER["QUERY_STRING"]) && ($_SERVER["REQUEST_URI"] === "/" || strtolower (rtrim (get_bloginfo ("url"), "/")) === rtrim (strtolower ("http://" . $_SERVER["HTTP_HOST"]) . $_SERVER["REQUEST_URI"], "/")))
58
  {
59
- return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ())); /* Only true when the request starts with /?s2member from the root URL of the domain, or from the root URL of the install. */
60
  }
61
  else /* Otherwise, we return false. */
62
  {
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit("Do not access this file directly.");
16
  /*
17
  Function that determines whether we are on a systematic use page.
18
  */
24
  /**/
25
  if (isset ($is_systematic)) /* Already cached? This saves time. */
26
  {
27
+ return $is_systematic; /* Filters will have already been applied. */
28
  }
29
+ else if (is_admin ()) /* In the admin area? - All administrational pages are considered systematic. */
30
  {
31
  return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ()));
32
  }
56
  }
57
  else if (preg_match ("/^s2member/", $_SERVER["QUERY_STRING"]) && ($_SERVER["REQUEST_URI"] === "/" || strtolower (rtrim (get_bloginfo ("url"), "/")) === rtrim (strtolower ("http://" . $_SERVER["HTTP_HOST"]) . $_SERVER["REQUEST_URI"], "/")))
58
  {
59
+ return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ())); /* Only true when the request starts with /?s2member from the root URL of the domain, or from the install. */
60
  }
61
  else /* Otherwise, we return false. */
62
  {
includes/functions/js-globals.inc.php DELETED
@@ -1,161 +0,0 @@
1
- <?php
2
- /*
3
- Copyright: © 2009 WebSharks, Inc. ( coded in the USA )
4
- <mailto:support@websharks-inc.com> <http://www.websharks-inc.com/>
5
-
6
- Released under the terms of the GNU General Public License.
7
- You should have received a copy of the GNU General Public License,
8
- along with this software. In the main directory, see: /licensing/
9
- If not, see: <http://www.gnu.org/licenses/>.
10
- */
11
- /*
12
- Direct access denial.
13
- */
14
- if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
- /*
17
- Function for adding script to the header.
18
- This function is fired in the admin area also.
19
- Do NOT enqueue the script in the admin area.
20
- Attach to: add_action("wp_print_scripts");
21
- */
22
- if (!function_exists ("ws_plugin__s2member_add_js_w_globals"))
23
- {
24
- function ws_plugin__s2member_add_js_w_globals ()
25
- {
26
- do_action ("ws_plugin__s2member_before_add_js_w_globals", get_defined_vars ());
27
- /**/
28
- if (!is_admin ()) /* Not in the admin. */
29
- {
30
- if (is_user_logged_in ())
31
- {
32
- $a = get_defined_constants (true);
33
- $c = (array)$a["user"];
34
- unset ($a);
35
- /**/
36
- foreach ($c as $k => $v)
37
- if (preg_match ("/^S2MEMBER_/i", $k))
38
- $s2member[$k] = $v;
39
- /**/
40
- $md5 = md5 (serialize ($s2member)); /* This is a hash based on the global key => values. */
41
- /* The md5 hash allows the script to be cached in the browser until the globals happen to change. */
42
- /* For instance, the global variables may change when a user who is logged-in changes their profile. */
43
- wp_enqueue_script ("ws-plugin--s2member", get_bloginfo ("url") . "/?ws_plugin__s2member_js_w_globals=1&qcABC=1&" . $md5, array ("jquery"), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["options_version"] . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["filemtime"]);
44
- }
45
- else /* Else if they are not logged in, we distinguish the script by not including the md5 hash. */
46
- { /* This essentially creates 2 versions of the script. One while logged in & another when not. */
47
- wp_enqueue_script ("ws-plugin--s2member", get_bloginfo ("url") . "/?ws_plugin__s2member_js_w_globals=1&qcABC=1", array ("jquery"), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["options_version"] . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["filemtime"]);
48
- }
49
- /**/
50
- do_action ("ws_plugin__s2member_during_add_js_w_globals", get_defined_vars ());
51
- }
52
- /**/
53
- do_action ("ws_plugin__s2member_after_add_js_w_globals", get_defined_vars ());
54
- /**/
55
- return;
56
- }
57
- }
58
- /*
59
- Function for adding s2member.js with globals.
60
- Attach to: add_action("init");
61
- */
62
- if (!function_exists ("ws_plugin__s2member_js_w_globals"))
63
- {
64
- function ws_plugin__s2member_js_w_globals ()
65
- {
66
- do_action ("ws_plugin__s2member_before_js_w_globals", get_defined_vars ());
67
- /**/
68
- if ($_GET["ws_plugin__s2member_js_w_globals"])
69
- {
70
- $g = ""; /* Initialize here to give hooks a chance. */
71
- /**/
72
- header ("Content-Type: text/javascript; charset=utf-8");
73
- header ("Expires: " . gmdate ("D, d M Y H:i:s", strtotime ("+1 week")) . " GMT");
74
- header ("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
75
- header ("Cache-Control: max-age=604800");
76
- header ("Pragma: public");
77
- /**/
78
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
79
- do_action ("ws_plugin__s2member_during_js_w_globals_before", get_defined_vars ());
80
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
81
- /**/
82
- $g .= "var S2MEMBER_VERSION = '" . preg_replace ("/'/", "\'", S2MEMBER_VERSION) . "',"; /* Since s2Member 3.0. */
83
- /**/
84
- $g .= "S2MEMBER_CURRENT_USER_IS_LOGGED_IN = " . ((S2MEMBER_CURRENT_USER_IS_LOGGED_IN) ? "true" : "false") . ",";
85
- $g .= "S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER = " . ((S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER) ? "true" : "false") . ",";
86
- $g .= "S2MEMBER_CURRENT_USER_ACCESS_LEVEL = " . S2MEMBER_CURRENT_USER_ACCESS_LEVEL . ",";
87
- $g .= "S2MEMBER_CURRENT_USER_ACCESS_LABEL = '" . preg_replace ("/'/", "\'", S2MEMBER_CURRENT_USER_ACCESS_LABEL) . "',";
88
- $g .= "S2MEMBER_CURRENT_USER_SUBSCR_ID = '" . preg_replace ("/'/", "\'", S2MEMBER_CURRENT_USER_SUBSCR_ID) . "',";
89
- $g .= "S2MEMBER_CURRENT_USER_CUSTOM = '" . preg_replace ("/'/", "\'", S2MEMBER_CURRENT_USER_CUSTOM) . "',";
90
- $g .= "S2MEMBER_CURRENT_USER_REGISTRATION_TIME = " . S2MEMBER_CURRENT_USER_REGISTRATION_TIME . ",";
91
- $g .= "S2MEMBER_CURRENT_USER_REGISTRATION_DAYS = " . S2MEMBER_CURRENT_USER_REGISTRATION_DAYS . ",";
92
- $g .= "S2MEMBER_CURRENT_USER_DISPLAY_NAME = '" . preg_replace ("/'/", "\'", S2MEMBER_CURRENT_USER_DISPLAY_NAME) . "',";
93
- $g .= "S2MEMBER_CURRENT_USER_FIRST_NAME = '" . preg_replace ("/'/", "\'", S2MEMBER_CURRENT_USER_FIRST_NAME) . "',";
94
- $g .= "S2MEMBER_CURRENT_USER_LAST_NAME = '" . preg_replace ("/'/", "\'", S2MEMBER_CURRENT_USER_LAST_NAME) . "',";
95
- $g .= "S2MEMBER_CURRENT_USER_LOGIN = '" . preg_replace ("/'/", "\'", S2MEMBER_CURRENT_USER_LOGIN) . "',";
96
- $g .= "S2MEMBER_CURRENT_USER_EMAIL = '" . preg_replace ("/'/", "\'", S2MEMBER_CURRENT_USER_EMAIL) . "',";
97
- $g .= "S2MEMBER_CURRENT_USER_IP = '" . preg_replace ("/'/", "\'", S2MEMBER_CURRENT_USER_IP) . "',";
98
- $g .= "S2MEMBER_CURRENT_USER_ID = " . S2MEMBER_CURRENT_USER_ID . ",";
99
- $g .= "S2MEMBER_CURRENT_USER_FIELDS = " . S2MEMBER_CURRENT_USER_FIELDS . ",";
100
- /**/
101
- $g .= "S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED = " . S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED . ",";
102
- $g .= "S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED = " . ((S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED) ? "true" : "false") . ",";
103
- $g .= "S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY = " . S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY . ",";
104
- $g .= "S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS = " . S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS . ",";
105
- /**/
106
- $g .= "S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID = " . S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID . ",";
107
- $g .= "S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID = " . S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID . ",";
108
- $g .= "S2MEMBER_LOGIN_WELCOME_PAGE_ID = " . S2MEMBER_LOGIN_WELCOME_PAGE_ID . ",";
109
- /**/
110
- $g .= "S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL = '" . preg_replace ("/'/", "\'", S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL) . "',";
111
- $g .= "S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL = '" . preg_replace ("/'/", "\'", S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL) . "',";
112
- $g .= "S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL = '" . preg_replace ("/'/", "\'", S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL) . "',";
113
- $g .= "S2MEMBER_LOGIN_WELCOME_PAGE_URL = '" . preg_replace ("/'/", "\'", S2MEMBER_LOGIN_WELCOME_PAGE_URL) . "',";
114
- $g .= "S2MEMBER_LOGOUT_PAGE_URL = '" . preg_replace ("/'/", "\'", S2MEMBER_LOGOUT_PAGE_URL) . "',";
115
- $g .= "S2MEMBER_LOGIN_PAGE_URL = '" . preg_replace ("/'/", "\'", S2MEMBER_LOGIN_PAGE_URL) . "',";
116
- /**/
117
- $g .= "S2MEMBER_LEVEL1_LABEL = '" . preg_replace ("/'/", "\'", S2MEMBER_LEVEL1_LABEL) . "',";
118
- $g .= "S2MEMBER_LEVEL2_LABEL = '" . preg_replace ("/'/", "\'", S2MEMBER_LEVEL2_LABEL) . "',";
119
- $g .= "S2MEMBER_LEVEL3_LABEL = '" . preg_replace ("/'/", "\'", S2MEMBER_LEVEL3_LABEL) . "',";
120
- $g .= "S2MEMBER_LEVEL4_LABEL = '" . preg_replace ("/'/", "\'", S2MEMBER_LEVEL4_LABEL) . "',";
121
- /**/
122
- $g .= "S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED = " . S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED . ",";
123
- $g .= "S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED = " . S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED . ",";
124
- $g .= "S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED = " . S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED . ",";
125
- $g .= "S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED = " . S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED . ",";
126
- /**/
127
- $g .= "S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED_DAYS = " . S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED_DAYS . ",";
128
- $g .= "S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED_DAYS = " . S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED_DAYS . ",";
129
- $g .= "S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED_DAYS = " . S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED_DAYS . ",";
130
- $g .= "S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED_DAYS = " . S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED_DAYS . ",";
131
- /**/
132
- $g .= "S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS = '" . preg_replace ("/'/", "\'", S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS) . "',";
133
- /**/
134
- $g .= "S2MEMBER_REG_EMAIL_FROM_NAME = '" . preg_replace ("/'/", "\'", S2MEMBER_REG_EMAIL_FROM_NAME) . "',";
135
- $g .= "S2MEMBER_REG_EMAIL_FROM_EMAIL = '" . preg_replace ("/'/", "\'", S2MEMBER_REG_EMAIL_FROM_EMAIL) . "',";
136
- /**/
137
- $g .= "S2MEMBER_PAYPAL_NOTIFY_URL = '" . preg_replace ("/'/", "\'", S2MEMBER_PAYPAL_NOTIFY_URL) . "',";
138
- $g .= "S2MEMBER_PAYPAL_RETURN_URL = '" . preg_replace ("/'/", "\'", S2MEMBER_PAYPAL_RETURN_URL) . "',";
139
- $g .= "S2MEMBER_PAYPAL_ENDPOINT = '" . preg_replace ("/'/", "\'", S2MEMBER_PAYPAL_ENDPOINT) . "',";
140
- $g .= "S2MEMBER_PAYPAL_BUSINESS = '" . preg_replace ("/'/", "\'", S2MEMBER_PAYPAL_BUSINESS) . "',";
141
- /**/
142
- $g .= "S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0 = '" . preg_replace ("/'/", "\'", S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0) . "',";
143
- $g .= "S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0 = '" . preg_replace ("/'/", "\'", S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0) . "',";
144
- /**/
145
- $g = trim ($g, " ,") . ";"; /* Trim & add semicolon. */
146
- $j = file_get_contents (dirname (dirname (__FILE__)) . "/s2member-min.js");
147
- $j = preg_replace ("/('|\")%%globals%%('|\");/", $g, $j);
148
- /**/
149
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
150
- do_action ("ws_plugin__s2member_during_js_w_globals_after", get_defined_vars ());
151
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
152
- /**/
153
- echo apply_filters ("ws_plugin__s2member_js_w_globals", $j, get_defined_vars ());
154
- /**/
155
- exit;
156
- }
157
- /**/
158
- do_action ("ws_plugin__s2member_after_js_w_globals", get_defined_vars ());
159
- }
160
- }
161
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/functions/list-servers.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
  /*
17
  Function that process list server integrations for s2Member.
18
  */
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
  /*
17
  Function that process list server integrations for s2Member.
18
  */
includes/functions/login-customizations.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
  /*
17
  Function for filtering the login logo url.
18
  Attach to: add_filter("login_headerurl");
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
  /*
17
  Function for filtering the login logo url.
18
  Attach to: add_filter("login_headerurl");
includes/functions/login-redirection.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
  /*
17
  Function for handling login redirections.
18
  Attach to: add_action("wp_login");
@@ -25,9 +25,7 @@ if (!function_exists ("ws_plugin__s2member_login_redirect"))
25
  do_action ("ws_plugin__s2member_before_login_redirect", get_defined_vars ());
26
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
27
  /**/
28
- $user = new WP_User ($username); /* Get user object reference. */
29
- /**/
30
- if (!$user->has_cap ("edit_posts")) /* Subscribers & Members. */
31
  {
32
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
33
  do_action ("ws_plugin__s2member_during_login_redirect", get_defined_vars ());
@@ -43,7 +41,7 @@ if (!function_exists ("ws_plugin__s2member_login_redirect"))
43
  wp_redirect (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]));
44
  }
45
  /**/
46
- exit;
47
  }
48
  /**/
49
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
@@ -67,8 +65,8 @@ if (!function_exists ("ws_plugin__s2member_fill_login_redirect_rc_vars"))
67
  $current_user_login = (is_object ($current_user)) ? strtolower ($current_user->user_login) : "";
68
  $current_user_ID = (is_object ($current_user)) ? (string)$current_user->ID : "";
69
  /**/
70
- $url = preg_replace ("/%%current_user_login%%/i", $current_user_login, $url);
71
- $url = preg_replace ("/%%current_user_ID%%/i", $current_user_ID, $url);
72
  /**/
73
  return apply_filters ("ws_plugin__s2member_fill_login_redirect_rc_vars", $url, get_defined_vars ());
74
  }
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
  /*
17
  Function for handling login redirections.
18
  Attach to: add_action("wp_login");
25
  do_action ("ws_plugin__s2member_before_login_redirect", get_defined_vars ());
26
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
27
  /**/
28
+ if (!is_object ($user = new WP_User ($username)) || !$user->ID || !$user->has_cap ("edit_posts"))
 
 
29
  {
30
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
31
  do_action ("ws_plugin__s2member_during_login_redirect", get_defined_vars ());
41
  wp_redirect (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]));
42
  }
43
  /**/
44
+ exit ();
45
  }
46
  /**/
47
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
65
  $current_user_login = (is_object ($current_user)) ? strtolower ($current_user->user_login) : "";
66
  $current_user_ID = (is_object ($current_user)) ? (string)$current_user->ID : "";
67
  /**/
68
+ $url = preg_replace ("/%%current_user_login%%/i", ws_plugin__s2member_esc_ds ($current_user_login), $url);
69
+ $url = preg_replace ("/%%current_user_ID%%/i", ws_plugin__s2member_esc_ds ($current_user_ID), $url);
70
  /**/
71
  return apply_filters ("ws_plugin__s2member_fill_login_redirect_rc_vars", $url, get_defined_vars ());
72
  }
includes/functions/menu-pages.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
  /*
17
  Function for saving all options from any page.
18
  */
@@ -75,20 +75,27 @@ if (!function_exists ("ws_plugin__s2member_add_admin_options"))
75
  {
76
  function ws_plugin__s2member_add_admin_options ()
77
  {
 
 
78
  do_action ("ws_plugin__s2member_before_add_admin_options", get_defined_vars ());
79
  /**/
80
  add_filter ("plugin_action_links", "_ws_plugin__s2member_add_settings_link", 10, 2);
81
  /**/
82
  if (apply_filters ("ws_plugin__s2member_during_add_admin_options_create_menu_items", true, get_defined_vars ()))
83
  {
84
- add_menu_page ("s2Member Options", "s2Member", "edit_plugins", "ws-plugin--s2member-options", "ws_plugin__s2member_options_page");
 
 
 
 
 
85
  add_submenu_page ("ws-plugin--s2member-options", "s2Member General Options", "General Options", "edit_plugins", "ws-plugin--s2member-options", "ws_plugin__s2member_options_page");
86
  /**/
87
  if (apply_filters ("ws_plugin__s2member_during_add_admin_options_add_paypal_ops_page", true, get_defined_vars ()))
88
  add_submenu_page ("ws-plugin--s2member-options", "s2Member PayPal Options", "PayPal® Options", "edit_plugins", "ws-plugin--s2member-paypal-ops", "ws_plugin__s2member_paypal_ops_page");
89
  /**/
90
- if (apply_filters ("ws_plugin__s2member_during_add_admin_options_add_buttons_page", true, get_defined_vars ()))
91
- add_submenu_page ("ws-plugin--s2member-options", "s2Member PayPal® Buttons", "PayPal® Buttons", "edit_plugins", "ws-plugin--s2member-buttons", "ws_plugin__s2member_buttons_page");
92
  /**/
93
  if (apply_filters ("ws_plugin__s2member_during_add_admin_options_add_down_ops_page", true, get_defined_vars ()))
94
  add_submenu_page ("ws-plugin--s2member-options", "s2Member File Download Options", "Download Options", "edit_plugins", "ws-plugin--s2member-down-ops", "ws_plugin__s2member_down_ops_page");
@@ -215,7 +222,7 @@ if (!function_exists ("ws_plugin__s2member_menu_pages_js"))
215
  /**/
216
  do_action ("ws_plugin__s2member_during_menu_pages_js", get_defined_vars ());
217
  /**/
218
- exit;
219
  }
220
  /**/
221
  do_action ("ws_plugin__s2member_after_menu_pages_js", get_defined_vars ());
@@ -247,7 +254,7 @@ if (!function_exists ("ws_plugin__s2member_menu_pages_css"))
247
  /**/
248
  do_action ("ws_plugin__s2member_during_menu_pages_css", get_defined_vars ());
249
  /**/
250
- exit;
251
  }
252
  /**/
253
  do_action ("ws_plugin__s2member_after_menu_pages_css", get_defined_vars ());
@@ -408,15 +415,18 @@ if (!function_exists ("ws_plugin__s2member_api_ops_page"))
408
  /*
409
  Function for building the PayPal Button Generator page.
410
  */
411
- if (!function_exists ("ws_plugin__s2member_buttons_page"))
412
  {
413
- function ws_plugin__s2member_buttons_page ()
414
  {
415
- do_action ("ws_plugin__s2member_before_buttons_page", get_defined_vars ());
 
 
 
416
  /**/
417
- include_once dirname (dirname (__FILE__)) . "/menu-pages/buttons.inc.php";
418
  /**/
419
- do_action ("ws_plugin__s2member_after_buttons_page", get_defined_vars ());
420
  /**/
421
  return;
422
  }
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
  /*
17
  Function for saving all options from any page.
18
  */
75
  {
76
  function ws_plugin__s2member_add_admin_options ()
77
  {
78
+ global $menu; /* Need this to work out positioning. */
79
+ /**/
80
  do_action ("ws_plugin__s2member_before_add_admin_options", get_defined_vars ());
81
  /**/
82
  add_filter ("plugin_action_links", "_ws_plugin__s2member_add_settings_link", 10, 2);
83
  /**/
84
  if (apply_filters ("ws_plugin__s2member_during_add_admin_options_create_menu_items", true, get_defined_vars ()))
85
  {
86
+ $position = (!$position && !$menu[71]) ? 71 : $position; /* Ideal position if available. */
87
+ $position = (!$position && !$menu[72]) ? 72 : $position; /* Else position here if available. */
88
+ $position = (!$position && !$menu[73]) ? 73 : $position; /* Else position here if available. */
89
+ $position = (!$position && !$menu[74]) ? 74 : $position; /* Else position here if available. */
90
+ /**/
91
+ add_menu_page ("s2Member Options", "s2Member", "edit_plugins", "ws-plugin--s2member-options", "ws_plugin__s2member_options_page", "", $position);
92
  add_submenu_page ("ws-plugin--s2member-options", "s2Member General Options", "General Options", "edit_plugins", "ws-plugin--s2member-options", "ws_plugin__s2member_options_page");
93
  /**/
94
  if (apply_filters ("ws_plugin__s2member_during_add_admin_options_add_paypal_ops_page", true, get_defined_vars ()))
95
  add_submenu_page ("ws-plugin--s2member-options", "s2Member PayPal Options", "PayPal® Options", "edit_plugins", "ws-plugin--s2member-paypal-ops", "ws_plugin__s2member_paypal_ops_page");
96
  /**/
97
+ if (apply_filters ("ws_plugin__s2member_during_add_admin_options_add_paypal_buttons_page", true, get_defined_vars ()))
98
+ add_submenu_page ("ws-plugin--s2member-options", "s2Member PayPal® Buttons", "PayPal® Buttons", "edit_plugins", "ws-plugin--s2member-paypal-buttons", "ws_plugin__s2member_paypal_buttons_page");
99
  /**/
100
  if (apply_filters ("ws_plugin__s2member_during_add_admin_options_add_down_ops_page", true, get_defined_vars ()))
101
  add_submenu_page ("ws-plugin--s2member-options", "s2Member File Download Options", "Download Options", "edit_plugins", "ws-plugin--s2member-down-ops", "ws_plugin__s2member_down_ops_page");
222
  /**/
223
  do_action ("ws_plugin__s2member_during_menu_pages_js", get_defined_vars ());
224
  /**/
225
+ exit ();
226
  }
227
  /**/
228
  do_action ("ws_plugin__s2member_after_menu_pages_js", get_defined_vars ());
254
  /**/
255
  do_action ("ws_plugin__s2member_during_menu_pages_css", get_defined_vars ());
256
  /**/
257
+ exit ();
258
  }
259
  /**/
260
  do_action ("ws_plugin__s2member_after_menu_pages_css", get_defined_vars ());
415
  /*
416
  Function for building the PayPal Button Generator page.
417
  */
418
+ if (!function_exists ("ws_plugin__s2member_paypal_buttons_page"))
419
  {
420
+ function ws_plugin__s2member_paypal_buttons_page ()
421
  {
422
+ do_action ("ws_plugin__s2member_before_paypal_buttons_page", get_defined_vars ());
423
+ /**/
424
+ if (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"]) /* Report error if PayPal® Options are not yet configured. */
425
+ ws_plugin__s2member_display_admin_notice ('Please configure <code>s2Member -> PayPal® Options</code> first. Once all of your PayPal® Options have been configured, return to this page &amp; generate your PayPal® Button(s).', true);
426
  /**/
427
+ include_once dirname (dirname (__FILE__)) . "/menu-pages/paypal-buttons.inc.php";
428
  /**/
429
+ do_action ("ws_plugin__s2member_after_paypal_buttons_page", get_defined_vars ());
430
  /**/
431
  return;
432
  }
includes/functions/nocache.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
  /*
17
  Handles no-cache headers and compatible constants for s2Member.
18
  This is compatible with Quick Cache and also with WP Super Cache.
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
  /*
17
  Handles no-cache headers and compatible constants for s2Member.
18
  This is compatible with Quick Cache and also with WP Super Cache.
includes/functions/page-level-access.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
  /*
17
  Function for handling Page Level Access permissions.
18
  Attach to: add_action("template_redirect");
@@ -31,38 +31,44 @@ if (!function_exists ("ws_plugin__s2member_check_page_level_access"))
31
  {
32
  $current_user = (is_user_logged_in ()) ? wp_get_current_user () : false;
33
  /**/
34
- if ($page_ID == $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"] && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || (!current_user_can ("access_s2member_level1") && !$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["allow_subscribers_in"])) && $page_ID != $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"] && wp_redirect (add_query_arg ("s2member_level_req", "1", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
35
- exit;
36
  /**/
37
- else if ($page_ID == $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"] && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level1")) && $page_ID != $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"] && wp_redirect (add_query_arg ("s2member_level_req", "1", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
38
- exit;
 
 
 
 
 
 
39
  /**/
40
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_pages"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level1")) && !ws_plugin__s2member_is_systematic_use_page () && wp_redirect (add_query_arg ("s2member_level_req", "1", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
41
- exit;
42
  /**/
43
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_pages"] && in_array ($page_ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_pages"])) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level1")) && !ws_plugin__s2member_is_systematic_use_page () && wp_redirect (add_query_arg ("s2member_level_req", "1", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
44
- exit;
45
  /**/
46
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_pages"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level2")) && !ws_plugin__s2member_is_systematic_use_page () && wp_redirect (add_query_arg ("s2member_level_req", "2", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
47
- exit;
48
  /**/
49
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_pages"] && in_array ($page_ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_pages"])) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level2")) && !ws_plugin__s2member_is_systematic_use_page () && wp_redirect (add_query_arg ("s2member_level_req", "2", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
50
- exit;
51
  /**/
52
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_pages"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level3")) && !ws_plugin__s2member_is_systematic_use_page () && wp_redirect (add_query_arg ("s2member_level_req", "3", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
53
- exit;
54
  /**/
55
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_pages"] && in_array ($page_ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_pages"])) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level3")) && !ws_plugin__s2member_is_systematic_use_page () && wp_redirect (add_query_arg ("s2member_level_req", "3", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
56
- exit;
57
  /**/
58
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_pages"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level4")) && !ws_plugin__s2member_is_systematic_use_page () && wp_redirect (add_query_arg ("s2member_level_req", "4", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
59
- exit;
60
  /**/
61
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_pages"] && in_array ($page_ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_pages"])) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level4")) && !ws_plugin__s2member_is_systematic_use_page () && wp_redirect (add_query_arg ("s2member_level_req", "4", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
62
- exit;
63
  /**/
64
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"] && in_array ($page_ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"])) && ws_plugin__s2member_nocache_constants () !== "nill" && !ws_plugin__s2member_sp_access ($page_ID) && !ws_plugin__s2member_is_systematic_use_page () && wp_redirect (add_query_arg ("s2member_sp_req", $page_ID, get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
65
- exit;
66
  /**/
67
  do_action ("ws_plugin__s2member_during_check_page_level_access", get_defined_vars ());
68
  }
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
  /*
17
  Function for handling Page Level Access permissions.
18
  Attach to: add_action("template_redirect");
31
  {
32
  $current_user = (is_user_logged_in ()) ? wp_get_current_user () : false;
33
  /**/
34
+ if ($page_ID == $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"] && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level0")) && $page_ID != $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"] && wp_redirect (add_query_arg ("s2member_level_req", "0", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
35
+ exit ();
36
  /**/
37
+ else if ($page_ID == $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"] && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level0")) && $page_ID != $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"] && wp_redirect (add_query_arg ("s2member_level_req", "0", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
38
+ exit ();
39
+ /**/
40
+ else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_pages"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level0")) && !ws_plugin__s2member_is_systematic_use_page () && wp_redirect (add_query_arg ("s2member_level_req", "0", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
41
+ exit ();
42
+ /**/
43
+ else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_pages"] && in_array ($page_ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_pages"])) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level0")) && !ws_plugin__s2member_is_systematic_use_page () && wp_redirect (add_query_arg ("s2member_level_req", "0", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
44
+ exit ();
45
  /**/
46
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_pages"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level1")) && !ws_plugin__s2member_is_systematic_use_page () && wp_redirect (add_query_arg ("s2member_level_req", "1", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
47
+ exit ();
48
  /**/
49
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_pages"] && in_array ($page_ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_pages"])) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level1")) && !ws_plugin__s2member_is_systematic_use_page () && wp_redirect (add_query_arg ("s2member_level_req", "1", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
50
+ exit ();
51
  /**/
52
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_pages"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level2")) && !ws_plugin__s2member_is_systematic_use_page () && wp_redirect (add_query_arg ("s2member_level_req", "2", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
53
+ exit ();
54
  /**/
55
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_pages"] && in_array ($page_ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_pages"])) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level2")) && !ws_plugin__s2member_is_systematic_use_page () && wp_redirect (add_query_arg ("s2member_level_req", "2", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
56
+ exit ();
57
  /**/
58
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_pages"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level3")) && !ws_plugin__s2member_is_systematic_use_page () && wp_redirect (add_query_arg ("s2member_level_req", "3", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
59
+ exit ();
60
  /**/
61
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_pages"] && in_array ($page_ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_pages"])) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level3")) && !ws_plugin__s2member_is_systematic_use_page () && wp_redirect (add_query_arg ("s2member_level_req", "3", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
62
+ exit ();
63
  /**/
64
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_pages"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level4")) && !ws_plugin__s2member_is_systematic_use_page () && wp_redirect (add_query_arg ("s2member_level_req", "4", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
65
+ exit ();
66
  /**/
67
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_pages"] && in_array ($page_ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_pages"])) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level4")) && !ws_plugin__s2member_is_systematic_use_page () && wp_redirect (add_query_arg ("s2member_level_req", "4", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
68
+ exit ();
69
  /**/
70
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"] && in_array ($page_ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"])) && ws_plugin__s2member_nocache_constants () !== "nill" && !ws_plugin__s2member_sp_access ($page_ID) && !ws_plugin__s2member_is_systematic_use_page () && wp_redirect (add_query_arg ("s2member_sp_req", $page_ID, get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
71
+ exit ();
72
  /**/
73
  do_action ("ws_plugin__s2member_during_check_page_level_access", get_defined_vars ());
74
  }
includes/functions/paypal-button.inc.php ADDED
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Copyright: © 2009 WebSharks, Inc. ( coded in the USA )
4
+ <mailto:support@websharks-inc.com> <http://www.websharks-inc.com/>
5
+
6
+ Released under the terms of the GNU General Public License.
7
+ You should have received a copy of the GNU General Public License,
8
+ along with this software. In the main directory, see: /licensing/
9
+ If not, see: <http://www.gnu.org/licenses/>.
10
+ */
11
+ /*
12
+ Direct access denial.
13
+ */
14
+ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
+ /*
17
+ Function that handles the Shortcode for [s2Member-PayPal-Button /].
18
+ Attach to: add_shortcode("s2Member-PayPal-Button");
19
+
20
+ [s2Member-PayPal-Button level="1" ccaps="" desc="" ps="paypal" cc="USD" custom="www.domain.com" tp="0" tt="D" ra="0.01" rp="1" rt="M" rr="1" image="default" /]
21
+ [s2Member-PayPal-Button page="0" exp="72" desc="Specific Post/Page Access" ps="paypal" cc="USD" custom="www.domain.com" ra="0.01" sp="1" image="default" /]
22
+ The image="" attribute will be used as a custom image; when provided; and not equal to "default".
23
+
24
+ PayPal® Cancellation Buttons are identified by cancel="1".
25
+ PayPal® Specific Post/Page Buttons are identified by sp="1".
26
+ PayPal® Modification Buttons are identified by modify="1".
27
+ */
28
+ if (!function_exists ("ws_plugin__s2member_paypal_button"))
29
+ {
30
+ function ws_plugin__s2member_paypal_button ($attr = FALSE, $content = FALSE, $shortcode = FALSE)
31
+ {
32
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
33
+ do_action ("ws_plugin__s2member_before_paypal_button", get_defined_vars ());
34
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
35
+ /**/
36
+ $attr = ws_plugin__s2member_trim_quot_deep ($attr); /* Fix &quot; in Shortcode attrs
37
+ that have been corrupted by a non-default visual editor; ( i.e. CKEditor does this ). */
38
+ /**/
39
+ $attr["tt"] = strtoupper ($attr["tt"]); /* Term lengths absolutely must be provided in upper-case format. */
40
+ $attr["rt"] = strtoupper ($attr["rt"]); /* Term lengths absolutely must be provided in upper-case format. */
41
+ $attr["rr"] = strtoupper ($attr["rr"]); /* Must be provided in upper-case format. Numerical, or BN value. */
42
+ $attr["ccaps"] = strtolower ($attr["ccaps"]); /* Custom Capabilities must be typed in lower-case format. */
43
+ /**/
44
+ $attr["rr"] = ($attr["rt"] === "L") ? "BN" : $attr["rr"]; /* Lifetime Subscriptions absolutely require Buy Now functionality in the (rr) attribute. */
45
+ /**/
46
+ $attr["modify"] = (!$attr["modify"] && $attr["mb"]) ? $attr["mb"] : $attr["modify"]; /* Backward compatibilty for "mb", which was renamed to "modify" in v3.0.5. */
47
+ $attr["cancel"] = (!$attr["cancel"] && $attr["cb"]) ? $attr["cb"] : $attr["cancel"]; /* Backward compatibilty for "cb", which was renamed to "cancel" in v3.0.5. */
48
+ $attr["ids"] = (!$attr["ids"] && $attr["page"]) ? $attr["page"] : $attr["ids"]; /* Backward compatibilty for "page", which was renamed to "ids" in s2Member v3.0. */
49
+ /**/
50
+ $attr = shortcode_atts (array ("ids" => "0", "exp" => "72", "level" => "1", "ccaps" => "", "desc" => "", "ps" => "paypal", "cc" => "USD", "custom" => $_SERVER["HTTP_HOST"], "tp" => "0", "tt" => "D", "ra" => "0.01", "rp" => "1", "rt" => "M", "rr" => "1", "modify" => "0", "cancel" => "0", "sp" => "0", "image" => "default"), $attr);
51
+ /**/
52
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
53
+ do_action ("ws_plugin__s2member_before_paypal_button_after_shortcode_atts", get_defined_vars ());
54
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
55
+ /**/
56
+ if ($attr["cancel"]) /* This is a special routine for Cancellation Buttons. Cancellation Buttons use a different template. */
57
+ {
58
+ $code = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/paypal-cancellation-button.html"));
59
+ $code = preg_replace ("/%%endpoint%%/", ws_plugin__s2member_esc_ds (esc_attr (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "www.sandbox.paypal.com" : "www.paypal.com")), $code);
60
+ $code = preg_replace ("/%%paypal_business%%/", ws_plugin__s2member_esc_ds (esc_attr ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"])), $code);
61
+ /**/
62
+ $code = ($attr["image"] && $attr["image"] !== "default") ? preg_replace ('/ src\="(.*?)"/', ' src="' . ws_plugin__s2member_esc_ds (esc_attr ($attr["image"])) . '"', $code) : $code;
63
+ /**/
64
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
65
+ do_action ("ws_plugin__s2member_during_paypal_cancellation_button", get_defined_vars ());
66
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
67
+ }
68
+ /**/
69
+ else if ($attr["sp"]) /* This is a special routine for Specific Post/Page Buttons. Specific Post/Page Buttons use a different template. */
70
+ {
71
+ $attr["sp_ids_exp"] = "sp:" . $attr["ids"] . ":" . $attr["exp"]; /* Combined "sp:ids:expiration hours". */
72
+ /**/
73
+ $code = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/paypal-sp-button.html"));
74
+ $code = preg_replace ("/%%endpoint%%/", ws_plugin__s2member_esc_ds (esc_attr (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "www.sandbox.paypal.com" : "www.paypal.com")), $code);
75
+ $code = preg_replace ("/%%paypal_business%%/", ws_plugin__s2member_esc_ds (esc_attr ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"])), $code);
76
+ $code = preg_replace ("/%%cancel_return%%/", ws_plugin__s2member_esc_ds (esc_attr (get_bloginfo ("url"))), $code);
77
+ $code = preg_replace ("/%%notify_url%%/", ws_plugin__s2member_esc_ds (esc_attr (get_bloginfo ("url") . "/?s2member_paypal_notify=1")), $code);
78
+ $code = preg_replace ("/%%return%%/", ws_plugin__s2member_esc_ds (esc_attr (get_bloginfo ("url") . "/?s2member_paypal_return=1")), $code);
79
+ $code = preg_replace ("/%%domain%%/", ws_plugin__s2member_esc_ds (esc_attr (strtolower ($_SERVER["HTTP_HOST"]))), $code);
80
+ /**/
81
+ $code = preg_replace ('/ name\="item_name" value\="(.*?)"/', ' name="item_name" value="' . ws_plugin__s2member_esc_ds (esc_attr ($attr["desc"])) . '"', $code);
82
+ $code = preg_replace ('/ name\="item_number" value\="(.*?)"/', ' name="item_number" value="' . ws_plugin__s2member_esc_ds (esc_attr ($attr["sp_ids_exp"])) . '"', $code);
83
+ $code = preg_replace ('/ name\="page_style" value\="(.*?)"/', ' name="page_style" value="' . ws_plugin__s2member_esc_ds (esc_attr ($attr["ps"])) . '"', $code);
84
+ $code = preg_replace ('/ name\="currency_code" value\="(.*?)"/', ' name="currency_code" value="' . ws_plugin__s2member_esc_ds (esc_attr ($attr["cc"])) . '"', $code);
85
+ $code = preg_replace ('/ name\="custom" value\="(.*?)"/', ' name="custom" value="' . ws_plugin__s2member_esc_ds (esc_attr ($attr["custom"])) . '"', $code);
86
+ $code = preg_replace ('/ name\="amount" value\="(.*?)"/', ' name="amount" value="' . ws_plugin__s2member_esc_ds (esc_attr ($attr["ra"])) . '"', $code);
87
+ /**/
88
+ $code = ($attr["image"] && $attr["image"] !== "default") ? preg_replace ('/ src\="(.*?)"/', ' src="' . ws_plugin__s2member_esc_ds (esc_attr ($attr["image"])) . '"', $code) : $code;
89
+ /**/
90
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
91
+ do_action ("ws_plugin__s2member_during_paypal_sp_button", get_defined_vars ());
92
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
93
+ }
94
+ else /* Otherwise, we'll process this Button normally, using the Membership routines. Also handles Modification Buttons. */
95
+ {
96
+ $attr["desc"] = (!$attr["desc"]) ? $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $attr["level"] . "_label"] : $attr["desc"];
97
+ /**/
98
+ $attr["level_ccaps_eotper"] = ($attr["rr"] === "BN" && $attr["rt"] !== "L") ? $attr["level"] . ":" . $attr["ccaps"] . ":" . $attr["rp"] . " " . $attr["rt"] : $attr["level"] . ":" . $attr["ccaps"];
99
+ $attr["level_ccaps_eotper"] = rtrim ($attr["level_ccaps_eotper"], ":"); /* Clean any trailing separators from this string. */
100
+ /**/
101
+ $code = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/paypal-button.html"));
102
+ $code = preg_replace ("/%%endpoint%%/", ws_plugin__s2member_esc_ds (esc_attr (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "www.sandbox.paypal.com" : "www.paypal.com")), $code);
103
+ $code = preg_replace ("/%%paypal_business%%/", ws_plugin__s2member_esc_ds (esc_attr ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"])), $code);
104
+ $code = preg_replace ("/%%level_label%%/", ws_plugin__s2member_esc_ds (esc_attr ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $attr["level"] . "_label"])), $code);
105
+ $code = preg_replace ("/%%cancel_return%%/", ws_plugin__s2member_esc_ds (esc_attr (get_bloginfo ("url"))), $code); /* This brings them back to Front Page. */
106
+ $code = preg_replace ("/%%notify_url%%/", ws_plugin__s2member_esc_ds (esc_attr (get_bloginfo ("url") . "/?s2member_paypal_notify=1")), $code);
107
+ $code = preg_replace ("/%%return%%/", ws_plugin__s2member_esc_ds (esc_attr (get_bloginfo ("url") . "/?s2member_paypal_return=1")), $code);
108
+ $code = preg_replace ("/%%domain%%/", ws_plugin__s2member_esc_ds (esc_attr (strtolower ($_SERVER["HTTP_HOST"]))), $code);
109
+ $code = preg_replace ("/%%level%%/", ws_plugin__s2member_esc_ds (esc_attr ($attr["level"])), $code);
110
+ /**/
111
+ $code = preg_replace ('/ \<\!--(\<input type\="hidden" name\="(amount|src|sra|a1|p1|t1|a3|p3|t3)" value\="(.*?)" \/\>)--\>/', " $1", $code);
112
+ $code = ($attr["tp"] <= 0) ? preg_replace ('/ (\<input type\="hidden" name\="(a1|p1|t1)" value\="(.*?)" \/\>)/', " <!--$1-->", $code) : $code;
113
+ $code = ($attr["rr"] === "BN") ? preg_replace ('/ (\<input type\="hidden" name\="cmd" value\=")(.*?)(" \/\>)/', " $1_xclick$3", $code) : $code;
114
+ $code = ($attr["rr"] === "BN") ? preg_replace ('/ (\<input type\="hidden" name\="(src|sra|a1|p1|t1|a3|p3|t3)" value\="(.*?)" \/\>)/', " <!--$1-->", $code) : $code;
115
+ $code = ($attr["rr"] !== "BN") ? preg_replace ('/ (\<input type\="hidden" name\="cmd" value\=")(.*?)(" \/\>)/', " $1_xclick-subscriptions$3", $code) : $code;
116
+ $code = ($attr["rr"] !== "BN") ? preg_replace ('/ (\<input type\="hidden" name\="amount" value\="(.*?)" \/\>)/', " <!--$1-->", $code) : $code;
117
+ /**/
118
+ $code = preg_replace ('/ name\="item_name" value\="(.*?)"/', ' name="item_name" value="' . ws_plugin__s2member_esc_ds (esc_attr ($attr["desc"])) . '"', $code);
119
+ $code = preg_replace ('/ name\="item_number" value\="(.*?)"/', ' name="item_number" value="' . ws_plugin__s2member_esc_ds (esc_attr ($attr["level_ccaps_eotper"])) . '"', $code);
120
+ $code = preg_replace ('/ name\="page_style" value\="(.*?)"/', ' name="page_style" value="' . ws_plugin__s2member_esc_ds (esc_attr ($attr["ps"])) . '"', $code);
121
+ $code = preg_replace ('/ name\="currency_code" value\="(.*?)"/', ' name="currency_code" value="' . ws_plugin__s2member_esc_ds (esc_attr ($attr["cc"])) . '"', $code);
122
+ $code = preg_replace ('/ name\="custom" value\="(.*?)"/', ' name="custom" value="' . ws_plugin__s2member_esc_ds (esc_attr ($attr["custom"])) . '"', $code);
123
+ $code = preg_replace ('/ name\="on0" value\="(.*?)"/', ' name="on0" value="' . ws_plugin__s2member_esc_ds (esc_attr (S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0)) . '"', $code);
124
+ $code = preg_replace ('/ name\="os0" value\="(.*?)"/', ' name="os0" value="' . ws_plugin__s2member_esc_ds (esc_attr (S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0)) . '"', $code);
125
+ $code = preg_replace ('/ name\="modify" value\="(.*?)"/', ' name="modify" value="' . ws_plugin__s2member_esc_ds (esc_attr (($attr["modify"]) ? "1" : "0")) . '"', $code);
126
+ $code = preg_replace ('/ name\="amount" value\="(.*?)"/', ' name="amount" value="' . ws_plugin__s2member_esc_ds (esc_attr ($attr["ra"])) . '"', $code);
127
+ $code = preg_replace ('/ name\="src" value\="(.*?)"/', ' name="src" value="' . ws_plugin__s2member_esc_ds (esc_attr ($attr["rr"])) . '"', $code);
128
+ $code = preg_replace ('/ name\="p1" value\="(.*?)"/', ' name="p1" value="' . ws_plugin__s2member_esc_ds (esc_attr ($attr["tp"])) . '"', $code);
129
+ $code = preg_replace ('/ name\="t1" value\="(.*?)"/', ' name="t1" value="' . ws_plugin__s2member_esc_ds (esc_attr ($attr["tt"])) . '"', $code);
130
+ $code = preg_replace ('/ name\="a3" value\="(.*?)"/', ' name="a3" value="' . ws_plugin__s2member_esc_ds (esc_attr ($attr["ra"])) . '"', $code);
131
+ $code = preg_replace ('/ name\="p3" value\="(.*?)"/', ' name="p3" value="' . ws_plugin__s2member_esc_ds (esc_attr ($attr["rp"])) . '"', $code);
132
+ $code = preg_replace ('/ name\="t3" value\="(.*?)"/', ' name="t3" value="' . ws_plugin__s2member_esc_ds (esc_attr ($attr["rt"])) . '"', $code);
133
+ /**/
134
+ $code = ($attr["image"] && $attr["image"] !== "default") ? preg_replace ('/ src\="(.*?)"/', ' src="' . ws_plugin__s2member_esc_ds (esc_attr ($attr["image"])) . '"', $code) : $code;
135
+ /**/
136
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
137
+ ($attr["modify"]) ? do_action ("ws_plugin__s2member_during_paypal_modification_button", get_defined_vars ()) : do_action ("ws_plugin__s2member_during_paypal_button", get_defined_vars ());
138
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
139
+ }
140
+ /**/
141
+ return apply_filters ("ws_plugin__s2member_paypal_button", $code, get_defined_vars ());
142
+ }
143
+ }
144
+ ?>
includes/functions/paypal-notify.inc.php CHANGED
@@ -12,9 +12,19 @@ If not, see: <http://www.gnu.org/licenses/>.
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
  /*
17
  Handles PayPal® IPN URL processing.
 
 
 
 
 
 
 
 
 
 
18
  Attach to: add_action("init");
19
  */
20
  if (!function_exists ("ws_plugin__s2member_paypal_notify"))
@@ -44,16 +54,74 @@ if (!function_exists ("ws_plugin__s2member_paypal_notify"))
44
  /*
45
  Custom conditionals can be applied by filters.
46
  */
47
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
48
  if (!apply_filters ("ws_plugin__s2member_during_paypal_notify_conditionals", false, get_defined_vars ()))
49
  {
50
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
51
  /*
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
  Specific Post/Page Access.
53
  */
54
- if (preg_match ("/^web_accept$/i", $paypal["txn_type"]) && $paypal["payer_email"] && $paypal["txn_id"] && preg_match ("/^sp\:[0-9,]+\:[0-9]+$/", $paypal["item_number"]))
 
 
55
  {
56
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
57
  do_action ("ws_plugin__s2member_during_paypal_notify_before_sp_access", get_defined_vars ());
58
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
59
  /**/
@@ -65,58 +133,58 @@ if (!function_exists ("ws_plugin__s2member_paypal_notify"))
65
  {
66
  $processing = $during = true; /* Yes, we ARE processing this. */
67
  /**/
68
- $sbj = preg_replace ("/%%sp_access_url%%/i", $sp_access_url, $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_email_subject"]);
69
- $sbj = preg_replace ("/%%sp_access_exp%%/i", ws_plugin__s2member_approx_time_difference (time (), strtotime ("+" . $paypal["hours"] . " hours")), $sbj);
70
  /**/
71
- $msg = preg_replace ("/%%sp_access_url%%/i", $sp_access_url, $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_email_message"]);
72
- $msg = preg_replace ("/%%sp_access_exp%%/i", ws_plugin__s2member_approx_time_difference (time (), strtotime ("+" . $paypal["hours"] . " hours")), $msg);
73
  /**/
74
- if (($sbj = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $sbj)) && ($sbj = preg_replace ("/%%txn_id%%/i", $paypal["txn_id"], $sbj)))
75
- if (($sbj = preg_replace ("/%%amount%%/i", $paypal["mc_gross"], $sbj))) /* Full amount of the payment, before fee is subtracted. */
76
- if (($sbj = preg_replace ("/%%item_number%%/i", $paypal["item_number"], $sbj)) && ($sbj = preg_replace ("/%%item_name%%/i", $paypal["item_name"], $sbj)))
77
- if (($sbj = preg_replace ("/%%first_name%%/i", $paypal["first_name"], $sbj)) && ($sbj = preg_replace ("/%%last_name%%/i", $paypal["last_name"], $sbj)))
78
- if (($sbj = preg_replace ("/%%full_name%%/i", trim ($paypal["first_name"] . " " . $paypal["last_name"]), $sbj)))
79
- if (($sbj = preg_replace ("/%%payer_email%%/i", $paypal["payer_email"], $sbj)))
80
  /**/
81
- if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $msg)) && ($msg = preg_replace ("/%%txn_id%%/i", $paypal["txn_id"], $msg)))
82
- if (($msg = preg_replace ("/%%amount%%/i", $paypal["mc_gross"], $msg))) /* Full amount of the payment, before fee is subtracted. */
83
- if (($msg = preg_replace ("/%%item_number%%/i", $paypal["item_number"], $msg)) && ($msg = preg_replace ("/%%item_name%%/i", $paypal["item_name"], $msg)))
84
- if (($msg = preg_replace ("/%%first_name%%/i", $paypal["first_name"], $msg)) && ($msg = preg_replace ("/%%last_name%%/i", $paypal["last_name"], $msg)))
85
- if (($msg = preg_replace ("/%%full_name%%/i", trim ($paypal["first_name"] . " " . $paypal["last_name"]), $msg)))
86
- if (($msg = preg_replace ("/%%payer_email%%/i", $paypal["payer_email"], $msg)))
87
  /**/
88
  if (($sbj = trim ($sbj)) && ($msg = trim ($msg))) /* Make sure they are not empty. */
89
  {
90
  @mail ($paypal["payer_email"], $sbj, $msg, "From: \"" . preg_replace ('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">\r\nContent-Type: text/plain; charset=utf-8");
91
  /**/
92
- $paypal["s2member_log"][] = "Specific Post/Page Confirmation Email sent to Customer, with a URL that provides Specific Post/Page Access.";
93
  }
94
  /**/
95
  if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_notification_urls"])
96
  {
97
  foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_notification_urls"]) as $url)
98
  /**/
99
- if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)) && ($url = preg_replace ("/%%sp_access_url%%/i", rawurlencode ($sp_access_url), $url)))
100
- if (($url = preg_replace ("/%%sp_access_exp%%/i", urlencode (ws_plugin__s2member_approx_time_difference (time (), strtotime ("+" . $paypal["hours"] . " hours"))), $url)))
101
- if (($url = preg_replace ("/%%amount%%/i", urlencode ($paypal["mc_gross"]), $url)) && ($url = preg_replace ("/%%txn_id%%/i", urlencode ($paypal["txn_id"]), $url)))
102
- if (($url = preg_replace ("/%%item_number%%/i", urlencode ($paypal["item_number"]), $url)) && ($url = preg_replace ("/%%item_name%%/i", urlencode ($paypal["item_name"]), $url)))
103
- if (($url = preg_replace ("/%%first_name%%/i", urlencode ($paypal["first_name"]), $url)) && ($url = preg_replace ("/%%last_name%%/i", urlencode ($paypal["last_name"]), $url)))
104
- if (($url = preg_replace ("/%%full_name%%/i", urlencode (trim ($paypal["first_name"] . " " . $paypal["last_name"])), $url)))
105
- if (($url = preg_replace ("/%%payer_email%%/i", urlencode ($paypal["payer_email"]), $url)))
106
  /**/
107
  if (($url = trim ($url))) /* Empty? */
108
- ws_plugin__s2member_remote ($url);
109
  /**/
110
  $paypal["s2member_log"][] = "Specific Post/Page Access Notification URLs have been processed.";
111
  }
112
  /**/
113
  if ($processing && ($code = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_tracking_codes"]))
114
  {
115
- if (($code = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $code)) && ($code = preg_replace ("/%%amount%%/i", $paypal["mc_gross"], $code)) && ($code = preg_replace ("/%%txn_id%%/i", $paypal["txn_id"], $code)))
116
- if (($code = preg_replace ("/%%item_number%%/i", $paypal["item_number"], $code)) && ($code = preg_replace ("/%%item_name%%/i", $paypal["item_name"], $code)))
117
- if (($code = preg_replace ("/%%first_name%%/i", $paypal["first_name"], $code)) && ($code = preg_replace ("/%%last_name%%/i", $paypal["last_name"], $code)))
118
- if (($code = preg_replace ("/%%full_name%%/i", trim ($paypal["first_name"] . " " . $paypal["last_name"]), $code)))
119
- if (($code = preg_replace ("/%%payer_email%%/i", $paypal["payer_email"], $code)))
120
  /**/
121
  if (($code = trim ($code))) /* Make sure it is not empty. This gets stored into a Transient Queue. */
122
  {
@@ -125,7 +193,7 @@ if (!function_exists ("ws_plugin__s2member_paypal_notify"))
125
  }
126
  }
127
  /**/
128
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
129
  do_action ("ws_plugin__s2member_during_paypal_notify_during_sp_access", get_defined_vars ());
130
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
131
  }
@@ -134,16 +202,21 @@ if (!function_exists ("ws_plugin__s2member_paypal_notify"))
134
  $paypal["s2member_log"][] = "Unable to generate Access Link for Specific Post/Page Access. Does your Leading Post/Page still exist?";
135
  }
136
  /**/
137
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
138
  do_action ("ws_plugin__s2member_during_paypal_notify_after_sp_access", get_defined_vars ());
139
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
140
  }
141
  /*
142
- New Subscriptions. Possibly containing advanced update vars ( option_name1, option_selection1 ); which allow account modifications.
 
 
143
  */
144
- else if (preg_match ("/^(web_accept|subscr_signup)$/i", $paypal["txn_type"]) && $paypal["payer_email"] && ($paypal["subscr_id"] || ($paypal["subscr_id"] = $paypal["txn_id"])) && preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?$/", $paypal["item_number"]))
 
 
 
145
  {
146
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
147
  do_action ("ws_plugin__s2member_during_paypal_notify_before_subscr_signup", get_defined_vars ());
148
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
149
  /**/
@@ -151,7 +224,7 @@ if (!function_exists ("ws_plugin__s2member_paypal_notify"))
151
  /**/
152
  list ($paypal["level"], $paypal["ccaps"], $paypal["eotper"]) = preg_split ("/\:/", $paypal["item_number"], 3);
153
  /**/
154
- if (preg_match ("/^web_accept$/i", $paypal["txn_type"])) /* Conversions for Lifetime & Fixed-Term sales. Transform into Subscription. */
155
  {
156
  $paypal["period3"] = ($paypal["eotper"]) ? $paypal["eotper"] : "1 L"; /* This defaults to exactly 1 Lifetime. */
157
  $paypal["mc_amount3"] = $paypal["mc_gross"]; /* The "Buy Now" amount. */
@@ -169,17 +242,15 @@ if (!function_exists ("ws_plugin__s2member_paypal_notify"))
169
  /* This advanced method is required whenever a Subscription that is already completed, or was never setup to recur in the first place needs to be modified. PayPal will not allow the
170
  modify=1|2 parameter to be used in those scenarios, because technically there is nothing to update. The only thing that actually needs to be updated is the account. */
171
  {
172
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
173
  do_action ("ws_plugin__s2member_during_paypal_notify_before_subscr_signup_w_update_vars", get_defined_vars ());
174
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
175
  /**/
176
  $paypal["s2member_log"][] = "s2Member txn_type identified as (web_accept|subscr_signup) w/ update vars.";
177
  /**/
178
  /* Check for both the old & new subscr_id's, just in case the Return routine already changed it. */
179
- if (($user_id = ws_plugin__s2member_paypal_user_id ($paypal["subscr_id"], $paypal["option_selection1"])))
180
  {
181
- $user = new WP_User ($user_id); /* Acquire user object. */
182
- /**/
183
  if (!ws_plugin__s2member_user_has_wp_role ($user)) /* Non WP Roles. */
184
  {
185
  $processing = $during = true; /* Yes, we ARE processing this. */
@@ -208,11 +279,11 @@ if (!function_exists ("ws_plugin__s2member_paypal_notify"))
208
  /**/
209
  $paypal["s2member_log"][] = "s2Member Level/Capabilities updated w/ advanced update routines.";
210
  /**/
211
- @mail ($paypal["payer_email"], "Thank You! Your membership has been updated.", "Thank You! Your membership has been updated to:\n" . $paypal["item_name"] . "\n\nYou\\'ll need to log back in now.\n" . wp_login_url (), "From: \"" . preg_replace ('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">\r\nContent-Type: text/plain; charset=utf-8");
212
  /**/
213
  $paypal["s2member_log"][] = "Modification Confirmation Email sent to Customer, with a URL that provides them with a way to log back in.";
214
  /**/
215
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
216
  do_action ("ws_plugin__s2member_during_paypal_notify_during_subscr_signup_w_update_vars", get_defined_vars ());
217
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
218
  }
@@ -226,7 +297,7 @@ if (!function_exists ("ws_plugin__s2member_paypal_notify"))
226
  $paypal["s2member_log"][] = "Unable to modify Subscription. Could not get the existing User ID from the DB. Please check the on0 and os0 variables in your Button Code.";
227
  }
228
  /**/
229
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
230
  do_action ("ws_plugin__s2member_during_paypal_notify_after_subscr_signup_w_update_vars", get_defined_vars ());
231
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
232
  }
@@ -235,7 +306,7 @@ if (!function_exists ("ws_plugin__s2member_paypal_notify"))
235
  */
236
  else /* Else this is a normal Subscription signup, we are not updating anything. */
237
  {
238
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
239
  do_action ("ws_plugin__s2member_during_paypal_notify_before_subscr_signup_wo_update_vars", get_defined_vars ());
240
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
241
  /**/
@@ -245,104 +316,146 @@ if (!function_exists ("ws_plugin__s2member_paypal_notify"))
245
  {
246
  $processing = $during = true; /* Yes, we ARE processing this. */
247
  /**/
248
- $sbj = preg_replace ("/%%registration_url%%/i", $registration_url, $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["signup_email_subject"]);
249
- $msg = preg_replace ("/%%registration_url%%/i", $registration_url, $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["signup_email_message"]);
250
  /**/
251
- if (($sbj = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $sbj)) && ($sbj = preg_replace ("/%%subscr_id%%/i", $paypal["subscr_id"], $sbj)))
252
- if (($sbj = preg_replace ("/%%initial%%/i", $paypal["initial"], $sbj)) && ($sbj = preg_replace ("/%%regular%%/i", $paypal["regular"], $sbj)) && ($sbj = preg_replace ("/%%recurring%%/i", $paypal["recurring"], $sbj)))
253
- if (($sbj = preg_replace ("/%%initial_term%%/i", $paypal["initial_term"], $sbj)) && ($sbj = preg_replace ("/%%regular_term%%/i", $paypal["regular_term"], $sbj)))
254
- if (($sbj = preg_replace ("/%%item_number%%/i", $paypal["item_number"], $sbj)) && ($sbj = preg_replace ("/%%item_name%%/i", $paypal["item_name"], $sbj)))
255
- if (($sbj = preg_replace ("/%%first_name%%/i", $paypal["first_name"], $sbj)) && ($sbj = preg_replace ("/%%last_name%%/i", $paypal["last_name"], $sbj)))
256
- if (($sbj = preg_replace ("/%%full_name%%/i", trim ($paypal["first_name"] . " " . $paypal["last_name"]), $sbj)))
257
- if (($sbj = preg_replace ("/%%payer_email%%/i", $paypal["payer_email"], $sbj)))
258
- /**/
259
- if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $msg)) && ($msg = preg_replace ("/%%subscr_id%%/i", $paypal["subscr_id"], $msg)))
260
- if (($msg = preg_replace ("/%%initial%%/i", $paypal["initial"], $msg)) && ($msg = preg_replace ("/%%regular%%/i", $paypal["regular"], $msg)) && ($msg = preg_replace ("/%%recurring%%/i", $paypal["recurring"], $msg)))
261
- if (($msg = preg_replace ("/%%initial_term%%/i", $paypal["initial_term"], $msg)) && ($msg = preg_replace ("/%%regular_term%%/i", $paypal["regular_term"], $msg)))
262
- if (($msg = preg_replace ("/%%item_number%%/i", $paypal["item_number"], $msg)) && ($msg = preg_replace ("/%%item_name%%/i", $paypal["item_name"], $msg)))
263
- if (($msg = preg_replace ("/%%first_name%%/i", $paypal["first_name"], $msg)) && ($msg = preg_replace ("/%%last_name%%/i", $paypal["last_name"], $msg)))
264
- if (($msg = preg_replace ("/%%full_name%%/i", trim ($paypal["first_name"] . " " . $paypal["last_name"]), $msg)))
265
- if (($msg = preg_replace ("/%%payer_email%%/i", $paypal["payer_email"], $msg)))
266
- /**/
267
- if (($sbj = trim ($sbj)) && ($msg = trim ($msg))) /* Make sure they are not empty. */
268
- {
269
- @mail ($paypal["payer_email"], $sbj, $msg, "From: \"" . preg_replace ('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">\r\nContent-Type: text/plain; charset=utf-8");
270
- /**/
271
- $paypal["s2member_log"][] = "Signup Confirmation Email sent to Customer, with a URL to assist w/ registration.";
272
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
273
  /**/
274
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
275
  do_action ("ws_plugin__s2member_during_paypal_notify_during_subscr_signup_wo_update_vars", get_defined_vars ());
276
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
277
  }
 
 
 
 
278
  /**/
279
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
280
  do_action ("ws_plugin__s2member_during_paypal_notify_after_subscr_signup_wo_update_vars", get_defined_vars ());
281
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
282
  }
283
  /**/
284
- if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["signup_notification_urls"] && is_array ($cv = preg_split ("/\|/", $paypal["custom"])))
285
- {
286
- foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["signup_notification_urls"]) as $url)
287
- /**/
288
- if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)) && ($url = preg_replace ("/%%subscr_id%%/i", urlencode ($paypal["subscr_id"]), $url)))
289
- if (($url = preg_replace ("/%%initial%%/i", urlencode ($paypal["initial"]), $url)) && ($url = preg_replace ("/%%regular%%/i", urlencode ($paypal["regular"]), $url)) && ($url = preg_replace ("/%%recurring%%/i", urlencode ($paypal["recurring"]), $url)))
290
- if (($url = preg_replace ("/%%initial_term%%/i", urlencode ($paypal["initial_term"]), $url)) && ($url = preg_replace ("/%%regular_term%%/i", urlencode ($paypal["regular_term"]), $url)))
291
- if (($url = preg_replace ("/%%item_number%%/i", urlencode ($paypal["item_number"]), $url)) && ($url = preg_replace ("/%%item_name%%/i", urlencode ($paypal["item_name"]), $url)))
292
- if (($url = preg_replace ("/%%first_name%%/i", urlencode ($paypal["first_name"]), $url)) && ($url = preg_replace ("/%%last_name%%/i", urlencode ($paypal["last_name"]), $url)))
293
- if (($url = preg_replace ("/%%full_name%%/i", urlencode (trim ($paypal["first_name"] . " " . $paypal["last_name"])), $url)))
294
- if (($url = preg_replace ("/%%payer_email%%/i", urlencode ($paypal["payer_email"]), $url)))
295
- /**/
296
- if (($url = trim ($url))) /* Empty? */
297
- ws_plugin__s2member_remote ($url);
298
- /**/
299
- $paypal["s2member_log"][] = "Signup Notification URLs have been processed.";
300
- }
301
- /**/
302
- if ($processing && ($code = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["signup_tracking_codes"]) && is_array ($cv = preg_split ("/\|/", $paypal["custom"])))
303
- {
304
- if (($code = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $code)) && ($code = preg_replace ("/%%subscr_id%%/i", $paypal["subscr_id"], $code)))
305
- if (($code = preg_replace ("/%%initial%%/i", $paypal["initial"], $code)) && ($code = preg_replace ("/%%regular%%/i", $paypal["regular"], $code)) && ($code = preg_replace ("/%%recurring%%/i", $paypal["recurring"], $code)))
306
- if (($code = preg_replace ("/%%initial_term%%/i", $paypal["initial_term"], $code)) && ($code = preg_replace ("/%%regular_term%%/i", $paypal["regular_term"], $code)))
307
- if (($code = preg_replace ("/%%item_number%%/i", $paypal["item_number"], $code)) && ($code = preg_replace ("/%%item_name%%/i", $paypal["item_name"], $code)))
308
- if (($code = preg_replace ("/%%first_name%%/i", $paypal["first_name"], $code)) && ($code = preg_replace ("/%%last_name%%/i", $paypal["last_name"], $code)))
309
- if (($code = preg_replace ("/%%full_name%%/i", trim ($paypal["first_name"] . " " . $paypal["last_name"]), $code)))
310
- if (($code = preg_replace ("/%%payer_email%%/i", $paypal["payer_email"], $code)))
311
- /**/
312
- if (($code = trim ($code))) /* Make sure it is not empty. This gets stored into a Transient Queue. */
313
- {
314
- $paypal["s2member_log"][] = "Storing Signup Tracking Codes into a Transient Queue for s2Member. These will be processed on-site.";
315
- set_transient (md5 ("s2member_transient_signup_tracking_codes_" . $paypal["subscr_id"]), $code, 43200);
316
- }
317
- }
318
- /**/
319
  if ($processing && preg_match ("/^web_accept$/i", $paypal["txn_type"]) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_urls"] && is_array ($cv = preg_split ("/\|/", $paypal["custom"])))
320
  {
321
  foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_urls"]) as $url)
322
  /**/
323
- if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)) && ($url = preg_replace ("/%%subscr_id%%/i", urlencode ($paypal["subscr_id"]), $url)))
324
- if (($url = preg_replace ("/%%amount%%/i", urlencode ($paypal["mc_gross"]), $url)) && ($url = preg_replace ("/%%txn_id%%/i", urlencode ($paypal["txn_id"]), $url)))
325
- if (($url = preg_replace ("/%%item_number%%/i", urlencode ($paypal["item_number"]), $url)) && ($url = preg_replace ("/%%item_name%%/i", urlencode ($paypal["item_name"]), $url)))
326
- if (($url = preg_replace ("/%%first_name%%/i", urlencode ($paypal["first_name"]), $url)) && ($url = preg_replace ("/%%last_name%%/i", urlencode ($paypal["last_name"]), $url)))
327
- if (($url = preg_replace ("/%%full_name%%/i", urlencode (trim ($paypal["first_name"] . " " . $paypal["last_name"])), $url)))
328
- if (($url = preg_replace ("/%%payer_email%%/i", urlencode ($paypal["payer_email"]), $url)))
329
  /**/
330
  if (($url = trim ($url))) /* Empty? */
331
- ws_plugin__s2member_remote ($url);
332
  /**/
333
  $paypal["s2member_log"][] = "Payment Notification URLs have been processed.";
334
  }
335
  /**/
336
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
337
  do_action ("ws_plugin__s2member_during_paypal_notify_after_subscr_signup", get_defined_vars ());
338
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
339
  }
340
  /*
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
341
  Subscription modifications.
342
  */
343
- else if (preg_match ("/^subscr_modify$/i", $paypal["txn_type"]) && $paypal["payer_email"] && $paypal["subscr_id"] && preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?$/", $paypal["item_number"]))
 
 
344
  {
345
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
346
  do_action ("ws_plugin__s2member_during_paypal_notify_before_subscr_modify", get_defined_vars ());
347
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
348
  /**/
@@ -350,10 +463,8 @@ if (!function_exists ("ws_plugin__s2member_paypal_notify"))
350
  /**/
351
  list ($paypal["level"], $paypal["ccaps"]) = preg_split ("/\:/", $paypal["item_number"], 2);
352
  /**/
353
- if (($user_id = ws_plugin__s2member_paypal_user_id ($paypal["subscr_id"])))
354
  {
355
- $user = new WP_User ($user_id); /* Acquire user object. */
356
- /**/
357
  if (!ws_plugin__s2member_user_has_wp_role ($user)) /* Non WP Roles. */
358
  {
359
  $processing = $during = true; /* Yes, we ARE processing this. */
@@ -378,11 +489,11 @@ if (!function_exists ("ws_plugin__s2member_paypal_notify"))
378
  /**/
379
  $paypal["s2member_log"][] = "s2Member Level/Capabilities updated on Subscription modification.";
380
  /**/
381
- @mail ($paypal["payer_email"], "Thank You! Your membership has been updated.", "Thank You! Your membership has been updated to:\n" . $paypal["item_name"] . "\n\nYou\\'ll need to log back in now.\n" . wp_login_url (), "From: \"" . preg_replace ('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">\r\nContent-Type: text/plain; charset=utf-8");
382
  /**/
383
  $paypal["s2member_log"][] = "Modification Confirmation Email sent to Customer, with a URL that provides them with a way to log back in.";
384
  /**/
385
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
386
  do_action ("ws_plugin__s2member_during_paypal_notify_during_subscr_modify", get_defined_vars ());
387
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
388
  }
@@ -396,28 +507,34 @@ if (!function_exists ("ws_plugin__s2member_paypal_notify"))
396
  $paypal["s2member_log"][] = "Unable to modify Subscription. Could not get the existing User ID from the DB.";
397
  }
398
  /**/
399
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
400
  do_action ("ws_plugin__s2member_during_paypal_notify_after_subscr_modify", get_defined_vars ());
401
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
402
  }
403
  /*
404
- Subscription payments.
 
405
  */
406
- else if (preg_match ("/^subscr_payment$/i", $paypal["txn_type"]) && $paypal["payer_email"] && $paypal["subscr_id"] && preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?$/", $paypal["item_number"]) && $paypal["txn_id"] && $paypal["mc_gross"])
 
 
 
 
 
407
  {
408
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
409
  do_action ("ws_plugin__s2member_during_paypal_notify_before_subscr_payment", get_defined_vars ());
410
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
411
  /**/
412
- $paypal["s2member_log"][] = "s2Member txn_type identified as subscr_payment.";
413
- $paypal["s2member_log"][] = "Sleeping for 2 seconds. Waiting for a possible subscr_signup|subscr_modify.";
414
- sleep (2); /* Sleep here for a moment. PayPal® sometimes sends a subscr_payment before the subscr_signup, subscr_modify.
415
- It is NOT a big deal if they do. However, s2Member goes to sleep here, just to help keep the log files in a logical order. */
416
- $paypal["s2member_log"][] = "Awake. It's " . date ("D M j, Y g:i:s a T") . ". s2Member txn_type identified as subscr_payment.";
417
  /**/
418
  list ($paypal["level"], $paypal["ccaps"]) = preg_split ("/\:/", $paypal["item_number"], 2);
419
  /**/
420
- if (($user_id = ws_plugin__s2member_paypal_user_id ($paypal["subscr_id"], $paypal["option_selection1"])))
421
  {
422
  $processing = $during = true; /* Yes, we ARE processing this. */
423
  /**/
@@ -429,20 +546,20 @@ if (!function_exists ("ws_plugin__s2member_paypal_notify"))
429
  {
430
  foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_urls"]) as $url)
431
  /**/
432
- if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)) && ($url = preg_replace ("/%%subscr_id%%/i", urlencode ($paypal["subscr_id"]), $url)))
433
- if (($url = preg_replace ("/%%amount%%/i", urlencode ($paypal["mc_gross"]), $url)) && ($url = preg_replace ("/%%txn_id%%/i", urlencode ($paypal["txn_id"]), $url)))
434
- if (($url = preg_replace ("/%%item_number%%/i", urlencode ($paypal["item_number"]), $url)) && ($url = preg_replace ("/%%item_name%%/i", urlencode ($paypal["item_name"]), $url)))
435
- if (($url = preg_replace ("/%%first_name%%/i", urlencode ($paypal["first_name"]), $url)) && ($url = preg_replace ("/%%last_name%%/i", urlencode ($paypal["last_name"]), $url)))
436
- if (($url = preg_replace ("/%%full_name%%/i", urlencode (trim ($paypal["first_name"] . " " . $paypal["last_name"])), $url)))
437
- if (($url = preg_replace ("/%%payer_email%%/i", urlencode ($paypal["payer_email"]), $url)))
438
  /**/
439
  if (($url = trim ($url))) /* Empty? */
440
- ws_plugin__s2member_remote ($url);
441
  /**/
442
  $paypal["s2member_log"][] = "Payment Notification URLs have been processed.";
443
  }
444
  /**/
445
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
446
  do_action ("ws_plugin__s2member_during_paypal_notify_during_subscr_payment", get_defined_vars ());
447
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
448
  }
@@ -453,27 +570,67 @@ if (!function_exists ("ws_plugin__s2member_paypal_notify"))
453
  set_transient (md5 ("s2member_transient_ipn_subscr_payment_" . $paypal["subscr_id"]), $_POST, 43200);
454
  }
455
  /**/
456
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
457
  do_action ("ws_plugin__s2member_during_paypal_notify_after_subscr_payment", get_defined_vars ());
458
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
459
  }
460
  /*
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
461
  Subscription cancellations. s2Member can use this, to determine when/if it should Auto-EOT (demote|delete) a Member's account.
462
- The IPN for `subscr_cancel` is compatible with newer PayPal® accounts that do NOT send a subscr_eot when an account is cancelled.
463
- This works in conjunction with `s2member_last_payment_time`, and the s2Member Auto-EOT System.
464
- For further details & stupidity, see: https://www.x.com/thread/41155?start=15&tstart=0
465
  */
466
- else if (preg_match ("/^subscr_cancel$/i", $paypal["txn_type"]) && $paypal["payer_email"] && $paypal["subscr_id"] && preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?$/", $paypal["item_number"]))
 
 
 
 
 
 
 
467
  {
468
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
469
  do_action ("ws_plugin__s2member_during_paypal_notify_before_subscr_cancel", get_defined_vars ());
470
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
471
  /**/
472
- $paypal["s2member_log"][] = "s2Member txn_type identified as subscr_cancel.";
473
  /**/
474
  list ($paypal["level"], $paypal["ccaps"]) = preg_split ("/\:/", $paypal["item_number"], 2);
475
  /**/
476
- if (($user_id = ws_plugin__s2member_paypal_user_id ($paypal["subscr_id"])))
477
  {
478
  if (!get_usermeta ($user_id, "s2member_auto_eot_time")) /* Respect existing. */
479
  {
@@ -485,7 +642,7 @@ if (!function_exists ("ws_plugin__s2member_paypal_notify"))
485
  /**/
486
  $paypal["s2member_log"][] = "Auto-EOT Time for this account: " . date ("D M j, Y g:i a T", $auto_eot_time);
487
  /**/
488
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
489
  do_action ("ws_plugin__s2member_during_paypal_notify_during_subscr_cancel", get_defined_vars ());
490
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
491
  }
@@ -499,29 +656,32 @@ if (!function_exists ("ws_plugin__s2member_paypal_notify"))
499
  $paypal["s2member_log"][] = "Unable to handle Cancellation. Could not get the existing User ID from the DB.";
500
  }
501
  /**/
502
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
503
  do_action ("ws_plugin__s2member_during_paypal_notify_after_subscr_cancel", get_defined_vars ());
504
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
505
  }
506
  /*
507
- Subscription terminations, max failed payments, initial payment failed, chargebacks, refunds, and reversals. *** NOT processed for Specific Posts/Pages. */
508
- else if ( /* An immediate EOT is necessary under MANY different conditions. This consolidates them all, with a sub-classification for refunds/reversals. */
509
- (preg_match ("/^(subscr_eot|recurring_payment_expired|recurring_payment_suspended_due_to_max_failed_payment)$/i", $paypal["txn_type"]) || (preg_match ("/^recurring_payment_profile_cancel$/i", $paypal["txn_type"]) && preg_match ("/^failed$/i", $paypal["initial_payment_status"])) || (preg_match ("/^new_case$/i", $paypal["txn_type"]) && preg_match ("/^chargeback$/i", $paypal["case_type"])) || (!$paypal["txn_type"] && preg_match ("/^(refunded|reversed)$/i", $paypal["payment_status"])))/**/
 
 
 
 
510
  && ($paypal["subscr_id"] || ($paypal["subscr_id"] = $paypal["recurring_payment_id"]) || ($paypal["subscr_id"] = $paypal["parent_txn_id"]))/**/
511
- && (preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?$/", $paypal["item_number"]) || $paypal["recurring_payment_id"])/**/)
 
512
  {
513
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
514
  do_action ("ws_plugin__s2member_during_paypal_notify_before_subscr_eot", get_defined_vars ());
515
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
516
  /**/
517
- $paypal["s2member_log"][] = "s2Member txn_type identified as (subscr_eot|recurring_payment_expired|recurring_payment_suspended_due_to_max_failed_payment) - or - initial_payment_status (failed) - or - case_type (chargeback) - or - payment_status (refunded|reversed).";
518
  /**/
519
- if (($user_id = ws_plugin__s2member_paypal_user_id ($paypal["subscr_id"], $paypal["option_selection1"])))
520
  {
521
  if (!get_usermeta ($user_id, "s2member_auto_eot_time")) /* Respect Auto-EOT. */
522
  {
523
- $user = new WP_User ($user_id); /* Acquire user object. */
524
- /**/
525
  if (!ws_plugin__s2member_user_has_wp_role ($user)) /* Non WP Roles. */
526
  {
527
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["auto_eot_system_enabled"]) /* EOT enabled? */
@@ -530,7 +690,8 @@ if (!function_exists ("ws_plugin__s2member_paypal_notify"))
530
  {
531
  $processing = $during = true; /* Yes, we ARE processing this. */
532
  /**/
533
- $user->set_role ("subscriber");
 
534
  /**/
535
  delete_usermeta ($user_id, "s2member_custom");
536
  delete_usermeta ($user_id, "s2member_subscr_id");
@@ -546,24 +707,24 @@ if (!function_exists ("ws_plugin__s2member_paypal_notify"))
546
  /**/
547
  ws_plugin__s2member_append_user_notes ($user_id, "Demoted by s2Member: " . date ("D M j, Y g:i a T"));
548
  /**/
549
- $paypal["s2member_log"][] = "Member Level/Capabilities demoted to a Free Subscriber.";
550
  /**/
551
  if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"] && is_array ($cv = preg_split ("/\|/", $paypal["custom"])))
552
  {
553
  foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"]) as $url) /* Handle eot notifications. */
554
  /**/
555
- if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)) && ($url = preg_replace ("/%%subscr_id%%/i", urlencode ($paypal["subscr_id"]), $url)))
556
- if (($url = preg_replace ("/%%user_first_name%%/i", urlencode ($user->first_name), $url)) && ($url = preg_replace ("/%%user_last_name%%/i", urlencode ($user->last_name), $url)))
557
- if (($url = preg_replace ("/%%user_full_name%%/i", urlencode (trim ($user->first_name . " " . $user->last_name)), $url)))
558
- if (($url = preg_replace ("/%%user_email%%/i", urlencode ($user->user_email), $url)))
559
  /**/
560
  if (($url = trim ($url))) /* Empty? */
561
- ws_plugin__s2member_remote ($url);
562
  /**/
563
  $paypal["s2member_log"][] = "EOT/Deletion Notification URLs have been processed.";
564
  }
565
  /**/
566
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
567
  do_action ("ws_plugin__s2member_during_paypal_notify_during_subscr_eot_demote", get_defined_vars ());
568
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
569
  }
@@ -571,19 +732,19 @@ if (!function_exists ("ws_plugin__s2member_paypal_notify"))
571
  {
572
  $processing = $during = true; /* Yes, we ARE processing this. */
573
  /**/
574
- wp_delete_user ($user_id); /* Triggers: `ws_plugin__s2member_handle_user_deletions()` */
575
  /* `ws_plugin__s2member_handle_user_deletions()` triggers `eot_del_notification_urls` */
576
  /**/
577
  $paypal["s2member_log"][] = "The Member's account has been deleted completely.";
578
  /**/
579
  $paypal["s2member_log"][] = "EOT/Deletion Notification URLs have been processed.";
580
  /**/
581
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
582
  do_action ("ws_plugin__s2member_during_paypal_notify_during_subscr_eot_delete", get_defined_vars ());
583
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
584
  }
585
  /**/
586
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
587
  do_action ("ws_plugin__s2member_during_paypal_notify_during_subscr_eot", get_defined_vars ());
588
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
589
  }
@@ -597,7 +758,7 @@ if (!function_exists ("ws_plugin__s2member_paypal_notify"))
597
  $paypal["s2member_log"][] = "Auto-EOT is currently disabled. Skipping immediate EOT (demote|delete), for now.";
598
  $paypal["s2member_log"][] = "Recording the Auto-EOT Time for this Member's account: " . date ("D M j, Y g:i a T", $auto_eot_time);
599
  /**/
600
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
601
  do_action ("ws_plugin__s2member_during_paypal_notify_during_subscr_eot_disabled", get_defined_vars ());
602
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
603
  }
@@ -620,7 +781,7 @@ if (!function_exists ("ws_plugin__s2member_paypal_notify"))
620
  Refunds and chargeback reversals. This is excluded from the processing check, because a Member *could* have already been (demoted|deleted).
621
  In other words, s2Member sends `Refund/Reversal` Notifications ANYTIME a Refund/Reversal occurs; even if s2Member did not process it otherwise.
622
  Since this routine ignores the processing check, it is *possible* that Refund/Reversal Notification URLs will be contacted more than once.
623
- If you are writing scripts that depend on Refund/Reversal Notifications, please keep this in mind.
624
  */
625
  if (!$paypal["txn_type"] && preg_match ("/^(refunded|reversed)$/i", $paypal["payment_status"]) && $paypal["parent_txn_id"])
626
  {
@@ -628,62 +789,89 @@ if (!function_exists ("ws_plugin__s2member_paypal_notify"))
628
  {
629
  foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["ref_rev_notification_urls"]) as $url)
630
  /**/
631
- if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)) && ($url = preg_replace ("/%%subscr_id%%/i", urlencode ($paypal["subscr_id"]), $url)))
632
- if (($url = preg_replace ("/%%-amount%%/i", urlencode ($paypal["mc_gross"]), $url)) && ($url = preg_replace ("/%%parent_txn_id%%/i", urlencode ($paypal["parent_txn_id"]), $url)))
633
- if (($url = preg_replace ("/%%item_number%%/i", urlencode ($paypal["item_number"]), $url)) && ($url = preg_replace ("/%%item_name%%/i", urlencode ($paypal["item_name"]), $url)))
634
- if (($url = preg_replace ("/%%first_name%%/i", urlencode ($paypal["first_name"]), $url)) && ($url = preg_replace ("/%%last_name%%/i", urlencode ($paypal["last_name"]), $url)))
635
- if (($url = preg_replace ("/%%full_name%%/i", urlencode (trim ($paypal["first_name"] . " " . $paypal["last_name"])), $url)))
636
- if (($url = preg_replace ("/%%payer_email%%/i", urlencode ($paypal["payer_email"]), $url)))
637
  /**/
638
  if (($url = trim ($url))) /* Empty? */
639
- ws_plugin__s2member_remote ($url);
640
  /**/
641
  $paypal["s2member_log"][] = "Refund/Reversal Notification URLs have been processed.";
642
  }
643
  /**/
644
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
645
  do_action ("ws_plugin__s2member_during_paypal_notify_during_subscr_eot_refund_reversal", get_defined_vars ());
646
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
647
  }
648
  /**/
649
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
650
  do_action ("ws_plugin__s2member_during_paypal_notify_after_subscr_eot", get_defined_vars ());
651
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
652
  }
653
  else
654
  {
655
- $paypal["s2member_log"][] = "Properly ignoring this IPN request. The txn_type does not require any action on the part of s2Member.";
656
  }
657
  }
658
  else /* Else a custom conditional has been applied by filters. */
659
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
660
  }
661
- else
 
 
 
662
  {
663
- $paypal["s2member_log"][] = "Unable to verify _SERVER[HTTP_HOST]. Possibly caused by a fraudulent request. If this error continues, please check the `custom` value in your Button Code. It MUST start with your domain name.";
 
664
  }
 
 
 
 
 
 
 
 
 
 
665
  }
 
 
 
666
  else
667
  {
668
- $paypal["s2member_log"][] = "Unable to verify POST vars. Possibly caused by a fraudulent request. If this error continues, please run IPN tests against your server from a PayPal® Sandbox account. They provide special diagnostic tools that may assist you.";
 
669
  }
670
- /**/
 
 
671
  if ($_GET["s2member_paypal_proxy"]) /* For proxy identification. */
672
  $paypal["s2member_paypal_proxy"] = $_GET["s2member_paypal_proxy"];
673
- /**/
674
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_debug"])
 
 
 
 
 
 
 
675
  if (is_dir ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"]))
676
  if (is_writable ($logs_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"]))
677
  file_put_contents ($logs_dir . "/paypal-ipn.log", var_export ($paypal, true) . "\n\n", FILE_APPEND);
678
  /**/
679
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
680
  do_action ("ws_plugin__s2member_during_paypal_notify", get_defined_vars ());
681
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
682
  /**/
683
- exit;
684
  }
685
  /**/
686
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
687
  do_action ("ws_plugin__s2member_after_paypal_notify", get_defined_vars ());
688
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
689
  }
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit("Do not access this file directly.");
16
  /*
17
  Handles PayPal® IPN URL processing.
18
+ These same routines also handle s2Member Pro/PayPal® Pro operations;
19
+ giving you the ability ( as needed ) to hook into these routines using
20
+ WordPress® Hooks/Filters; as seen in the source code below.
21
+
22
+ Please do NOT modify the source code directly.
23
+ Instead, use WordPress® Hooks/Filters.
24
+
25
+ For example, if you'd like to add your own custom conditionals, use:
26
+ add_filter ("ws_plugin__s2member_during_paypal_notify_conditionals", "your_function");
27
+
28
  Attach to: add_action("init");
29
  */
30
  if (!function_exists ("ws_plugin__s2member_paypal_notify"))
54
  /*
55
  Custom conditionals can be applied by filters.
56
  */
57
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
58
  if (!apply_filters ("ws_plugin__s2member_during_paypal_notify_conditionals", false, get_defined_vars ()))
59
  {
60
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
61
  /*
62
+ Express Checkout transactions.
63
+ This is not really necessary. It is only here because this txn_type could
64
+ be necessary in a future release of s2Member. For now, it's just a fill-in.
65
+ These Hooks/Filters will remain, so you can use them now; if you need to.
66
+ */
67
+ if (/**/preg_match ("/^express_checkout$/i", $paypal["txn_type"])/**/
68
+ && $paypal["item_number"] && $paypal["payer_email"] && $paypal["txn_id"]/**/)
69
+ {
70
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
71
+ do_action ("ws_plugin__s2member_during_paypal_notify_before_express_checkout", get_defined_vars ());
72
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
73
+ /**/
74
+ $paypal["s2member_log"][] = "s2Member txn_type identified as express_checkout.";
75
+ /**/
76
+ $processing = $during = true; /* Yes, we ARE processing this. */
77
+ /**/
78
+ $paypal["s2member_log"][] = "The txn_type does not require any action on the part of s2Member.";
79
+ $paypal["s2member_log"][] = "s2Member Pro handles Express Checkout events on-site, with an IPN proxy.";
80
+ /**/
81
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
82
+ do_action ("ws_plugin__s2member_during_paypal_notify_during_express_checkout", get_defined_vars ());
83
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
84
+ /**/
85
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
86
+ do_action ("ws_plugin__s2member_during_paypal_notify_after_express_checkout", get_defined_vars ());
87
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
88
+ }
89
+ /*
90
+ Cart ( Line Item ) transactions.
91
+ This is not really necessary. It is only here because this txn_type could
92
+ be necessary in a future release of s2Member. For now, it's just a fill-in.
93
+ These Hooks/Filters will remain, so you can use them now; if you need to.
94
+ */
95
+ else if (/**/preg_match ("/^cart$/i", $paypal["txn_type"])/**/
96
+ && $paypal["item_number1"] && $paypal["payer_email"] && $paypal["txn_id"]/**/)
97
+ {
98
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
99
+ do_action ("ws_plugin__s2member_during_paypal_notify_before_cart", get_defined_vars ());
100
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
101
+ /**/
102
+ $paypal["s2member_log"][] = "s2Member txn_type identified as cart.";
103
+ /**/
104
+ $processing = $during = true; /* Yes, we ARE processing this. */
105
+ /**/
106
+ $paypal["s2member_log"][] = "The txn_type does not require any action on the part of s2Member.";
107
+ $paypal["s2member_log"][] = "s2Member Pro handles Cart events on-site, with an IPN proxy.";
108
+ /**/
109
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
110
+ do_action ("ws_plugin__s2member_during_paypal_notify_during_cart", get_defined_vars ());
111
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
112
+ /**/
113
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
114
+ do_action ("ws_plugin__s2member_during_paypal_notify_after_cart", get_defined_vars ());
115
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
116
+ }
117
+ /*
118
  Specific Post/Page Access.
119
  */
120
+ else if (/**/preg_match ("/^web_accept$/i", $paypal["txn_type"])/**/
121
+ && preg_match ("/^sp\:[0-9,]+\:[0-9]+$/", $paypal["item_number"])/**/
122
+ && $paypal["payer_email"] && $paypal["txn_id"]/**/)
123
  {
124
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
125
  do_action ("ws_plugin__s2member_during_paypal_notify_before_sp_access", get_defined_vars ());
126
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
127
  /**/
133
  {
134
  $processing = $during = true; /* Yes, we ARE processing this. */
135
  /**/
136
+ $sbj = preg_replace ("/%%sp_access_url%%/i", ws_plugin__s2member_esc_ds ($sp_access_url), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"][(($_GET["s2member_paypal_proxy"] === "s2member-pro-module") ? "pro_" : "") . "sp_email_subject"]);
137
+ $sbj = preg_replace ("/%%sp_access_exp%%/i", ws_plugin__s2member_esc_ds (ws_plugin__s2member_approx_time_difference (time (), strtotime ("+" . $paypal["hours"] . " hours"))), $sbj);
138
  /**/
139
+ $msg = preg_replace ("/%%sp_access_url%%/i", ws_plugin__s2member_esc_ds ($sp_access_url), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"][(($_GET["s2member_paypal_proxy"] === "s2member-pro-module") ? "pro_" : "") . "sp_email_message"]);
140
+ $msg = preg_replace ("/%%sp_access_exp%%/i", ws_plugin__s2member_esc_ds (ws_plugin__s2member_approx_time_difference (time (), strtotime ("+" . $paypal["hours"] . " hours"))), $msg);
141
  /**/
142
+ if (($sbj = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $sbj)) && ($sbj = preg_replace ("/%%txn_id%%/i", ws_plugin__s2member_esc_ds ($paypal["txn_id"]), $sbj)))
143
+ if (($sbj = preg_replace ("/%%amount%%/i", ws_plugin__s2member_esc_ds ($paypal["mc_gross"]), $sbj))) /* Full amount of the payment, before fee is subtracted. */
144
+ if (($sbj = preg_replace ("/%%item_number%%/i", ws_plugin__s2member_esc_ds ($paypal["item_number"]), $sbj)) && ($sbj = preg_replace ("/%%item_name%%/i", ws_plugin__s2member_esc_ds ($paypal["item_name"]), $sbj)))
145
+ if (($sbj = preg_replace ("/%%first_name%%/i", ws_plugin__s2member_esc_ds ($paypal["first_name"]), $sbj)) && ($sbj = preg_replace ("/%%last_name%%/i", ws_plugin__s2member_esc_ds ($paypal["last_name"]), $sbj)))
146
+ if (($sbj = preg_replace ("/%%full_name%%/i", ws_plugin__s2member_esc_ds (trim ($paypal["first_name"] . " " . $paypal["last_name"])), $sbj)))
147
+ if (($sbj = preg_replace ("/%%payer_email%%/i", ws_plugin__s2member_esc_ds ($paypal["payer_email"]), $sbj)))
148
  /**/
149
+ if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $msg)) && ($msg = preg_replace ("/%%txn_id%%/i", ws_plugin__s2member_esc_ds ($paypal["txn_id"]), $msg)))
150
+ if (($msg = preg_replace ("/%%amount%%/i", ws_plugin__s2member_esc_ds ($paypal["mc_gross"]), $msg))) /* Full amount of the payment, before fee is subtracted. */
151
+ if (($msg = preg_replace ("/%%item_number%%/i", ws_plugin__s2member_esc_ds ($paypal["item_number"]), $msg)) && ($msg = preg_replace ("/%%item_name%%/i", ws_plugin__s2member_esc_ds ($paypal["item_name"]), $msg)))
152
+ if (($msg = preg_replace ("/%%first_name%%/i", ws_plugin__s2member_esc_ds ($paypal["first_name"]), $msg)) && ($msg = preg_replace ("/%%last_name%%/i", ws_plugin__s2member_esc_ds ($paypal["last_name"]), $msg)))
153
+ if (($msg = preg_replace ("/%%full_name%%/i", ws_plugin__s2member_esc_ds (trim ($paypal["first_name"] . " " . $paypal["last_name"])), $msg)))
154
+ if (($msg = preg_replace ("/%%payer_email%%/i", ws_plugin__s2member_esc_ds ($paypal["payer_email"]), $msg)))
155
  /**/
156
  if (($sbj = trim ($sbj)) && ($msg = trim ($msg))) /* Make sure they are not empty. */
157
  {
158
  @mail ($paypal["payer_email"], $sbj, $msg, "From: \"" . preg_replace ('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">\r\nContent-Type: text/plain; charset=utf-8");
159
  /**/
160
+ $paypal["s2member_log"][] = "Specific Post/Page Confirmation Email sent to Customer.";
161
  }
162
  /**/
163
  if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_notification_urls"])
164
  {
165
  foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_notification_urls"]) as $url)
166
  /**/
167
+ if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)) && ($url = preg_replace ("/%%sp_access_url%%/i", ws_plugin__s2member_esc_ds (rawurlencode ($sp_access_url)), $url)))
168
+ if (($url = preg_replace ("/%%sp_access_exp%%/i", ws_plugin__s2member_esc_ds (urlencode (ws_plugin__s2member_approx_time_difference (time (), strtotime ("+" . $paypal["hours"] . " hours")))), $url)))
169
+ if (($url = preg_replace ("/%%amount%%/i", ws_plugin__s2member_esc_ds (urlencode ($paypal["mc_gross"])), $url)) && ($url = preg_replace ("/%%txn_id%%/i", ws_plugin__s2member_esc_ds (urlencode ($paypal["txn_id"])), $url)))
170
+ if (($url = preg_replace ("/%%item_number%%/i", ws_plugin__s2member_esc_ds (urlencode ($paypal["item_number"])), $url)) && ($url = preg_replace ("/%%item_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($paypal["item_name"])), $url)))
171
+ if (($url = preg_replace ("/%%first_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($paypal["first_name"])), $url)) && ($url = preg_replace ("/%%last_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($paypal["last_name"])), $url)))
172
+ if (($url = preg_replace ("/%%full_name%%/i", ws_plugin__s2member_esc_ds (urlencode (trim ($paypal["first_name"] . " " . $paypal["last_name"]))), $url)))
173
+ if (($url = preg_replace ("/%%payer_email%%/i", ws_plugin__s2member_esc_ds (urlencode ($paypal["payer_email"])), $url)))
174
  /**/
175
  if (($url = trim ($url))) /* Empty? */
176
+ ws_plugin__s2member_remote($url);
177
  /**/
178
  $paypal["s2member_log"][] = "Specific Post/Page Access Notification URLs have been processed.";
179
  }
180
  /**/
181
  if ($processing && ($code = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_tracking_codes"]))
182
  {
183
+ if (($code = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $code)) && ($code = preg_replace ("/%%amount%%/i", ws_plugin__s2member_esc_ds ($paypal["mc_gross"]), $code)) && ($code = preg_replace ("/%%txn_id%%/i", ws_plugin__s2member_esc_ds ($paypal["txn_id"]), $code)))
184
+ if (($code = preg_replace ("/%%item_number%%/i", ws_plugin__s2member_esc_ds ($paypal["item_number"]), $code)) && ($code = preg_replace ("/%%item_name%%/i", ws_plugin__s2member_esc_ds ($paypal["item_name"]), $code)))
185
+ if (($code = preg_replace ("/%%first_name%%/i", ws_plugin__s2member_esc_ds ($paypal["first_name"]), $code)) && ($code = preg_replace ("/%%last_name%%/i", ws_plugin__s2member_esc_ds ($paypal["last_name"]), $code)))
186
+ if (($code = preg_replace ("/%%full_name%%/i", ws_plugin__s2member_esc_ds (trim ($paypal["first_name"] . " " . $paypal["last_name"])), $code)))
187
+ if (($code = preg_replace ("/%%payer_email%%/i", ws_plugin__s2member_esc_ds ($paypal["payer_email"]), $code)))
188
  /**/
189
  if (($code = trim ($code))) /* Make sure it is not empty. This gets stored into a Transient Queue. */
190
  {
193
  }
194
  }
195
  /**/
196
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
197
  do_action ("ws_plugin__s2member_during_paypal_notify_during_sp_access", get_defined_vars ());
198
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
199
  }
202
  $paypal["s2member_log"][] = "Unable to generate Access Link for Specific Post/Page Access. Does your Leading Post/Page still exist?";
203
  }
204
  /**/
205
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
206
  do_action ("ws_plugin__s2member_during_paypal_notify_after_sp_access", get_defined_vars ());
207
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
208
  }
209
  /*
210
+ New Subscriptions.
211
+ Possibly containing advanced update vars
212
+ ( option_name1, option_selection1 ); which allow account modifications.
213
  */
214
+ else if (/**/preg_match ("/^(web_accept|subscr_signup)$/i", $paypal["txn_type"])/**/
215
+ && ($paypal["subscr_id"] || ($paypal["subscr_id"] = $paypal["txn_id"]))/**/
216
+ && preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?$/", $paypal["item_number"])/**/
217
+ && $paypal["payer_email"]/**/)
218
  {
219
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
220
  do_action ("ws_plugin__s2member_during_paypal_notify_before_subscr_signup", get_defined_vars ());
221
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
222
  /**/
224
  /**/
225
  list ($paypal["level"], $paypal["ccaps"], $paypal["eotper"]) = preg_split ("/\:/", $paypal["item_number"], 3);
226
  /**/
227
+ if (preg_match ("/^web_accept$/i", $paypal["txn_type"])) /* Conversions for Lifetime & Fixed-Term sales. */
228
  {
229
  $paypal["period3"] = ($paypal["eotper"]) ? $paypal["eotper"] : "1 L"; /* This defaults to exactly 1 Lifetime. */
230
  $paypal["mc_amount3"] = $paypal["mc_gross"]; /* The "Buy Now" amount. */
242
  /* This advanced method is required whenever a Subscription that is already completed, or was never setup to recur in the first place needs to be modified. PayPal will not allow the
243
  modify=1|2 parameter to be used in those scenarios, because technically there is nothing to update. The only thing that actually needs to be updated is the account. */
244
  {
245
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
246
  do_action ("ws_plugin__s2member_during_paypal_notify_before_subscr_signup_w_update_vars", get_defined_vars ());
247
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
248
  /**/
249
  $paypal["s2member_log"][] = "s2Member txn_type identified as (web_accept|subscr_signup) w/ update vars.";
250
  /**/
251
  /* Check for both the old & new subscr_id's, just in case the Return routine already changed it. */
252
+ if (($user_id = ws_plugin__s2member_paypal_user_id ($paypal["subscr_id"], $paypal["option_selection1"])) && is_object ($user = new WP_User ($user_id)) && $user->ID)
253
  {
 
 
254
  if (!ws_plugin__s2member_user_has_wp_role ($user)) /* Non WP Roles. */
255
  {
256
  $processing = $during = true; /* Yes, we ARE processing this. */
279
  /**/
280
  $paypal["s2member_log"][] = "s2Member Level/Capabilities updated w/ advanced update routines.";
281
  /**/
282
+ @mail ($paypal["payer_email"], "Thank You! Your membership has been updated.", "Thank You! Your membership has been updated to:\n" . $paypal["item_name"] . "\n\nYou'll need to log back in now.\n" . wp_login_url (), "From: \"" . preg_replace ('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">\r\nContent-Type: text/plain; charset=utf-8");
283
  /**/
284
  $paypal["s2member_log"][] = "Modification Confirmation Email sent to Customer, with a URL that provides them with a way to log back in.";
285
  /**/
286
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
287
  do_action ("ws_plugin__s2member_during_paypal_notify_during_subscr_signup_w_update_vars", get_defined_vars ());
288
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
289
  }
297
  $paypal["s2member_log"][] = "Unable to modify Subscription. Could not get the existing User ID from the DB. Please check the on0 and os0 variables in your Button Code.";
298
  }
299
  /**/
300
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
301
  do_action ("ws_plugin__s2member_during_paypal_notify_after_subscr_signup_w_update_vars", get_defined_vars ());
302
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
303
  }
306
  */
307
  else /* Else this is a normal Subscription signup, we are not updating anything. */
308
  {
309
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
310
  do_action ("ws_plugin__s2member_during_paypal_notify_before_subscr_signup_wo_update_vars", get_defined_vars ());
311
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
312
  /**/
316
  {
317
  $processing = $during = true; /* Yes, we ARE processing this. */
318
  /**/
319
+ $sbj = preg_replace ("/%%registration_url%%/i", ws_plugin__s2member_esc_ds ($registration_url), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"][(($_GET["s2member_paypal_proxy"] === "s2member-pro-module") ? "pro_" : "") . "signup_email_subject"]);
320
+ $msg = preg_replace ("/%%registration_url%%/i", ws_plugin__s2member_esc_ds ($registration_url), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"][(($_GET["s2member_paypal_proxy"] === "s2member-pro-module") ? "pro_" : "") . "signup_email_message"]);
321
  /**/
322
+ if (($sbj = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $sbj)) && ($sbj = preg_replace ("/%%subscr_id%%/i", ws_plugin__s2member_esc_ds ($paypal["subscr_id"]), $sbj)))
323
+ if (($sbj = preg_replace ("/%%initial%%/i", ws_plugin__s2member_esc_ds ($paypal["initial"]), $sbj)) && ($sbj = preg_replace ("/%%regular%%/i", ws_plugin__s2member_esc_ds ($paypal["regular"]), $sbj)))
324
+ if (($sbj = preg_replace ("/%%initial_term%%/i", ws_plugin__s2member_esc_ds ($paypal["initial_term"]), $sbj)) && ($sbj = preg_replace ("/%%regular_term%%/i", ws_plugin__s2member_esc_ds ($paypal["regular_term"]), $sbj)))
325
+ if (($sbj = preg_replace ("/%%initial_cycle%%/i", ws_plugin__s2member_esc_ds (ws_plugin__s2member_paypal_term_cycle ($paypal["initial_term"])), $sbj)) && ($sbj = preg_replace ("/%%regular_cycle%%/i", ws_plugin__s2member_esc_ds (ws_plugin__s2member_paypal_term_cycle ($paypal["regular_term"])), $sbj)))
326
+ if (($sbj = preg_replace ("/%%recurring%%/i", ws_plugin__s2member_esc_ds ($paypal["recurring"]), $sbj)) && ($sbj = preg_replace ("/%%recurring\/regular_cycle%%/i", ws_plugin__s2member_esc_ds ((($paypal["recurring"]) ? $paypal["recurring"] . " / " . ws_plugin__s2member_paypal_term_cycle ($paypal["regular_term"]) : "0 / non-recurring")), $sbj)))
327
+ if (($sbj = preg_replace ("/%%item_number%%/i", ws_plugin__s2member_esc_ds ($paypal["item_number"]), $sbj)) && ($sbj = preg_replace ("/%%item_name%%/i", ws_plugin__s2member_esc_ds ($paypal["item_name"]), $sbj)))
328
+ if (($sbj = preg_replace ("/%%first_name%%/i", ws_plugin__s2member_esc_ds ($paypal["first_name"]), $sbj)) && ($sbj = preg_replace ("/%%last_name%%/i", ws_plugin__s2member_esc_ds ($paypal["last_name"]), $sbj)))
329
+ if (($sbj = preg_replace ("/%%full_name%%/i", ws_plugin__s2member_esc_ds (trim ($paypal["first_name"] . " " . $paypal["last_name"])), $sbj)))
330
+ if (($sbj = preg_replace ("/%%payer_email%%/i", ws_plugin__s2member_esc_ds ($paypal["payer_email"]), $sbj)))
331
+ /**/
332
+ if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $msg)) && ($msg = preg_replace ("/%%subscr_id%%/i", ws_plugin__s2member_esc_ds ($paypal["subscr_id"]), $msg)))
333
+ if (($msg = preg_replace ("/%%initial%%/i", ws_plugin__s2member_esc_ds ($paypal["initial"]), $msg)) && ($msg = preg_replace ("/%%regular%%/i", ws_plugin__s2member_esc_ds ($paypal["regular"]), $msg)))
334
+ if (($msg = preg_replace ("/%%initial_term%%/i", ws_plugin__s2member_esc_ds ($paypal["initial_term"]), $msg)) && ($msg = preg_replace ("/%%regular_term%%/i", ws_plugin__s2member_esc_ds ($paypal["regular_term"]), $msg)))
335
+ if (($msg = preg_replace ("/%%initial_cycle%%/i", ws_plugin__s2member_esc_ds (ws_plugin__s2member_paypal_term_cycle ($paypal["initial_term"])), $msg)) && ($msg = preg_replace ("/%%regular_cycle%%/i", ws_plugin__s2member_esc_ds (ws_plugin__s2member_paypal_term_cycle ($paypal["regular_term"])), $msg)))
336
+ if (($msg = preg_replace ("/%%recurring%%/i", ws_plugin__s2member_esc_ds ($paypal["recurring"]), $msg)) && ($msg = preg_replace ("/%%recurring\/regular_cycle%%/i", ws_plugin__s2member_esc_ds ((($paypal["recurring"]) ? $paypal["recurring"] . " / " . ws_plugin__s2member_paypal_term_cycle ($paypal["regular_term"]) : "0 / non-recurring")), $msg)))
337
+ if (($msg = preg_replace ("/%%item_number%%/i", ws_plugin__s2member_esc_ds ($paypal["item_number"]), $msg)) && ($msg = preg_replace ("/%%item_name%%/i", ws_plugin__s2member_esc_ds ($paypal["item_name"]), $msg)))
338
+ if (($msg = preg_replace ("/%%first_name%%/i", ws_plugin__s2member_esc_ds ($paypal["first_name"]), $msg)) && ($msg = preg_replace ("/%%last_name%%/i", ws_plugin__s2member_esc_ds ($paypal["last_name"]), $msg)))
339
+ if (($msg = preg_replace ("/%%full_name%%/i", ws_plugin__s2member_esc_ds (trim ($paypal["first_name"] . " " . $paypal["last_name"])), $msg)))
340
+ if (($msg = preg_replace ("/%%payer_email%%/i", ws_plugin__s2member_esc_ds ($paypal["payer_email"]), $msg)))
341
+ /**/
342
+ if (($sbj = trim ($sbj)) && ($msg = trim ($msg))) /* Make sure they are not empty. */
343
+ {
344
+ @mail ($paypal["payer_email"], $sbj, $msg, "From: \"" . preg_replace ('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">\r\nContent-Type: text/plain; charset=utf-8");
345
+ /**/
346
+ $paypal["s2member_log"][] = "Signup Confirmation Email sent to Customer.";
347
+ }
348
+ /**/
349
+ if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["signup_notification_urls"] && is_array ($cv = preg_split ("/\|/", $paypal["custom"])))
350
+ {
351
+ foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["signup_notification_urls"]) as $url)
352
+ /**/
353
+ if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)) && ($url = preg_replace ("/%%subscr_id%%/i", ws_plugin__s2member_esc_ds (urlencode ($paypal["subscr_id"])), $url)))
354
+ if (($url = preg_replace ("/%%initial%%/i", ws_plugin__s2member_esc_ds (urlencode ($paypal["initial"])), $url)) && ($url = preg_replace ("/%%regular%%/i", ws_plugin__s2member_esc_ds (urlencode ($paypal["regular"])), $url)) && ($url = preg_replace ("/%%recurring%%/i", ws_plugin__s2member_esc_ds (urlencode ($paypal["recurring"])), $url)))
355
+ if (($url = preg_replace ("/%%initial_term%%/i", ws_plugin__s2member_esc_ds (urlencode ($paypal["initial_term"])), $url)) && ($url = preg_replace ("/%%regular_term%%/i", ws_plugin__s2member_esc_ds (urlencode ($paypal["regular_term"])), $url)))
356
+ if (($url = preg_replace ("/%%item_number%%/i", ws_plugin__s2member_esc_ds (urlencode ($paypal["item_number"])), $url)) && ($url = preg_replace ("/%%item_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($paypal["item_name"])), $url)))
357
+ if (($url = preg_replace ("/%%first_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($paypal["first_name"])), $url)) && ($url = preg_replace ("/%%last_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($paypal["last_name"])), $url)))
358
+ if (($url = preg_replace ("/%%full_name%%/i", ws_plugin__s2member_esc_ds (urlencode (trim ($paypal["first_name"] . " " . $paypal["last_name"]))), $url)))
359
+ if (($url = preg_replace ("/%%payer_email%%/i", ws_plugin__s2member_esc_ds (urlencode ($paypal["payer_email"])), $url)))
360
+ /**/
361
+ if (($url = trim ($url))) /* Empty? */
362
+ ws_plugin__s2member_remote($url);
363
+ /**/
364
+ $paypal["s2member_log"][] = "Signup Notification URLs have been processed.";
365
+ }
366
+ /**/
367
+ if ($processing && ($code = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["signup_tracking_codes"]) && is_array ($cv = preg_split ("/\|/", $paypal["custom"])))
368
+ {
369
+ if (($code = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $code)) && ($code = preg_replace ("/%%subscr_id%%/i", ws_plugin__s2member_esc_ds ($paypal["subscr_id"]), $code)))
370
+ if (($code = preg_replace ("/%%initial%%/i", ws_plugin__s2member_esc_ds ($paypal["initial"]), $code)) && ($code = preg_replace ("/%%regular%%/i", ws_plugin__s2member_esc_ds ($paypal["regular"]), $code)) && ($code = preg_replace ("/%%recurring%%/i", ws_plugin__s2member_esc_ds ($paypal["recurring"]), $code)))
371
+ if (($code = preg_replace ("/%%initial_term%%/i", ws_plugin__s2member_esc_ds ($paypal["initial_term"]), $code)) && ($code = preg_replace ("/%%regular_term%%/i", ws_plugin__s2member_esc_ds ($paypal["regular_term"]), $code)))
372
+ if (($code = preg_replace ("/%%item_number%%/i", ws_plugin__s2member_esc_ds ($paypal["item_number"]), $code)) && ($code = preg_replace ("/%%item_name%%/i", ws_plugin__s2member_esc_ds ($paypal["item_name"]), $code)))
373
+ if (($code = preg_replace ("/%%first_name%%/i", ws_plugin__s2member_esc_ds ($paypal["first_name"]), $code)) && ($code = preg_replace ("/%%last_name%%/i", ws_plugin__s2member_esc_ds ($paypal["last_name"]), $code)))
374
+ if (($code = preg_replace ("/%%full_name%%/i", ws_plugin__s2member_esc_ds (trim ($paypal["first_name"] . " " . $paypal["last_name"])), $code)))
375
+ if (($code = preg_replace ("/%%payer_email%%/i", ws_plugin__s2member_esc_ds ($paypal["payer_email"]), $code)))
376
+ /**/
377
+ if (($code = trim ($code))) /* Make sure it is not empty. This gets stored into a Transient Queue. */
378
+ {
379
+ $paypal["s2member_log"][] = "Storing Signup Tracking Codes into a Transient Queue for s2Member. These will be processed on-site.";
380
+ set_transient (md5 ("s2member_transient_signup_tracking_codes_" . $paypal["subscr_id"]), $code, 43200);
381
+ }
382
+ }
383
  /**/
384
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
385
  do_action ("ws_plugin__s2member_during_paypal_notify_during_subscr_signup_wo_update_vars", get_defined_vars ());
386
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
387
  }
388
+ else
389
+ {
390
+ $paypal["s2member_log"][] = "Unable to generate Registration URL for Membership Access. Possible data corruption within the IPN response.";
391
+ }
392
  /**/
393
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
394
  do_action ("ws_plugin__s2member_during_paypal_notify_after_subscr_signup_wo_update_vars", get_defined_vars ());
395
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
396
  }
397
  /**/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
398
  if ($processing && preg_match ("/^web_accept$/i", $paypal["txn_type"]) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_urls"] && is_array ($cv = preg_split ("/\|/", $paypal["custom"])))
399
  {
400
  foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_urls"]) as $url)
401
  /**/
402
+ if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)) && ($url = preg_replace ("/%%subscr_id%%/i", ws_plugin__s2member_esc_ds (urlencode ($paypal["subscr_id"])), $url)))
403
+ if (($url = preg_replace ("/%%amount%%/i", ws_plugin__s2member_esc_ds (urlencode ($paypal["mc_gross"])), $url)) && ($url = preg_replace ("/%%txn_id%%/i", ws_plugin__s2member_esc_ds (urlencode ($paypal["txn_id"])), $url)))
404
+ if (($url = preg_replace ("/%%item_number%%/i", ws_plugin__s2member_esc_ds (urlencode ($paypal["item_number"])), $url)) && ($url = preg_replace ("/%%item_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($paypal["item_name"])), $url)))
405
+ if (($url = preg_replace ("/%%first_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($paypal["first_name"])), $url)) && ($url = preg_replace ("/%%last_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($paypal["last_name"])), $url)))
406
+ if (($url = preg_replace ("/%%full_name%%/i", ws_plugin__s2member_esc_ds (urlencode (trim ($paypal["first_name"] . " " . $paypal["last_name"]))), $url)))
407
+ if (($url = preg_replace ("/%%payer_email%%/i", ws_plugin__s2member_esc_ds (urlencode ($paypal["payer_email"])), $url)))
408
  /**/
409
  if (($url = trim ($url))) /* Empty? */
410
+ ws_plugin__s2member_remote($url);
411
  /**/
412
  $paypal["s2member_log"][] = "Payment Notification URLs have been processed.";
413
  }
414
  /**/
415
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
416
  do_action ("ws_plugin__s2member_during_paypal_notify_after_subscr_signup", get_defined_vars ());
417
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
418
  }
419
  /*
420
+ Recurring payment profile creation.
421
+ This is not really necessary. It is only here because this txn_type could
422
+ be necessary in a future release of s2Member. For now, it's just a fill-in.
423
+ These Hooks/Filters will remain, so you can use them now; if you need to.
424
+ */
425
+ else if (/**/preg_match ("/^recurring_payment_profile_created$/i", $paypal["txn_type"])/**/
426
+ && ($paypal["subscr_id"] || ($paypal["subscr_id"] = $paypal["recurring_payment_id"]))/**/
427
+ && ($paypal["item_number"] || ($paypal["item_number"] = ws_plugin__s2member_paypal_pro_item_number ($paypal)))/**/
428
+ && preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?$/", $paypal["item_number"])/**/
429
+ && ($paypal["item_name"] || ($paypal["item_name"] = $paypal["product_name"]))/**/)
430
+ /* The "payer_email" is not passed in: recurring_payment_profile_created ?? */
431
+ {
432
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
433
+ do_action ("ws_plugin__s2member_during_paypal_notify_before_recurring_payment_profile_created", get_defined_vars ());
434
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
435
+ /**/
436
+ $paypal["s2member_log"][] = "s2Member txn_type identified as recurring_payment_profile_created.";
437
+ /**/
438
+ $processing = $during = true; /* Yes, we ARE processing this. */
439
+ /**/
440
+ $paypal["s2member_log"][] = "The txn_type does not require any action on the part of s2Member.";
441
+ $paypal["s2member_log"][] = "s2Member Pro handles this event on-site, with an IPN proxy.";
442
+ /**/
443
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
444
+ do_action ("ws_plugin__s2member_during_paypal_notify_during_recurring_payment_profile_created", get_defined_vars ());
445
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
446
+ /**/
447
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
448
+ do_action ("ws_plugin__s2member_during_paypal_notify_after_recurring_payment_profile_created", get_defined_vars ());
449
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
450
+ }
451
+ /*
452
  Subscription modifications.
453
  */
454
+ else if (/**/preg_match ("/^subscr_modify$/i", $paypal["txn_type"])/**/
455
+ && preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?$/", $paypal["item_number"])/**/
456
+ && $paypal["subscr_id"] && $paypal["payer_email"]/**/)
457
  {
458
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
459
  do_action ("ws_plugin__s2member_during_paypal_notify_before_subscr_modify", get_defined_vars ());
460
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
461
  /**/
463
  /**/
464
  list ($paypal["level"], $paypal["ccaps"]) = preg_split ("/\:/", $paypal["item_number"], 2);
465
  /**/
466
+ if (($user_id = ws_plugin__s2member_paypal_user_id ($paypal["subscr_id"])) && is_object ($user = new WP_User ($user_id)) && $user->ID)
467
  {
 
 
468
  if (!ws_plugin__s2member_user_has_wp_role ($user)) /* Non WP Roles. */
469
  {
470
  $processing = $during = true; /* Yes, we ARE processing this. */
489
  /**/
490
  $paypal["s2member_log"][] = "s2Member Level/Capabilities updated on Subscription modification.";
491
  /**/
492
+ @mail ($paypal["payer_email"], "Thank You! Your membership has been updated.", "Thank You! Your membership has been updated to:\n" . $paypal["item_name"] . "\n\nYou'll need to log back in now.\n" . wp_login_url (), "From: \"" . preg_replace ('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">\r\nContent-Type: text/plain; charset=utf-8");
493
  /**/
494
  $paypal["s2member_log"][] = "Modification Confirmation Email sent to Customer, with a URL that provides them with a way to log back in.";
495
  /**/
496
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
497
  do_action ("ws_plugin__s2member_during_paypal_notify_during_subscr_modify", get_defined_vars ());
498
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
499
  }
507
  $paypal["s2member_log"][] = "Unable to modify Subscription. Could not get the existing User ID from the DB.";
508
  }
509
  /**/
510
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
511
  do_action ("ws_plugin__s2member_during_paypal_notify_after_subscr_modify", get_defined_vars ());
512
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
513
  }
514
  /*
515
+ Subscription payment notifications.
516
+ We need these to update: `s2member_last_payment_time`.
517
  */
518
+ else if (/**/preg_match ("/^(subscr_payment|recurring_payment)$/i", $paypal["txn_type"])/**/
519
+ && ($paypal["subscr_id"] || ($paypal["subscr_id"] = $paypal["recurring_payment_id"]))/**/
520
+ && ($paypal["item_number"] || ($paypal["item_number"] = ws_plugin__s2member_paypal_pro_item_number ($paypal)))/**/
521
+ && preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?$/", $paypal["item_number"])/**/
522
+ && ($paypal["item_name"] || ($paypal["item_name"] = $paypal["product_name"]))/**/
523
+ && $paypal["payer_email"] && $paypal["txn_id"] && $paypal["mc_gross"]/**/)
524
  {
525
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
526
  do_action ("ws_plugin__s2member_during_paypal_notify_before_subscr_payment", get_defined_vars ());
527
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
528
  /**/
529
+ $paypal["s2member_log"][] = "s2Member txn_type identified as subscr_payment|recurring_payment.";
530
+ $paypal["s2member_log"][] = "Sleeping for 2 seconds. Waiting for a possible subscr_signup|subscr_modify|recurring_payment_profile_created.";
531
+ sleep(2); /* Sleep here for a moment. PayPal® sometimes sends a subscr_payment before the subscr_signup, subscr_modify.
532
+ It is NOT a big deal if they do. However, s2Member goes to sleep here, just to help keep the log files in a logical order. */
533
+ $paypal["s2member_log"][] = "Awake. It's " . date ("D M j, Y g:i:s a T") . ". s2Member txn_type identified as subscr_payment|recurring_payment.";
534
  /**/
535
  list ($paypal["level"], $paypal["ccaps"]) = preg_split ("/\:/", $paypal["item_number"], 2);
536
  /**/
537
+ if (($user_id = ws_plugin__s2member_paypal_user_id ($paypal["subscr_id"], $paypal["option_selection1"])) && is_object ($user = new WP_User ($user_id)) && $user->ID)
538
  {
539
  $processing = $during = true; /* Yes, we ARE processing this. */
540
  /**/
546
  {
547
  foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_urls"]) as $url)
548
  /**/
549
+ if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)) && ($url = preg_replace ("/%%subscr_id%%/i", ws_plugin__s2member_esc_ds (urlencode ($paypal["subscr_id"])), $url)))
550
+ if (($url = preg_replace ("/%%amount%%/i", ws_plugin__s2member_esc_ds (urlencode ($paypal["mc_gross"])), $url)) && ($url = preg_replace ("/%%txn_id%%/i", ws_plugin__s2member_esc_ds (urlencode ($paypal["txn_id"])), $url)))
551
+ if (($url = preg_replace ("/%%item_number%%/i", ws_plugin__s2member_esc_ds (urlencode ($paypal["item_number"])), $url)) && ($url = preg_replace ("/%%item_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($paypal["item_name"])), $url)))
552
+ if (($url = preg_replace ("/%%first_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($paypal["first_name"])), $url)) && ($url = preg_replace ("/%%last_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($paypal["last_name"])), $url)))
553
+ if (($url = preg_replace ("/%%full_name%%/i", ws_plugin__s2member_esc_ds (urlencode (trim ($paypal["first_name"] . " " . $paypal["last_name"]))), $url)))
554
+ if (($url = preg_replace ("/%%payer_email%%/i", ws_plugin__s2member_esc_ds (urlencode ($paypal["payer_email"])), $url)))
555
  /**/
556
  if (($url = trim ($url))) /* Empty? */
557
+ ws_plugin__s2member_remote($url);
558
  /**/
559
  $paypal["s2member_log"][] = "Payment Notification URLs have been processed.";
560
  }
561
  /**/
562
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
563
  do_action ("ws_plugin__s2member_during_paypal_notify_during_subscr_payment", get_defined_vars ());
564
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
565
  }
570
  set_transient (md5 ("s2member_transient_ipn_subscr_payment_" . $paypal["subscr_id"]), $_POST, 43200);
571
  }
572
  /**/
573
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
574
  do_action ("ws_plugin__s2member_during_paypal_notify_after_subscr_payment", get_defined_vars ());
575
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
576
  }
577
  /*
578
+ Subscription failed payment notifications.
579
+ This is not really necessary. It is only here because this txn_type could
580
+ be necessary in a future release of s2Member. For now, it's just a fill-in.
581
+ These Hooks/Filters will remain, so you can use them now; if you need to.
582
+ */
583
+ else if (/**/preg_match ("/^(subscr_failed|recurring_payment_failed|recurring_payment_skipped)$/i", $paypal["txn_type"])/**/
584
+ && ($paypal["subscr_id"] || ($paypal["subscr_id"] = $paypal["recurring_payment_id"]))/**/
585
+ && ($paypal["item_number"] || ($paypal["item_number"] = ws_plugin__s2member_paypal_pro_item_number ($paypal)))/**/
586
+ && preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?$/", $paypal["item_number"])/**/
587
+ && ($paypal["item_name"] || ($paypal["item_name"] = $paypal["product_name"]))/**/
588
+ && $paypal["payer_email"]/**/)
589
+ {
590
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
591
+ do_action ("ws_plugin__s2member_during_paypal_notify_before_subscr_failed", get_defined_vars ());
592
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
593
+ /**/
594
+ $paypal["s2member_log"][] = "s2Member txn_type identified as subscr_failed|recurring_payment_failed|recurring_payment_skipped.";
595
+ /**/
596
+ $processing = $during = true; /* Yes, we ARE processing this. */
597
+ /**/
598
+ $paypal["s2member_log"][] = "This txn_type does not require any action on the part of s2Member.";
599
+ $paypal["s2member_log"][] = "s2Member does NOT respond to individual failed payments, only multiple consecutive failed payments.";
600
+ $paypal["s2member_log"][] = "When multiple consecutive payments fail, a special IPN response will be triggered.";
601
+ /**/
602
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
603
+ do_action ("ws_plugin__s2member_during_paypal_notify_during_subscr_failed", get_defined_vars ());
604
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
605
+ /**/
606
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
607
+ do_action ("ws_plugin__s2member_during_paypal_notify_after_subscr_failed", get_defined_vars ());
608
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
609
+ }
610
+ /*
611
  Subscription cancellations. s2Member can use this, to determine when/if it should Auto-EOT (demote|delete) a Member's account.
612
+ The IPN for `subscr_cancel` is compatible with newer PayPal® accounts that do NOT send a subscr_eot when an account is cancelled.
613
+ This works in conjunction with `s2member_last_payment_time`, and the s2Member Auto-EOT System.
614
+ For further details & examples of stupidity, see: https://www.x.com/thread/41155?start=15&tstart=0
615
  */
616
+ else if (/**/preg_match ("/^(subscr_cancel|recurring_payment_profile_cancel)$/i", $paypal["txn_type"])/**/
617
+ && !(preg_match ("/^recurring_payment_profile_cancel$/i", $paypal["txn_type"]) && preg_match ("/^failed$/i", $paypal["initial_payment_status"]))/**/
618
+ && ($paypal["subscr_id"] || ($paypal["subscr_id"] = $paypal["recurring_payment_id"]))/**/
619
+ && ($paypal["item_number"] || ($paypal["item_number"] = ws_plugin__s2member_paypal_pro_item_number ($paypal)))/**/
620
+ && preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?$/", $paypal["item_number"])/**/
621
+ && ($paypal["period1"] || ($paypal["period1"] = ws_plugin__s2member_paypal_pro_period1 ($paypal)))/**/
622
+ && ($paypal["period3"] || ($paypal["period3"] = ws_plugin__s2member_paypal_pro_period3 ($paypal)))/**/
623
+ && $paypal["payer_email"]/**/)
624
  {
625
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
626
  do_action ("ws_plugin__s2member_during_paypal_notify_before_subscr_cancel", get_defined_vars ());
627
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
628
  /**/
629
+ $paypal["s2member_log"][] = "s2Member txn_type identified as subscr_cancel|recurring_payment_profile_cancel.";
630
  /**/
631
  list ($paypal["level"], $paypal["ccaps"]) = preg_split ("/\:/", $paypal["item_number"], 2);
632
  /**/
633
+ if (($user_id = ws_plugin__s2member_paypal_user_id ($paypal["subscr_id"])) && is_object ($user = new WP_User ($user_id)) && $user->ID)
634
  {
635
  if (!get_usermeta ($user_id, "s2member_auto_eot_time")) /* Respect existing. */
636
  {
642
  /**/
643
  $paypal["s2member_log"][] = "Auto-EOT Time for this account: " . date ("D M j, Y g:i a T", $auto_eot_time);
644
  /**/
645
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
646
  do_action ("ws_plugin__s2member_during_paypal_notify_during_subscr_cancel", get_defined_vars ());
647
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
648
  }
656
  $paypal["s2member_log"][] = "Unable to handle Cancellation. Could not get the existing User ID from the DB.";
657
  }
658
  /**/
659
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
660
  do_action ("ws_plugin__s2member_during_paypal_notify_after_subscr_cancel", get_defined_vars ());
661
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
662
  }
663
  /*
664
+ Subscription terminations, max failed payments, initial payment failed, chargebacks, refunds, and reversals.
665
+ An immediate EOT is necessary under MANY different conditions. This consolidates them all, with a sub-classification for refunds/reversals.
666
+ */
667
+ else if (/**/(/**/preg_match ("/^(subscr_eot|recurring_payment_expired|recurring_payment_suspended_due_to_max_failed_payment)$/i", $paypal["txn_type"])/**/
668
+ || (preg_match ("/^recurring_payment_profile_cancel$/i", $paypal["txn_type"]) && preg_match ("/^failed$/i", $paypal["initial_payment_status"]))/**/
669
+ || (preg_match ("/^new_case$/i", $paypal["txn_type"]) && preg_match ("/^chargeback$/i", $paypal["case_type"]))/**/
670
+ || (!$paypal["txn_type"] && preg_match ("/^(refunded|reversed)$/i", $paypal["payment_status"]))/**/)/**/
671
  && ($paypal["subscr_id"] || ($paypal["subscr_id"] = $paypal["recurring_payment_id"]) || ($paypal["subscr_id"] = $paypal["parent_txn_id"]))/**/
672
+ && ($paypal["item_number"] || ($paypal["item_number"] = ws_plugin__s2member_paypal_pro_item_number ($paypal)))/**/
673
+ && preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?$/", $paypal["item_number"])/**/)
674
  {
675
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
676
  do_action ("ws_plugin__s2member_during_paypal_notify_before_subscr_eot", get_defined_vars ());
677
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
678
  /**/
679
+ $paypal["s2member_log"][] = "s2Member txn_type identified as (subscr_eot|recurring_payment_expired|recurring_payment_suspended_due_to_max_failed_payment) - or - recurring_payment_profile_cancel w/ initial_payment_status (failed) - or - new_case w/ case_type (chargeback) - or - !txn_type w/ payment_status (refunded|reversed).";
680
  /**/
681
+ if (($user_id = ws_plugin__s2member_paypal_user_id ($paypal["subscr_id"], $paypal["option_selection1"])) && is_object ($user = new WP_User ($user_id)) && $user->ID)
682
  {
683
  if (!get_usermeta ($user_id, "s2member_auto_eot_time")) /* Respect Auto-EOT. */
684
  {
 
 
685
  if (!ws_plugin__s2member_user_has_wp_role ($user)) /* Non WP Roles. */
686
  {
687
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["auto_eot_system_enabled"]) /* EOT enabled? */
690
  {
691
  $processing = $during = true; /* Yes, we ARE processing this. */
692
  /**/
693
+ $demotion_role = ws_plugin__s2member_force_demotion_role ("subscriber");
694
+ $user->set_role ($demotion_role); /* Defaults to Free Subscriber. */
695
  /**/
696
  delete_usermeta ($user_id, "s2member_custom");
697
  delete_usermeta ($user_id, "s2member_subscr_id");
707
  /**/
708
  ws_plugin__s2member_append_user_notes ($user_id, "Demoted by s2Member: " . date ("D M j, Y g:i a T"));
709
  /**/
710
+ $paypal["s2member_log"][] = "Member Level/Capabilities demoted to: " . ucwords (preg_replace ("/_/", " ", $demotion_role)) . ".";
711
  /**/
712
  if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"] && is_array ($cv = preg_split ("/\|/", $paypal["custom"])))
713
  {
714
  foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"]) as $url) /* Handle eot notifications. */
715
  /**/
716
+ if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)) && ($url = preg_replace ("/%%subscr_id%%/i", ws_plugin__s2member_esc_ds (urlencode ($paypal["subscr_id"])), $url)))
717
+ if (($url = preg_replace ("/%%user_first_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($user->first_name)), $url)) && ($url = preg_replace ("/%%user_last_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($user->last_name)), $url)))
718
+ if (($url = preg_replace ("/%%user_full_name%%/i", ws_plugin__s2member_esc_ds (urlencode (trim ($user->first_name . " " . $user->last_name))), $url)))
719
+ if (($url = preg_replace ("/%%user_email%%/i", ws_plugin__s2member_esc_ds (urlencode ($user->user_email)), $url)))
720
  /**/
721
  if (($url = trim ($url))) /* Empty? */
722
+ ws_plugin__s2member_remote($url);
723
  /**/
724
  $paypal["s2member_log"][] = "EOT/Deletion Notification URLs have been processed.";
725
  }
726
  /**/
727
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
728
  do_action ("ws_plugin__s2member_during_paypal_notify_during_subscr_eot_demote", get_defined_vars ());
729
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
730
  }
732
  {
733
  $processing = $during = true; /* Yes, we ARE processing this. */
734
  /**/
735
+ wp_delete_user($user_id); /* Triggers: `ws_plugin__s2member_handle_user_deletions()` */
736
  /* `ws_plugin__s2member_handle_user_deletions()` triggers `eot_del_notification_urls` */
737
  /**/
738
  $paypal["s2member_log"][] = "The Member's account has been deleted completely.";
739
  /**/
740
  $paypal["s2member_log"][] = "EOT/Deletion Notification URLs have been processed.";
741
  /**/
742
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
743
  do_action ("ws_plugin__s2member_during_paypal_notify_during_subscr_eot_delete", get_defined_vars ());
744
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
745
  }
746
  /**/
747
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
748
  do_action ("ws_plugin__s2member_during_paypal_notify_during_subscr_eot", get_defined_vars ());
749
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
750
  }
758
  $paypal["s2member_log"][] = "Auto-EOT is currently disabled. Skipping immediate EOT (demote|delete), for now.";
759
  $paypal["s2member_log"][] = "Recording the Auto-EOT Time for this Member's account: " . date ("D M j, Y g:i a T", $auto_eot_time);
760
  /**/
761
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
762
  do_action ("ws_plugin__s2member_during_paypal_notify_during_subscr_eot_disabled", get_defined_vars ());
763
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
764
  }
781
  Refunds and chargeback reversals. This is excluded from the processing check, because a Member *could* have already been (demoted|deleted).
782
  In other words, s2Member sends `Refund/Reversal` Notifications ANYTIME a Refund/Reversal occurs; even if s2Member did not process it otherwise.
783
  Since this routine ignores the processing check, it is *possible* that Refund/Reversal Notification URLs will be contacted more than once.
784
+ If you're writing scripts that depend on Refund/Reversal Notifications, please keep this in mind.
785
  */
786
  if (!$paypal["txn_type"] && preg_match ("/^(refunded|reversed)$/i", $paypal["payment_status"]) && $paypal["parent_txn_id"])
787
  {
789
  {
790
  foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["ref_rev_notification_urls"]) as $url)
791
  /**/
792
+ if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)) && ($url = preg_replace ("/%%subscr_id%%/i", ws_plugin__s2member_esc_ds (urlencode ($paypal["subscr_id"])), $url)))
793
+ if (($url = preg_replace ("/%%-amount%%/i", ws_plugin__s2member_esc_ds (urlencode ($paypal["mc_gross"])), $url)) && ($url = preg_replace ("/%%parent_txn_id%%/i", ws_plugin__s2member_esc_ds (urlencode ($paypal["parent_txn_id"])), $url)))
794
+ if (($url = preg_replace ("/%%item_number%%/i", ws_plugin__s2member_esc_ds (urlencode ($paypal["item_number"])), $url)) && ($url = preg_replace ("/%%item_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($paypal["item_name"])), $url)))
795
+ if (($url = preg_replace ("/%%first_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($paypal["first_name"])), $url)) && ($url = preg_replace ("/%%last_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($paypal["last_name"])), $url)))
796
+ if (($url = preg_replace ("/%%full_name%%/i", ws_plugin__s2member_esc_ds (urlencode (trim ($paypal["first_name"] . " " . $paypal["last_name"]))), $url)))
797
+ if (($url = preg_replace ("/%%payer_email%%/i", ws_plugin__s2member_esc_ds (urlencode ($paypal["payer_email"])), $url)))
798
  /**/
799
  if (($url = trim ($url))) /* Empty? */
800
+ ws_plugin__s2member_remote($url);
801
  /**/
802
  $paypal["s2member_log"][] = "Refund/Reversal Notification URLs have been processed.";
803
  }
804
  /**/
805
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
806
  do_action ("ws_plugin__s2member_during_paypal_notify_during_subscr_eot_refund_reversal", get_defined_vars ());
807
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
808
  }
809
  /**/
810
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
811
  do_action ("ws_plugin__s2member_during_paypal_notify_after_subscr_eot", get_defined_vars ());
812
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
813
  }
814
  else
815
  {
816
+ $paypal["s2member_log"][] = "Ignoring this IPN request. The txn_type does not require any action on the part of s2Member.";
817
  }
818
  }
819
  else /* Else a custom conditional has been applied by filters. */
820
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
821
  }
822
+ /*
823
+ Else, check on cancelled recurring profiles.
824
+ */
825
+ else if (preg_match ("/^recurring_payment_profile_cancel$/i", $paypal["txn_type"]))
826
  {
827
+ $paypal["s2member_log"][] = "Transaction type ( recurring_payment_profile_cancel ), but there is no match to an existing account; so verification of _SERVER[HTTP_HOST] was not possible.";
828
+ $paypal["s2member_log"][] = "It's likely this account was just upgraded/downgraded by s2Member Pro; so the Subscr. ID has probably been updated on-site; nothing to worry about here.";
829
  }
830
+ /*
831
+ Else, check on other ^recurring_ transaction types.
832
+ */
833
+ else if (preg_match ("/^recurring_/i", $paypal["txn_type"])) /* Otherwise, is this a ^recurring_ txn_type? */
834
+ {
835
+ $paypal["s2member_log"][] = "Transaction type ( ^recurring_? ), but there is no match to an existing account; so verification of _SERVER[HTTP_HOST] was not possible.";
836
+ }
837
+ /**/
838
+ else /* Else, use the default _SERVER[HTTP_HOST] error. */
839
+ $paypal["s2member_log"][] = "Unable to verify _SERVER[HTTP_HOST]. Possibly caused by a fraudulent request. If this error continues, please check the `custom` value in your Form and/or Button Code. It MUST always start with your domain name.";
840
  }
841
+ /*
842
+ Otherwise, POST vars could not even be verified. This needs to be reported in the logs.
843
+ */
844
  else
845
  {
846
+ $paypal["s2member_log"][] = "Unable to verify POST vars. Possibly caused by a fraudulent request. If this error continues, please run IPN tests against your server from a PayPal® Sandbox account. They provide special diagnostic tools to assist you.";
847
+ $paypal["s2member_log"][] = var_export ($_POST, true); /* Recording _POST vars for analysis and debugging. */
848
  }
849
+ /*
850
+ Add IPN proxy identification ( when available ) to the $paypal array for log reporting.
851
+ */
852
  if ($_GET["s2member_paypal_proxy"]) /* For proxy identification. */
853
  $paypal["s2member_paypal_proxy"] = $_GET["s2member_paypal_proxy"];
854
+ /*
855
+ Also add IPN proxy self-verification ( when available ) to the $paypal array.
856
+ */
857
+ if ($_GET["s2member_paypal_proxy_verification"]) /* Proxy identification w/verification. */
858
+ $paypal["s2member_paypal_proxy_verification"] = $_GET["s2member_paypal_proxy_verification"];
859
+ /*
860
+ If debugging/logging is enabled; we need to append $paypal to the log file.
861
+ */
862
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_debug"]) /* Append to log? */
863
  if (is_dir ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"]))
864
  if (is_writable ($logs_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"]))
865
  file_put_contents ($logs_dir . "/paypal-ipn.log", var_export ($paypal, true) . "\n\n", FILE_APPEND);
866
  /**/
867
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
868
  do_action ("ws_plugin__s2member_during_paypal_notify", get_defined_vars ());
869
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
870
  /**/
871
+ exit ();
872
  }
873
  /**/
874
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
875
  do_action ("ws_plugin__s2member_after_paypal_notify", get_defined_vars ());
876
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
877
  }
includes/functions/paypal-return.inc.php CHANGED
@@ -12,9 +12,10 @@ If not, see: <http://www.gnu.org/licenses/>.
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
  /*
17
  Handles PayPal® Return URL processing.
 
18
  Attach to: add_action("init");
19
  */
20
  if (!function_exists ("ws_plugin__s2member_paypal_return"))
@@ -37,16 +38,18 @@ if (!function_exists ("ws_plugin__s2member_paypal_return"))
37
  /*
38
  Custom conditionals can be applied by filters.
39
  */
40
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
41
  if (!apply_filters ("ws_plugin__s2member_during_paypal_return_conditionals", false, get_defined_vars ()))
42
  {
43
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
44
  /*
45
  Specific Post/Page Access.
46
  */
47
- if (preg_match ("/^web_accept$/i", $paypal["txn_type"]) && $paypal["txn_id"] && preg_match ("/^sp\:[0-9,]+\:[0-9]+$/", $paypal["item_number"]))
 
 
48
  {
49
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
50
  do_action ("ws_plugin__s2member_during_paypal_return_before_sp_access", get_defined_vars ());
51
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
52
  /**/
@@ -64,11 +67,11 @@ if (!function_exists ("ws_plugin__s2member_paypal_return"))
64
  /**/
65
  if ($processing && ($code = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_tracking_codes"]) && is_array ($cv = preg_split ("/\|/", $paypal["custom"])))
66
  {
67
- if (($code = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $code)) && ($code = preg_replace ("/%%amount%%/i", $paypal["mc_gross"], $code)) && ($code = preg_replace ("/%%txn_id%%/i", $paypal["txn_id"], $code)))
68
- if (($code = preg_replace ("/%%item_number%%/i", $paypal["item_number"], $code)) && ($code = preg_replace ("/%%item_name%%/i", $paypal["item_name"], $code)))
69
- if (($code = preg_replace ("/%%first_name%%/i", $paypal["first_name"], $code)) && ($code = preg_replace ("/%%last_name%%/i", $paypal["last_name"], $code)))
70
- if (($code = preg_replace ("/%%full_name%%/i", trim ($paypal["first_name"] . " " . $paypal["last_name"]), $code)))
71
- if (($code = preg_replace ("/%%payer_email%%/i", $paypal["payer_email"], $code)))
72
  /**/
73
  if (($code = trim ($code))) /* Make sure it is not empty. This gets stored into a Transient Queue. */
74
  {
@@ -77,13 +80,13 @@ if (!function_exists ("ws_plugin__s2member_paypal_return"))
77
  }
78
  }
79
  /**/
80
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
81
  do_action ("ws_plugin__s2member_during_paypal_return_during_sp_access", get_defined_vars ());
82
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
83
  /**/
84
  $paypal["s2member_log"][] = "Redirecting Customer to the Specific Post/Page.";
85
  /**/
86
- header ("Location: " . $sp_access_url);
87
  }
88
  else /* Otherwise, the ID must have been invalid. Or the Post/Page was deleted. */
89
  {
@@ -97,18 +100,22 @@ if (!function_exists ("ws_plugin__s2member_paypal_return"))
97
  echo '</script>' . "\n";
98
  }
99
  /**/
100
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
101
  do_action ("ws_plugin__s2member_during_paypal_return_after_sp_access", get_defined_vars ());
102
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
103
  }
104
  /*
105
- New Subscriptions. Possibly containing advanced updated vars ( option_name1, option_selection1 ); which allow account modifications.
 
 
106
  */
107
- else if (preg_match ("/^(web_accept|subscr_signup|subscr_payment)$/i", $paypal["txn_type"]) && ($paypal["subscr_id"] || ($paypal["subscr_id"] = $paypal["txn_id"])) && preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9] [A-Z])?$/", $paypal["item_number"]))
 
 
108
  { /* With Auto-Return/PDT, PayPal will send subscr_payment instead of subscr_signup to the return URL.
109
  So we need to look for (web_accept|subscr_signup|subscr_payment), and treat them as the same. */
110
  /**/
111
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
112
  do_action ("ws_plugin__s2member_during_paypal_return_before_subscr_signup", get_defined_vars ());
113
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
114
  /**/
@@ -122,17 +129,15 @@ if (!function_exists ("ws_plugin__s2member_paypal_return"))
122
  /* This advanced method is required whenever a Subscription that is already completed, or was never setup to recur in the first place needs to be modified. PayPal® will not allow the
123
  modify=2 parameter to be used in those scenarios, because technically there is nothing to update. The only thing to be updated is the account. */
124
  {
125
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
126
  do_action ("ws_plugin__s2member_during_paypal_return_before_subscr_signup_w_update_vars", get_defined_vars ());
127
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
128
  /**/
129
  $paypal["s2member_log"][] = "s2Member txn_type identified as (web_accept|subscr_signup|subscr_payment) w/ update vars.";
130
  /**/
131
  /* Check for both the old & new subscr_id's, just in case the IPN routine already changed it. */
132
- if (($user_id = ws_plugin__s2member_paypal_user_id ($paypal["subscr_id"], $paypal["option_selection1"])))
133
  {
134
- $user = new WP_User ($user_id); /* Acquire user object. */
135
- /**/
136
  if (!ws_plugin__s2member_user_has_wp_role ($user)) /* Non WP Roles. */
137
  {
138
  $processing = $during = true; /* Yes, we ARE processing this. */
@@ -161,7 +166,7 @@ if (!function_exists ("ws_plugin__s2member_paypal_return"))
161
  /**/
162
  $paypal["s2member_log"][] = "s2Member Level/Capabilities updated w/ advanced update routines.";
163
  /**/
164
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
165
  do_action ("ws_plugin__s2member_during_paypal_return_during_subscr_signup_w_update_vars", get_defined_vars ());
166
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
167
  /**/
@@ -196,7 +201,7 @@ if (!function_exists ("ws_plugin__s2member_paypal_return"))
196
  echo '</script>' . "\n";
197
  }
198
  /**/
199
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
200
  do_action ("ws_plugin__s2member_during_paypal_return_after_subscr_signup_w_update_vars", get_defined_vars ());
201
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
202
  }
@@ -205,7 +210,7 @@ if (!function_exists ("ws_plugin__s2member_paypal_return"))
205
  */
206
  else /* Else this is a normal Subscription signup, we are not updating an existing Subscription. */
207
  {
208
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
209
  do_action ("ws_plugin__s2member_during_paypal_return_before_subscr_signup_wo_update_vars", get_defined_vars ());
210
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
211
  /**/
@@ -219,7 +224,7 @@ if (!function_exists ("ws_plugin__s2member_paypal_return"))
219
  /**/
220
  $paypal["s2member_log"][] = "Registration Cookies set on (web_accept|subscr_signup|subscr_payment) w/o update vars.";
221
  /**/
222
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
223
  do_action ("ws_plugin__s2member_during_paypal_return_during_subscr_signup_wo_update_vars", get_defined_vars ());
224
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
225
  /**/
@@ -230,21 +235,23 @@ if (!function_exists ("ws_plugin__s2member_paypal_return"))
230
  echo "window.location = '" . esc_js (add_query_arg ("action", "register", wp_login_url ())) . "';" . "\n";
231
  echo '</script>' . "\n";
232
  /**/
233
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
234
  do_action ("ws_plugin__s2member_during_paypal_return_after_subscr_signup_wo_update_vars", get_defined_vars ());
235
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
236
  }
237
  /**/
238
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
239
  do_action ("ws_plugin__s2member_during_paypal_return_after_subscr_signup", get_defined_vars ());
240
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
241
  }
242
  /*
243
  Subscription modifications.
244
  */
245
- else if (preg_match ("/^subscr_modify$/i", $paypal["txn_type"]) && $paypal["subscr_id"] && preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9] [A-Z])?$/", $paypal["item_number"]))
 
 
246
  {
247
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
248
  do_action ("ws_plugin__s2member_during_paypal_return_before_subscr_modify", get_defined_vars ());
249
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
250
  /**/
@@ -252,10 +259,8 @@ if (!function_exists ("ws_plugin__s2member_paypal_return"))
252
  /**/
253
  list ($paypal["level"], $paypal["ccaps"]) = preg_split ("/\:/", $paypal["item_number"], 2);
254
  /**/
255
- if (($user_id = ws_plugin__s2member_paypal_user_id ($paypal["subscr_id"])))
256
  {
257
- $user = new WP_User ($user_id); /* Acquire user object. */
258
- /**/
259
  if (!ws_plugin__s2member_user_has_wp_role ($user)) /* Non WP Roles. */
260
  {
261
  $processing = $during = true; /* Yes, we ARE processing this. */
@@ -280,7 +285,7 @@ if (!function_exists ("ws_plugin__s2member_paypal_return"))
280
  /**/
281
  $paypal["s2member_log"][] = "s2Member Level/Capabilities updated on Subscription modification.";
282
  /**/
283
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
284
  do_action ("ws_plugin__s2member_during_paypal_return_during_subscr_modify", get_defined_vars ());
285
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
286
  /**/
@@ -315,7 +320,7 @@ if (!function_exists ("ws_plugin__s2member_paypal_return"))
315
  echo '</script>' . "\n";
316
  }
317
  /**/
318
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
319
  do_action ("ws_plugin__s2member_during_paypal_return_after_subscr_modify", get_defined_vars ());
320
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
321
  }
@@ -348,13 +353,13 @@ if (!function_exists ("ws_plugin__s2member_paypal_return"))
348
  }
349
  else if (!isset ($_GET["tx"]) && (empty ($_POST) || $_POST["auth"]))
350
  {
351
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
352
  do_action ("ws_plugin__s2member_during_paypal_return_before_no_return_data", get_defined_vars ());
353
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
354
  /**/
355
  $paypal["s2member_log"][] = "No Return-Data from PayPal®. Customer must wait for Email Confirmation.";
356
  /**/
357
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
358
  do_action ("ws_plugin__s2member_during_paypal_return_during_no_return_data", get_defined_vars ());
359
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
360
  /**/
@@ -366,13 +371,14 @@ if (!function_exists ("ws_plugin__s2member_paypal_return"))
366
  echo "window.location = '" . esc_js (get_bloginfo ("url")) . "';";
367
  echo '</script>' . "\n";
368
  /**/
369
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
370
  do_action ("ws_plugin__s2member_during_paypal_return_after_no_return_data", get_defined_vars ());
371
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
372
  }
373
  else
374
  {
375
  $paypal["s2member_log"][] = "Unable to verify POST vars. This is most likely related to an invalid PayPal® configuration. Please check: s2Member -> PayPal® Options.";
 
376
  /**/
377
  $paypal["s2member_log"][] = "Redirecting Customer to the Login Page, due to an error that occurred.";
378
  /**/
@@ -385,19 +391,22 @@ if (!function_exists ("ws_plugin__s2member_paypal_return"))
385
  if ($_GET["s2member_paypal_proxy"]) /* For proxy identification. */
386
  $paypal["s2member_paypal_proxy"] = $_GET["s2member_paypal_proxy"];
387
  /**/
388
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_debug"])
 
 
 
389
  if (is_dir ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"]))
390
  if (is_writable ($logs_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"]))
391
  file_put_contents ($logs_dir . "/paypal-rtn.log", var_export ($paypal, true) . "\n\n", FILE_APPEND);
392
  /**/
393
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
394
  do_action ("ws_plugin__s2member_during_paypal_return", get_defined_vars ());
395
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
396
  /**/
397
- exit;
398
  }
399
  /**/
400
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
401
  do_action ("ws_plugin__s2member_after_paypal_return", get_defined_vars ());
402
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
403
  }
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit("Do not access this file directly.");
16
  /*
17
  Handles PayPal® Return URL processing.
18
+ This is used ONLY in PayPal® Standard Integration.
19
  Attach to: add_action("init");
20
  */
21
  if (!function_exists ("ws_plugin__s2member_paypal_return"))
38
  /*
39
  Custom conditionals can be applied by filters.
40
  */
41
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
42
  if (!apply_filters ("ws_plugin__s2member_during_paypal_return_conditionals", false, get_defined_vars ()))
43
  {
44
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
45
  /*
46
  Specific Post/Page Access.
47
  */
48
+ if (/**/preg_match ("/^web_accept$/i", $paypal["txn_type"])/**/
49
+ && preg_match ("/^sp\:[0-9,]+\:[0-9]+$/", $paypal["item_number"])/**/
50
+ && $paypal["txn_id"]/**/)
51
  {
52
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
53
  do_action ("ws_plugin__s2member_during_paypal_return_before_sp_access", get_defined_vars ());
54
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
55
  /**/
67
  /**/
68
  if ($processing && ($code = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_tracking_codes"]) && is_array ($cv = preg_split ("/\|/", $paypal["custom"])))
69
  {
70
+ if (($code = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $code)) && ($code = preg_replace ("/%%amount%%/i", ws_plugin__s2member_esc_ds ($paypal["mc_gross"]), $code)) && ($code = preg_replace ("/%%txn_id%%/i", ws_plugin__s2member_esc_ds ($paypal["txn_id"]), $code)))
71
+ if (($code = preg_replace ("/%%item_number%%/i", ws_plugin__s2member_esc_ds ($paypal["item_number"]), $code)) && ($code = preg_replace ("/%%item_name%%/i", ws_plugin__s2member_esc_ds ($paypal["item_name"]), $code)))
72
+ if (($code = preg_replace ("/%%first_name%%/i", ws_plugin__s2member_esc_ds ($paypal["first_name"]), $code)) && ($code = preg_replace ("/%%last_name%%/i", ws_plugin__s2member_esc_ds ($paypal["last_name"]), $code)))
73
+ if (($code = preg_replace ("/%%full_name%%/i", ws_plugin__s2member_esc_ds (trim ($paypal["first_name"] . " " . $paypal["last_name"])), $code)))
74
+ if (($code = preg_replace ("/%%payer_email%%/i", ws_plugin__s2member_esc_ds ($paypal["payer_email"]), $code)))
75
  /**/
76
  if (($code = trim ($code))) /* Make sure it is not empty. This gets stored into a Transient Queue. */
77
  {
80
  }
81
  }
82
  /**/
83
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
84
  do_action ("ws_plugin__s2member_during_paypal_return_during_sp_access", get_defined_vars ());
85
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
86
  /**/
87
  $paypal["s2member_log"][] = "Redirecting Customer to the Specific Post/Page.";
88
  /**/
89
+ header("Location: " . $sp_access_url);
90
  }
91
  else /* Otherwise, the ID must have been invalid. Or the Post/Page was deleted. */
92
  {
100
  echo '</script>' . "\n";
101
  }
102
  /**/
103
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
104
  do_action ("ws_plugin__s2member_during_paypal_return_after_sp_access", get_defined_vars ());
105
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
106
  }
107
  /*
108
+ New Subscriptions.
109
+ Possibly containing advanced update vars
110
+ ( option_name1, option_selection1 ); which allow account modifications.
111
  */
112
+ else if (/**/preg_match ("/^(web_accept|subscr_signup|subscr_payment)$/i", $paypal["txn_type"])/**/
113
+ && ($paypal["subscr_id"] || ($paypal["subscr_id"] = $paypal["txn_id"]))/**/
114
+ && preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?$/", $paypal["item_number"])/**/)
115
  { /* With Auto-Return/PDT, PayPal will send subscr_payment instead of subscr_signup to the return URL.
116
  So we need to look for (web_accept|subscr_signup|subscr_payment), and treat them as the same. */
117
  /**/
118
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
119
  do_action ("ws_plugin__s2member_during_paypal_return_before_subscr_signup", get_defined_vars ());
120
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
121
  /**/
129
  /* This advanced method is required whenever a Subscription that is already completed, or was never setup to recur in the first place needs to be modified. PayPal® will not allow the
130
  modify=2 parameter to be used in those scenarios, because technically there is nothing to update. The only thing to be updated is the account. */
131
  {
132
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
133
  do_action ("ws_plugin__s2member_during_paypal_return_before_subscr_signup_w_update_vars", get_defined_vars ());
134
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
135
  /**/
136
  $paypal["s2member_log"][] = "s2Member txn_type identified as (web_accept|subscr_signup|subscr_payment) w/ update vars.";
137
  /**/
138
  /* Check for both the old & new subscr_id's, just in case the IPN routine already changed it. */
139
+ if (($user_id = ws_plugin__s2member_paypal_user_id ($paypal["subscr_id"], $paypal["option_selection1"])) && is_object ($user = new WP_User ($user_id)) && $user->ID)
140
  {
 
 
141
  if (!ws_plugin__s2member_user_has_wp_role ($user)) /* Non WP Roles. */
142
  {
143
  $processing = $during = true; /* Yes, we ARE processing this. */
166
  /**/
167
  $paypal["s2member_log"][] = "s2Member Level/Capabilities updated w/ advanced update routines.";
168
  /**/
169
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
170
  do_action ("ws_plugin__s2member_during_paypal_return_during_subscr_signup_w_update_vars", get_defined_vars ());
171
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
172
  /**/
201
  echo '</script>' . "\n";
202
  }
203
  /**/
204
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
205
  do_action ("ws_plugin__s2member_during_paypal_return_after_subscr_signup_w_update_vars", get_defined_vars ());
206
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
207
  }
210
  */
211
  else /* Else this is a normal Subscription signup, we are not updating an existing Subscription. */
212
  {
213
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
214
  do_action ("ws_plugin__s2member_during_paypal_return_before_subscr_signup_wo_update_vars", get_defined_vars ());
215
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
216
  /**/
224
  /**/
225
  $paypal["s2member_log"][] = "Registration Cookies set on (web_accept|subscr_signup|subscr_payment) w/o update vars.";
226
  /**/
227
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
228
  do_action ("ws_plugin__s2member_during_paypal_return_during_subscr_signup_wo_update_vars", get_defined_vars ());
229
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
230
  /**/
235
  echo "window.location = '" . esc_js (add_query_arg ("action", "register", wp_login_url ())) . "';" . "\n";
236
  echo '</script>' . "\n";
237
  /**/
238
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
239
  do_action ("ws_plugin__s2member_during_paypal_return_after_subscr_signup_wo_update_vars", get_defined_vars ());
240
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
241
  }
242
  /**/
243
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
244
  do_action ("ws_plugin__s2member_during_paypal_return_after_subscr_signup", get_defined_vars ());
245
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
246
  }
247
  /*
248
  Subscription modifications.
249
  */
250
+ else if (/**/preg_match ("/^subscr_modify$/i", $paypal["txn_type"])/**/
251
+ && preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?$/", $paypal["item_number"])/**/
252
+ && $paypal["subscr_id"]/**/)
253
  {
254
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
255
  do_action ("ws_plugin__s2member_during_paypal_return_before_subscr_modify", get_defined_vars ());
256
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
257
  /**/
259
  /**/
260
  list ($paypal["level"], $paypal["ccaps"]) = preg_split ("/\:/", $paypal["item_number"], 2);
261
  /**/
262
+ if (($user_id = ws_plugin__s2member_paypal_user_id ($paypal["subscr_id"])) && is_object ($user = new WP_User ($user_id)) && $user->ID)
263
  {
 
 
264
  if (!ws_plugin__s2member_user_has_wp_role ($user)) /* Non WP Roles. */
265
  {
266
  $processing = $during = true; /* Yes, we ARE processing this. */
285
  /**/
286
  $paypal["s2member_log"][] = "s2Member Level/Capabilities updated on Subscription modification.";
287
  /**/
288
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
289
  do_action ("ws_plugin__s2member_during_paypal_return_during_subscr_modify", get_defined_vars ());
290
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
291
  /**/
320
  echo '</script>' . "\n";
321
  }
322
  /**/
323
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
324
  do_action ("ws_plugin__s2member_during_paypal_return_after_subscr_modify", get_defined_vars ());
325
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
326
  }
353
  }
354
  else if (!isset ($_GET["tx"]) && (empty ($_POST) || $_POST["auth"]))
355
  {
356
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
357
  do_action ("ws_plugin__s2member_during_paypal_return_before_no_return_data", get_defined_vars ());
358
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
359
  /**/
360
  $paypal["s2member_log"][] = "No Return-Data from PayPal®. Customer must wait for Email Confirmation.";
361
  /**/
362
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
363
  do_action ("ws_plugin__s2member_during_paypal_return_during_no_return_data", get_defined_vars ());
364
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
365
  /**/
371
  echo "window.location = '" . esc_js (get_bloginfo ("url")) . "';";
372
  echo '</script>' . "\n";
373
  /**/
374
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
375
  do_action ("ws_plugin__s2member_during_paypal_return_after_no_return_data", get_defined_vars ());
376
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
377
  }
378
  else
379
  {
380
  $paypal["s2member_log"][] = "Unable to verify POST vars. This is most likely related to an invalid PayPal® configuration. Please check: s2Member -> PayPal® Options.";
381
+ $paypal["s2member_log"][] = var_export ($_POST, true); /* Recording _POST vars for analysis and debugging. */
382
  /**/
383
  $paypal["s2member_log"][] = "Redirecting Customer to the Login Page, due to an error that occurred.";
384
  /**/
391
  if ($_GET["s2member_paypal_proxy"]) /* For proxy identification. */
392
  $paypal["s2member_paypal_proxy"] = $_GET["s2member_paypal_proxy"];
393
  /**/
394
+ if ($_GET["s2member_paypal_proxy_verification"]) /* Proxy identification w/verification. */
395
+ $paypal["s2member_paypal_proxy_verification"] = $_GET["s2member_paypal_proxy_verification"];
396
+ /**/
397
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_debug"]) /* Append to log? */
398
  if (is_dir ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"]))
399
  if (is_writable ($logs_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"]))
400
  file_put_contents ($logs_dir . "/paypal-rtn.log", var_export ($paypal, true) . "\n\n", FILE_APPEND);
401
  /**/
402
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
403
  do_action ("ws_plugin__s2member_during_paypal_return", get_defined_vars ());
404
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
405
  /**/
406
+ exit ();
407
  }
408
  /**/
409
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
410
  do_action ("ws_plugin__s2member_after_paypal_return", get_defined_vars ());
411
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
412
  }
includes/functions/paypal-utilities.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
  /*
17
  Get POST vars from PayPal®, verify and return array.
18
  */
@@ -31,7 +31,7 @@ if (!function_exists ("ws_plugin__s2member_paypal_postvars"))
31
  {
32
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
33
  /**/
34
- if ($_GET["tx"]) /* PDT with Auto-Return. */
35
  {
36
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_identity_token"])
37
  {
@@ -63,12 +63,15 @@ if (!function_exists ("ws_plugin__s2member_paypal_postvars"))
63
  $postback = $postvars;
64
  $postback["cmd"] = "_notify-validate";
65
  /**/
66
- foreach ($postvars as $key => $value)
67
- $postvars[$key] = trim ($value);
68
  /**/
69
  $endpoint = ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "www.sandbox.paypal.com" : "www.paypal.com";
70
  /**/
71
- if (strtolower (trim (ws_plugin__s2member_remote ("https://" . $endpoint . "/cgi-bin/webscr", $postback))) === "verified")
 
 
 
 
72
  {
73
  return apply_filters ("ws_plugin__s2member_paypal_postvars", $postvars, get_defined_vars ());
74
  }
@@ -88,6 +91,8 @@ if (!function_exists ("ws_plugin__s2member_paypal_postvars"))
88
  }
89
  /*
90
  Get the custom value for an existing Member, referenced by a Subscr. ID.
 
 
91
  */
92
  if (!function_exists ("ws_plugin__s2member_paypal_custom"))
93
  {
@@ -158,7 +163,7 @@ if (!function_exists ("ws_plugin__s2member_paypal_auto_eot_time"))
158
  do_action ("ws_plugin__s2member_before_paypal_auto_eot_time", get_defined_vars ());
159
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
160
  /**/
161
- if ($user_id && ($user = new WP_User ($user_id))) /* Must have a valid user_id. */
162
  {
163
  $registration_time = strtotime ($user->user_registered);
164
  $last_payment_time = (int)get_usermeta ($user_id, "s2member_last_payment_time");
@@ -168,10 +173,14 @@ if (!function_exists ("ws_plugin__s2member_paypal_auto_eot_time"))
168
  list ($num, $span) = preg_split ("/ /", $period1, 2);
169
  /**/
170
  $days = 0; /* Days start at 0. */
171
- $days = ($span === "D") ? 1 : $days;
172
- $days = ($span === "W") ? 7 : $days;
173
- $days = ($span === "M") ? 30 : $days;
174
- $days = ($span === "Y") ? 365 : $days;
 
 
 
 
175
  /**/
176
  $p1_days = (int)$num * (int)$days;
177
  $p1_time = $p1_days * 86400;
@@ -182,10 +191,14 @@ if (!function_exists ("ws_plugin__s2member_paypal_auto_eot_time"))
182
  list ($num, $span) = preg_split ("/ /", $period3, 2);
183
  /**/
184
  $days = 0; /* Days start at 0. */
185
- $days = ($span === "D") ? 1 : $days;
186
- $days = ($span === "W") ? 7 : $days;
187
- $days = ($span === "M") ? 30 : $days;
188
- $days = ($span === "Y") ? 365 : $days;
 
 
 
 
189
  /**/
190
  $p3_days = (int)$num * (int)$days;
191
  $p3_time = $p3_days * 86400;
@@ -214,10 +227,14 @@ if (!function_exists ("ws_plugin__s2member_paypal_auto_eot_time"))
214
  list ($num, $span) = preg_split ("/ /", $eotper, 2);
215
  /**/
216
  $days = 0; /* Days start at 0. */
217
- $days = ($span === "D") ? 1 : $days;
218
- $days = ($span === "W") ? 7 : $days;
219
- $days = ($span === "M") ? 30 : $days;
220
- $days = ($span === "Y") ? 365 : $days;
 
 
 
 
221
  /**/
222
  $eot_days = (int)$num * (int)$days;
223
  $eot_time = $eot_days * 86400;
@@ -231,4 +248,177 @@ if (!function_exists ("ws_plugin__s2member_paypal_auto_eot_time"))
231
  return apply_filters ("ws_plugin__s2member_paypal_auto_eot_time", $auto_eot_time, get_defined_vars ());
232
  }
233
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
234
  ?>
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
  /*
17
  Get POST vars from PayPal®, verify and return array.
18
  */
31
  {
32
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
33
  /**/
34
+ if ($_GET["tx"]) /* PDT ( Payment Data Transfer ) with Auto-Return. */
35
  {
36
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_identity_token"])
37
  {
63
  $postback = $postvars;
64
  $postback["cmd"] = "_notify-validate";
65
  /**/
66
+ $postvars = ws_plugin__s2member_trim_deep ($postvars);
 
67
  /**/
68
  $endpoint = ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "www.sandbox.paypal.com" : "www.paypal.com";
69
  /**/
70
+ if ($_GET["s2member_paypal_proxy"] && ws_plugin__s2member_decrypt ($_GET["s2member_paypal_proxy_verification"]) === $_SERVER["HTTP_HOST"])
71
+ {
72
+ return apply_filters ("ws_plugin__s2member_paypal_postvars", $postvars, get_defined_vars ());
73
+ }
74
+ else if (strtolower (trim (ws_plugin__s2member_remote ("https://" . $endpoint . "/cgi-bin/webscr", $postback))) === "verified")
75
  {
76
  return apply_filters ("ws_plugin__s2member_paypal_postvars", $postvars, get_defined_vars ());
77
  }
91
  }
92
  /*
93
  Get the custom value for an existing Member, referenced by a Subscr. ID.
94
+ A second lookup parameter can be provided, which will trigger some additional routines.
95
+ The $os0 value comes from advanced update vars, pertaining to subscription modifications.
96
  */
97
  if (!function_exists ("ws_plugin__s2member_paypal_custom"))
98
  {
163
  do_action ("ws_plugin__s2member_before_paypal_auto_eot_time", get_defined_vars ());
164
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
165
  /**/
166
+ if ($user_id && ($user = new WP_User ($user_id)) && $user->ID) /* Valid user_id? */
167
  {
168
  $registration_time = strtotime ($user->user_registered);
169
  $last_payment_time = (int)get_usermeta ($user_id, "s2member_last_payment_time");
173
  list ($num, $span) = preg_split ("/ /", $period1, 2);
174
  /**/
175
  $days = 0; /* Days start at 0. */
176
+ /**/
177
+ if (is_numeric ($num) && !is_numeric ($span))
178
+ {
179
+ $days = ($span === "D") ? 1 : $days;
180
+ $days = ($span === "W") ? 7 : $days;
181
+ $days = ($span === "M") ? 30 : $days;
182
+ $days = ($span === "Y") ? 365 : $days;
183
+ }
184
  /**/
185
  $p1_days = (int)$num * (int)$days;
186
  $p1_time = $p1_days * 86400;
191
  list ($num, $span) = preg_split ("/ /", $period3, 2);
192
  /**/
193
  $days = 0; /* Days start at 0. */
194
+ /**/
195
+ if (is_numeric ($num) && !is_numeric ($span))
196
+ {
197
+ $days = ($span === "D") ? 1 : $days;
198
+ $days = ($span === "W") ? 7 : $days;
199
+ $days = ($span === "M") ? 30 : $days;
200
+ $days = ($span === "Y") ? 365 : $days;
201
+ }
202
  /**/
203
  $p3_days = (int)$num * (int)$days;
204
  $p3_time = $p3_days * 86400;
227
  list ($num, $span) = preg_split ("/ /", $eotper, 2);
228
  /**/
229
  $days = 0; /* Days start at 0. */
230
+ /**/
231
+ if (is_numeric ($num) && !is_numeric ($span))
232
+ {
233
+ $days = ($span === "D") ? 1 : $days;
234
+ $days = ($span === "W") ? 7 : $days;
235
+ $days = ($span === "M") ? 30 : $days;
236
+ $days = ($span === "Y") ? 365 : $days;
237
+ }
238
  /**/
239
  $eot_days = (int)$num * (int)$days;
240
  $eot_time = $eot_days * 86400;
248
  return apply_filters ("ws_plugin__s2member_paypal_auto_eot_time", $auto_eot_time, get_defined_vars ());
249
  }
250
  }
251
+ /*
252
+ Function converts a term [DWMY] into PayPal® Pro format.
253
+ */
254
+ if (!function_exists ("ws_plugin__s2member_paypal_pro_term"))
255
+ {
256
+ function ws_plugin__s2member_paypal_pro_term ($term = FALSE)
257
+ {
258
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
259
+ do_action ("ws_plugin__s2member_before_paypal_pro_term", get_defined_vars ());
260
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
261
+ /**/
262
+ $paypal_pro_terms = array ("D" => "Day", "W" => "Week", "M" => "Month", "Y" => "Year");
263
+ /**/
264
+ $pro_term = $paypal_pro_terms[strtoupper ($term)];
265
+ return apply_filters ("ws_plugin__s2member_paypal_pro_term", $pro_term, get_defined_vars ());
266
+ }
267
+ }
268
+ /*
269
+ Function converts a term [Day,Week,Month,Year] into PayPal® Standard format.
270
+ */
271
+ if (!function_exists ("ws_plugin__s2member_paypal_std_term"))
272
+ {
273
+ function ws_plugin__s2member_paypal_std_term ($term = FALSE)
274
+ {
275
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
276
+ do_action ("ws_plugin__s2member_before_paypal_std_term", get_defined_vars ());
277
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
278
+ /**/
279
+ $paypal_std_terms = array ("DAY" => "D", "WEEK" => "W", "MONTH" => "M", "YEAR" => "Y");
280
+ /**/
281
+ $std_term = $paypal_std_terms[strtoupper ($term)];
282
+ return apply_filters ("ws_plugin__s2member_paypal_std_term", $std_term, get_defined_vars ());
283
+ }
284
+ }
285
+ /*
286
+ Function converts a term [D,W,M,Y,L,Day,Week,Month,Year,Lifetime] into Daily, Weekly, Monthly, Yearly, Lifetime.
287
+ This function can also handle "Period Term" combinations. Where the Period will be stripped automatically before conversion.
288
+ For example, "1 D", would become, just "Daily". Another example, "3 Y" would become "Yearly"; and "1 L", would become "Lifetime".
289
+ */
290
+ if (!function_exists ("ws_plugin__s2member_paypal_term_cycle"))
291
+ {
292
+ function ws_plugin__s2member_paypal_term_cycle ($term_or_period_term = FALSE)
293
+ {
294
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
295
+ do_action ("ws_plugin__s2member_before_paypal_term_cycle", get_defined_vars ());
296
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
297
+ /**/
298
+ $paypal_term_cycles = array ("D" => "Daily", "W" => "Weekly", "M" => "Monthly", "Y" => "Yearly", "L" => "Lifetime", "DAY" => "Daily", "WEEK" => "Weekly", "MONTH" => "Monthly", "YEAR" => "Yearly", "Lifetime" => "Lifetime");
299
+ /**/
300
+ $term_cycle = $paypal_term_cycles[strtoupper (preg_replace ("/^(.+?) /", "", $term_or_period_term))];
301
+ return apply_filters ("ws_plugin__s2member_paypal_term_cycle", $term_cycle, get_defined_vars ());
302
+ }
303
+ }
304
+ /*
305
+ Parse/validate item_number from either an array with
306
+ PROFILEREFERENCE|rp_invoice_id, or parse/validate an existing string
307
+ to make sure it is a valid "level:ccaps:eotper" combination.
308
+ */
309
+ if (!function_exists ("ws_plugin__s2member_paypal_pro_item_number"))
310
+ {
311
+ function ws_plugin__s2member_paypal_pro_item_number ($array_or_string = FALSE)
312
+ {
313
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
314
+ do_action ("ws_plugin__s2member_before_paypal_pro_item_number", get_defined_vars ());
315
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
316
+ /**/
317
+ if (is_array ($array = $array_or_string))
318
+ {
319
+ $r = (!$r && $array["PROFILEREFERENCE"]) ? $array["PROFILEREFERENCE"] : $r;
320
+ $r = (!$r && $array["rp_invoice_id"]) ? $array["rp_invoice_id"] : $r;
321
+ /**/
322
+ list ($reference, $domain, $item_number) = preg_split ("/~/", $r, 3);
323
+ }
324
+ /**/
325
+ else if (is_string ($string = $array_or_string))
326
+ $item_number = $string;
327
+ /**/
328
+ if ($item_number) /* Were we able to get an item_number string parsed out? */
329
+ if (preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?$/", $item_number))
330
+ return apply_filters ("ws_plugin__s2member_paypal_pro_item_number", $item_number, get_defined_vars ());
331
+ /**/
332
+ return apply_filters ("ws_plugin__s2member_paypal_pro_item_number", "1", get_defined_vars ());
333
+ }
334
+ }
335
+ /*
336
+ Parse/validate period1 from either a return array coming from the
337
+ Pro API with PROFILEREFERENCE|rp_invoice_id, or parse/validate an existing string
338
+ to make sure it is a valid "period term" combination.
339
+
340
+ Note: This will also convert "1 Day", into "1 D".
341
+ */
342
+ if (!function_exists ("ws_plugin__s2member_paypal_pro_period1"))
343
+ {
344
+ function ws_plugin__s2member_paypal_pro_period1 ($array_or_string = FALSE)
345
+ {
346
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
347
+ do_action ("ws_plugin__s2member_before_paypal_pro_period1", get_defined_vars ());
348
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
349
+ /**/
350
+ if (is_array ($array = $array_or_string))
351
+ {
352
+ $r = (!$r && $array["PROFILEREFERENCE"]) ? $array["PROFILEREFERENCE"] : $r;
353
+ $r = (!$r && $array["rp_invoice_id"]) ? $array["rp_invoice_id"] : $r;
354
+ /**/
355
+ list ($reference, $domain, $item_number) = preg_split ("/~/", $r, 3);
356
+ list ($start_time, $period1, $period3) = preg_split ("/\:/", $reference, 3);
357
+ }
358
+ /**/
359
+ else if (is_string ($string = $array_or_string))
360
+ $period1 = $string; /* A string was passed in for validation. */
361
+ /**/
362
+ if ($period1) /* Were we able to get a period1 string parsed out? */
363
+ {
364
+ list ($num, $span) = preg_split ("/ /", $period1, 2);
365
+ /**/
366
+ if (strlen ($span) !== 1) /* Convert to Standard format. */
367
+ $span = ws_plugin__s2member_paypal_std_term ($span);
368
+ /**/
369
+ $span = (preg_match ("/^[DWMY]$/i", $span)) ? $span : "";
370
+ $num = ($span && is_numeric ($num) && $num >= 0) ? $num : "";
371
+ /**/
372
+ $period1 = ($num && $span) ? $num . " " . strtoupper ($span) : "0 D";
373
+ return apply_filters ("ws_plugin__s2member_paypal_pro_period1", $period1, get_defined_vars ());
374
+ }
375
+ else /* Default. */
376
+ return apply_filters ("ws_plugin__s2member_paypal_pro_period1", "0 D", get_defined_vars ());
377
+ }
378
+ }
379
+ /*
380
+ Parse/validate period3 from either a return array coming from the
381
+ Pro API with PROFILEREFERENCE|rp_invoice_id, or parse/validate an existing string
382
+ to make sure it is a valid "period term" combination.
383
+
384
+ Note: This will also convert "1 Day", into "1 D".
385
+ Note: The regular period can never be less than 1 day ( 1 D ).
386
+ */
387
+ if (!function_exists ("ws_plugin__s2member_paypal_pro_period3"))
388
+ {
389
+ function ws_plugin__s2member_paypal_pro_period3 ($array_or_string = FALSE)
390
+ {
391
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
392
+ do_action ("ws_plugin__s2member_before_paypal_pro_period3", get_defined_vars ());
393
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
394
+ /**/
395
+ if (is_array ($array = $array_or_string))
396
+ {
397
+ $r = (!$r && $array["PROFILEREFERENCE"]) ? $array["PROFILEREFERENCE"] : $r;
398
+ $r = (!$r && $array["rp_invoice_id"]) ? $array["rp_invoice_id"] : $r;
399
+ /**/
400
+ list ($reference, $domain, $item_number) = preg_split ("/~/", $r, 3);
401
+ list ($start_time, $period1, $period3) = preg_split ("/\:/", $reference, 3);
402
+ }
403
+ /**/
404
+ else if (is_string ($string = $array_or_string))
405
+ $period3 = $string; /* A string was passed in for validation. */
406
+ /**/
407
+ if ($period3) /* Were we able to get a period3 string parsed out? */
408
+ {
409
+ list ($num, $span) = preg_split ("/ /", $period3, 2);
410
+ /**/
411
+ if (strlen ($span) !== 1) /* Convert to Standard format. */
412
+ $span = ws_plugin__s2member_paypal_std_term ($span);
413
+ /**/
414
+ $span = (preg_match ("/^[DWMY]$/i", $span)) ? $span : "";
415
+ $num = ($span && is_numeric ($num) && $num >= 0) ? $num : "";
416
+ /**/
417
+ $period3 = ($num && $span) ? $num . " " . strtoupper ($span) : "1 D";
418
+ return apply_filters ("ws_plugin__s2member_paypal_pro_period3", $period3, get_defined_vars ());
419
+ }
420
+ else /* Default. */
421
+ return apply_filters ("ws_plugin__s2member_paypal_pro_period3", "1 D", get_defined_vars ());
422
+ }
423
+ }
424
  ?>
includes/functions/post-level-access.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
  /*
17
  Function for handling post level access permissions.
18
  Attach to: add_action("template_redirect");
@@ -33,32 +33,38 @@ if (!function_exists ("ws_plugin__s2member_check_post_level_access"))
33
  {
34
  $current_user = (is_user_logged_in ()) ? wp_get_current_user () : false;
35
  /**/
36
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_posts"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level1")) && wp_redirect (add_query_arg ("s2member_level_req", "1", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
37
- exit;
 
 
 
 
 
 
38
  /**/
39
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_posts"] && in_array ($post_ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_posts"])) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level1")) && wp_redirect (add_query_arg ("s2member_level_req", "1", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
40
- exit;
41
  /**/
42
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_posts"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level2")) && wp_redirect (add_query_arg ("s2member_level_req", "2", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
43
- exit;
44
  /**/
45
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_posts"] && in_array ($post_ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_posts"])) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level2")) && wp_redirect (add_query_arg ("s2member_level_req", "2", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
46
- exit;
47
  /**/
48
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_posts"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level3")) && wp_redirect (add_query_arg ("s2member_level_req", "3", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
49
- exit;
50
  /**/
51
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_posts"] && in_array ($post_ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_posts"])) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level3")) && wp_redirect (add_query_arg ("s2member_level_req", "3", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
52
- exit;
53
  /**/
54
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_posts"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level4")) && wp_redirect (add_query_arg ("s2member_level_req", "4", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
55
- exit;
56
  /**/
57
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_posts"] && in_array ($post_ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_posts"])) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level4")) && wp_redirect (add_query_arg ("s2member_level_req", "4", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
58
- exit;
59
  /**/
60
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"] && in_array ($post_ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"])) && ws_plugin__s2member_nocache_constants () !== "nill" && !ws_plugin__s2member_sp_access ($post_ID) && wp_redirect (add_query_arg ("s2member_sp_req", $post_ID, get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
61
- exit;
62
  /**/
63
  do_action ("ws_plugin__s2member_during_check_post_level_access", get_defined_vars ());
64
  }
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
  /*
17
  Function for handling post level access permissions.
18
  Attach to: add_action("template_redirect");
33
  {
34
  $current_user = (is_user_logged_in ()) ? wp_get_current_user () : false;
35
  /**/
36
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_posts"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level0")) && wp_redirect (add_query_arg ("s2member_level_req", "0", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
37
+ exit ();
38
+ /**/
39
+ else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_posts"] && in_array ($post_ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_posts"])) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level0")) && wp_redirect (add_query_arg ("s2member_level_req", "0", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
40
+ exit ();
41
+ /**/
42
+ else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_posts"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level1")) && wp_redirect (add_query_arg ("s2member_level_req", "1", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
43
+ exit ();
44
  /**/
45
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_posts"] && in_array ($post_ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_posts"])) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level1")) && wp_redirect (add_query_arg ("s2member_level_req", "1", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
46
+ exit ();
47
  /**/
48
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_posts"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level2")) && wp_redirect (add_query_arg ("s2member_level_req", "2", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
49
+ exit ();
50
  /**/
51
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_posts"] && in_array ($post_ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_posts"])) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level2")) && wp_redirect (add_query_arg ("s2member_level_req", "2", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
52
+ exit ();
53
  /**/
54
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_posts"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level3")) && wp_redirect (add_query_arg ("s2member_level_req", "3", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
55
+ exit ();
56
  /**/
57
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_posts"] && in_array ($post_ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_posts"])) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level3")) && wp_redirect (add_query_arg ("s2member_level_req", "3", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
58
+ exit ();
59
  /**/
60
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_posts"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level4")) && wp_redirect (add_query_arg ("s2member_level_req", "4", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
61
+ exit ();
62
  /**/
63
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_posts"] && in_array ($post_ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_posts"])) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level4")) && wp_redirect (add_query_arg ("s2member_level_req", "4", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
64
+ exit ();
65
  /**/
66
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"] && in_array ($post_ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"])) && ws_plugin__s2member_nocache_constants () !== "nill" && !ws_plugin__s2member_sp_access ($post_ID) && wp_redirect (add_query_arg ("s2member_sp_req", $post_ID, get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
67
+ exit ();
68
  /**/
69
  do_action ("ws_plugin__s2member_during_check_post_level_access", get_defined_vars ());
70
  }
includes/functions/profile-modifications.inc.php CHANGED
@@ -12,7 +12,29 @@ If not, see: <http://www.gnu.org/licenses/>.
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  /*
17
  Function for handling profile modifications.
18
  Attach to: add_action("init");
@@ -31,7 +53,7 @@ if (!function_exists ("ws_plugin__s2member_handle_profile_modifications"))
31
  /**/
32
  $userdata["ID"] = $user_id = $current_user->ID;
33
  /**/
34
- include_once (ABSPATH . WPINC . "/registration.php");
35
  /**/
36
  if (trim ($_POST["ws_plugin__s2member_profile_email"]))
37
  if (is_email (trim ($_POST["ws_plugin__s2member_profile_email"])))
@@ -52,8 +74,10 @@ if (!function_exists ("ws_plugin__s2member_handle_profile_modifications"))
52
  {
53
  if ($field = trim ($field, "* \t\n\r\0\x0B")) /* Don't process empty fields. */
54
  {
55
- $field = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field));
56
- $fields[$field] = trim ($_POST["ws_plugin__s2member_profile_" . $field]);
 
 
57
  }
58
  }
59
  /**/
@@ -69,20 +93,8 @@ if (!function_exists ("ws_plugin__s2member_handle_profile_modifications"))
69
  echo "else { alert('Profile updated successfully!'); window.location = '" . esc_js (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"])) . "'; }";
70
  echo '</script>' . "\n";
71
  /**/
72
- exit;
73
  }
74
- /**/
75
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
76
- do_action ("ws_plugin__s2member_before_profile", get_defined_vars ());
77
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
78
- /**/
79
- include_once dirname (dirname (__FILE__)) . "/profile.inc.php";
80
- /**/
81
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
82
- do_action ("ws_plugin__s2member_after_profile", get_defined_vars ());
83
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
84
- /**/
85
- exit;
86
  }
87
  /**/
88
  do_action ("ws_plugin__s2member_after_handle_profile_modifications", get_defined_vars ());
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
+ /*
17
+ Function that displays the Profile Modification Form.
18
+ Attach to: add_action("template_redirect");
19
+ */
20
+ if (!function_exists ("ws_plugin__s2member_profile"))
21
+ {
22
+ function ws_plugin__s2member_profile ()
23
+ {
24
+ do_action ("ws_plugin__s2member_before_profile", get_defined_vars ());
25
+ /**/
26
+ if ($_GET["s2member_profile"] && is_user_logged_in ()) /* Logged in? */
27
+ {
28
+ include_once dirname (dirname (__FILE__)) . "/profile.inc.php";
29
+ /* Additional Hooks/Filters inside profile.inc.php. */
30
+ exit ();
31
+ }
32
+ /**/
33
+ do_action ("ws_plugin__s2member_after_profile", get_defined_vars ());
34
+ /**/
35
+ return;
36
+ }
37
+ }
38
  /*
39
  Function for handling profile modifications.
40
  Attach to: add_action("init");
53
  /**/
54
  $userdata["ID"] = $user_id = $current_user->ID;
55
  /**/
56
+ include_once ABSPATH . WPINC . "/registration.php";
57
  /**/
58
  if (trim ($_POST["ws_plugin__s2member_profile_email"]))
59
  if (is_email (trim ($_POST["ws_plugin__s2member_profile_email"])))
74
  {
75
  if ($field = trim ($field, "* \t\n\r\0\x0B")) /* Don't process empty fields. */
76
  {
77
+ $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field));
78
+ $field_id_class = preg_replace ("/_/", "-", $field_var);
79
+ /**/
80
+ $fields[$field_var] = trim ($_POST["ws_plugin__s2member_profile_" . $field_var]);
81
  }
82
  }
83
  /**/
93
  echo "else { alert('Profile updated successfully!'); window.location = '" . esc_js (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"])) . "'; }";
94
  echo '</script>' . "\n";
95
  /**/
96
+ exit ();
97
  }
 
 
 
 
 
 
 
 
 
 
 
 
98
  }
99
  /**/
100
  do_action ("ws_plugin__s2member_after_handle_profile_modifications", get_defined_vars ());
includes/functions/ptag-level-access.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
  /*
17
  Function for handling ptag level access permissions.
18
  Attach to: add_action("template_redirect");
@@ -35,55 +35,67 @@ if (!function_exists ("ws_plugin__s2member_check_ptag_level_access"))
35
  /**/
36
  if (is_tag () && $tag_ID) /* We also check if this is a post or page with tags, having a restricted tag. */
37
  {
38
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_ptags"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level1")) && wp_redirect (add_query_arg ("s2member_level_req", "1", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
39
- exit;
 
 
 
 
 
 
40
  /**/
41
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_ptags"] && is_tag (preg_split ("/[\r\n\t;,]+/", preg_replace ("/( +)/", "-", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_ptags"]))) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level1")) && wp_redirect (add_query_arg ("s2member_level_req", "1", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
42
- exit;
43
  /**/
44
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_ptags"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level2")) && wp_redirect (add_query_arg ("s2member_level_req", "2", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
45
- exit;
46
  /**/
47
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_ptags"] && is_tag (preg_split ("/[\r\n\t;,]+/", preg_replace ("/( +)/", "-", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_ptags"]))) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level2")) && wp_redirect (add_query_arg ("s2member_level_req", "2", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
48
- exit;
49
  /**/
50
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_ptags"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level3")) && wp_redirect (add_query_arg ("s2member_level_req", "3", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
51
- exit;
52
  /**/
53
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_ptags"] && is_tag (preg_split ("/[\r\n\t;,]+/", preg_replace ("/( +)/", "-", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_ptags"]))) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level3")) && wp_redirect (add_query_arg ("s2member_level_req", "3", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
54
- exit;
55
  /**/
56
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_catgs"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level4")) && wp_redirect (add_query_arg ("s2member_level_req", "4", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
57
- exit;
58
  /**/
59
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_ptags"] && is_tag (preg_split ("/[\r\n\t;,]+/", preg_replace ("/( +)/", "-", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_ptags"]))) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level4")) && wp_redirect (add_query_arg ("s2member_level_req", "4", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
60
- exit;
61
  }
62
  else if (is_single () && has_tag () && $post_ID)
63
  {
64
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_ptags"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level1")) && wp_redirect (add_query_arg ("s2member_level_req", "1", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
65
- exit;
 
 
 
 
 
 
66
  /**/
67
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_ptags"] && has_tag (preg_split ("/[\r\n\t;,]+/", preg_replace ("/( +)/", "-", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_ptags"]))) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level1")) && wp_redirect (add_query_arg ("s2member_level_req", "1", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
68
- exit;
69
  /**/
70
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_ptags"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level2")) && wp_redirect (add_query_arg ("s2member_level_req", "2", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
71
- exit;
72
  /**/
73
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_ptags"] && has_tag (preg_split ("/[\r\n\t;,]+/", preg_replace ("/( +)/", "-", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_ptags"]))) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level2")) && wp_redirect (add_query_arg ("s2member_level_req", "2", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
74
- exit;
75
  /**/
76
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_ptags"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level3")) && wp_redirect (add_query_arg ("s2member_level_req", "3", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
77
- exit;
78
  /**/
79
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_ptags"] && has_tag (preg_split ("/[\r\n\t;,]+/", preg_replace ("/( +)/", "-", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_ptags"]))) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level3")) && wp_redirect (add_query_arg ("s2member_level_req", "3", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
80
- exit;
81
  /**/
82
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_ptags"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level4")) && wp_redirect (add_query_arg ("s2member_level_req", "4", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
83
- exit;
84
  /**/
85
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_ptags"] && has_tag (preg_split ("/[\r\n\t;,]+/", preg_replace ("/( +)/", "-", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_ptags"]))) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level4")) && wp_redirect (add_query_arg ("s2member_level_req", "4", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
86
- exit;
87
  }
88
  /**/
89
  do_action ("ws_plugin__s2member_during_check_ptag_level_access", get_defined_vars ());
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit("Do not access this file directly.");
16
  /*
17
  Function for handling ptag level access permissions.
18
  Attach to: add_action("template_redirect");
35
  /**/
36
  if (is_tag () && $tag_ID) /* We also check if this is a post or page with tags, having a restricted tag. */
37
  {
38
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_ptags"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level0")) && wp_redirect (add_query_arg ("s2member_level_req", "0", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
39
+ exit ();
40
+ /**/
41
+ else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_ptags"] && is_tag (preg_split ("/[\r\n\t;,]+/", preg_replace ("/( +)/", "-", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_ptags"]))) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level0")) && wp_redirect (add_query_arg ("s2member_level_req", "0", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
42
+ exit ();
43
+ /**/
44
+ else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_ptags"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level1")) && wp_redirect (add_query_arg ("s2member_level_req", "1", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
45
+ exit ();
46
  /**/
47
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_ptags"] && is_tag (preg_split ("/[\r\n\t;,]+/", preg_replace ("/( +)/", "-", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_ptags"]))) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level1")) && wp_redirect (add_query_arg ("s2member_level_req", "1", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
48
+ exit ();
49
  /**/
50
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_ptags"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level2")) && wp_redirect (add_query_arg ("s2member_level_req", "2", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
51
+ exit ();
52
  /**/
53
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_ptags"] && is_tag (preg_split ("/[\r\n\t;,]+/", preg_replace ("/( +)/", "-", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_ptags"]))) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level2")) && wp_redirect (add_query_arg ("s2member_level_req", "2", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
54
+ exit ();
55
  /**/
56
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_ptags"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level3")) && wp_redirect (add_query_arg ("s2member_level_req", "3", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
57
+ exit ();
58
  /**/
59
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_ptags"] && is_tag (preg_split ("/[\r\n\t;,]+/", preg_replace ("/( +)/", "-", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_ptags"]))) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level3")) && wp_redirect (add_query_arg ("s2member_level_req", "3", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
60
+ exit ();
61
  /**/
62
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_catgs"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level4")) && wp_redirect (add_query_arg ("s2member_level_req", "4", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
63
+ exit ();
64
  /**/
65
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_ptags"] && is_tag (preg_split ("/[\r\n\t;,]+/", preg_replace ("/( +)/", "-", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_ptags"]))) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level4")) && wp_redirect (add_query_arg ("s2member_level_req", "4", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
66
+ exit ();
67
  }
68
  else if (is_single () && has_tag () && $post_ID)
69
  {
70
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_ptags"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level0")) && wp_redirect (add_query_arg ("s2member_level_req", "0", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
71
+ exit ();
72
+ /**/
73
+ else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_ptags"] && has_tag (preg_split ("/[\r\n\t;,]+/", preg_replace ("/( +)/", "-", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_ptags"]))) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level0")) && wp_redirect (add_query_arg ("s2member_level_req", "0", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
74
+ exit ();
75
+ /**/
76
+ else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_ptags"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level1")) && wp_redirect (add_query_arg ("s2member_level_req", "1", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
77
+ exit ();
78
  /**/
79
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_ptags"] && has_tag (preg_split ("/[\r\n\t;,]+/", preg_replace ("/( +)/", "-", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_ptags"]))) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level1")) && wp_redirect (add_query_arg ("s2member_level_req", "1", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
80
+ exit ();
81
  /**/
82
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_ptags"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level2")) && wp_redirect (add_query_arg ("s2member_level_req", "2", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
83
+ exit ();
84
  /**/
85
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_ptags"] && has_tag (preg_split ("/[\r\n\t;,]+/", preg_replace ("/( +)/", "-", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_ptags"]))) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level2")) && wp_redirect (add_query_arg ("s2member_level_req", "2", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
86
+ exit ();
87
  /**/
88
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_ptags"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level3")) && wp_redirect (add_query_arg ("s2member_level_req", "3", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
89
+ exit ();
90
  /**/
91
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_ptags"] && has_tag (preg_split ("/[\r\n\t;,]+/", preg_replace ("/( +)/", "-", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_ptags"]))) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level3")) && wp_redirect (add_query_arg ("s2member_level_req", "3", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
92
+ exit ();
93
  /**/
94
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_ptags"] === "all" && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level4")) && wp_redirect (add_query_arg ("s2member_level_req", "4", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
95
+ exit ();
96
  /**/
97
  else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_ptags"] && has_tag (preg_split ("/[\r\n\t;,]+/", preg_replace ("/( +)/", "-", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_ptags"]))) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level4")) && wp_redirect (add_query_arg ("s2member_level_req", "4", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
98
+ exit ();
99
  }
100
  /**/
101
  do_action ("ws_plugin__s2member_during_check_ptag_level_access", get_defined_vars ());
includes/functions/readme-parsing.inc.php CHANGED
@@ -12,17 +12,20 @@ If not, see: <http://www.gnu.org/licenses/>.
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
  /*
17
  Function that handles readme.txt parsing.
18
  */
19
  if (!function_exists ("ws_plugin__s2member_parse_readme"))
20
  {
21
- function ws_plugin__s2member_parse_readme ()
22
  {
23
- $path = dirname (dirname (dirname (__FILE__))) . "/readme.txt";
24
- $dev_path = dirname (dirname (dirname (__FILE__))) . "/readme-dev.txt";
25
- $path = (file_exists ($dev_path)) ? $dev_path : $path;
 
 
 
26
  /**/
27
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
28
  do_action ("ws_plugin__s2member_before_parse_readme", get_defined_vars ());
@@ -92,28 +95,31 @@ Function for parsing readme.txt files and returning a key value.
92
  */
93
  if (!function_exists ("ws_plugin__s2member_parse_readme_value"))
94
  {
95
- function ws_plugin__s2member_parse_readme_value ($key = FALSE)
96
  {
97
- static $readme; /* For repeated lookups. */
98
  /**/
99
- $path = dirname (dirname (dirname (__FILE__))) . "/readme.txt";
100
- $dev_path = dirname (dirname (dirname (__FILE__))) . "/readme-dev.txt";
101
- $path = (file_exists ($dev_path)) ? $dev_path : $path;
 
 
 
102
  /**/
103
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
104
  do_action ("ws_plugin__s2member_before_parse_readme_value", get_defined_vars ());
105
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
106
  /**/
107
- if (isset ($readme) || file_exists ($path))
108
  {
109
- if (!isset ($readme)) /* If not already opened, we need open it up now. */
110
  {
111
- $readme = file_get_contents ($path); /* Get readme.txt file contents. */
112
- $mb = function_exists ("mb_convert_encoding") ? @mb_convert_encoding ($readme, "UTF-8",@mb_detect_encoding ($readme, "WINDOWS-1252, UTF-8")) : $readme;
113
- $readme = ($mb) ? $mb : $readme; /* Double check this, just in case conversion fails on an unpredicted charset. */
114
  }
115
  /**/
116
- preg_match ("/(^)(" . preg_quote ($key, "/") . ")(\:)( )(.+?)($)/m", $readme, $m);
117
  /**/
118
  return strlen ($m[5] = trim ($m[5])) ? apply_filters ("ws_plugin__s2member_parse_readme_value", $m[5], get_defined_vars ()) : false;
119
  }
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
  /*
17
  Function that handles readme.txt parsing.
18
  */
19
  if (!function_exists ("ws_plugin__s2member_parse_readme"))
20
  {
21
+ function ws_plugin__s2member_parse_readme ($specific_path = FALSE)
22
  {
23
+ if (!($path = $specific_path)) /* Was a specific path passed in? */
24
+ {
25
+ $path = dirname (dirname (dirname (__FILE__))) . "/readme.txt";
26
+ $dev_path = dirname (dirname (dirname (__FILE__))) . "/readme-dev.txt";
27
+ $path = (file_exists ($dev_path)) ? $dev_path : $path;
28
+ }
29
  /**/
30
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
31
  do_action ("ws_plugin__s2member_before_parse_readme", get_defined_vars ());
95
  */
96
  if (!function_exists ("ws_plugin__s2member_parse_readme_value"))
97
  {
98
+ function ws_plugin__s2member_parse_readme_value ($key = FALSE, $specific_path = FALSE)
99
  {
100
+ static $readme = array (); /* For repeated lookups across different paths. */
101
  /**/
102
+ if (!($path = $specific_path)) /* Was a specific path passed in? */
103
+ {
104
+ $path = dirname (dirname (dirname (__FILE__))) . "/readme.txt";
105
+ $dev_path = dirname (dirname (dirname (__FILE__))) . "/readme-dev.txt";
106
+ $path = (file_exists ($dev_path)) ? $dev_path : $path;
107
+ }
108
  /**/
109
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
110
  do_action ("ws_plugin__s2member_before_parse_readme_value", get_defined_vars ());
111
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
112
  /**/
113
+ if ($readme[$path] || file_exists ($path))
114
  {
115
+ if (!$readme[$path]) /* If not already opened, we need open it up now. */
116
  {
117
+ $readme[$path] = file_get_contents ($path); /* Get readme.txt file contents. */
118
+ $mb = function_exists ("mb_convert_encoding") ? @mb_convert_encoding ($readme[$path], "UTF-8",@mb_detect_encoding ($readme[$path], "WINDOWS-1252, UTF-8")) : $readme[$path];
119
+ $readme[$path] = ($mb) ? $mb : $readme[$path]; /* Double check this, just in case conversion fails on an unpredicted charset. */
120
  }
121
  /**/
122
+ preg_match ("/(^)(" . preg_quote ($key, "/") . ")(\:)( )(.+?)($)/m", $readme[$path], $m);
123
  /**/
124
  return strlen ($m[5] = trim ($m[5])) ? apply_filters ("ws_plugin__s2member_parse_readme_value", $m[5], get_defined_vars ()) : false;
125
  }
includes/functions/register-access.inc.php CHANGED
@@ -12,9 +12,9 @@ If not, see: <http://www.gnu.org/licenses/>.
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
  /*
17
- Function that forces a default Subscriber Role.
18
  Attach to: add_filter("pre_option_default_role");
19
  */
20
  if (!function_exists ("ws_plugin__s2member_force_default_role"))
@@ -42,7 +42,7 @@ if (!function_exists ("ws_plugin__s2member_check_register_access"))
42
  {
43
  return apply_filters ("ws_plugin__s2member_check_register_access", ($users_can_register = "1"), get_defined_vars ());
44
  }
45
- else if ($pagenow !== "options-general.php" && ($subscr_id = ws_plugin__s2member_decrypt ($_COOKIE["s2member_subscr_id"])) && ($custom = ws_plugin__s2member_decrypt ($_COOKIE["s2member_custom"])) && preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9] [A-Z])?$/", ($level = ws_plugin__s2member_decrypt ($_COOKIE["s2member_level"]))))
46
  {
47
  global $wpdb; /* Global database object reference. */
48
  /**/
@@ -69,7 +69,7 @@ if (!function_exists ("ws_plugin__s2member_general_ops_notice"))
69
  /**/
70
  if ($pagenow === "options-general.php" && !isset ($_GET["page"]))
71
  {
72
- $notice = "<em>* Note: The s2Member plugin has control over two options on this page. <code>Anyone Can Register = " . esc_html (get_option ("users_can_register")) . "</code>, and <code>Default Role = " . esc_html (get_option ("default_role")) . "</code>. For further details, see: <code>s2Member -> General Options -> Login Welcome Page -> Allow Free Subscribers</code>.";
73
  /**/
74
  do_action ("ws_plugin__s2member_during_general_ops_notice", get_defined_vars ());
75
  /**/
@@ -91,113 +91,112 @@ if (!function_exists ("ws_plugin__s2member_custom_registration_fields"))
91
  {
92
  do_action ("ws_plugin__s2member_before_custom_registration_fields", get_defined_vars ());
93
  /**/
94
- if (!defined ("BP_VERSION")) /* Not compatible with BuddyPress. */
 
 
 
 
 
 
 
 
95
  {
96
- echo '<input type="hidden" name="ws_plugin__s2member_registration" value="' . esc_attr (wp_create_nonce ("ws-plugin--s2member-registration")) . '" />' . "\n";
 
 
97
  /**/
98
- $tabindex = 20; /* Incremented tabindex starting with 20. */
 
 
 
 
 
99
  /**/
100
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
101
- do_action ("ws_plugin__s2member_during_custom_registration_fields_before", get_defined_vars ());
102
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  /**/
104
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_password"] && function_exists ("ws_plugin__s2member_generate_password"))
105
  {
106
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
107
- do_action ("ws_plugin__s2member_during_custom_registration_fields_before_user_pass", get_defined_vars ());
108
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
109
  /**/
 
 
 
110
  echo '<p>' . "\n";
111
  echo '<label>' . "\n";
112
- echo 'Password *' . "\n";
113
- echo '<input aria-required="true" type="password" maxlength="100" name="ws_plugin__s2member_custom_reg_field_user_pass" id="ws-plugin--s2member-custom-reg-field-user-pass" class="ws-plugin--s2member-custom-reg-field input" size="25" tabindex="' . esc_attr (($tabindex = $tabindex + 10)) . '" value="' . format_to_edit (trim (stripslashes ($_POST["ws_plugin__s2member_custom_reg_field_user_pass"]))) . '" />' . "\n";
114
  echo '</label>' . "\n";
115
  echo '</p>';
116
  /**/
117
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
118
- do_action ("ws_plugin__s2member_during_custom_registration_fields_after_user_pass", get_defined_vars ());
119
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
120
  }
121
- /**/
122
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
123
- do_action ("ws_plugin__s2member_during_custom_registration_fields_before_first_name", get_defined_vars ());
124
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
125
- /**/
126
- echo '<p>' . "\n";
127
- echo '<label>' . "\n";
128
- echo 'First Name *' . "\n";
129
- 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 input" size="25" tabindex="' . esc_attr (($tabindex = $tabindex + 10)) . '" value="' . format_to_edit (trim (stripslashes ($_POST["ws_plugin__s2member_custom_reg_field_first_name"]))) . '" />' . "\n";
130
- echo '</label>' . "\n";
131
- echo '</p>';
132
- /**/
133
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
134
- do_action ("ws_plugin__s2member_during_custom_registration_fields_after_first_name", get_defined_vars ());
135
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
136
- /**/
137
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
138
- do_action ("ws_plugin__s2member_during_custom_registration_fields_before_last_name", get_defined_vars ());
139
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
140
  /**/
141
  echo '<p>' . "\n";
142
  echo '<label>' . "\n";
143
- echo 'Last Name *' . "\n";
144
- 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 input" size="25" tabindex="' . esc_attr (($tabindex = $tabindex + 10)) . '" value="' . format_to_edit (trim (stripslashes ($_POST["ws_plugin__s2member_custom_reg_field_last_name"]))) . '" />' . "\n";
145
  echo '</label>' . "\n";
146
  echo '</p>';
147
  /**/
148
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
149
- do_action ("ws_plugin__s2member_during_custom_registration_fields_after_last_name", get_defined_vars ());
150
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
151
- /**/
152
- foreach (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) as $field)
153
- {
154
- $req = preg_match ("/\*/", $field); /* Required fields should be wrapped inside asterisks. */
155
- $req = ($req) ? ' aria-required="true"' : ''; /* Has JavaScript validation applied. */
156
- /**/
157
- if ($field = trim ($field, "* \t\n\r\0\x0B")) /* Don't process empty fields. */
158
- {
159
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
160
- do_action ("ws_plugin__s2member_during_custom_registration_fields_before_custom_fields", get_defined_vars ());
161
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
162
- /**/
163
- echo '<p>' . "\n";
164
- echo '<label>' . "\n";
165
- echo esc_html ($field) . (($req) ? " *" : "") . "\n";
166
- $field = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field));
167
- echo '<input' . $req . ' type="text" maxlength="100" name="ws_plugin__s2member_custom_reg_field_' . esc_attr ($field) . '" id="ws-plugin--s2member-custom-reg-field-' . esc_attr (preg_replace ("/_/", "-", $field)) . '" class="ws-plugin--s2member-custom-reg-field input" size="25" tabindex="' . esc_attr (($tabindex = $tabindex + 10)) . '" value="' . format_to_edit (trim (stripslashes ($_POST["ws_plugin__s2member_custom_reg_field_" . $field]))) . '" />' . "\n";
168
- echo '</label>' . "\n";
169
- echo '</p>';
170
- /**/
171
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
172
- do_action ("ws_plugin__s2member_during_custom_registration_fields_after_custom_fields", get_defined_vars ());
173
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
174
- }
175
- }
176
- /**/
177
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] && ws_plugin__s2member_list_servers_integrated ())
178
- {
179
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
180
- do_action ("ws_plugin__s2member_during_custom_registration_fields_before_opt_in", get_defined_vars ());
181
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
182
- /**/
183
- echo '<p>' . "\n";
184
- echo '<label>' . "\n";
185
- echo '<input type="checkbox" name="ws_plugin__s2member_custom_reg_field_opt_in" id="ws-plugin--s2member-custom-reg-field-opt-in" tabindex="' . esc_attr (($tabindex = $tabindex + 10)) . '" value="1"' . (((empty ($_POST) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] == 1) || $_POST["ws_plugin__s2member_custom_reg_field_opt_in"]) ? ' checked="checked"' : '') . ' />' . "\n";
186
- echo $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in_label"] . "\n";
187
- echo '</label>' . "\n";
188
- echo '</p>';
189
- /**/
190
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
191
- do_action ("ws_plugin__s2member_during_custom_registration_fields_after_opt_in", get_defined_vars ());
192
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
193
- }
194
- /**/
195
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
196
- do_action ("ws_plugin__s2member_during_custom_registration_fields_after", get_defined_vars ());
197
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
198
  }
199
  /**/
200
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
 
 
 
 
201
  do_action ("ws_plugin__s2member_after_custom_registration_fields", get_defined_vars ());
202
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
203
  /**/
@@ -244,7 +243,7 @@ if (!function_exists ("ws_plugin__s2member_register_link_gen"))
244
  {
245
  function ws_plugin__s2member_register_link_gen ($subscr_id = FALSE, $custom = FALSE, $item_number = FALSE, $shrink = TRUE)
246
  {
247
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
248
  do_action ("ws_plugin__s2member_before_register_link_gen", get_defined_vars ());
249
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
250
  /**/
@@ -295,9 +294,7 @@ if (!function_exists ("ws_plugin__s2member_register"))
295
  /**/
296
  echo '<strong>Your Link Expired:</strong><br />Please contact Support if you need assistance.';
297
  /**/
298
- exit; /* $_GET["s2member_register"] has expired. Or it is simply invalid. */
299
- /**/
300
- exit;
301
  }
302
  /**/
303
  do_action ("ws_plugin__s2member_after_register", get_defined_vars ());
@@ -314,16 +311,16 @@ if (!function_exists ("ws_plugin__s2member_configure_user_registration"))
314
  global $wpdb; /* Global database object may be required for this routine. */
315
  static $processed; /* Prevents duplicate processing. */
316
  /**/
317
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
318
  do_action ("ws_plugin__s2member_before_configure_user_registration", get_defined_vars ());
319
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
320
  /**/
321
- if (!$processed && $user_id && is_array ($_POST = stripslashes_deep ($_POST)) && is_object ($user = new WP_User ($user_id)) && ($processed = true))
322
  {
323
  ws_plugin__s2member_email_config (); /* Configures From: header that will be used in new user notifications. */
324
  /**/
325
  if (!is_admin () /* Only run this particular routine whenever a Member [1-4] is registering themselves with cookies. */
326
- && ($subscr_id = ws_plugin__s2member_decrypt ($_COOKIE["s2member_subscr_id"])) && ($custom = ws_plugin__s2member_decrypt ($_COOKIE["s2member_custom"])) && preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9] [A-Z])?$/", ($level = ws_plugin__s2member_decrypt ($_COOKIE["s2member_level"])))/**/
327
  && (!$usermeta = $wpdb->get_row ("SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = 's2member_subscr_id' AND `meta_value` = '" . $wpdb->escape ($subscr_id) . "' LIMIT 1")))
328
  /* ^ This is for security ^ It checks the database to make sure the User/Member has not already registered in the past, with the same PayPal Subscr. ID. */
329
  {
@@ -341,8 +338,8 @@ if (!function_exists ("ws_plugin__s2member_configure_user_registration"))
341
  $name = trim ($fname . " " . $lname);
342
  /**/
343
  if (!$pass) /* s2Member password? */
344
- if ($GLOBALS["ws_plugin__s2member_generated_or_custom_password"])
345
- $pass = $GLOBALS["ws_plugin__s2member_generated_or_custom_password"];
346
  /**/
347
  if (!$pass) /* Also try to get the password from BuddyPress. */
348
  if ($_POST["signup_password"]) /* Field used by BuddyPress. */
@@ -367,12 +364,12 @@ if (!function_exists ("ws_plugin__s2member_configure_user_registration"))
367
  {
368
  $proxy = array ("s2member_paypal_notify" => "1", "s2member_paypal_proxy" => "s2member_transient_ipn_subscr_payment");
369
  ws_plugin__s2member_remote (add_query_arg ($proxy, get_bloginfo ("url")), stripslashes_deep ($subscr_payment));
370
- delete_transient($transient);
371
  }
372
  /**/
373
  setcookie ("s2member_signup_tracking", ws_plugin__s2member_encrypt ($subscr_id), time () + 31556926, "/");
374
  /**/
375
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
376
  do_action ("ws_plugin__s2member_during_configure_user_registration_front_side", get_defined_vars ());
377
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
378
  }
@@ -393,8 +390,8 @@ if (!function_exists ("ws_plugin__s2member_configure_user_registration"))
393
  $name = trim ($fname . " " . $lname);
394
  /**/
395
  if (!$pass) /* s2Member password? */
396
- if ($GLOBALS["ws_plugin__s2member_generated_or_custom_password"])
397
- $pass = $GLOBALS["ws_plugin__s2member_generated_or_custom_password"];
398
  /**/
399
  if (!$pass) /* Also try to get the password from BuddyPress. */
400
  if ($_POST["signup_password"]) /* Field used by BuddyPress. */
@@ -402,7 +399,7 @@ if (!function_exists ("ws_plugin__s2member_configure_user_registration"))
402
  /**/
403
  $opt_in = (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] || $_POST["ws_plugin__s2member_custom_reg_field_opt_in"]) ? true : false;
404
  /**/
405
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
406
  do_action ("ws_plugin__s2member_during_configure_user_registration_front_side", get_defined_vars ());
407
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
408
  }
@@ -423,8 +420,8 @@ if (!function_exists ("ws_plugin__s2member_configure_user_registration"))
423
  $name = trim ($fname . " " . $lname);
424
  /**/
425
  if (!$pass) /* s2Member password? */
426
- if ($GLOBALS["ws_plugin__s2member_generated_or_custom_password"])
427
- $pass = $GLOBALS["ws_plugin__s2member_generated_or_custom_password"];
428
  /**/
429
  if (!$pass) /* Also try the `Users -> Add New` form. */
430
  if ($_POST["pass1"]) /* Field used by admin form. */
@@ -432,7 +429,7 @@ if (!function_exists ("ws_plugin__s2member_configure_user_registration"))
432
  /**/
433
  $opt_in = (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] || $_POST["ws_plugin__s2member_custom_reg_field_opt_in"]) ? true : false;
434
  /**/
435
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
436
  do_action ("ws_plugin__s2member_during_configure_user_registration_admin_side", get_defined_vars ());
437
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
438
  }
@@ -450,9 +447,11 @@ if (!function_exists ("ws_plugin__s2member_configure_user_registration"))
450
  {
451
  if ($field = trim ($field, "* \t\n\r\0\x0B")) /* Don't process empty fields. */
452
  {
453
- $field = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field));
454
- if (strlen ($_POST["ws_plugin__s2member_custom_reg_field_" . $field]))
455
- $fields[$field] = trim ($_POST["ws_plugin__s2member_custom_reg_field_" . $field]);
 
 
456
  }
457
  }
458
  /**/
@@ -463,27 +462,27 @@ if (!function_exists ("ws_plugin__s2member_configure_user_registration"))
463
  if ($urls = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["registration_notification_urls"])
464
  foreach (preg_split ("/[\r\n\t]+/", $urls) as $url) /* Notify each of the urls. */
465
  if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)))
466
- if (($url = preg_replace ("/%%level%%/i", urlencode ($level), $url)))
467
- if (($url = preg_replace ("/%%user_first_name%%/i", urlencode ($fname), $url)))
468
- if (($url = preg_replace ("/%%user_last_name%%/i", urlencode ($lname), $url)))
469
- if (($url = preg_replace ("/%%user_full_name%%/i", urlencode ($name), $url)))
470
- if (($url = preg_replace ("/%%user_email%%/i", urlencode ($email), $url)))
471
- if (($url = preg_replace ("/%%user_login%%/i", urlencode ($login), $url)))
472
- if (($url = preg_replace ("/%%user_pass%%/i", urlencode ($pass), $url)))
473
  if (($url = trim ($url))) /* Empty? */
474
- ws_plugin__s2member_remote($url);
475
  /**/
476
  setcookie ("s2member_subscr_id", "", time () + 31556926, "/");
477
  setcookie ("s2member_custom", "", time () + 31556926, "/");
478
  setcookie ("s2member_level", "", time () + 31556926, "/");
479
  /**/
480
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
481
  do_action ("ws_plugin__s2member_during_configure_user_registration", get_defined_vars ());
482
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
483
  }
484
  }
485
  /**/
486
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
487
  do_action ("ws_plugin__s2member_after_configure_user_registration", get_defined_vars ());
488
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
489
  /**/
@@ -507,17 +506,50 @@ if (!function_exists ("wp_generate_password"))
507
  {
508
  $password = ws_plugin__s2member_random_str_gen ($length, $special_chars);
509
  /**/
510
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
511
  do_action ("ws_plugin__s2member_before_generate_password", get_defined_vars ());
512
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
513
  /**/
514
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_password"])
515
- if (wp_verify_nonce (trim (stripslashes ($_POST["ws_plugin__s2member_registration"])), "ws-plugin--s2member-registration"))
516
- if ($custom = trim (stripslashes ($_POST["ws_plugin__s2member_custom_reg_field_user_pass"])))
517
- $password = $custom;
 
 
 
 
 
 
 
 
 
 
518
  /**/
519
- return ($GLOBALS["ws_plugin__s2member_generated_or_custom_password"] = $password);
520
  }
521
  }
522
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
523
  ?>
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
  /*
17
+ Forces a default Role for new registrations not tied to an incoming payment.
18
  Attach to: add_filter("pre_option_default_role");
19
  */
20
  if (!function_exists ("ws_plugin__s2member_force_default_role"))
42
  {
43
  return apply_filters ("ws_plugin__s2member_check_register_access", ($users_can_register = "1"), get_defined_vars ());
44
  }
45
+ else if ($pagenow !== "options-general.php" && ($subscr_id = ws_plugin__s2member_decrypt ($_COOKIE["s2member_subscr_id"])) && ($custom = ws_plugin__s2member_decrypt ($_COOKIE["s2member_custom"])) && preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?$/", ($level = ws_plugin__s2member_decrypt ($_COOKIE["s2member_level"]))))
46
  {
47
  global $wpdb; /* Global database object reference. */
48
  /**/
69
  /**/
70
  if ($pagenow === "options-general.php" && !isset ($_GET["page"]))
71
  {
72
+ $notice = "<em>* Note: The s2Member plugin has control over two options on this page. <code>Anyone Can Register = " . esc_html (get_option ("users_can_register")) . "</code>, and <code>Default Role = " . esc_html (get_option ("default_role")) . "</code>. For further details, see: <code>s2Member -> General Options -> Open Registration</code>.";
73
  /**/
74
  do_action ("ws_plugin__s2member_during_general_ops_notice", get_defined_vars ());
75
  /**/
91
  {
92
  do_action ("ws_plugin__s2member_before_custom_registration_fields", get_defined_vars ());
93
  /**/
94
+ echo '<input type="hidden" name="ws_plugin__s2member_registration" value="' . esc_attr (wp_create_nonce ("ws-plugin--s2member-registration")) . '" />' . "\n";
95
+ /**/
96
+ $tabindex = 20; /* Incremented tabindex starting with 20. */
97
+ /**/
98
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
99
+ do_action ("ws_plugin__s2member_during_custom_registration_fields_before", get_defined_vars ());
100
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
101
+ /**/
102
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_password"] && function_exists ("ws_plugin__s2member_generate_password"))
103
  {
104
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
105
+ do_action ("ws_plugin__s2member_during_custom_registration_fields_before_user_pass", get_defined_vars ());
106
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
107
  /**/
108
+ echo '<p>' . "\n";
109
+ echo '<label>' . "\n";
110
+ echo 'Password *' . "\n";
111
+ echo '<input aria-required="true" type="password" maxlength="100" autocomplete="off" name="ws_plugin__s2member_custom_reg_field_user_pass" id="ws-plugin--s2member-custom-reg-field-user-pass" class="ws-plugin--s2member-custom-reg-field input" size="25" value="' . format_to_edit (trim (stripslashes ($_POST["ws_plugin__s2member_custom_reg_field_user_pass"]))) . '" tabindex="' . esc_attr (($tabindex = $tabindex + 10)) . '" />' . "\n";
112
+ echo '</label>' . "\n";
113
+ echo '</p>';
114
  /**/
115
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
116
+ do_action ("ws_plugin__s2member_during_custom_registration_fields_after_user_pass", get_defined_vars ());
117
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
118
+ }
119
+ /**/
120
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
121
+ do_action ("ws_plugin__s2member_during_custom_registration_fields_before_first_name", get_defined_vars ());
122
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
123
+ /**/
124
+ echo '<p>' . "\n";
125
+ echo '<label>' . "\n";
126
+ echo 'First Name *' . "\n";
127
+ 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 input" size="25" value="' . format_to_edit (trim (stripslashes ($_POST["ws_plugin__s2member_custom_reg_field_first_name"]))) . '" tabindex="' . esc_attr (($tabindex = $tabindex + 10)) . '" />' . "\n";
128
+ echo '</label>' . "\n";
129
+ echo '</p>';
130
+ /**/
131
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
132
+ do_action ("ws_plugin__s2member_during_custom_registration_fields_after_first_name", get_defined_vars ());
133
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
134
+ /**/
135
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
136
+ do_action ("ws_plugin__s2member_during_custom_registration_fields_before_last_name", get_defined_vars ());
137
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
138
+ /**/
139
+ echo '<p>' . "\n";
140
+ echo '<label>' . "\n";
141
+ echo 'Last Name *' . "\n";
142
+ 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 input" size="25" value="' . format_to_edit (trim (stripslashes ($_POST["ws_plugin__s2member_custom_reg_field_last_name"]))) . '" tabindex="' . esc_attr (($tabindex = $tabindex + 10)) . '" />' . "\n";
143
+ echo '</label>' . "\n";
144
+ echo '</p>';
145
+ /**/
146
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
147
+ do_action ("ws_plugin__s2member_during_custom_registration_fields_after_last_name", get_defined_vars ());
148
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
149
+ /**/
150
+ foreach (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) as $field)
151
+ {
152
+ $req = preg_match ("/\*/", $field); /* Required fields should be wrapped inside asterisks. */
153
+ $req = ($req) ? ' aria-required="true"' : ''; /* Has JavaScript validation applied. */
154
  /**/
155
+ if ($field = trim ($field, "* \t\n\r\0\x0B")) /* Don't process empty fields. */
156
  {
157
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
158
+ do_action ("ws_plugin__s2member_during_custom_registration_fields_before_custom_fields", get_defined_vars ());
159
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
160
  /**/
161
+ $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field));
162
+ $field_id_class = preg_replace ("/_/", "-", $field_var);
163
+ /**/
164
  echo '<p>' . "\n";
165
  echo '<label>' . "\n";
166
+ echo esc_html ($field) . (($req) ? " *" : "") . "\n";
167
+ echo '<input' . $req . ' type="text" maxlength="100" name="ws_plugin__s2member_custom_reg_field_' . $field_var . '" id="ws-plugin--s2member-custom-reg-field-' . $field_id_class . '" class="ws-plugin--s2member-custom-reg-field input" size="25" value="' . format_to_edit (trim (stripslashes ($_POST["ws_plugin__s2member_custom_reg_field_" . $field_var]))) . '" tabindex="' . esc_attr (($tabindex = $tabindex + 10)) . '" />' . "\n";
168
  echo '</label>' . "\n";
169
  echo '</p>';
170
  /**/
171
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
172
+ do_action ("ws_plugin__s2member_during_custom_registration_fields_after_custom_fields", get_defined_vars ());
173
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
174
  }
175
+ }
176
+ /**/
177
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] && ws_plugin__s2member_list_servers_integrated ())
178
+ {
179
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
180
+ do_action ("ws_plugin__s2member_during_custom_registration_fields_before_opt_in", get_defined_vars ());
 
 
 
 
 
 
 
 
 
 
 
 
181
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
182
  /**/
183
  echo '<p>' . "\n";
184
  echo '<label>' . "\n";
185
+ echo '<input type="checkbox" name="ws_plugin__s2member_custom_reg_field_opt_in" id="ws-plugin--s2member-custom-reg-field-opt-in" value="1"' . (((empty ($_POST) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] == 1) || $_POST["ws_plugin__s2member_custom_reg_field_opt_in"]) ? ' checked="checked"' : '') . ' tabindex="' . esc_attr (($tabindex = $tabindex + 10)) . '" />' . "\n";
186
+ echo $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in_label"] . "\n";
187
  echo '</label>' . "\n";
188
  echo '</p>';
189
  /**/
190
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
191
+ do_action ("ws_plugin__s2member_during_custom_registration_fields_after_opt_in", get_defined_vars ());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
192
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
193
  }
194
  /**/
195
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
196
+ do_action ("ws_plugin__s2member_during_custom_registration_fields_after", get_defined_vars ());
197
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
198
+ /**/
199
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
200
  do_action ("ws_plugin__s2member_after_custom_registration_fields", get_defined_vars ());
201
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
202
  /**/
243
  {
244
  function ws_plugin__s2member_register_link_gen ($subscr_id = FALSE, $custom = FALSE, $item_number = FALSE, $shrink = TRUE)
245
  {
246
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
247
  do_action ("ws_plugin__s2member_before_register_link_gen", get_defined_vars ());
248
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
249
  /**/
294
  /**/
295
  echo '<strong>Your Link Expired:</strong><br />Please contact Support if you need assistance.';
296
  /**/
297
+ exit (); /* $_GET["s2member_register"] has expired. Or it is simply invalid. */
 
 
298
  }
299
  /**/
300
  do_action ("ws_plugin__s2member_after_register", get_defined_vars ());
311
  global $wpdb; /* Global database object may be required for this routine. */
312
  static $processed; /* Prevents duplicate processing. */
313
  /**/
314
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
315
  do_action ("ws_plugin__s2member_before_configure_user_registration", get_defined_vars ());
316
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
317
  /**/
318
+ if (!$processed && is_array ($_POST = stripslashes_deep ($_POST)) && $user_id && is_object ($user = new WP_User ($user_id)) && $user->ID && ($processed = true))
319
  {
320
  ws_plugin__s2member_email_config (); /* Configures From: header that will be used in new user notifications. */
321
  /**/
322
  if (!is_admin () /* Only run this particular routine whenever a Member [1-4] is registering themselves with cookies. */
323
+ && ($subscr_id = ws_plugin__s2member_decrypt ($_COOKIE["s2member_subscr_id"])) && ($custom = ws_plugin__s2member_decrypt ($_COOKIE["s2member_custom"])) && preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?$/", ($level = ws_plugin__s2member_decrypt ($_COOKIE["s2member_level"])))/**/
324
  && (!$usermeta = $wpdb->get_row ("SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = 's2member_subscr_id' AND `meta_value` = '" . $wpdb->escape ($subscr_id) . "' LIMIT 1")))
325
  /* ^ This is for security ^ It checks the database to make sure the User/Member has not already registered in the past, with the same PayPal Subscr. ID. */
326
  {
338
  $name = trim ($fname . " " . $lname);
339
  /**/
340
  if (!$pass) /* s2Member password? */
341
+ if ($GLOBALS["ws_plugin__s2member_generate_password_return"])
342
+ $pass = $GLOBALS["ws_plugin__s2member_generate_password_return"];
343
  /**/
344
  if (!$pass) /* Also try to get the password from BuddyPress. */
345
  if ($_POST["signup_password"]) /* Field used by BuddyPress. */
364
  {
365
  $proxy = array ("s2member_paypal_notify" => "1", "s2member_paypal_proxy" => "s2member_transient_ipn_subscr_payment");
366
  ws_plugin__s2member_remote (add_query_arg ($proxy, get_bloginfo ("url")), stripslashes_deep ($subscr_payment));
367
+ delete_transient ($transient);
368
  }
369
  /**/
370
  setcookie ("s2member_signup_tracking", ws_plugin__s2member_encrypt ($subscr_id), time () + 31556926, "/");
371
  /**/
372
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
373
  do_action ("ws_plugin__s2member_during_configure_user_registration_front_side", get_defined_vars ());
374
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
375
  }
390
  $name = trim ($fname . " " . $lname);
391
  /**/
392
  if (!$pass) /* s2Member password? */
393
+ if ($GLOBALS["ws_plugin__s2member_generate_password_return"])
394
+ $pass = $GLOBALS["ws_plugin__s2member_generate_password_return"];
395
  /**/
396
  if (!$pass) /* Also try to get the password from BuddyPress. */
397
  if ($_POST["signup_password"]) /* Field used by BuddyPress. */
399
  /**/
400
  $opt_in = (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] || $_POST["ws_plugin__s2member_custom_reg_field_opt_in"]) ? true : false;
401
  /**/
402
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
403
  do_action ("ws_plugin__s2member_during_configure_user_registration_front_side", get_defined_vars ());
404
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
405
  }
420
  $name = trim ($fname . " " . $lname);
421
  /**/
422
  if (!$pass) /* s2Member password? */
423
+ if ($GLOBALS["ws_plugin__s2member_generate_password_return"])
424
+ $pass = $GLOBALS["ws_plugin__s2member_generate_password_return"];
425
  /**/
426
  if (!$pass) /* Also try the `Users -> Add New` form. */
427
  if ($_POST["pass1"]) /* Field used by admin form. */
429
  /**/
430
  $opt_in = (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] || $_POST["ws_plugin__s2member_custom_reg_field_opt_in"]) ? true : false;
431
  /**/
432
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
433
  do_action ("ws_plugin__s2member_during_configure_user_registration_admin_side", get_defined_vars ());
434
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
435
  }
447
  {
448
  if ($field = trim ($field, "* \t\n\r\0\x0B")) /* Don't process empty fields. */
449
  {
450
+ $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field));
451
+ $field_id_class = preg_replace ("/_/", "-", $field_var);
452
+ /**/
453
+ if (strlen ($_POST["ws_plugin__s2member_custom_reg_field_" . $field_var]))
454
+ $fields[$field_var] = trim ($_POST["ws_plugin__s2member_custom_reg_field_" . $field_var]);
455
  }
456
  }
457
  /**/
462
  if ($urls = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["registration_notification_urls"])
463
  foreach (preg_split ("/[\r\n\t]+/", $urls) as $url) /* Notify each of the urls. */
464
  if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)))
465
+ if (($url = preg_replace ("/%%level%%/i", ws_plugin__s2member_esc_ds (urlencode ($level)), $url)))
466
+ if (($url = preg_replace ("/%%user_first_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($fname)), $url)))
467
+ if (($url = preg_replace ("/%%user_last_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($lname)), $url)))
468
+ if (($url = preg_replace ("/%%user_full_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($name)), $url)))
469
+ if (($url = preg_replace ("/%%user_email%%/i", ws_plugin__s2member_esc_ds (urlencode ($email)), $url)))
470
+ if (($url = preg_replace ("/%%user_login%%/i", ws_plugin__s2member_esc_ds (urlencode ($login)), $url)))
471
+ if (($url = preg_replace ("/%%user_pass%%/i", ws_plugin__s2member_esc_ds (urlencode ($pass)), $url)))
472
  if (($url = trim ($url))) /* Empty? */
473
+ ws_plugin__s2member_remote ($url);
474
  /**/
475
  setcookie ("s2member_subscr_id", "", time () + 31556926, "/");
476
  setcookie ("s2member_custom", "", time () + 31556926, "/");
477
  setcookie ("s2member_level", "", time () + 31556926, "/");
478
  /**/
479
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
480
  do_action ("ws_plugin__s2member_during_configure_user_registration", get_defined_vars ());
481
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
482
  }
483
  }
484
  /**/
485
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
486
  do_action ("ws_plugin__s2member_after_configure_user_registration", get_defined_vars ());
487
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
488
  /**/
506
  {
507
  $password = ws_plugin__s2member_random_str_gen ($length, $special_chars);
508
  /**/
509
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
510
  do_action ("ws_plugin__s2member_before_generate_password", get_defined_vars ());
511
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
512
  /**/
513
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_password"])
514
+ if ($custom = trim (stripslashes ($_POST["ws_plugin__s2member_custom_reg_field_user_pass"])))
515
+ {
516
+ $password = $custom; /* Use custom password and filter login messages. */
517
+ add_filter ("login_messages", "_ws_plugin__s2member_registration_login_message");
518
+ }
519
+ /**/
520
+ return ($GLOBALS["ws_plugin__s2member_generate_password_return"] = $password);
521
+ }
522
+ /**/
523
+ function _ws_plugin__s2member_registration_login_message ($message = FALSE)
524
+ {
525
+ if ($message === "Registration complete. Please check your e-mail.")
526
+ return apply_filters ("_ws_plugin__s2member_registration_login_message", "Registration complete. Please log in.", get_defined_vars ());
527
  /**/
528
+ return $message;
529
  }
530
  }
531
  }
532
+ /*
533
+ Function hides password fields for demo users.
534
+
535
+ Demo accounts ( where the Username MUST be "demo" ), will NOT be allowed to change their password.
536
+ Any other restrictions you need to impose must be done through custom programming, using s2Member's Advanced Conditionals.
537
+ See `s2Member -> API Scripting -> Advanced Conditionals`.
538
+
539
+ Attach to: add_filter("show_password_fields");
540
+ */
541
+ if (!function_exists ("ws_plugin__s2member_demo_hide_password_fields"))
542
+ {
543
+ function ws_plugin__s2member_demo_hide_password_fields ($show = TRUE, $profileuser = FALSE)
544
+ {
545
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
546
+ do_action ("ws_plugin__s2member_before_demo_hide_password_fields", get_defined_vars ());
547
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
548
+ /**/
549
+ if ($profileuser->user_login === "demo")
550
+ return ($show = false);
551
+ /**/
552
+ return $show;
553
+ }
554
+ }
555
  ?>
includes/functions/ruri-level-access.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
  /*
17
  Function for handling Request URI Level Access permissions.
18
  Attach to: add_action("template_redirect");
@@ -29,25 +29,30 @@ if (!function_exists ("ws_plugin__s2member_check_ruri_level_access"))
29
  {
30
  $current_user = (is_user_logged_in ()) ? wp_get_current_user () : false; /* Is a user logged in? */
31
  /**/
 
 
 
 
 
32
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_ruris"])
33
  foreach (preg_split ("/[\r\n\t]+/", ws_plugin__s2member_fill_ruri_level_access_rc_vars ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_ruris"], $current_user)) as $str)
34
  if ($str && preg_match ("/" . preg_quote ($str, "/") . "/", $_SERVER["REQUEST_URI"]) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level1")) && wp_redirect (add_query_arg ("s2member_level_req", "1", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
35
- exit;
36
  /**/
37
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_ruris"])
38
  foreach (preg_split ("/[\r\n\t]+/", ws_plugin__s2member_fill_ruri_level_access_rc_vars ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_ruris"], $current_user)) as $str)
39
  if ($str && preg_match ("/" . preg_quote ($str, "/") . "/", $_SERVER["REQUEST_URI"]) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level2")) && wp_redirect (add_query_arg ("s2member_level_req", "2", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
40
- exit;
41
  /**/
42
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_ruris"])
43
  foreach (preg_split ("/[\r\n\t]+/", ws_plugin__s2member_fill_ruri_level_access_rc_vars ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_ruris"], $current_user)) as $str)
44
  if ($str && preg_match ("/" . preg_quote ($str, "/") . "/", $_SERVER["REQUEST_URI"]) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level3")) && wp_redirect (add_query_arg ("s2member_level_req", "3", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
45
- exit;
46
  /**/
47
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_ruris"])
48
  foreach (preg_split ("/[\r\n\t]+/", ws_plugin__s2member_fill_ruri_level_access_rc_vars ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_ruris"], $current_user)) as $str)
49
  if ($str && preg_match ("/" . preg_quote ($str, "/") . "/", $_SERVER["REQUEST_URI"]) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level4")) && wp_redirect (add_query_arg ("s2member_level_req", "4", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
50
- exit;
51
  /**/
52
  do_action ("ws_plugin__s2member_during_check_ruri_level_access", get_defined_vars ());
53
  }
@@ -64,15 +69,15 @@ if (!function_exists ("ws_plugin__s2member_fill_ruri_level_access_rc_vars"))
64
  {
65
  function ws_plugin__s2member_fill_ruri_level_access_rc_vars ($uris = FALSE, $current_user = FALSE)
66
  {
67
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
68
  do_action ("ws_plugin__s2member_before_fill_ruri_level_access_rc_vars", get_defined_vars ());
69
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
70
  /**/
71
  $current_user_login = (is_object ($current_user)) ? strtolower ($current_user->user_login) : "";
72
  $current_user_ID = (is_object ($current_user)) ? (string)$current_user->ID : "";
73
  /**/
74
- $uris = preg_replace ("/%%current_user_login%%/i", $current_user_login, $uris);
75
- $uris = preg_replace ("/%%current_user_ID%%/i", $current_user_ID, $uris);
76
  /**/
77
  return apply_filters ("ws_plugin__s2member_fill_ruri_level_access_rc_vars", $uris, get_defined_vars ());
78
  }
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit("Do not access this file directly.");
16
  /*
17
  Function for handling Request URI Level Access permissions.
18
  Attach to: add_action("template_redirect");
29
  {
30
  $current_user = (is_user_logged_in ()) ? wp_get_current_user () : false; /* Is a user logged in? */
31
  /**/
32
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_ruris"])
33
+ foreach (preg_split ("/[\r\n\t]+/", ws_plugin__s2member_fill_ruri_level_access_rc_vars ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_ruris"], $current_user)) as $str)
34
+ if ($str && preg_match ("/" . preg_quote ($str, "/") . "/", $_SERVER["REQUEST_URI"]) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level0")) && wp_redirect (add_query_arg ("s2member_level_req", "0", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
35
+ exit ();
36
+ /**/
37
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_ruris"])
38
  foreach (preg_split ("/[\r\n\t]+/", ws_plugin__s2member_fill_ruri_level_access_rc_vars ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_ruris"], $current_user)) as $str)
39
  if ($str && preg_match ("/" . preg_quote ($str, "/") . "/", $_SERVER["REQUEST_URI"]) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level1")) && wp_redirect (add_query_arg ("s2member_level_req", "1", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
40
+ exit ();
41
  /**/
42
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_ruris"])
43
  foreach (preg_split ("/[\r\n\t]+/", ws_plugin__s2member_fill_ruri_level_access_rc_vars ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_ruris"], $current_user)) as $str)
44
  if ($str && preg_match ("/" . preg_quote ($str, "/") . "/", $_SERVER["REQUEST_URI"]) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level2")) && wp_redirect (add_query_arg ("s2member_level_req", "2", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
45
+ exit ();
46
  /**/
47
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_ruris"])
48
  foreach (preg_split ("/[\r\n\t]+/", ws_plugin__s2member_fill_ruri_level_access_rc_vars ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_ruris"], $current_user)) as $str)
49
  if ($str && preg_match ("/" . preg_quote ($str, "/") . "/", $_SERVER["REQUEST_URI"]) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level3")) && wp_redirect (add_query_arg ("s2member_level_req", "3", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
50
+ exit ();
51
  /**/
52
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_ruris"])
53
  foreach (preg_split ("/[\r\n\t]+/", ws_plugin__s2member_fill_ruri_level_access_rc_vars ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_ruris"], $current_user)) as $str)
54
  if ($str && preg_match ("/" . preg_quote ($str, "/") . "/", $_SERVER["REQUEST_URI"]) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level4")) && wp_redirect (add_query_arg ("s2member_level_req", "4", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
55
+ exit ();
56
  /**/
57
  do_action ("ws_plugin__s2member_during_check_ruri_level_access", get_defined_vars ());
58
  }
69
  {
70
  function ws_plugin__s2member_fill_ruri_level_access_rc_vars ($uris = FALSE, $current_user = FALSE)
71
  {
72
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
73
  do_action ("ws_plugin__s2member_before_fill_ruri_level_access_rc_vars", get_defined_vars ());
74
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
75
  /**/
76
  $current_user_login = (is_object ($current_user)) ? strtolower ($current_user->user_login) : "";
77
  $current_user_ID = (is_object ($current_user)) ? (string)$current_user->ID : "";
78
  /**/
79
+ $uris = preg_replace ("/%%current_user_login%%/i", ws_plugin__s2member_esc_ds ($current_user_login), $uris);
80
+ $uris = preg_replace ("/%%current_user_ID%%/i", ws_plugin__s2member_esc_ds ($current_user_ID), $uris);
81
  /**/
82
  return apply_filters ("ws_plugin__s2member_fill_ruri_level_access_rc_vars", $uris, get_defined_vars ());
83
  }
includes/functions/shortcodes.inc.php DELETED
@@ -1,142 +0,0 @@
1
- <?php
2
- /*
3
- Copyright: © 2009 WebSharks, Inc. ( coded in the USA )
4
- <mailto:support@websharks-inc.com> <http://www.websharks-inc.com/>
5
-
6
- Released under the terms of the GNU General Public License.
7
- You should have received a copy of the GNU General Public License,
8
- along with this software. In the main directory, see: /licensing/
9
- If not, see: <http://www.gnu.org/licenses/>.
10
- */
11
- /*
12
- Direct access denial.
13
- */
14
- if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
- /*
17
- Function that handles the Shortcode for [s2Member-PayPal-Button /].
18
-
19
- [s2Member-PayPal-Button level="1" ccaps="" desc="" ps="paypal" cc="USD" custom="www.domain.com" tp="0" tt="D" ra="0.01" rp="1" rt="M" rr="1" image="default" /]
20
- [s2Member-PayPal-Button page="0" exp="72" desc="Specific Post/Page Access" ps="paypal" cc="USD" custom="www.domain.com" ra="0.01" sp="1" image="default" /]
21
-
22
- The image attribute will be used as a custom image; when provided; and not equal to "default".
23
-
24
- The desc attribute is only required for Specific Post/Page buttons, optional for others.
25
- The ids attribute is only used for Specific Post/Page buttons.
26
-
27
- PayPal® Specific Post/Page Buttons are identified by sp="1".
28
- PayPal® Modification Buttons are identified by mb="1".
29
- PayPal® Cancellation Buttons are identified by cb="1".
30
-
31
- Attach to: add_shortcode("s2Member-PayPal-Button");
32
- */
33
- if (!function_exists ("ws_plugin__s2member_paypal_button"))
34
- {
35
- function ws_plugin__s2member_paypal_button ($attr = FALSE, $content = FALSE, $shortcode = FALSE)
36
- {
37
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
38
- do_action ("ws_plugin__s2member_before_paypal_button", get_defined_vars ());
39
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
40
- /**/
41
- $attr["tt"] = strtoupper ($attr["tt"]); /* Term lengths absolutely must be provided in upper-case format. */
42
- $attr["rt"] = strtoupper ($attr["rt"]); /* Term lengths absolutely must be provided in upper-case format. */
43
- $attr["rr"] = strtoupper ($attr["rr"]); /* Must be provided in upper-case format. Numerical, or BN value. */
44
- $attr["ccaps"] = strtolower ($attr["ccaps"]); /* Custom Capabilities must be typed in lower-case format. */
45
- /**/
46
- $attr["rr"] = ($attr["rt"] === "L") ? "BN" : $attr["rr"]; /* Lifetime Subscriptions absolutely require Buy Now functionality in the (rr) attribute. */
47
- /**/
48
- $attr["ids"] = (!$attr["ids"] && $attr["page"]) ? $attr["page"] : $attr["ids"]; /* Backward compatibilty for "page", which was renamed to "ids" in s2Member v3.0. */
49
- /**/
50
- $sc = shortcode_atts (array ("ids" => "0", "exp" => "72", "level" => "1", "ccaps" => "", "desc" => "", "ps" => "paypal", "cc" => "USD", "custom" => $_SERVER["HTTP_HOST"], "tp" => "0", "tt" => "D", "ra" => "0.01", "rp" => "1", "rt" => "M", "rr" => "1", "mb" => "0", "cb" => "0", "sp" => "0", "image" => "default"), $attr);
51
- /**/
52
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
53
- do_action ("ws_plugin__s2member_before_paypal_button_after_shortcode_atts", get_defined_vars ());
54
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
55
- /**/
56
- if ($sc["cb"]) /* This is a special routine for Cancellation Buttons. Cancellation Buttons use a different template. */
57
- {
58
- $code = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/c-button.html"));
59
- $code = preg_replace ("/%%endpoint%%/", (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "www.sandbox.paypal.com" : "www.paypal.com"), $code);
60
- $code = preg_replace ("/%%paypal_business%%/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"], $code);
61
- /**/
62
- $code = ($sc["image"] && $sc["image"] !== "default") ? preg_replace ('/ src\="(.*?)"/', ' src="' . $sc["image"] . '"', $code) : $code;
63
- /**/
64
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
65
- do_action ("ws_plugin__s2member_during_paypal_button_cb", get_defined_vars ());
66
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
67
- }
68
- /**/
69
- else if ($sc["sp"]) /* This is a special routine for Specific Post/Page Buttons. Specific Post/Page Buttons use a different template. */
70
- {
71
- $code = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/sp-button.html"));
72
- $code = preg_replace ("/%%endpoint%%/", (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "www.sandbox.paypal.com" : "www.paypal.com"), $code);
73
- $code = preg_replace ("/%%paypal_business%%/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"], $code);
74
- $code = preg_replace ("/%%cancel_return%%/", get_bloginfo ("url"), $code);
75
- $code = preg_replace ("/%%notify_url%%/", get_bloginfo ("url") . "/?s2member_paypal_notify=1", $code);
76
- $code = preg_replace ("/%%return%%/", get_bloginfo ("url") . "/?s2member_paypal_return=1", $code);
77
- $code = preg_replace ("/%%domain%%/", strtolower ($_SERVER["HTTP_HOST"]), $code);
78
- /**/
79
- $code = preg_replace ('/ name\="item_name" value\="(.*?)"/', ' name="item_name" value="' . $sc["desc"] . '"', $code);
80
- $code = preg_replace ('/ name\="item_number" value\="(.*?)"/', ' name="item_number" value="sp:' . $sc["ids"] . ':' . $sc["exp"] . '"', $code);
81
- $code = preg_replace ('/ name\="page_style" value\="(.*?)"/', ' name="page_style" value="' . $sc["ps"] . '"', $code);
82
- $code = preg_replace ('/ name\="currency_code" value\="(.*?)"/', ' name="currency_code" value="' . $sc["cc"] . '"', $code);
83
- $code = preg_replace ('/ name\="custom" value\="(.*?)"/', ' name="custom" value="' . $sc["custom"] . '"', $code);
84
- $code = preg_replace ('/ name\="amount" value\="(.*?)"/', ' name="amount" value="' . $sc["ra"] . '"', $code);
85
- /**/
86
- $code = ($sc["image"] && $sc["image"] !== "default") ? preg_replace ('/ src\="(.*?)"/', ' src="' . $sc["image"] . '"', $code) : $code;
87
- /**/
88
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
89
- do_action ("ws_plugin__s2member_during_paypal_button_sp", get_defined_vars ());
90
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
91
- }
92
- else /* Otherwise, we'll process this Button normally, using the Membership routines. Also handles Modification Buttons. */
93
- {
94
- $sc["desc"] = (!$sc["desc"]) ? $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $sc["level"] . "_label"] : $sc["desc"];
95
- /**/
96
- $sc["level_ccaps_eotper"] = ($sc["rr"] === "BN" && $sc["rt"] !== "L") ? $sc["level"] . ":" . $sc["ccaps"] . ":" . $sc["rp"] . " " . $sc["rt"] : $sc["level"] . ":" . $sc["ccaps"];
97
- $sc["level_ccaps_eotper"] = rtrim ($sc["level_ccaps_eotper"], ":"); /* Clean any trailing separators from this string. */
98
- /**/
99
- $code = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/button.html"));
100
- $code = preg_replace ("/%%endpoint%%/", (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "www.sandbox.paypal.com" : "www.paypal.com"), $code);
101
- $code = preg_replace ("/%%paypal_business%%/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"], $code);
102
- $code = preg_replace ("/%%level_label%%/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $sc["level"] . "_label"], $code);
103
- $code = preg_replace ("/%%cancel_return%%/", get_bloginfo ("url"), $code); /* This brings them back to Front Page. */
104
- $code = preg_replace ("/%%notify_url%%/", get_bloginfo ("url") . "/?s2member_paypal_notify=1", $code);
105
- $code = preg_replace ("/%%return%%/", get_bloginfo ("url") . "/?s2member_paypal_return=1", $code);
106
- $code = preg_replace ("/%%domain%%/", strtolower ($_SERVER["HTTP_HOST"]), $code);
107
- $code = preg_replace ("/%%level%%/", $sc["level"], $code);
108
- /**/
109
- $code = preg_replace ('/ \<\!--(\<input type\="hidden" name\="(amount|src|sra|a1|p1|t1|a3|p3|t3)" value\="(.*?)" \/\>)--\>/', " $1", $code);
110
- $code = ($sc["tp"] <= 0) ? preg_replace ('/ (\<input type\="hidden" name\="(a1|p1|t1)" value\="(.*?)" \/\>)/', " <!--$1-->", $code) : $code;
111
- $code = ($sc["rr"] === "BN") ? preg_replace ('/ (\<input type\="hidden" name\="cmd" value\=")(.*?)(" \/\>)/', " $1_xclick$3", $code) : $code;
112
- $code = ($sc["rr"] === "BN") ? preg_replace ('/ (\<input type\="hidden" name\="(src|sra|a1|p1|t1|a3|p3|t3)" value\="(.*?)" \/\>)/', " <!--$1-->", $code) : $code;
113
- $code = ($sc["rr"] !== "BN") ? preg_replace ('/ (\<input type\="hidden" name\="cmd" value\=")(.*?)(" \/\>)/', " $1_xclick-subscriptions$3", $code) : $code;
114
- $code = ($sc["rr"] !== "BN") ? preg_replace ('/ (\<input type\="hidden" name\="amount" value\="(.*?)" \/\>)/', " <!--$1-->", $code) : $code;
115
- /**/
116
- $code = preg_replace ('/ name\="item_name" value\="(.*?)"/', ' name="item_name" value="' . $sc["desc"] . '"', $code);
117
- $code = preg_replace ('/ name\="item_number" value\="(.*?)"/', ' name="item_number" value="' . $sc["level_ccaps_eotper"] . '"', $code);
118
- $code = preg_replace ('/ name\="page_style" value\="(.*?)"/', ' name="page_style" value="' . $sc["ps"] . '"', $code);
119
- $code = preg_replace ('/ name\="currency_code" value\="(.*?)"/', ' name="currency_code" value="' . $sc["cc"] . '"', $code);
120
- $code = preg_replace ('/ name\="custom" value\="(.*?)"/', ' name="custom" value="' . $sc["custom"] . '"', $code);
121
- $code = preg_replace ('/ name\="on0" value\="(.*?)"/', ' name="on0" value="' . S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0 . '"', $code);
122
- $code = preg_replace ('/ name\="os0" value\="(.*?)"/', ' name="os0" value="' . S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0 . '"', $code);
123
- $code = preg_replace ('/ name\="modify" value\="(.*?)"/', ' name="modify" value="' . (($sc["mb"]) ? "1" : "0") . '"', $code);
124
- $code = preg_replace ('/ name\="amount" value\="(.*?)"/', ' name="amount" value="' . $sc["ra"] . '"', $code);
125
- $code = preg_replace ('/ name\="src" value\="(.*?)"/', ' name="src" value="' . $sc["rr"] . '"', $code);
126
- $code = preg_replace ('/ name\="p1" value\="(.*?)"/', ' name="p1" value="' . $sc["tp"] . '"', $code);
127
- $code = preg_replace ('/ name\="t1" value\="(.*?)"/', ' name="t1" value="' . $sc["tt"] . '"', $code);
128
- $code = preg_replace ('/ name\="a3" value\="(.*?)"/', ' name="a3" value="' . $sc["ra"] . '"', $code);
129
- $code = preg_replace ('/ name\="p3" value\="(.*?)"/', ' name="p3" value="' . $sc["rp"] . '"', $code);
130
- $code = preg_replace ('/ name\="t3" value\="(.*?)"/', ' name="t3" value="' . $sc["rt"] . '"', $code);
131
- /**/
132
- $code = ($sc["image"] && $sc["image"] !== "default") ? preg_replace ('/ src\="(.*?)"/', ' src="' . $sc["image"] . '"', $code) : $code;
133
- /**/
134
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
135
- ($sc["mb"]) ? do_action ("ws_plugin__s2member_during_paypal_button_mb", get_defined_vars ()) : do_action ("ws_plugin__s2member_during_paypal_button", get_defined_vars ());
136
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
137
- }
138
- /**/
139
- return apply_filters ("ws_plugin__s2member_paypal_button", $code, get_defined_vars ());
140
- }
141
- }
142
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/functions/sp-access.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
  /*
17
  Generates Specific Post/Page Access links.
18
  */
@@ -52,7 +52,7 @@ if (!function_exists ("ws_plugin__s2member_sp_access_link"))
52
  if (($nonce = $_POST["s2member_sp_access_link"]) && wp_verify_nonce ($nonce, "ws-plugin--s2member-sp-access-link"))
53
  echo apply_filters ("ws_plugin__s2member_sp_access_link", ws_plugin__s2member_sp_access_link_gen ($_POST["s2member_sp_access_link_ids"], $_POST["s2member_sp_access_link_hours"]), get_defined_vars ());
54
  /**/
55
- exit;
56
  }
57
  }
58
  /*
@@ -95,7 +95,7 @@ if (!function_exists ("ws_plugin__s2member_sp_access"))
95
  {
96
  echo '<strong>Your Link Expired:</strong><br />Please contact Support if you need assistance.';
97
  /**/
98
- exit; /* $_GET["s2member_sp_access"] has expired. Or it is simply invalid. */
99
  }
100
  /**/
101
  return apply_filters ("ws_plugin__s2member_sp_access", false, get_defined_vars ());
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
  /*
17
  Generates Specific Post/Page Access links.
18
  */
52
  if (($nonce = $_POST["s2member_sp_access_link"]) && wp_verify_nonce ($nonce, "ws-plugin--s2member-sp-access-link"))
53
  echo apply_filters ("ws_plugin__s2member_sp_access_link", ws_plugin__s2member_sp_access_link_gen ($_POST["s2member_sp_access_link_ids"], $_POST["s2member_sp_access_link_hours"]), get_defined_vars ());
54
  /**/
55
+ exit ();
56
  }
57
  }
58
  /*
95
  {
96
  echo '<strong>Your Link Expired:</strong><br />Please contact Support if you need assistance.';
97
  /**/
98
+ exit (); /* $_GET["s2member_sp_access"] has expired. Or it is simply invalid. */
99
  }
100
  /**/
101
  return apply_filters ("ws_plugin__s2member_sp_access", false, get_defined_vars ());
includes/functions/tracking-codes.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
  /*
17
  Function that displays Signup Tracking Codes.
18
  These are stored inside s2Member's Transient Queue by the IPN processor.
@@ -75,7 +75,7 @@ if (!function_exists ("ws_plugin__s2member_delete_signup_tracking_cookie"))
75
  /**/
76
  do_action ("ws_plugin__s2member_during_delete_signup_tracking_cookie", get_defined_vars ());
77
  /**/
78
- exit;
79
  }
80
  /**/
81
  do_action ("ws_plugin__s2member_after_delete_signup_tracking_cookie", get_defined_vars ());
@@ -139,7 +139,7 @@ if (!function_exists ("ws_plugin__s2member_delete_sp_tracking_cookie"))
139
  /**/
140
  do_action ("ws_plugin__s2member_during_delete_sp_tracking_cookie", get_defined_vars ());
141
  /**/
142
- exit;
143
  }
144
  /**/
145
  do_action ("ws_plugin__s2member_after_delete_sp_tracking_cookie", get_defined_vars ());
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
  /*
17
  Function that displays Signup Tracking Codes.
18
  These are stored inside s2Member's Transient Queue by the IPN processor.
75
  /**/
76
  do_action ("ws_plugin__s2member_during_delete_signup_tracking_cookie", get_defined_vars ());
77
  /**/
78
+ exit ();
79
  }
80
  /**/
81
  do_action ("ws_plugin__s2member_after_delete_signup_tracking_cookie", get_defined_vars ());
139
  /**/
140
  do_action ("ws_plugin__s2member_during_delete_sp_tracking_cookie", get_defined_vars ());
141
  /**/
142
+ exit ();
143
  }
144
  /**/
145
  do_action ("ws_plugin__s2member_after_delete_sp_tracking_cookie", get_defined_vars ());
includes/functions/translations.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
  /*
17
  Mangles internal translations.
18
  Attach to: add_filter("gettext");
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
  /*
17
  Mangles internal translations.
18
  Attach to: add_filter("gettext");
includes/functions/user-access-level.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
  /*
17
  Function for determing the Access Level of a User/Member.
18
  Returns 0-4 according to the current User/Member's Access Level.
@@ -46,11 +46,13 @@ if (!function_exists ("ws_plugin__s2member_user_access_level"))
46
  return apply_filters ("ws_plugin__s2member_user_access_level", 1, get_defined_vars ());
47
  /* Member logged in with Level 1 Access. */
48
  }
49
- else /* Else if a User ( Free Subscriber ) is logged in. */
50
  {
51
  return apply_filters ("ws_plugin__s2member_user_access_level", 0, get_defined_vars ());
52
- /* User is logged in without Access. A Free Subscriber. */
53
  }
 
 
54
  }
55
  }
56
  ?>
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
  /*
17
  Function for determing the Access Level of a User/Member.
18
  Returns 0-4 according to the current User/Member's Access Level.
46
  return apply_filters ("ws_plugin__s2member_user_access_level", 1, get_defined_vars ());
47
  /* Member logged in with Level 1 Access. */
48
  }
49
+ else if (current_user_can ("access_s2member_level0"))
50
  {
51
  return apply_filters ("ws_plugin__s2member_user_access_level", 0, get_defined_vars ());
52
+ /* Subscriber logged in with Level 0 Access. */
53
  }
54
+ else /* Else we assume this is a User ( a Free Subscriber with a level of 0. ). */
55
+ return apply_filters ("ws_plugin__s2member_user_access_level", 0, get_defined_vars ());
56
  }
57
  }
58
  ?>
includes/functions/user-deletions.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
  /*
17
  Function for handling user deletions.
18
  Attach to: add_action("delete_user");
@@ -25,18 +25,16 @@ if (!function_exists ("ws_plugin__s2member_handle_user_deletions"))
25
  do_action ("ws_plugin__s2member_before_handle_user_deletions", get_defined_vars ());
26
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
27
  /**/
28
- $user = new WP_User ($user_id); /* Acquire user obj. */
29
- /**/
30
  $custom = get_usermeta ($user_id, "s2member_custom");
31
  $subscr_id = get_usermeta ($user_id, "s2member_subscr_id");
32
  /**/
33
- if (is_object ($user) && $subscr_id && $custom && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"] && is_array ($cv = preg_split ("/\|/", $custom)))
34
  {
35
  foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"]) as $url) /* Handle eot notifications on user deletion. */
36
- if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)) && ($url = preg_replace ("/%%subscr_id%%/i", urlencode ($subscr_id), $url)))
37
- if (($url = preg_replace ("/%%user_first_name%%/i", urlencode ($user->first_name), $url)) && ($url = preg_replace ("/%%user_last_name%%/i", urlencode ($user->last_name), $url)))
38
- if (($url = preg_replace ("/%%user_full_name%%/i", urlencode (trim ($user->first_name . " " . $user->last_name)), $url)))
39
- if (($url = preg_replace ("/%%user_email%%/i", urlencode ($user->user_email), $url)))
40
  /**/
41
  if (($url = trim ($url))) /* Empty? */
42
  ws_plugin__s2member_remote ($url);
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
  /*
17
  Function for handling user deletions.
18
  Attach to: add_action("delete_user");
25
  do_action ("ws_plugin__s2member_before_handle_user_deletions", get_defined_vars ());
26
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
27
  /**/
 
 
28
  $custom = get_usermeta ($user_id, "s2member_custom");
29
  $subscr_id = get_usermeta ($user_id, "s2member_subscr_id");
30
  /**/
31
+ if (is_object ($user = new WP_User ($user_id)) && $user->ID && $subscr_id && $custom && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"] && is_array ($cv = preg_split ("/\|/", $custom)))
32
  {
33
  foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"]) as $url) /* Handle eot notifications on user deletion. */
34
+ if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)) && ($url = preg_replace ("/%%subscr_id%%/i", ws_plugin__s2member_esc_ds (urlencode ($subscr_id)), $url)))
35
+ if (($url = preg_replace ("/%%user_first_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($user->first_name)), $url)) && ($url = preg_replace ("/%%user_last_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($user->last_name)), $url)))
36
+ if (($url = preg_replace ("/%%user_full_name%%/i", ws_plugin__s2member_esc_ds (urlencode (trim ($user->first_name . " " . $user->last_name))), $url)))
37
+ if (($url = preg_replace ("/%%user_email%%/i", ws_plugin__s2member_esc_ds (urlencode ($user->user_email)), $url)))
38
  /**/
39
  if (($url = trim ($url))) /* Empty? */
40
  ws_plugin__s2member_remote ($url);
includes/functions/user-has-wp-role.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
  /*
17
  Function for determing whether $user has a built-in WP Role.
18
  One of: (administrator|editor|author|contributor).
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
  /*
17
  Function for determing whether $user has a built-in WP Role.
18
  One of: (administrator|editor|author|contributor).
includes/functions/user-notes.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
  /*
17
  Append a note onto a specific User/Member's account.
18
  */
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
  /*
17
  Append a note onto a specific User/Member's account.
18
  */
includes/functions/users-list.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
  /*
17
  Function that adds columns to the list of Users.
18
  Attach to: add_filter ("manage_users_columns");
@@ -21,7 +21,7 @@ if (!function_exists ("ws_plugin__s2member_users_list_cols"))
21
  {
22
  function ws_plugin__s2member_users_list_cols ($cols = FALSE)
23
  {
24
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
25
  do_action ("ws_plugin__s2member_before_users_list_cols", get_defined_vars ());
26
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
27
  /**/
@@ -29,21 +29,21 @@ if (!function_exists ("ws_plugin__s2member_users_list_cols"))
29
  $cols["s2member_subscr_id"] = "PayPal® Subscr. ID"; /* Special field that is always applied. */
30
  $cols["s2member_ccaps"] = "Custom Capabilities"; /* Special field that is always applied. */
31
  /**/
32
- if (!defined ("BP_VERSION")) /* Custom fields are not compatible when running together with BuddyPress. */
33
  {
34
- foreach (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) as $field)
35
  {
36
- if ($field = trim ($field, "* \t\n\r\0\x0B")) /* Don't process empty fields. */
37
- {
38
- $cols[preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field))] = $field;
39
- }
40
  }
41
- /**/
42
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
43
- do_action ("ws_plugin__s2member_during_users_list_cols", get_defined_vars ());
44
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
45
  }
46
  /**/
 
 
 
 
47
  return apply_filters ("ws_plugin__s2member_users_list_cols", $cols, get_defined_vars ());
48
  }
49
  }
@@ -59,7 +59,7 @@ if (!function_exists ("ws_plugin__s2member_users_list_display_cols"))
59
  $user = $user_object; /* Shorter reference to the $user_object var. */
60
  static $fields, $fields_4_user_id; /* Used for optimization. */
61
  /**/
62
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
63
  do_action ("ws_plugin__s2member_before_users_list_display_cols", get_defined_vars ());
64
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
65
  /**/
@@ -99,7 +99,7 @@ if (!function_exists ("ws_plugin__s2member_users_list_edit_cols"))
99
  {
100
  function ws_plugin__s2member_users_list_edit_cols ($user = FALSE)
101
  {
102
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
103
  do_action ("ws_plugin__s2member_before_users_list_edit_cols", get_defined_vars ());
104
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
105
  /**/
@@ -111,13 +111,13 @@ if (!function_exists ("ws_plugin__s2member_users_list_edit_cols"))
111
  /**/
112
  echo '<table class="form-table">' . "\n";
113
  /**/
114
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
115
  do_action ("ws_plugin__s2member_during_users_list_edit_cols_before", get_defined_vars ());
116
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
117
  /**/
118
  if (!ws_plugin__s2member_user_has_wp_role ($user)) /* Not for WP Roles. */
119
  {
120
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
121
  do_action ("ws_plugin__s2member_during_users_list_edit_cols_before_subscr_id", get_defined_vars ());
122
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
123
  /**/
@@ -126,7 +126,7 @@ if (!function_exists ("ws_plugin__s2member_users_list_edit_cols"))
126
  echo '<td><input type="text" name="ws_plugin__s2member_profile_s2member_subscr_id" value="' . format_to_edit (get_usermeta ($user->ID, "s2member_subscr_id")) . '" class="regular-text" /></td>' . "\n";
127
  echo '</tr>' . "\n";
128
  /**/
129
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
130
  do_action ("ws_plugin__s2member_during_users_list_edit_cols_after_subscr_id", get_defined_vars ());
131
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
132
  }
@@ -135,7 +135,7 @@ if (!function_exists ("ws_plugin__s2member_users_list_edit_cols"))
135
  if (preg_match ("/^access_s2member_ccap_/", $cap))
136
  $ccaps[] = preg_replace ("/^access_s2member_ccap_/", "", $cap);
137
  /**/
138
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
139
  do_action ("ws_plugin__s2member_during_users_list_edit_cols_before_ccaps", get_defined_vars ());
140
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
141
  /**/
@@ -144,13 +144,13 @@ if (!function_exists ("ws_plugin__s2member_users_list_edit_cols"))
144
  echo '<td><input type="text" name="ws_plugin__s2member_profile_s2member_ccaps" value="' . format_to_edit (((!empty ($ccaps)) ? implode (",", $ccaps) : "")) . '" class="regular-text" onkeyup="this.value = jQuery.trim (jQuery.trim (this.value).replace (/[ \-]/g, \'_\').replace (/[^A-Z_0-9,]/gi, \'\').toLowerCase ());"; /></td>' . "\n";
145
  echo '</tr>' . "\n";
146
  /**/
147
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
148
  do_action ("ws_plugin__s2member_during_users_list_edit_cols_after_ccaps", get_defined_vars ());
149
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
150
  /**/
151
  if (!ws_plugin__s2member_user_has_wp_role ($user)) /* Not for WP Roles. */
152
  {
153
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
154
  do_action ("ws_plugin__s2member_during_users_list_edit_cols_before_auto_eot_time", get_defined_vars ());
155
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
156
  /**/
@@ -161,60 +161,59 @@ if (!function_exists ("ws_plugin__s2member_users_list_edit_cols"))
161
  echo '<td><input type="text" name="ws_plugin__s2member_profile_s2member_auto_eot_time" value="' . format_to_edit ($auto_eot_time) . '" class="regular-text" /></td>' . "\n";
162
  echo '</tr>' . "\n";
163
  /**/
164
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
165
  do_action ("ws_plugin__s2member_during_users_list_edit_cols_after_auto_eot_time", get_defined_vars ());
166
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
167
  }
168
  /**/
169
- if (!defined ("BP_VERSION")) /* Custom fields are not compatible when running together with BuddyPress. */
170
  {
171
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) /* Only if configured. */
 
 
 
 
 
 
 
 
 
 
 
 
172
  {
173
- echo '<tr>' . "\n";
174
- echo '<td colspan="2">' . "\n";
175
- echo '<div style="height:1px; line-height:1px; background:#CCCCCC;"></div>' . "\n";
176
- echo '</td>' . "\n";
177
- echo '</tr>' . "\n";
178
- /**/
179
- $fields = get_usermeta ($user->ID, "s2member_custom_fields"); /* Get existing field values. */
180
- /**/
181
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
182
- do_action ("ws_plugin__s2member_during_users_list_edit_cols_before_custom_fields", get_defined_vars ());
183
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
184
- /**/
185
- foreach (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) as $field)
186
  {
187
- if ($field = trim ($field, "* \t\n\r\0\x0B")) /* Don't process empty fields. */
188
- {
189
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
190
- do_action ("ws_plugin__s2member_during_users_list_edit_cols_during_custom_fields_before", get_defined_vars ());
191
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
192
- /**/
193
- echo '<tr>' . "\n";
194
- echo '<th><label>' . esc_html ($field) . ' </label></th>' . "\n";
195
- $field = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field));
196
- echo '<td><input type="text" name="ws_plugin__s2member_profile_' . esc_attr ($field) . '" value="' . format_to_edit ($fields[$field]) . '" class="regular-text" /></td>' . "\n";
197
- echo '</tr>' . "\n";
198
- /**/
199
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
200
- do_action ("ws_plugin__s2member_during_users_list_edit_cols_during_custom_fields_after", get_defined_vars ());
201
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
202
- }
203
  }
204
- /**/
205
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
206
- do_action ("ws_plugin__s2member_during_users_list_edit_cols_after_custom_fields", get_defined_vars ());
207
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
208
- /**/
209
- echo '<tr>' . "\n";
210
- echo '<td colspan="2">' . "\n";
211
- echo '<div style="height:1px; line-height:1px; background:#CCCCCC;"></div>' . "\n";
212
- echo '</td>' . "\n";
213
- echo '</tr>' . "\n";
214
  }
 
 
 
 
 
 
 
 
 
 
215
  }
216
  /**/
217
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
218
  do_action ("ws_plugin__s2member_during_users_list_edit_cols_before_notes", get_defined_vars ());
219
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
220
  /**/
@@ -223,11 +222,11 @@ if (!function_exists ("ws_plugin__s2member_users_list_edit_cols"))
223
  echo '<td><textarea name="ws_plugin__s2member_profile_s2member_notes" rows="5" wrap="off" spellcheck="false">' . format_to_edit (get_usermeta ($user->ID, "s2member_notes")) . '</textarea></td>' . "\n";
224
  echo '</tr>' . "\n";
225
  /**/
226
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
227
  do_action ("ws_plugin__s2member_during_users_list_edit_cols_after_notes", get_defined_vars ());
228
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
229
  /**/
230
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
231
  do_action ("ws_plugin__s2member_during_users_list_edit_cols_after", get_defined_vars ());
232
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
233
  /**/
@@ -236,7 +235,7 @@ if (!function_exists ("ws_plugin__s2member_users_list_edit_cols"))
236
  echo '<div style="margin:25px 0 25px 0; height:1px; line-height:1px; background:#CCCCCC;"></div>' . "\n";
237
  }
238
  /**/
239
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
240
  do_action ("ws_plugin__s2member_after_users_list_edit_cols", get_defined_vars ());
241
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
242
  /**/
@@ -252,16 +251,14 @@ if (!function_exists ("ws_plugin__s2member_users_list_update_cols"))
252
  {
253
  function ws_plugin__s2member_users_list_update_cols ($user_id = FALSE)
254
  {
255
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
256
  do_action ("ws_plugin__s2member_before_users_list_update_cols", get_defined_vars ());
257
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
258
  /**/
259
  if (current_user_can ("edit_users")) /* Quick security check here. */
260
  {
261
- if (is_array ($_POST = stripslashes_deep ($_POST)) && !empty ($_POST))
262
  {
263
- $user = new WP_User ($user_id);
264
- /**/
265
  update_usermeta ($user_id, "s2member_subscr_id", $_POST["ws_plugin__s2member_profile_s2member_subscr_id"]);
266
  /**/
267
  foreach ($user->allcaps as $cap => $cap_enabled)
@@ -275,29 +272,28 @@ if (!function_exists ("ws_plugin__s2member_users_list_update_cols"))
275
  $auto_eot_time = ($eot = $_POST["ws_plugin__s2member_profile_s2member_auto_eot_time"]) ? strtotime ($eot) : "";
276
  update_usermeta ($user_id, "s2member_auto_eot_time", $auto_eot_time);
277
  /**/
278
- if (!defined ("BP_VERSION")) /* Custom fields are not compatible when running together with BuddyPress. */
279
  {
280
- foreach (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) as $field)
281
  {
282
- if ($field = trim ($field, "* \t\n\r\0\x0B")) /* Don't process empty fields. */
283
- {
284
- $field = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field));
285
- $fields[$field] = trim ($_POST["ws_plugin__s2member_profile_" . $field]);
286
- }
287
  }
288
- /**/
289
- update_usermeta ($user_id, "s2member_custom_fields", $fields);
290
  }
291
  /**/
 
 
292
  update_usermeta ($user_id, "s2member_notes", $_POST["ws_plugin__s2member_profile_s2member_notes"]);
293
  /**/
294
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
295
  do_action ("ws_plugin__s2member_during_users_list_update_cols", get_defined_vars ());
296
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
297
  }
298
  }
299
  /**/
300
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
301
  do_action ("ws_plugin__s2member_after_users_list_update_cols", get_defined_vars ());
302
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
303
  }
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit("Do not access this file directly.");
16
  /*
17
  Function that adds columns to the list of Users.
18
  Attach to: add_filter ("manage_users_columns");
21
  {
22
  function ws_plugin__s2member_users_list_cols ($cols = FALSE)
23
  {
24
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
25
  do_action ("ws_plugin__s2member_before_users_list_cols", get_defined_vars ());
26
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
27
  /**/
29
  $cols["s2member_subscr_id"] = "PayPal® Subscr. ID"; /* Special field that is always applied. */
30
  $cols["s2member_ccaps"] = "Custom Capabilities"; /* Special field that is always applied. */
31
  /**/
32
+ foreach (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) as $field)
33
  {
34
+ if ($field = trim ($field, "* \t\n\r\0\x0B")) /* Don't process empty fields. */
35
  {
36
+ $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field));
37
+ $field_id_class = preg_replace ("/_/", "-", $field_var);
38
+ /**/
39
+ $cols[$field_var] = $field;
40
  }
 
 
 
 
41
  }
42
  /**/
43
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
44
+ do_action ("ws_plugin__s2member_during_users_list_cols", get_defined_vars ());
45
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
46
+ /**/
47
  return apply_filters ("ws_plugin__s2member_users_list_cols", $cols, get_defined_vars ());
48
  }
49
  }
59
  $user = $user_object; /* Shorter reference to the $user_object var. */
60
  static $fields, $fields_4_user_id; /* Used for optimization. */
61
  /**/
62
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
63
  do_action ("ws_plugin__s2member_before_users_list_display_cols", get_defined_vars ());
64
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
65
  /**/
99
  {
100
  function ws_plugin__s2member_users_list_edit_cols ($user = FALSE)
101
  {
102
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
103
  do_action ("ws_plugin__s2member_before_users_list_edit_cols", get_defined_vars ());
104
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
105
  /**/
111
  /**/
112
  echo '<table class="form-table">' . "\n";
113
  /**/
114
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
115
  do_action ("ws_plugin__s2member_during_users_list_edit_cols_before", get_defined_vars ());
116
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
117
  /**/
118
  if (!ws_plugin__s2member_user_has_wp_role ($user)) /* Not for WP Roles. */
119
  {
120
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
121
  do_action ("ws_plugin__s2member_during_users_list_edit_cols_before_subscr_id", get_defined_vars ());
122
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
123
  /**/
126
  echo '<td><input type="text" name="ws_plugin__s2member_profile_s2member_subscr_id" value="' . format_to_edit (get_usermeta ($user->ID, "s2member_subscr_id")) . '" class="regular-text" /></td>' . "\n";
127
  echo '</tr>' . "\n";
128
  /**/
129
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
130
  do_action ("ws_plugin__s2member_during_users_list_edit_cols_after_subscr_id", get_defined_vars ());
131
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
132
  }
135
  if (preg_match ("/^access_s2member_ccap_/", $cap))
136
  $ccaps[] = preg_replace ("/^access_s2member_ccap_/", "", $cap);
137
  /**/
138
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
139
  do_action ("ws_plugin__s2member_during_users_list_edit_cols_before_ccaps", get_defined_vars ());
140
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
141
  /**/
144
  echo '<td><input type="text" name="ws_plugin__s2member_profile_s2member_ccaps" value="' . format_to_edit (((!empty ($ccaps)) ? implode (",", $ccaps) : "")) . '" class="regular-text" onkeyup="this.value = jQuery.trim (jQuery.trim (this.value).replace (/[ \-]/g, \'_\').replace (/[^A-Z_0-9,]/gi, \'\').toLowerCase ());"; /></td>' . "\n";
145
  echo '</tr>' . "\n";
146
  /**/
147
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
148
  do_action ("ws_plugin__s2member_during_users_list_edit_cols_after_ccaps", get_defined_vars ());
149
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
150
  /**/
151
  if (!ws_plugin__s2member_user_has_wp_role ($user)) /* Not for WP Roles. */
152
  {
153
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
154
  do_action ("ws_plugin__s2member_during_users_list_edit_cols_before_auto_eot_time", get_defined_vars ());
155
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
156
  /**/
161
  echo '<td><input type="text" name="ws_plugin__s2member_profile_s2member_auto_eot_time" value="' . format_to_edit ($auto_eot_time) . '" class="regular-text" /></td>' . "\n";
162
  echo '</tr>' . "\n";
163
  /**/
164
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
165
  do_action ("ws_plugin__s2member_during_users_list_edit_cols_after_auto_eot_time", get_defined_vars ());
166
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
167
  }
168
  /**/
169
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) /* Only if configured. */
170
  {
171
+ echo '<tr>' . "\n";
172
+ echo '<td colspan="2">' . "\n";
173
+ echo '<div style="height:1px; line-height:1px; background:#CCCCCC;"></div>' . "\n";
174
+ echo '</td>' . "\n";
175
+ echo '</tr>' . "\n";
176
+ /**/
177
+ $fields = get_usermeta ($user->ID, "s2member_custom_fields"); /* Get existing field values. */
178
+ /**/
179
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
180
+ do_action ("ws_plugin__s2member_during_users_list_edit_cols_before_custom_fields", get_defined_vars ());
181
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
182
+ /**/
183
+ foreach (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) as $field)
184
  {
185
+ if ($field = trim ($field, "* \t\n\r\0\x0B")) /* Don't process empty fields. */
 
 
 
 
 
 
 
 
 
 
 
 
186
  {
187
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
188
+ do_action ("ws_plugin__s2member_during_users_list_edit_cols_during_custom_fields_before", get_defined_vars ());
189
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
190
+ /**/
191
+ $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field));
192
+ $field_id_class = preg_replace ("/_/", "-", $field_var);
193
+ /**/
194
+ echo '<tr>' . "\n";
195
+ echo '<th><label>' . esc_html ($field) . ' </label></th>' . "\n";
196
+ echo '<td><input type="text" name="ws_plugin__s2member_profile_' . $field_var . '" value="' . format_to_edit ($fields[$field_var]) . '" class="regular-text" /></td>' . "\n";
197
+ echo '</tr>' . "\n";
198
+ /**/
199
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
200
+ do_action ("ws_plugin__s2member_during_users_list_edit_cols_during_custom_fields_after", get_defined_vars ());
201
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
 
202
  }
 
 
 
 
 
 
 
 
 
 
203
  }
204
+ /**/
205
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
206
+ do_action ("ws_plugin__s2member_during_users_list_edit_cols_after_custom_fields", get_defined_vars ());
207
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
208
+ /**/
209
+ echo '<tr>' . "\n";
210
+ echo '<td colspan="2">' . "\n";
211
+ echo '<div style="height:1px; line-height:1px; background:#CCCCCC;"></div>' . "\n";
212
+ echo '</td>' . "\n";
213
+ echo '</tr>' . "\n";
214
  }
215
  /**/
216
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
217
  do_action ("ws_plugin__s2member_during_users_list_edit_cols_before_notes", get_defined_vars ());
218
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
219
  /**/
222
  echo '<td><textarea name="ws_plugin__s2member_profile_s2member_notes" rows="5" wrap="off" spellcheck="false">' . format_to_edit (get_usermeta ($user->ID, "s2member_notes")) . '</textarea></td>' . "\n";
223
  echo '</tr>' . "\n";
224
  /**/
225
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
226
  do_action ("ws_plugin__s2member_during_users_list_edit_cols_after_notes", get_defined_vars ());
227
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
228
  /**/
229
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
230
  do_action ("ws_plugin__s2member_during_users_list_edit_cols_after", get_defined_vars ());
231
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
232
  /**/
235
  echo '<div style="margin:25px 0 25px 0; height:1px; line-height:1px; background:#CCCCCC;"></div>' . "\n";
236
  }
237
  /**/
238
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
239
  do_action ("ws_plugin__s2member_after_users_list_edit_cols", get_defined_vars ());
240
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
241
  /**/
251
  {
252
  function ws_plugin__s2member_users_list_update_cols ($user_id = FALSE)
253
  {
254
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
255
  do_action ("ws_plugin__s2member_before_users_list_update_cols", get_defined_vars ());
256
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
257
  /**/
258
  if (current_user_can ("edit_users")) /* Quick security check here. */
259
  {
260
+ if (is_array ($_POST = stripslashes_deep ($_POST)) && !empty ($_POST) && is_object ($user = new WP_User ($user_id)) && $user->ID)
261
  {
 
 
262
  update_usermeta ($user_id, "s2member_subscr_id", $_POST["ws_plugin__s2member_profile_s2member_subscr_id"]);
263
  /**/
264
  foreach ($user->allcaps as $cap => $cap_enabled)
272
  $auto_eot_time = ($eot = $_POST["ws_plugin__s2member_profile_s2member_auto_eot_time"]) ? strtotime ($eot) : "";
273
  update_usermeta ($user_id, "s2member_auto_eot_time", $auto_eot_time);
274
  /**/
275
+ foreach (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) as $field)
276
  {
277
+ if ($field = trim ($field, "* \t\n\r\0\x0B")) /* Don't process empty fields. */
278
  {
279
+ $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field));
280
+ $field_id_class = preg_replace ("/_/", "-", $field_var);
281
+ /**/
282
+ $fields[$field_var] = trim ($_POST["ws_plugin__s2member_profile_" . $field_var]);
 
283
  }
 
 
284
  }
285
  /**/
286
+ update_usermeta ($user_id, "s2member_custom_fields", $fields);
287
+ /**/
288
  update_usermeta ($user_id, "s2member_notes", $_POST["ws_plugin__s2member_profile_s2member_notes"]);
289
  /**/
290
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
291
  do_action ("ws_plugin__s2member_during_users_list_update_cols", get_defined_vars ());
292
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
293
  }
294
  }
295
  /**/
296
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
297
  do_action ("ws_plugin__s2member_after_users_list_update_cols", get_defined_vars ());
298
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
299
  }
includes/functions/utilities.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
  /*
17
  Function that handles a remote request.
18
  This extends wp_remote_request() through the `WP_Http` class.
@@ -156,6 +156,16 @@ if (!function_exists ("ws_plugin__s2member_get"))
156
  }
157
  }
158
  /*
 
 
 
 
 
 
 
 
 
 
159
  Function escapes single quotes.
160
  */
161
  if (!function_exists ("ws_plugin__s2member_esc_sq"))
@@ -166,6 +176,37 @@ if (!function_exists ("ws_plugin__s2member_esc_sq"))
166
  }
167
  }
168
  /*
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
169
  Function checks if a post is in a child category.
170
  */
171
  if (!function_exists ("ws_plugin__s2member_in_descendant_category"))
@@ -212,6 +253,7 @@ if (!function_exists ("ws_plugin__s2member_encrypt"))
212
  }
213
  /*
214
  Alias function for API Scripting usage.
 
215
  */
216
  if (!function_exists ("s2member_encrypt"))
217
  {
@@ -254,6 +296,7 @@ if (!function_exists ("ws_plugin__s2member_decrypt"))
254
  }
255
  /*
256
  Alias function for API Scripting usage.
 
257
  */
258
  if (!function_exists ("s2member_decrypt"))
259
  {
@@ -291,6 +334,7 @@ if (!function_exists ("ws_plugin__s2member_xencrypt"))
291
  }
292
  /*
293
  Alias function for API Scripting usage.
 
294
  */
295
  if (!function_exists ("s2member_xencrypt"))
296
  {
@@ -332,6 +376,7 @@ if (!function_exists ("ws_plugin__s2member_xdecrypt"))
332
  }
333
  /*
334
  Alias function for API Scripting usage.
 
335
  */
336
  if (!function_exists ("s2member_xdecrypt"))
337
  {
@@ -420,4 +465,45 @@ if (!function_exists ("ws_plugin__s2member_approx_time_difference"))
420
  return $since;
421
  }
422
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
423
  ?>
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
  /*
17
  Function that handles a remote request.
18
  This extends wp_remote_request() through the `WP_Http` class.
156
  }
157
  }
158
  /*
159
+ Function escapes double quotes.
160
+ */
161
+ if (!function_exists ("ws_plugin__s2member_esc_dq"))
162
+ {
163
+ function ws_plugin__s2member_esc_dq ($string = FALSE)
164
+ {
165
+ return preg_replace ('/"/', '\"', $string);
166
+ }
167
+ }
168
+ /*
169
  Function escapes single quotes.
170
  */
171
  if (!function_exists ("ws_plugin__s2member_esc_sq"))
176
  }
177
  }
178
  /*
179
+ Function escapes single quotes.
180
+ */
181
+ if (!function_exists ("ws_plugin__s2member_esc_ds"))
182
+ {
183
+ function ws_plugin__s2member_esc_ds ($string = FALSE)
184
+ {
185
+ return preg_replace ('/\$/', '\\\$', $string);
186
+ }
187
+ }
188
+ /*
189
+ Function that trims deeply.
190
+ */
191
+ if (!function_exists ("ws_plugin__s2member_trim_deep"))
192
+ {
193
+ function ws_plugin__s2member_trim_deep ($value = FALSE)
194
+ {
195
+ return is_array ($value) ? array_map ('ws_plugin__s2member_trim_deep', $value) : trim ($value);
196
+ }
197
+ }
198
+ /*
199
+ Function that trims &quot; entities deeply.
200
+ This is useful on Shortcode attributes mangled by a Visual Editor.
201
+ */
202
+ if (!function_exists ("ws_plugin__s2member_trim_quot_deep"))
203
+ {
204
+ function ws_plugin__s2member_trim_quot_deep ($value = FALSE)
205
+ {
206
+ return is_array ($value) ? array_map ('ws_plugin__s2member_trim_quot_deep', $value) : preg_replace ("(^(&quot;)+|(&quot;)+$)", "", $value);
207
+ }
208
+ }
209
+ /*
210
  Function checks if a post is in a child category.
211
  */
212
  if (!function_exists ("ws_plugin__s2member_in_descendant_category"))
253
  }
254
  /*
255
  Alias function for API Scripting usage.
256
+ Deprecated in v3.0.5. This will be removed in a future release.
257
  */
258
  if (!function_exists ("s2member_encrypt"))
259
  {
296
  }
297
  /*
298
  Alias function for API Scripting usage.
299
+ Deprecated in v3.0.5. This will be removed in a future release.
300
  */
301
  if (!function_exists ("s2member_decrypt"))
302
  {
334
  }
335
  /*
336
  Alias function for API Scripting usage.
337
+ Deprecated in v3.0.5. This will be removed in a future release.
338
  */
339
  if (!function_exists ("s2member_xencrypt"))
340
  {
376
  }
377
  /*
378
  Alias function for API Scripting usage.
379
+ Deprecated in v3.0.5. This will be removed in a future release.
380
  */
381
  if (!function_exists ("s2member_xdecrypt"))
382
  {
465
  return $since;
466
  }
467
  }
468
+ /*
469
+ Function converts a form with hidden inputs into a URL.
470
+ */
471
+ if (!function_exists ("ws_plugin__s2member_form_whips_2_url"))
472
+ {
473
+ function ws_plugin__s2member_form_whips_2_url ($form = FALSE)
474
+ {
475
+ if (preg_match ("/\<form(.+?)\>/is", $form, $form_attr_m))
476
+ {
477
+ if (preg_match ("/(\s)(action)( ?)(\=)( ?)(['\"])(.+?)(['\"])/i", $form_attr_m[1], $form_action_m))
478
+ {
479
+ if (($url = trim ($form_action_m[7]))) /* Set URL value dynamically. Now we add values. */
480
+ {
481
+ if (preg_match_all ("/\<input(.+?)\>/is", $form, $input_attr_ms, PREG_SET_ORDER))
482
+ {
483
+ foreach ($input_attr_ms as $input_attr_m) /* Go through each input variable. */
484
+ {
485
+ if (preg_match ("/(\s)(type)( ?)(\=)( ?)(['\"])(hidden)(['\"])/", $input_attr_m[1]))
486
+ {
487
+ if (preg_match ("/(\s)(name)( ?)(\=)( ?)(['\"])(.+?)(['\"])/", $input_attr_m[1], $input_name_m))
488
+ {
489
+ if (preg_match ("/(\s)(value)( ?)(\=)( ?)(['\"])(.+?)(['\"])/", $input_attr_m[1], $input_value_m))
490
+ {
491
+ $name = trim ($input_name_m[7]);
492
+ $value = trim (wp_specialchars_decode ($input_value_m[7], ENT_QUOTES));
493
+ $value = (preg_match ("/^http(s)?\:\/\//i", $value)) ? rawurlencode ($value) : $value;
494
+ $url = add_query_arg ($name, $value, $url);
495
+ }
496
+ }
497
+ }
498
+ }
499
+ }
500
+ /**/
501
+ return $url;
502
+ }
503
+ }
504
+ }
505
+ /**/
506
+ return false;
507
+ }
508
+ }
509
  ?>
includes/hooks.inc.php CHANGED
@@ -12,13 +12,14 @@ If not, see: <http://www.gnu.org/licenses/>.
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
  /*
17
  Add the plugin actions/filters here.
18
  */
19
  add_action ("init", "ws_plugin__s2member_nocache");
20
  add_action ("init", "ws_plugin__s2member_constants");
21
  add_action ("init", "ws_plugin__s2member_register");
 
22
  add_action ("init", "ws_plugin__s2member_js_w_globals");
23
  add_action ("init", "ws_plugin__s2member_menu_pages_js");
24
  add_action ("init", "ws_plugin__s2member_menu_pages_css");
@@ -30,12 +31,15 @@ add_action ("init", "ws_plugin__s2member_delete_signup_tracking_cookie");
30
  add_action ("init", "ws_plugin__s2member_delete_sp_tracking_cookie");
31
  add_action ("init", "ws_plugin__s2member_auto_eot_system_via_cron");
32
  /**/
 
 
33
  add_action ("template_redirect", "ws_plugin__s2member_check_ruri_level_access", 1);
34
  add_action ("template_redirect", "ws_plugin__s2member_check_catg_level_access", 1);
35
  add_action ("template_redirect", "ws_plugin__s2member_check_ptag_level_access", 1);
36
  add_action ("template_redirect", "ws_plugin__s2member_check_post_level_access", 1);
37
  add_action ("template_redirect", "ws_plugin__s2member_check_page_level_access", 1);
38
  /**/
 
39
  add_action ("wp_print_scripts", "ws_plugin__s2member_add_js_w_globals");
40
  add_filter ("gettext", "ws_plugin__s2member_translation_mangler", 10, 3);
41
  add_filter ("posts_where", "ws_plugin__s2member_hide_some_systematics");
@@ -46,6 +50,7 @@ add_filter ("pre_option_users_can_register", "ws_plugin__s2member_check_register
46
  add_action ("user_register", "ws_plugin__s2member_configure_user_registration");
47
  add_action ("register_form", "ws_plugin__s2member_custom_registration_fields");
48
  add_action ("bp_before_registration_submit_buttons", "ws_plugin__s2member_opt_in_4bp");
 
49
  /**/
50
  add_action ("wp_login", "ws_plugin__s2member_login_redirect");
51
  add_action ("login_head", "ws_plugin__s2member_login_header_styles");
@@ -57,6 +62,7 @@ add_action ("wp_footer", "ws_plugin__s2member_display_signup_tracking_codes");
57
  add_action ("wp_footer", "ws_plugin__s2member_display_sp_tracking_codes");
58
  /**/
59
  add_action ("admin_init", "ws_plugin__s2member_admin_lockout");
 
60
  add_action ("admin_init", "ws_plugin__s2member_general_ops_notice");
61
  add_action ("admin_notices", "ws_plugin__s2member_admin_notices");
62
  add_action ("admin_menu", "ws_plugin__s2member_add_admin_options");
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
  /*
17
  Add the plugin actions/filters here.
18
  */
19
  add_action ("init", "ws_plugin__s2member_nocache");
20
  add_action ("init", "ws_plugin__s2member_constants");
21
  add_action ("init", "ws_plugin__s2member_register");
22
+ add_action ("init", "ws_plugin__s2member_css");
23
  add_action ("init", "ws_plugin__s2member_js_w_globals");
24
  add_action ("init", "ws_plugin__s2member_menu_pages_js");
25
  add_action ("init", "ws_plugin__s2member_menu_pages_css");
31
  add_action ("init", "ws_plugin__s2member_delete_sp_tracking_cookie");
32
  add_action ("init", "ws_plugin__s2member_auto_eot_system_via_cron");
33
  /**/
34
+ add_action ("template_redirect", "ws_plugin__s2member_profile");
35
+ add_action ("template_redirect", "ws_plugin__s2member_check_force_ssl");
36
  add_action ("template_redirect", "ws_plugin__s2member_check_ruri_level_access", 1);
37
  add_action ("template_redirect", "ws_plugin__s2member_check_catg_level_access", 1);
38
  add_action ("template_redirect", "ws_plugin__s2member_check_ptag_level_access", 1);
39
  add_action ("template_redirect", "ws_plugin__s2member_check_post_level_access", 1);
40
  add_action ("template_redirect", "ws_plugin__s2member_check_page_level_access", 1);
41
  /**/
42
+ add_action ("wp_print_styles", "ws_plugin__s2member_add_css");
43
  add_action ("wp_print_scripts", "ws_plugin__s2member_add_js_w_globals");
44
  add_filter ("gettext", "ws_plugin__s2member_translation_mangler", 10, 3);
45
  add_filter ("posts_where", "ws_plugin__s2member_hide_some_systematics");
50
  add_action ("user_register", "ws_plugin__s2member_configure_user_registration");
51
  add_action ("register_form", "ws_plugin__s2member_custom_registration_fields");
52
  add_action ("bp_before_registration_submit_buttons", "ws_plugin__s2member_opt_in_4bp");
53
+ add_filter ("show_password_fields", "ws_plugin__s2member_demo_hide_password_fields", 10, 2);
54
  /**/
55
  add_action ("wp_login", "ws_plugin__s2member_login_redirect");
56
  add_action ("login_head", "ws_plugin__s2member_login_header_styles");
62
  add_action ("wp_footer", "ws_plugin__s2member_display_sp_tracking_codes");
63
  /**/
64
  add_action ("admin_init", "ws_plugin__s2member_admin_lockout");
65
+ add_action ("admin_init", "ws_plugin__s2member_check_activation");
66
  add_action ("admin_init", "ws_plugin__s2member_general_ops_notice");
67
  add_action ("admin_notices", "ws_plugin__s2member_admin_notices");
68
  add_action ("admin_menu", "ws_plugin__s2member_add_admin_options");
includes/menu-pages/api-ops.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
  /*
17
  API Notifications page.
18
  */
@@ -62,7 +62,7 @@ if (apply_filters ("ws_plugin__s2member_during_api_ops_page_during_left_sections
62
  echo 'You can input multiple Notification URLs by inserting one per line.<br />' . "\n";
63
  echo '<textarea name="ws_plugin__s2member_signup_notification_urls" id="ws-plugin--s2member-signup-notification-urls" rows="3" wrap="off">' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["signup_notification_urls"]) . '</textarea><br />' . "\n";
64
  echo 'Signup Notifications take place silently behind-the-scene, using an HTTP connection. Each URL will be notified every time a new user signs up successfully through PayPal.<br /><br />' . "\n";
65
- echo '<strong>You can also use these special replacement codes if you need them:</strong>' . "\n";
66
  echo '<ul>' . "\n";
67
  echo '<li><code>%%subscr_id%% = The PayPal® Subscription ID, which remains constant throughout any &amp; all future payments.</code> [ <a href="#" onclick="alert(\'There is one exception. If you are selling Lifetime or Fixed-Term ( non-recurring ) access, using a Buy It Now button; the %%subscr_id%% is actually set to the Transaction ID for the purchase.\\n\\nPayPal® does not provide a specific Subscription ID for Buy It Now purchases. Since Lifetime &amp; Fixed-Term Subscriptions are NOT recurring ( i.e. there is only ONE payment ), using the Transaction ID as the Subscription ID is a graceful way to deal with this minor conflict.\'); return false;">?</a> ]</li>' . "\n";
68
  echo '<li><code>%%initial%% = The Initial Fee charged during signup. If you offered a free trial, this will be 0.</code> [ <a href="#" onclick="alert(\'This will always represent the amount of money the Customer spent, whenever they initially signed up, no matter what. Even if that amount is 0.\\n\\nIf a Customer signs up, under the terms of a free trial period, this will be 0. So be careful using %%initial%% when you offer a free trial period, because a $0.00 sale amount could cause havoc with affiliate programs. If you\\\'re offering a free trial period, and you need to track sales through affiliate programs, you can either hard-code an amount; or use `Payment Notifications` instead.\'); return false;">?</a> ]</li>' . "\n";
@@ -77,14 +77,14 @@ if (apply_filters ("ws_plugin__s2member_during_api_ops_page_during_left_sections
77
  echo '<li><code>%%initial_term%% = This is the term length of the initial period. This will be a numeric value, followed by a space, then a single letter.</code> [ <a href="#" onclick="alert(\'Here are some examples:\\n\\n%%initial_term%% = 1 D ( this means 1 Day )\\n%%initial_term%% = 1 W ( this means 1 Week )\\n%%initial_term%% = 1 M ( this means 1 Month )\\n%%initial_term%% = 1 Y ( this means 1 Year )\\n\\nThe initial period never recurs, so this only lasts for the term length specified, then it is over. If no initial period was even offered, the value of %%initial_term%% will just be: 0 D, meaning zero days.\'); return false;">?</a> ]</li>' . "\n";
78
  echo '<li><code>%%regular_term%% = This is the term length of the regular period. This will be a numeric value, followed by a space, then a single letter.</code> [ <a href="#" onclick="alert(\'Here are some examples:\\n\\n%%regular_term%% = 1 D ( this means 1 Day )\\n%%regular_term%% = 1 W ( this means 1 Week )\\n%%regular_term%% = 1 M ( this means 1 Month )\\n%%regular_term%% = 1 Y ( this means 1 Year )\\n%%regular_term%% = 1 L ( this means 1 Lifetime )\\n\\nThe regular term is usually recurring. So the regular term value represents the period ( or duration ) of each recurring period. If %%recurring%% = 0, then the regular term only applies once, because it is not recurring. So if it is not recurring, the value of %%regular_term%% simply represents how long their membership privileges are going to last after the %%initial_term%% has expired, if there was an initial term. The value of this variable ( %%regular_term%% ) will never be empty, it will always be at least: 1 D, meaning 1 day. No exceptions.\'); return false;">?</a> ]</li>' . "\n";
79
  echo '</ul>' . "\n";
80
- echo '<strong>Custom replacement codes can also be inserted using these instructions:</strong>' . "\n";
81
  echo '<ul>' . "\n";
82
- echo '<li><code>%%cv0%% = The domain of your site, which is passed through to PayPal® using the `custom` field in your PayPal® Button Code.</code></li>' . "\n";
83
- echo '<li><code>%%cv1%% = If you need to track additional custom variables, you can pipe delimit them into the `custom` field of your Button Code like this: &lt;input type="hidden" name="custom" value="' . $_SERVER["HTTP_HOST"] . '|cv1|cv2|cv3" /&gt;. You can have an unlimited number of custom variables that track IP addresses, affiliate IDs, etc. In some cases you may need to use PHP code to insert a value into the custom field dynamically. Obviously this is for advanced webmasters, but the functionality has been made available for those who need it.</li>' . "\n";
84
  echo '</ul>' . "\n";
85
  echo '<strong>This example uses cv1 to track a User\'s IP address:</strong><br />' . "\n";
86
  echo '<em>( The IP address could be referenced in your Notification URL using %%cv1%% )</em><br />' . "\n";
87
- echo '<code>&lt;input type="hidden" name="custom" value="' . $_SERVER["HTTP_HOST"] . '|&lt;?php echo $_SERVER["REMOTE_ADDR"]; ?&gt;" /&gt;</code>' . "\n";
88
  echo '</td>' . "\n";
89
  /**/
90
  echo '</tr>' . "\n";
@@ -123,7 +123,7 @@ if (apply_filters ("ws_plugin__s2member_during_api_ops_page_during_left_sections
123
  echo 'You can input multiple Notification URLs by inserting one per line.<br />' . "\n";
124
  echo '<textarea name="ws_plugin__s2member_registration_notification_urls" id="ws-plugin--s2member-registration-notification-urls" rows="3" wrap="off">' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["registration_notification_urls"]) . '</textarea><br />' . "\n";
125
  echo 'Registration Notifications take place silently behind-the-scene, using an HTTP connection. Each URL will be notified every time a new user registers a Username.<br /><br />' . "\n";
126
- echo '<strong>You can also use these special replacement codes if you need them:</strong>' . "\n";
127
  echo '<ul>' . "\n";
128
  echo '<li><code>%%level%% = The level number ( 0, 1, 2, 3, 4 ) 0 = Free Subscriber.</code></li>' . "\n";
129
  echo '<li><code>%%user_first_name%% = The First Name of the Member who registered their Username.</code></li>' . "\n";
@@ -133,14 +133,14 @@ if (apply_filters ("ws_plugin__s2member_during_api_ops_page_during_left_sections
133
  echo '<li><code>%%user_login%% = The Username the Member selected during registration.</code></li>' . "\n";
134
  echo '<li><code>%%user_pass%% = The Password selected or generated during registration.</code></li>' . "\n";
135
  echo '</ul>' . "\n";
136
- echo '<strong>Custom replacement codes can also be inserted using these instructions:</strong>' . "\n";
137
  echo '<ul>' . "\n";
138
- echo '<li><code>%%cv0%% = The domain of your site, which is passed through to PayPal® using the `custom` field in your PayPal® Button Code.</code></li>' . "\n";
139
- echo '<li><code>%%cv1%% = If you need to track additional custom variables, you can pipe delimit them into the `custom` field of your Button Code like this: &lt;input type="hidden" name="custom" value="' . $_SERVER["HTTP_HOST"] . '|cv1|cv2|cv3" /&gt;. You can have an unlimited number of custom variables that track IP addresses, affiliate IDs, etc. In some cases you may need to use PHP code to insert a value into the custom field dynamically. Obviously this is for advanced webmasters, but the functionality has been made available for those who need it.</li>' . "\n";
140
  echo '</ul>' . "\n";
141
  echo '<strong>This example uses cv1 to track a User\'s IP address:</strong><br />' . "\n";
142
  echo '<em>( The IP address could be referenced in your Notification URL using %%cv1%% )</em><br />' . "\n";
143
- echo '<code>&lt;input type="hidden" name="custom" value="' . $_SERVER["HTTP_HOST"] . '|&lt;?php echo $_SERVER["REMOTE_ADDR"]; ?&gt;" /&gt;</code>' . "\n";
144
  echo '</td>' . "\n";
145
  /**/
146
  echo '</tr>' . "\n";
@@ -181,7 +181,7 @@ if (apply_filters ("ws_plugin__s2member_during_api_ops_page_during_left_sections
181
  echo 'You can input multiple Notification URLs by inserting one per line.<br />' . "\n";
182
  echo '<textarea name="ws_plugin__s2member_payment_notification_urls" id="ws-plugin--s2member-payment-notification-urls" rows="3" wrap="off">' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_urls"]) . '</textarea><br />' . "\n";
183
  echo 'Payment Notifications take place silently behind-the-scene, using an HTTP connection. Each URL will be notified every time an initial and/or recurring payment occurs.<br /><br />' . "\n";
184
- echo '<strong>You can also use these special replacement codes if you need them:</strong>' . "\n";
185
  echo '<ul>' . "\n";
186
  echo '<li><code>%%subscr_id%% = The PayPal® Subscription ID, which remains constant throughout any &amp; all future payments.</code> [ <a href="#" onclick="alert(\'There is one exception. If you are selling Lifetime or Fixed-Term ( non-recurring ) access, using a Buy It Now button; the %%subscr_id%% is actually set to the Transaction ID for the payment.\\n\\nPayPal® does not provide a specific Subscription ID for Buy It Now purchases. Since Lifetime &amp; Fixed-Term Subscriptions are NOT recurring ( i.e. there is only ONE payment ), using the Transaction ID as the Subscription ID is a graceful way to deal with this minor conflict.\'); return false;">?</a> ]</li>' . "\n";
187
  echo '<li><code>%%txn_id%% = The PayPal® unique Transaction ID, which is always unique for each payment received.</code></li>' . "\n";
@@ -193,14 +193,14 @@ if (apply_filters ("ws_plugin__s2member_during_api_ops_page_during_left_sections
193
  echo '<li><code>%%item_number%% = The Item Number ( colon separated <em>level:custom_capabilities:fixed term</em> ) that the payment is for.</code></li>' . "\n";
194
  echo '<li><code>%%item_name%% = The Item Name ( in other words, the associated membership Level Label that briefly describes the Item Number ).</code></li>' . "\n";
195
  echo '</ul>' . "\n";
196
- echo '<strong>Custom replacement codes can also be inserted using these instructions:</strong>' . "\n";
197
  echo '<ul>' . "\n";
198
- echo '<li><code>%%cv0%% = The domain of your site, which is passed through to PayPal® using the `custom` field in your PayPal® Button Code.</code></li>' . "\n";
199
- echo '<li><code>%%cv1%% = If you need to track additional custom variables, you can pipe delimit them into the `custom` field of your Button Code like this: &lt;input type="hidden" name="custom" value="' . $_SERVER["HTTP_HOST"] . '|cv1|cv2|cv3" /&gt;. You can have an unlimited number of custom variables that track IP addresses, affiliate IDs, etc. In some cases you may need to use PHP code to insert a value into the custom field dynamically. Obviously this is for advanced webmasters, but the functionality has been made available for those who need it.</li>' . "\n";
200
  echo '</ul>' . "\n";
201
  echo '<strong>This example uses cv1 to track a User\'s IP address:</strong><br />' . "\n";
202
  echo '<em>( The IP address could be referenced in your Notification URL using %%cv1%% )</em><br />' . "\n";
203
- echo '<code>&lt;input type="hidden" name="custom" value="' . $_SERVER["HTTP_HOST"] . '|&lt;?php echo $_SERVER["REMOTE_ADDR"]; ?&gt;" /&gt;</code>' . "\n";
204
  echo '</td>' . "\n";
205
  /**/
206
  echo '</tr>' . "\n";
@@ -243,7 +243,7 @@ if (apply_filters ("ws_plugin__s2member_during_api_ops_page_during_left_sections
243
  echo 'You can input multiple Notification URLs by inserting one per line.<br />' . "\n";
244
  echo '<textarea name="ws_plugin__s2member_eot_del_notification_urls" id="ws-plugin--s2member-eot-del-notification-urls" rows="3" wrap="off">' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"]) . '</textarea><br />' . "\n";
245
  echo 'EOT/Deletion Notifications take place silently behind-the-scene, using an HTTP connection. Each URL will be notified every time a Subscription hits an EOT, or is deleted.<br /><br />' . "\n";
246
- echo '<strong>You can also use these special replacement codes if you need them:</strong>' . "\n";
247
  echo '<ul>' . "\n";
248
  echo '<li><code>%%subscr_id%% = The PayPal® Subscription ID, which remained constant throughout the lifetime of the membership.</code> [ <a href="#" onclick="alert(\'There is one exception. If you are selling Lifetime or Fixed-Term ( non-recurring ) access, using a Buy It Now button; the %%subscr_id%% is actually set to the original Transaction ID for the purchase.\\n\\nPayPal® does not provide a specific Subscription ID for Buy It Now purchases. Since Lifetime &amp; Fixed-Term Subscriptions are NOT recurring ( i.e. there was only ONE payment ), using the Transaction ID as the Subscription ID is a graceful way to deal with this minor conflict.\'); return false;">?</a> ]</li>' . "\n";
249
  echo '<li><code>%%user_first_name%% = The First Name listed on their User account. This might be different than what is on file at PayPal®.</code></li>' . "\n";
@@ -251,14 +251,14 @@ if (apply_filters ("ws_plugin__s2member_during_api_ops_page_during_left_sections
251
  echo '<li><code>%%user_full_name%% = The Full Name listed on their User account. This might be different than what is on file at PayPal®.</code></li>' . "\n";
252
  echo '<li><code>%%user_email%% = The Email Address associated with their User account. This might be different than what is on file at PayPal®.</code></li>' . "\n";
253
  echo '</ul>' . "\n";
254
- echo '<strong>Custom replacement codes can also be inserted using these instructions:</strong>' . "\n";
255
  echo '<ul>' . "\n";
256
- echo '<li><code>%%cv0%% = The domain of your site, which is passed through to PayPal® using the `custom` field in your PayPal® Button Code.</code></li>' . "\n";
257
- echo '<li><code>%%cv1%% = If you need to track additional custom variables, you can pipe delimit them into the `custom` field of your Button Code like this: &lt;input type="hidden" name="custom" value="' . $_SERVER["HTTP_HOST"] . '|cv1|cv2|cv3" /&gt;. You can have an unlimited number of custom variables that track IP addresses, affiliate IDs, etc. In some cases you may need to use PHP code to insert a value into the custom field dynamically. Obviously this is for advanced webmasters, but the functionality has been made available for those who need it.</li>' . "\n";
258
  echo '</ul>' . "\n";
259
  echo '<strong>This example uses cv1 to track a User\'s IP address:</strong><br />' . "\n";
260
  echo '<em>( The IP address could be referenced in your Notification URL using %%cv1%% )</em><br />' . "\n";
261
- echo '<code>&lt;input type="hidden" name="custom" value="' . $_SERVER["HTTP_HOST"] . '|&lt;?php echo $_SERVER["REMOTE_ADDR"]; ?&gt;" /&gt;</code>' . "\n";
262
  echo '</td>' . "\n";
263
  /**/
264
  echo '</tr>' . "\n";
@@ -300,7 +300,7 @@ if (apply_filters ("ws_plugin__s2member_during_api_ops_page_during_left_sections
300
  echo 'You can input multiple Notification URLs by inserting one per line.<br />' . "\n";
301
  echo '<textarea name="ws_plugin__s2member_ref_rev_notification_urls" id="ws-plugin--s2member-ref-rev-notification-urls" rows="3" wrap="off">' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["ref_rev_notification_urls"]) . '</textarea><br />' . "\n";
302
  echo 'Refund/Reversal Notifications take place silently behind-the-scene, using an HTTP connection. Each URL will be notified every time a payment is refunded through PayPal® or a chargeback occurs.<br /><br />' . "\n";
303
- echo '<strong>You can also use these special replacement codes if you need them:</strong>' . "\n";
304
  echo '<ul>' . "\n";
305
  echo '<li><code>%%subscr_id%% = The PayPal® Subscription ID, which remained constant throughout the lifetime of the membership.</code> [ <a href="#" onclick="alert(\'There is one exception. If you are selling Lifetime or Fixed-Term ( non-recurring ) access, using a Buy It Now button; the %%subscr_id%% is actually set to the original Transaction ID for the purchase.\\n\\nPayPal® does not provide a specific Subscription ID for Buy It Now purchases. Since Lifetime &amp; Fixed-Term Subscriptions are NOT recurring ( i.e. there was only ONE payment ), using the Transaction ID as the Subscription ID is a graceful way to deal with this minor conflict.\'); return false;">?</a> ]</li>' . "\n";
306
  echo '<li><code>%%parent_txn_id%% = The PayPal® Transaction ID, associated with the original payment that is being refunded/reversed.</code></li>' . "\n";
@@ -312,14 +312,14 @@ if (apply_filters ("ws_plugin__s2member_during_api_ops_page_during_left_sections
312
  echo '<li><code>%%item_number%% = The Item Number ( colon separated <em>level:custom_capabilities:fixed term</em> ) that the payment was for.</code></li>' . "\n";
313
  echo '<li><code>%%item_name%% = The Item Name ( in other words, the associated membership Level Label that briefly describes the Item Number ).</code></li>' . "\n";
314
  echo '</ul>' . "\n";
315
- echo '<strong>Custom replacement codes can also be inserted using these instructions:</strong>' . "\n";
316
  echo '<ul>' . "\n";
317
- echo '<li><code>%%cv0%% = The domain of your site, which is passed through to PayPal® using the `custom` field in your PayPal® Button Code.</code></li>' . "\n";
318
- echo '<li><code>%%cv1%% = If you need to track additional custom variables, you can pipe delimit them into the `custom` field of your Button Code like this: &lt;input type="hidden" name="custom" value="' . $_SERVER["HTTP_HOST"] . '|cv1|cv2|cv3" /&gt;. You can have an unlimited number of custom variables that track IP addresses, affiliate IDs, etc. In some cases you may need to use PHP code to insert a value into the custom field dynamically. Obviously this is for advanced webmasters, but the functionality has been made available for those who need it.</li>' . "\n";
319
  echo '</ul>' . "\n";
320
  echo '<strong>This example uses cv1 to track a User\'s IP address:</strong><br />' . "\n";
321
  echo '<em>( The IP address could be referenced in your Notification URL using %%cv1%% )</em><br />' . "\n";
322
- echo '<code>&lt;input type="hidden" name="custom" value="' . $_SERVER["HTTP_HOST"] . '|&lt;?php echo $_SERVER["REMOTE_ADDR"]; ?&gt;" /&gt;</code>' . "\n";
323
  echo '</td>' . "\n";
324
  /**/
325
  echo '</tr>' . "\n";
@@ -360,7 +360,7 @@ if (apply_filters ("ws_plugin__s2member_during_api_ops_page_during_left_sections
360
  echo 'You can input multiple Notification URLs by inserting one per line.<br />' . "\n";
361
  echo '<textarea name="ws_plugin__s2member_sp_notification_urls" id="ws-plugin--s2member-sp-notification-urls" rows="3" wrap="off">' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_notification_urls"]) . '</textarea><br />' . "\n";
362
  echo 'Specific Post/Page Notifications take place silently behind-the-scene, using an HTTP connection. Each URL will be notified every time a sale occurs.<br /><br />' . "\n";
363
- echo '<strong>You can also use these special replacement codes if you need them:</strong>' . "\n";
364
  echo '<ul>' . "\n";
365
  echo '<li><code>%%sp_access_url%% = The full URL ( generated by s2Member ) where the Customer can gain access.</code></li>' . "\n";
366
  echo '<li><code>%%sp_access_exp%% = Human readable expiration for %%sp_access_url%%. Ex: <em>( link expires in %%sp_access_exp%% )</em>.</code></li>' . "\n";
@@ -373,14 +373,14 @@ if (apply_filters ("ws_plugin__s2member_during_api_ops_page_during_left_sections
373
  echo '<li><code>%%item_number%% = The Item Number. Ex: <em>sp:13,24,36:72</em> ( translates to: <em>sp:comma-delimited IDs:expiration hours</em> ).</code></li>' . "\n";
374
  echo '<li><code>%%item_name%% = The Item Name. In other words, a brief description, detailing what this purchase was for.</code></li>' . "\n";
375
  echo '</ul>' . "\n";
376
- echo '<strong>Custom replacement codes can also be inserted using these instructions:</strong>' . "\n";
377
  echo '<ul>' . "\n";
378
- echo '<li><code>%%cv0%% = The domain of your site, which is passed through to PayPal® using the `custom` field in your PayPal® Button Code.</code></li>' . "\n";
379
- echo '<li><code>%%cv1%% = If you need to track additional custom variables, you can pipe delimit them into the `custom` field of your Button Code like this: &lt;input type="hidden" name="custom" value="' . $_SERVER["HTTP_HOST"] . '|cv1|cv2|cv3" /&gt;. You can have an unlimited number of custom variables that track IP addresses, affiliate IDs, etc. In some cases you may need to use PHP code to insert a value into the custom field dynamically. Obviously this is for advanced webmasters, but the functionality has been made available for those who need it.</li>' . "\n";
380
  echo '</ul>' . "\n";
381
  echo '<strong>This example uses cv1 to track a User\'s IP address:</strong><br />' . "\n";
382
  echo '<em>( The IP address could be referenced in your Notification URL using %%cv1%% )</em><br />' . "\n";
383
- echo '<code>&lt;input type="hidden" name="custom" value="' . $_SERVER["HTTP_HOST"] . '|&lt;?php echo $_SERVER["REMOTE_ADDR"]; ?&gt;" /&gt;</code>' . "\n";
384
  echo '</td>' . "\n";
385
  /**/
386
  echo '</tr>' . "\n";
@@ -408,6 +408,7 @@ echo '<td class="ws-menu-page-table-r">' . "\n";
408
  do_action ("ws_plugin__s2member_during_api_ops_page_before_right_sections", get_defined_vars ());
409
  do_action ("ws_plugin__s2member_during_menu_pages_before_right_sections", get_defined_vars ());
410
  /**/
 
411
  echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["installation"]) ? '<div class="ws-menu-page-installation"><a href="' . ws_plugin__s2member_parse_readme_value ("Professional Installation URI") . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-installation.png" alt="." /></a></div>' . "\n" : '';
412
  echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["tools"]) ? '<div class="ws-menu-page-tools"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-tools.png" alt="." /></div>' . "\n" : '';
413
  echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["support"]) ? '<div class="ws-menu-page-support"><a href="' . ws_plugin__s2member_parse_readme_value ("Forum URI") . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-support.png" alt="." /></a></div>' . "\n" : '';
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
  /*
17
  API Notifications page.
18
  */
62
  echo 'You can input multiple Notification URLs by inserting one per line.<br />' . "\n";
63
  echo '<textarea name="ws_plugin__s2member_signup_notification_urls" id="ws-plugin--s2member-signup-notification-urls" rows="3" wrap="off">' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["signup_notification_urls"]) . '</textarea><br />' . "\n";
64
  echo 'Signup Notifications take place silently behind-the-scene, using an HTTP connection. Each URL will be notified every time a new user signs up successfully through PayPal.<br /><br />' . "\n";
65
+ echo '<strong>You can also use these special Replacement Codes if you need them:</strong>' . "\n";
66
  echo '<ul>' . "\n";
67
  echo '<li><code>%%subscr_id%% = The PayPal® Subscription ID, which remains constant throughout any &amp; all future payments.</code> [ <a href="#" onclick="alert(\'There is one exception. If you are selling Lifetime or Fixed-Term ( non-recurring ) access, using a Buy It Now button; the %%subscr_id%% is actually set to the Transaction ID for the purchase.\\n\\nPayPal® does not provide a specific Subscription ID for Buy It Now purchases. Since Lifetime &amp; Fixed-Term Subscriptions are NOT recurring ( i.e. there is only ONE payment ), using the Transaction ID as the Subscription ID is a graceful way to deal with this minor conflict.\'); return false;">?</a> ]</li>' . "\n";
68
  echo '<li><code>%%initial%% = The Initial Fee charged during signup. If you offered a free trial, this will be 0.</code> [ <a href="#" onclick="alert(\'This will always represent the amount of money the Customer spent, whenever they initially signed up, no matter what. Even if that amount is 0.\\n\\nIf a Customer signs up, under the terms of a free trial period, this will be 0. So be careful using %%initial%% when you offer a free trial period, because a $0.00 sale amount could cause havoc with affiliate programs. If you\\\'re offering a free trial period, and you need to track sales through affiliate programs, you can either hard-code an amount; or use `Payment Notifications` instead.\'); return false;">?</a> ]</li>' . "\n";
77
  echo '<li><code>%%initial_term%% = This is the term length of the initial period. This will be a numeric value, followed by a space, then a single letter.</code> [ <a href="#" onclick="alert(\'Here are some examples:\\n\\n%%initial_term%% = 1 D ( this means 1 Day )\\n%%initial_term%% = 1 W ( this means 1 Week )\\n%%initial_term%% = 1 M ( this means 1 Month )\\n%%initial_term%% = 1 Y ( this means 1 Year )\\n\\nThe initial period never recurs, so this only lasts for the term length specified, then it is over. If no initial period was even offered, the value of %%initial_term%% will just be: 0 D, meaning zero days.\'); return false;">?</a> ]</li>' . "\n";
78
  echo '<li><code>%%regular_term%% = This is the term length of the regular period. This will be a numeric value, followed by a space, then a single letter.</code> [ <a href="#" onclick="alert(\'Here are some examples:\\n\\n%%regular_term%% = 1 D ( this means 1 Day )\\n%%regular_term%% = 1 W ( this means 1 Week )\\n%%regular_term%% = 1 M ( this means 1 Month )\\n%%regular_term%% = 1 Y ( this means 1 Year )\\n%%regular_term%% = 1 L ( this means 1 Lifetime )\\n\\nThe regular term is usually recurring. So the regular term value represents the period ( or duration ) of each recurring period. If %%recurring%% = 0, then the regular term only applies once, because it is not recurring. So if it is not recurring, the value of %%regular_term%% simply represents how long their membership privileges are going to last after the %%initial_term%% has expired, if there was an initial term. The value of this variable ( %%regular_term%% ) will never be empty, it will always be at least: 1 D, meaning 1 day. No exceptions.\'); return false;">?</a> ]</li>' . "\n";
79
  echo '</ul>' . "\n";
80
+ echo '<strong>Custom Replacement Codes can also be inserted using these instructions:</strong>' . "\n";
81
  echo '<ul>' . "\n";
82
+ echo '<li><code>%%cv0%% = The domain of your site, which is passed through to PayPal® using the `custom` attribute in your PayPal® Shortcode.</code></li>' . "\n";
83
+ echo '<li><code>%%cv1%% = If you need to track additional custom variables, you can pipe delimit them into the `custom` attribute, inside your Shortcode, like this: custom="' . $_SERVER["HTTP_HOST"] . '|cv1|cv2|cv3". You can have an unlimited number of custom variables that track IP addresses, affiliate IDs, etc. In some cases you may need to use PHP code to insert a value into the custom field dynamically. Obviously this is for advanced webmasters, but the functionality has been made available for those who need it.</li>' . "\n";
84
  echo '</ul>' . "\n";
85
  echo '<strong>This example uses cv1 to track a User\'s IP address:</strong><br />' . "\n";
86
  echo '<em>( The IP address could be referenced in your Notification URL using %%cv1%% )</em><br />' . "\n";
87
+ echo '<code>custom="' . $_SERVER["HTTP_HOST"] . '|&lt;?php echo $_SERVER["REMOTE_ADDR"]; ?&gt;"</code>' . "\n";
88
  echo '</td>' . "\n";
89
  /**/
90
  echo '</tr>' . "\n";
123
  echo 'You can input multiple Notification URLs by inserting one per line.<br />' . "\n";
124
  echo '<textarea name="ws_plugin__s2member_registration_notification_urls" id="ws-plugin--s2member-registration-notification-urls" rows="3" wrap="off">' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["registration_notification_urls"]) . '</textarea><br />' . "\n";
125
  echo 'Registration Notifications take place silently behind-the-scene, using an HTTP connection. Each URL will be notified every time a new user registers a Username.<br /><br />' . "\n";
126
+ echo '<strong>You can also use these special Replacement Codes if you need them:</strong>' . "\n";
127
  echo '<ul>' . "\n";
128
  echo '<li><code>%%level%% = The level number ( 0, 1, 2, 3, 4 ) 0 = Free Subscriber.</code></li>' . "\n";
129
  echo '<li><code>%%user_first_name%% = The First Name of the Member who registered their Username.</code></li>' . "\n";
133
  echo '<li><code>%%user_login%% = The Username the Member selected during registration.</code></li>' . "\n";
134
  echo '<li><code>%%user_pass%% = The Password selected or generated during registration.</code></li>' . "\n";
135
  echo '</ul>' . "\n";
136
+ echo '<strong>Custom Replacement Codes can also be inserted using these instructions:</strong>' . "\n";
137
  echo '<ul>' . "\n";
138
+ echo '<li><code>%%cv0%% = The domain of your site, which is passed through to PayPal® using the `custom` attribute in your PayPal® Shortcode.</code></li>' . "\n";
139
+ echo '<li><code>%%cv1%% = If you need to track additional custom variables, you can pipe delimit them into the `custom` attribute, inside your Shortcode, like this: custom="' . $_SERVER["HTTP_HOST"] . '|cv1|cv2|cv3". You can have an unlimited number of custom variables that track IP addresses, affiliate IDs, etc. In some cases you may need to use PHP code to insert a value into the custom field dynamically. Obviously this is for advanced webmasters, but the functionality has been made available for those who need it.</li>' . "\n";
140
  echo '</ul>' . "\n";
141
  echo '<strong>This example uses cv1 to track a User\'s IP address:</strong><br />' . "\n";
142
  echo '<em>( The IP address could be referenced in your Notification URL using %%cv1%% )</em><br />' . "\n";
143
+ echo '<code>custom="' . $_SERVER["HTTP_HOST"] . '|&lt;?php echo $_SERVER["REMOTE_ADDR"]; ?&gt;"</code>' . "\n";
144
  echo '</td>' . "\n";
145
  /**/
146
  echo '</tr>' . "\n";
181
  echo 'You can input multiple Notification URLs by inserting one per line.<br />' . "\n";
182
  echo '<textarea name="ws_plugin__s2member_payment_notification_urls" id="ws-plugin--s2member-payment-notification-urls" rows="3" wrap="off">' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_urls"]) . '</textarea><br />' . "\n";
183
  echo 'Payment Notifications take place silently behind-the-scene, using an HTTP connection. Each URL will be notified every time an initial and/or recurring payment occurs.<br /><br />' . "\n";
184
+ echo '<strong>You can also use these special Replacement Codes if you need them:</strong>' . "\n";
185
  echo '<ul>' . "\n";
186
  echo '<li><code>%%subscr_id%% = The PayPal® Subscription ID, which remains constant throughout any &amp; all future payments.</code> [ <a href="#" onclick="alert(\'There is one exception. If you are selling Lifetime or Fixed-Term ( non-recurring ) access, using a Buy It Now button; the %%subscr_id%% is actually set to the Transaction ID for the payment.\\n\\nPayPal® does not provide a specific Subscription ID for Buy It Now purchases. Since Lifetime &amp; Fixed-Term Subscriptions are NOT recurring ( i.e. there is only ONE payment ), using the Transaction ID as the Subscription ID is a graceful way to deal with this minor conflict.\'); return false;">?</a> ]</li>' . "\n";
187
  echo '<li><code>%%txn_id%% = The PayPal® unique Transaction ID, which is always unique for each payment received.</code></li>' . "\n";
193
  echo '<li><code>%%item_number%% = The Item Number ( colon separated <em>level:custom_capabilities:fixed term</em> ) that the payment is for.</code></li>' . "\n";
194
  echo '<li><code>%%item_name%% = The Item Name ( in other words, the associated membership Level Label that briefly describes the Item Number ).</code></li>' . "\n";
195
  echo '</ul>' . "\n";
196
+ echo '<strong>Custom Replacement Codes can also be inserted using these instructions:</strong>' . "\n";
197
  echo '<ul>' . "\n";
198
+ echo '<li><code>%%cv0%% = The domain of your site, which is passed through to PayPal® using the `custom` attribute in your PayPal® Shortcode.</code></li>' . "\n";
199
+ echo '<li><code>%%cv1%% = If you need to track additional custom variables, you can pipe delimit them into the `custom` attribute, inside your Shortcode, like this: custom="' . $_SERVER["HTTP_HOST"] . '|cv1|cv2|cv3". You can have an unlimited number of custom variables that track IP addresses, affiliate IDs, etc. In some cases you may need to use PHP code to insert a value into the custom field dynamically. Obviously this is for advanced webmasters, but the functionality has been made available for those who need it.</li>' . "\n";
200
  echo '</ul>' . "\n";
201
  echo '<strong>This example uses cv1 to track a User\'s IP address:</strong><br />' . "\n";
202
  echo '<em>( The IP address could be referenced in your Notification URL using %%cv1%% )</em><br />' . "\n";
203
+ echo '<code>custom="' . $_SERVER["HTTP_HOST"] . '|&lt;?php echo $_SERVER["REMOTE_ADDR"]; ?&gt;"</code>' . "\n";
204
  echo '</td>' . "\n";
205
  /**/
206
  echo '</tr>' . "\n";
243
  echo 'You can input multiple Notification URLs by inserting one per line.<br />' . "\n";
244
  echo '<textarea name="ws_plugin__s2member_eot_del_notification_urls" id="ws-plugin--s2member-eot-del-notification-urls" rows="3" wrap="off">' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"]) . '</textarea><br />' . "\n";
245
  echo 'EOT/Deletion Notifications take place silently behind-the-scene, using an HTTP connection. Each URL will be notified every time a Subscription hits an EOT, or is deleted.<br /><br />' . "\n";
246
+ echo '<strong>You can also use these special Replacement Codes if you need them:</strong>' . "\n";
247
  echo '<ul>' . "\n";
248
  echo '<li><code>%%subscr_id%% = The PayPal® Subscription ID, which remained constant throughout the lifetime of the membership.</code> [ <a href="#" onclick="alert(\'There is one exception. If you are selling Lifetime or Fixed-Term ( non-recurring ) access, using a Buy It Now button; the %%subscr_id%% is actually set to the original Transaction ID for the purchase.\\n\\nPayPal® does not provide a specific Subscription ID for Buy It Now purchases. Since Lifetime &amp; Fixed-Term Subscriptions are NOT recurring ( i.e. there was only ONE payment ), using the Transaction ID as the Subscription ID is a graceful way to deal with this minor conflict.\'); return false;">?</a> ]</li>' . "\n";
249
  echo '<li><code>%%user_first_name%% = The First Name listed on their User account. This might be different than what is on file at PayPal®.</code></li>' . "\n";
251
  echo '<li><code>%%user_full_name%% = The Full Name listed on their User account. This might be different than what is on file at PayPal®.</code></li>' . "\n";
252
  echo '<li><code>%%user_email%% = The Email Address associated with their User account. This might be different than what is on file at PayPal®.</code></li>' . "\n";
253
  echo '</ul>' . "\n";
254
+ echo '<strong>Custom Replacement Codes can also be inserted using these instructions:</strong>' . "\n";
255
  echo '<ul>' . "\n";
256
+ echo '<li><code>%%cv0%% = The domain of your site, which is passed through to PayPal® using the `custom` attribute in your PayPal® Shortcode.</code></li>' . "\n";
257
+ echo '<li><code>%%cv1%% = If you need to track additional custom variables, you can pipe delimit them into the `custom` attribute, inside your Shortcode. like this: custom="' . $_SERVER["HTTP_HOST"] . '|cv1|cv2|cv3". You can have an unlimited number of custom variables that track IP addresses, affiliate IDs, etc. In some cases you may need to use PHP code to insert a value into the custom field dynamically. Obviously this is for advanced webmasters, but the functionality has been made available for those who need it.</li>' . "\n";
258
  echo '</ul>' . "\n";
259
  echo '<strong>This example uses cv1 to track a User\'s IP address:</strong><br />' . "\n";
260
  echo '<em>( The IP address could be referenced in your Notification URL using %%cv1%% )</em><br />' . "\n";
261
+ echo '<code>custom="' . $_SERVER["HTTP_HOST"] . '|&lt;?php echo $_SERVER["REMOTE_ADDR"]; ?&gt;"</code>' . "\n";
262
  echo '</td>' . "\n";
263
  /**/
264
  echo '</tr>' . "\n";
300
  echo 'You can input multiple Notification URLs by inserting one per line.<br />' . "\n";
301
  echo '<textarea name="ws_plugin__s2member_ref_rev_notification_urls" id="ws-plugin--s2member-ref-rev-notification-urls" rows="3" wrap="off">' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["ref_rev_notification_urls"]) . '</textarea><br />' . "\n";
302
  echo 'Refund/Reversal Notifications take place silently behind-the-scene, using an HTTP connection. Each URL will be notified every time a payment is refunded through PayPal® or a chargeback occurs.<br /><br />' . "\n";
303
+ echo '<strong>You can also use these special Replacement Codes if you need them:</strong>' . "\n";
304
  echo '<ul>' . "\n";
305
  echo '<li><code>%%subscr_id%% = The PayPal® Subscription ID, which remained constant throughout the lifetime of the membership.</code> [ <a href="#" onclick="alert(\'There is one exception. If you are selling Lifetime or Fixed-Term ( non-recurring ) access, using a Buy It Now button; the %%subscr_id%% is actually set to the original Transaction ID for the purchase.\\n\\nPayPal® does not provide a specific Subscription ID for Buy It Now purchases. Since Lifetime &amp; Fixed-Term Subscriptions are NOT recurring ( i.e. there was only ONE payment ), using the Transaction ID as the Subscription ID is a graceful way to deal with this minor conflict.\'); return false;">?</a> ]</li>' . "\n";
306
  echo '<li><code>%%parent_txn_id%% = The PayPal® Transaction ID, associated with the original payment that is being refunded/reversed.</code></li>' . "\n";
312
  echo '<li><code>%%item_number%% = The Item Number ( colon separated <em>level:custom_capabilities:fixed term</em> ) that the payment was for.</code></li>' . "\n";
313
  echo '<li><code>%%item_name%% = The Item Name ( in other words, the associated membership Level Label that briefly describes the Item Number ).</code></li>' . "\n";
314
  echo '</ul>' . "\n";
315
+ echo '<strong>Custom Replacement Codes can also be inserted using these instructions:</strong>' . "\n";
316
  echo '<ul>' . "\n";
317
+ echo '<li><code>%%cv0%% = The domain of your site, which is passed through to PayPal® using the `custom` attribute in your PayPal® Shortcode.</code></li>' . "\n";
318
+ echo '<li><code>%%cv1%% = If you need to track additional custom variables, you can pipe delimit them into the `custom` attribute, inside your Shortcode, like this: custom="' . $_SERVER["HTTP_HOST"] . '|cv1|cv2|cv3". You can have an unlimited number of custom variables that track IP addresses, affiliate IDs, etc. In some cases you may need to use PHP code to insert a value into the custom field dynamically. Obviously this is for advanced webmasters, but the functionality has been made available for those who need it.</li>' . "\n";
319
  echo '</ul>' . "\n";
320
  echo '<strong>This example uses cv1 to track a User\'s IP address:</strong><br />' . "\n";
321
  echo '<em>( The IP address could be referenced in your Notification URL using %%cv1%% )</em><br />' . "\n";
322
+ echo '<code>custom="' . $_SERVER["HTTP_HOST"] . '|&lt;?php echo $_SERVER["REMOTE_ADDR"]; ?&gt;"</code>' . "\n";
323
  echo '</td>' . "\n";
324
  /**/
325
  echo '</tr>' . "\n";
360
  echo 'You can input multiple Notification URLs by inserting one per line.<br />' . "\n";
361
  echo '<textarea name="ws_plugin__s2member_sp_notification_urls" id="ws-plugin--s2member-sp-notification-urls" rows="3" wrap="off">' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_notification_urls"]) . '</textarea><br />' . "\n";
362
  echo 'Specific Post/Page Notifications take place silently behind-the-scene, using an HTTP connection. Each URL will be notified every time a sale occurs.<br /><br />' . "\n";
363
+ echo '<strong>You can also use these special Replacement Codes if you need them:</strong>' . "\n";
364
  echo '<ul>' . "\n";
365
  echo '<li><code>%%sp_access_url%% = The full URL ( generated by s2Member ) where the Customer can gain access.</code></li>' . "\n";
366
  echo '<li><code>%%sp_access_exp%% = Human readable expiration for %%sp_access_url%%. Ex: <em>( link expires in %%sp_access_exp%% )</em>.</code></li>' . "\n";
373
  echo '<li><code>%%item_number%% = The Item Number. Ex: <em>sp:13,24,36:72</em> ( translates to: <em>sp:comma-delimited IDs:expiration hours</em> ).</code></li>' . "\n";
374
  echo '<li><code>%%item_name%% = The Item Name. In other words, a brief description, detailing what this purchase was for.</code></li>' . "\n";
375
  echo '</ul>' . "\n";
376
+ echo '<strong>Custom Replacement Codes can also be inserted using these instructions:</strong>' . "\n";
377
  echo '<ul>' . "\n";
378
+ echo '<li><code>%%cv0%% = The domain of your site, which is passed through to PayPal® using the `custom` attribute in your PayPal® Shortcode.</code></li>' . "\n";
379
+ echo '<li><code>%%cv1%% = If you need to track additional custom variables, you can pipe delimit them into the `custom` attribute, inside your Shortcode, like this: custom="' . $_SERVER["HTTP_HOST"] . '|cv1|cv2|cv3". You can have an unlimited number of custom variables that track IP addresses, affiliate IDs, etc. In some cases you may need to use PHP code to insert a value into the custom field dynamically. Obviously this is for advanced webmasters, but the functionality has been made available for those who need it.</li>' . "\n";
380
  echo '</ul>' . "\n";
381
  echo '<strong>This example uses cv1 to track a User\'s IP address:</strong><br />' . "\n";
382
  echo '<em>( The IP address could be referenced in your Notification URL using %%cv1%% )</em><br />' . "\n";
383
+ echo '<code>custom="' . $_SERVER["HTTP_HOST"] . '|&lt;?php echo $_SERVER["REMOTE_ADDR"]; ?&gt;"</code>' . "\n";
384
  echo '</td>' . "\n";
385
  /**/
386
  echo '</tr>' . "\n";
408
  do_action ("ws_plugin__s2member_during_api_ops_page_before_right_sections", get_defined_vars ());
409
  do_action ("ws_plugin__s2member_during_menu_pages_before_right_sections", get_defined_vars ());
410
  /**/
411
+ echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["upsell-pro"]) ? '<div class="ws-menu-page-others"><a href="' . ws_plugin__s2member_parse_readme_value ("Pro Module / Licensing") . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-upsell-pro.png" alt="." /></a></div>' . "\n" : '';
412
  echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["installation"]) ? '<div class="ws-menu-page-installation"><a href="' . ws_plugin__s2member_parse_readme_value ("Professional Installation URI") . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-installation.png" alt="." /></a></div>' . "\n" : '';
413
  echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["tools"]) ? '<div class="ws-menu-page-tools"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-tools.png" alt="." /></div>' . "\n" : '';
414
  echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["support"]) ? '<div class="ws-menu-page-support"><a href="' . ws_plugin__s2member_parse_readme_value ("Forum URI") . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-support.png" alt="." /></a></div>' . "\n" : '';
includes/menu-pages/buttons.inc.php DELETED
@@ -1,647 +0,0 @@
1
- <?php
2
- /*
3
- Copyright: © 2009 WebSharks, Inc. ( coded in the USA )
4
- <mailto:support@websharks-inc.com> <http://www.websharks-inc.com/>
5
-
6
- Released under the terms of the GNU General Public License.
7
- You should have received a copy of the GNU General Public License,
8
- along with this software. In the main directory, see: /licensing/
9
- If not, see: <http://www.gnu.org/licenses/>.
10
- */
11
- /*
12
- Direct access denial.
13
- */
14
- if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
- /*
17
- PayPal® Button Generating page.
18
- */
19
- echo '<div class="wrap ws-menu-page">' . "\n";
20
- /**/
21
- echo '<div id="icon-plugins" class="icon32"><br /></div>' . "\n";
22
- echo '<h2><div>Developed by <a href="' . ws_plugin__s2member_parse_readme_value ("Plugin URI") . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-light.png" alt="." /></a></div>s2Member / PayPal® Buttons</h2>' . "\n";
23
- /**/
24
- echo '<div class="ws-menu-page-hr"></div>' . "\n";
25
- /**/
26
- echo '<table class="ws-menu-page-table">' . "\n";
27
- echo '<tbody class="ws-menu-page-table-tbody">' . "\n";
28
- echo '<tr class="ws-menu-page-table-tr">' . "\n";
29
- echo '<td class="ws-menu-page-table-l">' . "\n";
30
- /**/
31
- if (get_option ("ws_plugin__s2member_configured") && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"])
32
- {
33
- do_action ("ws_plugin__s2member_during_buttons_page_before_left_sections", get_defined_vars ());
34
- /**/
35
- if (apply_filters ("ws_plugin__s2member_during_buttons_page_during_left_sections_display_level1_buttons", true, get_defined_vars ()))
36
- {
37
- do_action ("ws_plugin__s2member_during_options_page_during_left_sections_before_level1_buttons", get_defined_vars ());
38
- /**/
39
- echo '<div class="ws-menu-page-group" title="PayPal® Buttons For Level #1 Access">' . "\n";
40
- /**/
41
- echo '<div class="ws-menu-page-section ws-plugin--s2member-level1-buttons-section">' . "\n";
42
- echo '<h3>Button Code Generator For Level #1 Access</h3>' . "\n";
43
- echo '<p>Very simple. All you do is customize the form fields provided, for each Membership Level that you plan to offer. Then press (Generate Button Code). These special PayPal® Buttons are customized to work with s2Member seamlessly. Member accounts will be activated instantly, in an automated fashion. When you, or a Member, cancels their membership, or fails to make payments on time, s2Member will automatically terminate their membership privileges. s2Member makes extensive use of the PayPal® IPN service. s2Member receives updates from PayPal® behind-the-scene.</p>' . "\n";
44
- echo '<p><em>* Buttons are NOT saved here. This is only a Button Generator. Once you\'ve generated your Button, copy/paste it into your Membership Options Page. If you lose your Button Code, you\'ll need to come back &amp; re-generate a new one. If you\'re in Sandbox Test-Mode, and you\'re NOT using the Shortcode Format, please remember to come back and re-generate your Buttons before you go live.</em></p>' . "\n";
45
- do_action ("ws_plugin__s2member_during_options_page_during_left_sections_during_level1_buttons", get_defined_vars ());
46
- /**/
47
- echo '<table class="form-table">' . "\n";
48
- echo '<tbody>' . "\n";
49
- echo '<tr>' . "\n";
50
- /**/
51
- echo '<th class="ws-menu-page-th-side">' . "\n";
52
- echo '<label for="ws-plugin--s2member-level1-shortcode">' . "\n";
53
- echo 'Button Code<br />For Level #1:<br /><br />' . "\n";
54
- echo '<div id="ws-plugin--s2member-level1-button-prev"></div>' . "\n";
55
- echo '</label>' . "\n";
56
- echo '</th>' . "\n";
57
- /**/
58
- echo '<td>' . "\n";
59
- echo '<form onsubmit="return false;">' . "\n";
60
- echo '<p id="ws-plugin--s2member-level1-trial-line">I\'ll offer the first <input type="text" id="ws-plugin--s2member-level1-trial-period" value="0" size="2" /> <select id="ws-plugin--s2member-level1-trial-term">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/membership-trial-terms.html") . '</select> free.</p>' . "\n";
61
- echo '<p><span id="ws-plugin--s2member-level1-trial-then">Then, </span>I want to charge: $<input type="text" id="ws-plugin--s2member-level1-amount" value="0.01" size="4" /> / <select id="ws-plugin--s2member-level1-term">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/membership-regular-terms.html") . '</select></p>' . "\n";
62
- echo '<p>Checkout Page Style <a href="#" onclick="alert(\'Optional. This can be configured inside your PayPal® account. PayPal® allows you to create Custom Page Styles, and assign a unique name to them. You can add your own header image and color selection to the checkout form. Once you\\\'ve created a Custom Page Style at PayPal®, you can enter that Page Style here.\\n\\nIn addition. The Shortcode below, provided by s2Member; supports an image attribute: image=\\\'\\\'default\\\'\\\'. This can be changed to a full URL, pointing to a custom image of your own; instead of the default PayPal® Button image.\'); return false;">[?]</a>: <input type="text" id="ws-plugin--s2member-level1-page-style" value="paypal" size="18" /> <select id="ws-plugin--s2member-level1-currency">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/currencies.html") . '</select> <input type="button" value="Generate Button Code" onclick="ws_plugin__s2member_paypalButtonGenerate(\'level1\');" class="button-primary" /></p>' . "\n";
63
- echo '<p>Custom Capabilities ( comma delimited ) <a href="#" onclick="alert(\'Optional. This is VERY advanced. For full details, see:\\ns2Member -> API Scripting -> Custom Capabilities.\'); return false;">[?]</a> <input type="text" id="ws-plugin--s2member-level1-ccaps" size="40" maxlength="125" /></p>' . "\n";
64
- echo '</form>' . "\n";
65
- echo '</td>' . "\n";
66
- /**/
67
- echo '</tr>' . "\n";
68
- echo '<tr>' . "\n";
69
- /**/
70
- echo '<td colspan="2">' . "\n";
71
- echo '<form onsubmit="return false;">' . "\n";
72
- do_action ("ws_plugin__s2member_during_options_page_during_left_sections_during_level1_buttons_before_shortcode", get_defined_vars ());
73
- echo '<strong>WordPress® Shortcode:</strong> ( recommended for both the WordPress® Visual &amp; HTML Editors )<br />' . "\n";
74
- $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/shortcodes/shortcode.html"));
75
- $ws_plugin__s2member_temp_s = preg_replace ("/%%domain%%/", strtolower ($_SERVER["HTTP_HOST"]), $ws_plugin__s2member_temp_s);
76
- $ws_plugin__s2member_temp_s = preg_replace ("/%%level%%/", "1", $ws_plugin__s2member_temp_s);
77
- $ws_plugin__s2member_temp_s = preg_replace ("/%%level_label%%/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_label"], $ws_plugin__s2member_temp_s);
78
- echo '<input id="ws-plugin--s2member-level1-shortcode" type="text" value="' . format_to_edit ($ws_plugin__s2member_temp_s) . '" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;" /><br /><br />' . "\n";
79
- echo '<strong>Resulting PayPal® Button Code:</strong> ( ultimately, your Shortcode will produce this snippet )<br />' . "\n";
80
- echo '<textarea id="ws-plugin--s2member-level1-button" rows="8" wrap="off" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;">';
81
- $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/button.html"));
82
- $ws_plugin__s2member_temp_s = preg_replace ("/%%endpoint%%/", (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "www.sandbox.paypal.com" : "www.paypal.com"), $ws_plugin__s2member_temp_s);
83
- $ws_plugin__s2member_temp_s = preg_replace ("/%%paypal_business%%/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"], $ws_plugin__s2member_temp_s);
84
- $ws_plugin__s2member_temp_s = preg_replace ("/%%level_label%%/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_label"], $ws_plugin__s2member_temp_s);
85
- $ws_plugin__s2member_temp_s = preg_replace ("/%%cancel_return%%/", get_bloginfo ("url"), $ws_plugin__s2member_temp_s);
86
- $ws_plugin__s2member_temp_s = preg_replace ("/%%notify_url%%/", get_bloginfo ("url") . "/?s2member_paypal_notify=1", $ws_plugin__s2member_temp_s);
87
- $ws_plugin__s2member_temp_s = preg_replace ("/%%return%%/", get_bloginfo ("url") . "/?s2member_paypal_return=1", $ws_plugin__s2member_temp_s);
88
- $ws_plugin__s2member_temp_s = preg_replace ("/%%domain%%/", strtolower ($_SERVER["HTTP_HOST"]), $ws_plugin__s2member_temp_s);
89
- $ws_plugin__s2member_temp_s = preg_replace ("/%%level%%/", "1", $ws_plugin__s2member_temp_s);
90
- echo format_to_edit ($ws_plugin__s2member_temp_s);
91
- echo '</textarea><br />' . "\n";
92
- echo '&uarr; Use this more advanced Code if you\'re building a theme or plugin that integrates with s2Member.' . "\n";
93
- echo '</form>' . "\n";
94
- echo '</td>' . "\n";
95
- /**/
96
- echo '</tr>' . "\n";
97
- echo '</tbody>' . "\n";
98
- echo '</table>' . "\n";
99
- echo '</div>' . "\n";
100
- /**/
101
- echo '</div>' . "\n";
102
- /**/
103
- do_action ("ws_plugin__s2member_during_options_page_during_left_sections_after_level1_buttons", get_defined_vars ());
104
- }
105
- /**/
106
- if (apply_filters ("ws_plugin__s2member_during_buttons_page_during_left_sections_display_level2_buttons", true, get_defined_vars ()))
107
- {
108
- do_action ("ws_plugin__s2member_during_options_page_during_left_sections_before_level2_buttons", get_defined_vars ());
109
- /**/
110
- echo '<div class="ws-menu-page-group" title="PayPal® Buttons For Level #2 Access">' . "\n";
111
- /**/
112
- echo '<div class="ws-menu-page-section ws-plugin--s2member-level2-buttons-section">' . "\n";
113
- echo '<h3>Button Code Generator For Level #2 Access</h3>' . "\n";
114
- echo '<p>Very simple. All you do is customize the form fields provided, for each Membership Level that you plan to offer. Then press (Generate Button Code). These special PayPal® Buttons are customized to work with s2Member seamlessly. Member accounts will be activated instantly, in an automated fashion. When you, or a Member, cancels their membership, or fails to make payments on time, s2Member will automatically terminate their membership privileges. s2Member makes extensive use of the PayPal® IPN service. s2Member receives updates from PayPal® behind-the-scene.</p>' . "\n";
115
- echo '<p><em>* Buttons are NOT saved here. This is only a Button Generator. Once you\'ve generated your Button, copy/paste it into your Membership Options Page. If you lose your Button Code, you\'ll need to come back &amp; re-generate a new one. If you\'re in Sandbox Test-Mode, and you\'re NOT using the Shortcode Format, please remember to come back and re-generate your Buttons before you go live.</em></p>' . "\n";
116
- do_action ("ws_plugin__s2member_during_options_page_during_left_sections_during_level2_buttons", get_defined_vars ());
117
- /**/
118
- echo '<table class="form-table">' . "\n";
119
- echo '<tbody>' . "\n";
120
- echo '<tr>' . "\n";
121
- /**/
122
- echo '<th class="ws-menu-page-th-side">' . "\n";
123
- echo '<label for="ws-plugin--s2member-level2-shortcode">' . "\n";
124
- echo 'Button Code<br />For Level #2:<br /><br />' . "\n";
125
- echo '<div id="ws-plugin--s2member-level2-button-prev"></div>' . "\n";
126
- echo '</label>' . "\n";
127
- echo '</th>' . "\n";
128
- /**/
129
- echo '<td>' . "\n";
130
- echo '<form onsubmit="return false;">' . "\n";
131
- echo '<p id="ws-plugin--s2member-level2-trial-line">I\'ll offer the first <input type="text" id="ws-plugin--s2member-level2-trial-period" value="0" size="2" /> <select id="ws-plugin--s2member-level2-trial-term">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/membership-trial-terms.html") . '</select> free.</p>' . "\n";
132
- echo '<p><span id="ws-plugin--s2member-level2-trial-then">Then, </span>I want to charge: $<input type="text" id="ws-plugin--s2member-level2-amount" value="0.01" size="4" /> / <select id="ws-plugin--s2member-level2-term">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/membership-regular-terms.html") . '</select></p>' . "\n";
133
- echo '<p>Checkout Page Style <a href="#" onclick="alert(\'Optional. This can be configured inside your PayPal® account. PayPal® allows you to create Custom Page Styles, and assign a unique name to them. You can add your own header image and color selection to the checkout form. Once you\\\'ve created a Custom Page Style at PayPal®, you can enter that Page Style here.\\n\\nIn addition. The Shortcode below, provided by s2Member; supports an image attribute: image=\\\'\\\'default\\\'\\\'. This can be changed to a full URL, pointing to a custom image of your own; instead of the default PayPal® Button image.\'); return false;">[?]</a>: <input type="text" id="ws-plugin--s2member-level2-page-style" value="paypal" size="18" /> <select id="ws-plugin--s2member-level2-currency">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/currencies.html") . '</select> <input type="button" value="Generate Button Code" onclick="ws_plugin__s2member_paypalButtonGenerate(\'level2\');" class="button-primary" /></p>' . "\n";
134
- echo '<p>Custom Capabilities ( comma delimited ) <a href="#" onclick="alert(\'Optional. This is VERY advanced. For full details, see:\\ns2Member -> API Scripting -> Custom Capabilities.\'); return false;">[?]</a> <input type="text" id="ws-plugin--s2member-level2-ccaps" size="40" maxlength="125" /></p>' . "\n";
135
- echo '</form>' . "\n";
136
- echo '</td>' . "\n";
137
- /**/
138
- echo '</tr>' . "\n";
139
- echo '<tr>' . "\n";
140
- /**/
141
- echo '<td colspan="2">' . "\n";
142
- echo '<form onsubmit="return false;">' . "\n";
143
- do_action ("ws_plugin__s2member_during_options_page_during_left_sections_during_level2_buttons_before_shortcode", get_defined_vars ());
144
- echo '<strong>WordPress® Shortcode:</strong> ( recommended for both the WordPress® Visual &amp; HTML Editors )<br />' . "\n";
145
- $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/shortcodes/shortcode.html"));
146
- $ws_plugin__s2member_temp_s = preg_replace ("/%%domain%%/", strtolower ($_SERVER["HTTP_HOST"]), $ws_plugin__s2member_temp_s);
147
- $ws_plugin__s2member_temp_s = preg_replace ("/%%level%%/", "2", $ws_plugin__s2member_temp_s);
148
- $ws_plugin__s2member_temp_s = preg_replace ("/%%level_label%%/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_label"], $ws_plugin__s2member_temp_s);
149
- echo '<input id="ws-plugin--s2member-level2-shortcode" type="text" value="' . format_to_edit ($ws_plugin__s2member_temp_s) . '" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;" /><br /><br />' . "\n";
150
- echo '<strong>Resulting PayPal® Button Code:</strong> ( ultimately, your Shortcode will produce this snippet )<br />' . "\n";
151
- echo '<textarea id="ws-plugin--s2member-level2-button" rows="8" wrap="off" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;">';
152
- $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/button.html"));
153
- $ws_plugin__s2member_temp_s = preg_replace ("/%%endpoint%%/", (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "www.sandbox.paypal.com" : "www.paypal.com"), $ws_plugin__s2member_temp_s);
154
- $ws_plugin__s2member_temp_s = preg_replace ("/%%paypal_business%%/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"], $ws_plugin__s2member_temp_s);
155
- $ws_plugin__s2member_temp_s = preg_replace ("/%%level_label%%/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_label"], $ws_plugin__s2member_temp_s);
156
- $ws_plugin__s2member_temp_s = preg_replace ("/%%cancel_return%%/", get_bloginfo ("url"), $ws_plugin__s2member_temp_s);
157
- $ws_plugin__s2member_temp_s = preg_replace ("/%%notify_url%%/", get_bloginfo ("url") . "/?s2member_paypal_notify=1", $ws_plugin__s2member_temp_s);
158
- $ws_plugin__s2member_temp_s = preg_replace ("/%%return%%/", get_bloginfo ("url") . "/?s2member_paypal_return=1", $ws_plugin__s2member_temp_s);
159
- $ws_plugin__s2member_temp_s = preg_replace ("/%%domain%%/", strtolower ($_SERVER["HTTP_HOST"]), $ws_plugin__s2member_temp_s);
160
- $ws_plugin__s2member_temp_s = preg_replace ("/%%level%%/", "2", $ws_plugin__s2member_temp_s);
161
- echo format_to_edit ($ws_plugin__s2member_temp_s);
162
- echo '</textarea><br />' . "\n";
163
- echo '&uarr; Use this more advanced Code if you\'re building a theme or plugin that integrates with s2Member.' . "\n";
164
- echo '</form>' . "\n";
165
- echo '</td>' . "\n";
166
- /**/
167
- echo '</tr>' . "\n";
168
- echo '</tbody>' . "\n";
169
- echo '</table>' . "\n";
170
- echo '</div>' . "\n";
171
- /**/
172
- echo '</div>' . "\n";
173
- /**/
174
- do_action ("ws_plugin__s2member_during_options_page_during_left_sections_after_level2_buttons", get_defined_vars ());
175
- }
176
- /**/
177
- if (apply_filters ("ws_plugin__s2member_during_buttons_page_during_left_sections_display_level3_buttons", true, get_defined_vars ()))
178
- {
179
- do_action ("ws_plugin__s2member_during_options_page_during_left_sections_before_level3_buttons", get_defined_vars ());
180
- /**/
181
- echo '<div class="ws-menu-page-group" title="PayPal® Buttons For Level #3 Access">' . "\n";
182
- /**/
183
- echo '<div class="ws-menu-page-section ws-plugin--s2member-level3-buttons-section">' . "\n";
184
- echo '<h3>Button Code Generator For Level #3 Access</h3>' . "\n";
185
- echo '<p>Very simple. All you do is customize the form fields provided, for each Membership Level that you plan to offer. Then press (Generate Button Code). These special PayPal® Buttons are customized to work with s2Member seamlessly. Member accounts will be activated instantly, in an automated fashion. When you, or a Member, cancels their membership, or fails to make payments on time, s2Member will automatically terminate their membership privileges. s2Member makes extensive use of the PayPal® IPN service. s2Member receives updates from PayPal® behind-the-scene.</p>' . "\n";
186
- echo '<p><em>* Buttons are NOT saved here. This is only a Button Generator. Once you\'ve generated your Button, copy/paste it into your Membership Options Page. If you lose your Button Code, you\'ll need to come back &amp; re-generate a new one. If you\'re in Sandbox Test-Mode, and you\'re NOT using the Shortcode Format, please remember to come back and re-generate your Buttons before you go live.</em></p>' . "\n";
187
- do_action ("ws_plugin__s2member_during_options_page_during_left_sections_during_level3_buttons", get_defined_vars ());
188
- /**/
189
- echo '<table class="form-table">' . "\n";
190
- echo '<tbody>' . "\n";
191
- echo '<tr>' . "\n";
192
- /**/
193
- echo '<th class="ws-menu-page-th-side">' . "\n";
194
- echo '<label for="ws-plugin--s2member-level3-shortcode">' . "\n";
195
- echo 'Button Code<br />For Level #3:<br /><br />' . "\n";
196
- echo '<div id="ws-plugin--s2member-level3-button-prev"></div>' . "\n";
197
- echo '</label>' . "\n";
198
- echo '</th>' . "\n";
199
- /**/
200
- echo '<td>' . "\n";
201
- echo '<form onsubmit="return false;">' . "\n";
202
- echo '<p id="ws-plugin--s2member-level3-trial-line">I\'ll offer the first <input type="text" id="ws-plugin--s2member-level3-trial-period" value="0" size="2" /> <select id="ws-plugin--s2member-level3-trial-term">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/membership-trial-terms.html") . '</select> free.</p>' . "\n";
203
- echo '<p><span id="ws-plugin--s2member-level3-trial-then">Then, </span>I want to charge: $<input type="text" id="ws-plugin--s2member-level3-amount" value="0.01" size="4" /> / <select id="ws-plugin--s2member-level3-term">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/membership-regular-terms.html") . '</select></p>' . "\n";
204
- echo '<p>Checkout Page Style <a href="#" onclick="alert(\'Optional. This can be configured inside your PayPal® account. PayPal® allows you to create Custom Page Styles, and assign a unique name to them. You can add your own header image and color selection to the checkout form. Once you\\\'ve created a Custom Page Style at PayPal®, you can enter that Page Style here.\\n\\nIn addition. The Shortcode below, provided by s2Member; supports an image attribute: image=\\\'\\\'default\\\'\\\'. This can be changed to a full URL, pointing to a custom image of your own; instead of the default PayPal® Button image.\'); return false;">[?]</a>: <input type="text" id="ws-plugin--s2member-level3-page-style" value="paypal" size="18" /> <select id="ws-plugin--s2member-level3-currency">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/currencies.html") . '</select> <input type="button" value="Generate Button Code" onclick="ws_plugin__s2member_paypalButtonGenerate(\'level3\');" class="button-primary" /></p>' . "\n";
205
- echo '<p>Custom Capabilities ( comma delimited ) <a href="#" onclick="alert(\'Optional. This is VERY advanced. For full details, see:\\ns2Member -> API Scripting -> Custom Capabilities.\'); return false;">[?]</a> <input type="text" id="ws-plugin--s2member-level3-ccaps" size="40" maxlength="125" /></p>' . "\n";
206
- echo '</form>' . "\n";
207
- echo '</td>' . "\n";
208
- /**/
209
- echo '</tr>' . "\n";
210
- echo '<tr>' . "\n";
211
- /**/
212
- echo '<td colspan="2">' . "\n";
213
- echo '<form onsubmit="return false;">' . "\n";
214
- do_action ("ws_plugin__s2member_during_options_page_during_left_sections_during_level3_buttons_before_shortcode", get_defined_vars ());
215
- echo '<strong>WordPress® Shortcode:</strong> ( recommended for both the WordPress® Visual &amp; HTML Editors )<br />' . "\n";
216
- $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/shortcodes/shortcode.html"));
217
- $ws_plugin__s2member_temp_s = preg_replace ("/%%domain%%/", strtolower ($_SERVER["HTTP_HOST"]), $ws_plugin__s2member_temp_s);
218
- $ws_plugin__s2member_temp_s = preg_replace ("/%%level%%/", "3", $ws_plugin__s2member_temp_s);
219
- $ws_plugin__s2member_temp_s = preg_replace ("/%%level_label%%/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_label"], $ws_plugin__s2member_temp_s);
220
- echo '<input id="ws-plugin--s2member-level3-shortcode" type="text" value="' . format_to_edit ($ws_plugin__s2member_temp_s) . '" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;" /><br /><br />' . "\n";
221
- echo '<strong>Resulting PayPal® Button Code:</strong> ( ultimately, your Shortcode will produce this snippet )<br />' . "\n";
222
- echo '<textarea id="ws-plugin--s2member-level3-button" rows="8" wrap="off" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;">';
223
- $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/button.html"));
224
- $ws_plugin__s2member_temp_s = preg_replace ("/%%endpoint%%/", (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "www.sandbox.paypal.com" : "www.paypal.com"), $ws_plugin__s2member_temp_s);
225
- $ws_plugin__s2member_temp_s = preg_replace ("/%%paypal_business%%/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"], $ws_plugin__s2member_temp_s);
226
- $ws_plugin__s2member_temp_s = preg_replace ("/%%level_label%%/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_label"], $ws_plugin__s2member_temp_s);
227
- $ws_plugin__s2member_temp_s = preg_replace ("/%%cancel_return%%/", get_bloginfo ("url"), $ws_plugin__s2member_temp_s);
228
- $ws_plugin__s2member_temp_s = preg_replace ("/%%notify_url%%/", get_bloginfo ("url") . "/?s2member_paypal_notify=1", $ws_plugin__s2member_temp_s);
229
- $ws_plugin__s2member_temp_s = preg_replace ("/%%return%%/", get_bloginfo ("url") . "/?s2member_paypal_return=1", $ws_plugin__s2member_temp_s);
230
- $ws_plugin__s2member_temp_s = preg_replace ("/%%domain%%/", strtolower ($_SERVER["HTTP_HOST"]), $ws_plugin__s2member_temp_s);
231
- $ws_plugin__s2member_temp_s = preg_replace ("/%%level%%/", "3", $ws_plugin__s2member_temp_s);
232
- echo format_to_edit ($ws_plugin__s2member_temp_s);
233
- echo '</textarea><br />' . "\n";
234
- echo '&uarr; Use this more advanced Code if you\'re building a theme or plugin that integrates with s2Member.' . "\n";
235
- echo '</form>' . "\n";
236
- echo '</td>' . "\n";
237
- /**/
238
- echo '</tr>' . "\n";
239
- echo '</tbody>' . "\n";
240
- echo '</table>' . "\n";
241
- echo '</div>' . "\n";
242
- /**/
243
- echo '</div>' . "\n";
244
- /**/
245
- do_action ("ws_plugin__s2member_during_options_page_during_left_sections_after_level3_buttons", get_defined_vars ());
246
- }
247
- /**/
248
- if (apply_filters ("ws_plugin__s2member_during_buttons_page_during_left_sections_display_level4_buttons", true, get_defined_vars ()))
249
- {
250
- do_action ("ws_plugin__s2member_during_options_page_during_left_sections_before_level4_buttons", get_defined_vars ());
251
- /**/
252
- echo '<div class="ws-menu-page-group" title="PayPal® Buttons For Level #4 Access">' . "\n";
253
- /**/
254
- echo '<div class="ws-menu-page-section ws-plugin--s2member-level4-buttons-section">' . "\n";
255
- echo '<h3>Button Code Generator For Level #4 Access</h3>' . "\n";
256
- echo '<p>Very simple. All you do is customize the form fields provided, for each Membership Level that you plan to offer. Then press (Generate Button Code). These special PayPal® Buttons are customized to work with s2Member seamlessly. Member accounts will be activated instantly, in an automated fashion. When you, or a Member, cancels their membership, or fails to make payments on time, s2Member will automatically terminate their membership privileges. s2Member makes extensive use of the PayPal® IPN service. s2Member receives updates from PayPal® behind-the-scene.</p>' . "\n";
257
- echo '<p><em>* Buttons are NOT saved here. This is only a Button Generator. Once you\'ve generated your Button, copy/paste it into your Membership Options Page. If you lose your Button Code, you\'ll need to come back &amp; re-generate a new one. If you\'re in Sandbox Test-Mode, and you\'re NOT using the Shortcode Format, please remember to come back and re-generate your Buttons before you go live.</em></p>' . "\n";
258
- do_action ("ws_plugin__s2member_during_options_page_during_left_sections_during_level4_buttons", get_defined_vars ());
259
- /**/
260
- echo '<table class="form-table">' . "\n";
261
- echo '<tbody>' . "\n";
262
- echo '<tr>' . "\n";
263
- /**/
264
- echo '<th class="ws-menu-page-th-side">' . "\n";
265
- echo '<label for="ws-plugin--s2member-level4-shortcode">' . "\n";
266
- echo 'Button Code<br />For Level #4:<br /><br />' . "\n";
267
- echo '<div id="ws-plugin--s2member-level4-button-prev"></div>' . "\n";
268
- echo '</label>' . "\n";
269
- echo '</th>' . "\n";
270
- /**/
271
- echo '<td>' . "\n";
272
- echo '<form onsubmit="return false;">' . "\n";
273
- echo '<p id="ws-plugin--s2member-level4-trial-line">I\'ll offer the first <input type="text" id="ws-plugin--s2member-level4-trial-period" value="0" size="2" /> <select id="ws-plugin--s2member-level4-trial-term">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/membership-trial-terms.html") . '</select> free.</p>' . "\n";
274
- echo '<p><span id="ws-plugin--s2member-level4-trial-then">Then, </span>I want to charge: $<input type="text" id="ws-plugin--s2member-level4-amount" value="0.01" size="4" /> / <select id="ws-plugin--s2member-level4-term">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/membership-regular-terms.html") . '</select></p>' . "\n";
275
- echo '<p>Checkout Page Style <a href="#" onclick="alert(\'Optional. This can be configured inside your PayPal® account. PayPal® allows you to create Custom Page Styles, and assign a unique name to them. You can add your own header image and color selection to the checkout form. Once you\\\'ve created a Custom Page Style at PayPal®, you can enter that Page Style here.\\n\\nIn addition. The Shortcode below, provided by s2Member; supports an image attribute: image=\\\'\\\'default\\\'\\\'. This can be changed to a full URL, pointing to a custom image of your own; instead of the default PayPal® Button image.\'); return false;">[?]</a>: <input type="text" id="ws-plugin--s2member-level4-page-style" value="paypal" size="18" /> <select id="ws-plugin--s2member-level4-currency">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/currencies.html") . '</select> <input type="button" value="Generate Button Code" onclick="ws_plugin__s2member_paypalButtonGenerate(\'level4\');" class="button-primary" /></p>' . "\n";
276
- echo '<p>Custom Capabilities ( comma delimited ) <a href="#" onclick="alert(\'Optional. This is VERY advanced. For full details, see:\\ns2Member -> API Scripting -> Custom Capabilities.\'); return false;">[?]</a> <input type="text" id="ws-plugin--s2member-level4-ccaps" size="40" maxlength="125" /></p>' . "\n";
277
- echo '</form>' . "\n";
278
- echo '</td>' . "\n";
279
- /**/
280
- echo '</tr>' . "\n";
281
- echo '<tr>' . "\n";
282
- /**/
283
- echo '<td colspan="2">' . "\n";
284
- echo '<form onsubmit="return false;">' . "\n";
285
- do_action ("ws_plugin__s2member_during_options_page_during_left_sections_during_level4_buttons_before_shortcode", get_defined_vars ());
286
- echo '<strong>WordPress® Shortcode:</strong> ( recommended for both the WordPress® Visual &amp; HTML Editors )<br />' . "\n";
287
- $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/shortcodes/shortcode.html"));
288
- $ws_plugin__s2member_temp_s = preg_replace ("/%%domain%%/", strtolower ($_SERVER["HTTP_HOST"]), $ws_plugin__s2member_temp_s);
289
- $ws_plugin__s2member_temp_s = preg_replace ("/%%level%%/", "4", $ws_plugin__s2member_temp_s);
290
- $ws_plugin__s2member_temp_s = preg_replace ("/%%level_label%%/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_label"], $ws_plugin__s2member_temp_s);
291
- echo '<input id="ws-plugin--s2member-level4-shortcode" type="text" value="' . format_to_edit ($ws_plugin__s2member_temp_s) . '" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;" /><br /><br />' . "\n";
292
- echo '<strong>Resulting PayPal® Button Code:</strong> ( ultimately, your Shortcode will produce this snippet )<br />' . "\n";
293
- echo '<textarea id="ws-plugin--s2member-level4-button" rows="8" wrap="off" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;">';
294
- $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/button.html"));
295
- $ws_plugin__s2member_temp_s = preg_replace ("/%%endpoint%%/", (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "www.sandbox.paypal.com" : "www.paypal.com"), $ws_plugin__s2member_temp_s);
296
- $ws_plugin__s2member_temp_s = preg_replace ("/%%paypal_business%%/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"], $ws_plugin__s2member_temp_s);
297
- $ws_plugin__s2member_temp_s = preg_replace ("/%%level_label%%/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_label"], $ws_plugin__s2member_temp_s);
298
- $ws_plugin__s2member_temp_s = preg_replace ("/%%cancel_return%%/", get_bloginfo ("url"), $ws_plugin__s2member_temp_s);
299
- $ws_plugin__s2member_temp_s = preg_replace ("/%%notify_url%%/", get_bloginfo ("url") . "/?s2member_paypal_notify=1", $ws_plugin__s2member_temp_s);
300
- $ws_plugin__s2member_temp_s = preg_replace ("/%%return%%/", get_bloginfo ("url") . "/?s2member_paypal_return=1", $ws_plugin__s2member_temp_s);
301
- $ws_plugin__s2member_temp_s = preg_replace ("/%%domain%%/", strtolower ($_SERVER["HTTP_HOST"]), $ws_plugin__s2member_temp_s);
302
- $ws_plugin__s2member_temp_s = preg_replace ("/%%level%%/", "4", $ws_plugin__s2member_temp_s);
303
- echo format_to_edit ($ws_plugin__s2member_temp_s);
304
- echo '</textarea><br />' . "\n";
305
- echo '&uarr; Use this more advanced Code if you\'re building a theme or plugin that integrates with s2Member.' . "\n";
306
- echo '</form>' . "\n";
307
- echo '</td>' . "\n";
308
- /**/
309
- echo '</tr>' . "\n";
310
- echo '</tbody>' . "\n";
311
- echo '</table>' . "\n";
312
- echo '</div>' . "\n";
313
- /**/
314
- echo '</div>' . "\n";
315
- /**/
316
- do_action ("ws_plugin__s2member_during_options_page_during_left_sections_after_level4_buttons", get_defined_vars ());
317
- }
318
- /**/
319
- if (apply_filters ("ws_plugin__s2member_during_buttons_page_during_left_sections_display_modification_buttons", true, get_defined_vars ()))
320
- {
321
- do_action ("ws_plugin__s2member_during_options_page_during_left_sections_before_modification_buttons", get_defined_vars ());
322
- /**/
323
- echo '<div class="ws-menu-page-group" title="PayPal® Subscr Modification Buttons">' . "\n";
324
- /**/
325
- echo '<div class="ws-menu-page-section ws-plugin--s2member-modification-buttons-section">' . "\n";
326
- echo '<h3>Button Code Generator For Subscription Modifications</h3>' . "\n";
327
- echo '<p>If you\'d like to give your Members ( and/or your Free Subscribers ) the ability to modify their billing plan, by switching to a more expensive option, or a less expensive option; generate a new PayPal® Modification Button here. Configure the updated Level, pricing, terms, etc. Then, make that new Modification Button available to Members who are logged into their existing account with you. For example, you might want to insert a "Level #2" Upgrade Button into your Login Welcome Page, which would up-sell existing Level #1 Members to a more expensive plan that you offer.</p>' . "\n";
328
- echo '<p><em><strong>*Modification Process*</strong> When you send a Member to PayPal® using a Subscription Modification Button, PayPal® will ask them to login. Once they\'re logged in, instead of being able to signup for a new membership, PayPal® will provide them with the ability to upgrade and/or downgrade their existing membership with you, by allowing them to switch to the Membership Plan that was specified in the Subscription Modification Button. PayPal® handles this nicely, and you\'ll be happy to know that s2Member has been pre-configured to deal with this scenario as well, so that everything remains automated. Their Membership Access Level will either be promoted, or demoted, based on the actions they took at PayPal® during the modification process. Once an existing Member completes their Subscription Modification at PayPal®, they\'ll be brought back to their Login Welcome Page, instead of the registration screen.</em></p>' . "\n";
329
- echo '<p><em><strong>*Also Works For Free Subscribers*</strong> Although a Free Subscriber does not have an existing PayPal® Subscription, s2Member is capable of adapting to this scenario gracefully. Just make sure that your existing Free Subscribers ( the ones who wish to upgrade ) pay for their Membership through a Modification Button generated by s2Member. That will allow them to continue using their existing account with you. In other words, they can keep their existing Username ( and anything already associated with that Username ), rather than being forced to re-register after checkout.</em></p>' . "\n";
330
- echo '<p><em><strong>*Make It More User-Friendly*</strong> You can make the Subscription Modification Process, more user-friendly, by setting up a <a href="#" onclick="alert(\'Optional. This can be configured inside your PayPal® account. PayPal® allows you to create Custom Page Styles, and assign a unique name to them. You can add your own header image and color selection to the checkout form. Once you\\\'ve created a Custom Page Style at PayPal®, you can tell s2Member to use that Page Style whenever you generate your Button Code.\'); return false;">Custom Page Style at PayPal®</a>, specifically for Subscription Modification Buttons. Use a custom header image, with a brief explanation to the Customer. Something like, "Log into PayPal®", "You can Modify your Subscription!".</em></p>' . "\n";
331
- echo '<p><em>* Buttons are NOT saved here. This is only a Button Generator. Once you\'ve generated your Button, copy/paste it into your Login Welcome Page, or wherever you feel it would be most appropriate. If you lose your Button Code, you\'ll need to come back &amp; re-generate a new one. If you\'re in Sandbox Test-Mode, and you\'re NOT using the Shortcode Format, please remember to come back and re-generate your Buttons before you go live.</em></p>' . "\n";
332
- do_action ("ws_plugin__s2member_during_options_page_during_left_sections_during_modification_buttons", get_defined_vars ());
333
- /**/
334
- echo '<table class="form-table">' . "\n";
335
- echo '<tbody>' . "\n";
336
- echo '<tr>' . "\n";
337
- /**/
338
- echo '<th class="ws-menu-page-th-side">' . "\n";
339
- echo '<label for="ws-plugin--s2member-modification-shortcode">' . "\n";
340
- echo 'Button Code<br />For Modifications:<br /><br />' . "\n";
341
- echo '<div id="ws-plugin--s2member-modification-button-prev"></div>' . "\n";
342
- echo '</label>' . "\n";
343
- echo '</th>' . "\n";
344
- /**/
345
- echo '<td>' . "\n";
346
- echo '<form onsubmit="return false;">' . "\n";
347
- echo '<p>Modification: <select id="ws-plugin--s2member-modification-level">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/membership-modification-levels.html") . '</select></p>' . "\n";
348
- echo '<p id="ws-plugin--s2member-modification-trial-line">I\'ll offer the first <input type="text" id="ws-plugin--s2member-modification-trial-period" value="0" size="2" /> <select id="ws-plugin--s2member-modification-trial-term">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/membership-trial-terms.html") . '</select> free.</p>' . "\n";
349
- echo '<p><span id="ws-plugin--s2member-modification-trial-then">Then, </span>I want to charge: $<input type="text" id="ws-plugin--s2member-modification-amount" value="0.01" size="4" /> / <select id="ws-plugin--s2member-modification-term">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/membership-regular-terms.html") . '</select><span id="ws-plugin--s2member-modification-20p-rule"><br /><small>** Watch out for <a href="https://www.x.com/thread/41748" target="_blank" rel="external">the 20% rule</a>. Additional details on the 20% rule are <a href="https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_WPRecurringPayments#id086530108PM__id08653060UE6" target="_blank" rel="external">documented here</a>.</small></span></p>' . "\n";
350
- echo '<p>Checkout Page Style <a href="#" onclick="alert(\'Optional. This can be configured inside your PayPal® account. PayPal® allows you to create Custom Page Styles, and assign a unique name to them. You can add your own header image and color selection to the checkout form. Once you\\\'ve created a Custom Page Style at PayPal®, you can enter that Page Style here.\\n\\nIn addition. The Shortcode below, provided by s2Member; supports an image attribute: image=\\\'\\\'default\\\'\\\'. This can be changed to a full URL, pointing to a custom image of your own; instead of the default PayPal® Button image.\'); return false;">[?]</a>: <input type="text" id="ws-plugin--s2member-modification-page-style" value="paypal" size="18" /> <select id="ws-plugin--s2member-modification-currency">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/currencies.html") . '</select> <input type="button" value="Generate Button Code" onclick="ws_plugin__s2member_paypalButtonGenerate(\'modification\');" class="button-primary" /></p>' . "\n";
351
- echo '<p>Custom Capabilities ( comma delimited ) <a href="#" onclick="alert(\'Optional. This is VERY advanced. For full details, see:\\ns2Member -> API Scripting -> Custom Capabilities.\'); return false;">[?]</a> <input type="text" id="ws-plugin--s2member-modification-ccaps" size="40" maxlength="125" /></p>' . "\n";
352
- echo '</form>' . "\n";
353
- echo '</td>' . "\n";
354
- /**/
355
- echo '</tr>' . "\n";
356
- echo '<tr>' . "\n";
357
- /**/
358
- echo '<td colspan="2">' . "\n";
359
- echo '<form onsubmit="return false;">' . "\n";
360
- do_action ("ws_plugin__s2member_during_options_page_during_left_sections_during_modification_buttons_before_shortcode", get_defined_vars ());
361
- echo '<strong>WordPress® Shortcode:</strong> ( recommended for both the WordPress® Visual &amp; HTML Editors )<br />' . "\n";
362
- $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/shortcodes/shortcode.html"));
363
- $ws_plugin__s2member_temp_s = preg_replace ("/\/]$/", 'mb="1" /]', $ws_plugin__s2member_temp_s);
364
- $ws_plugin__s2member_temp_s = preg_replace ("/%%domain%%/", strtolower ($_SERVER["HTTP_HOST"]), $ws_plugin__s2member_temp_s);
365
- $ws_plugin__s2member_temp_s = preg_replace ("/%%level%%/", "2", $ws_plugin__s2member_temp_s);
366
- $ws_plugin__s2member_temp_s = preg_replace ("/%%level_label%%/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_label"], $ws_plugin__s2member_temp_s);
367
- echo '<input id="ws-plugin--s2member-modification-shortcode" type="text" value="' . format_to_edit ($ws_plugin__s2member_temp_s) . '" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;" /><br /><br />' . "\n";
368
- echo '<strong>Resulting PayPal® Button Code:</strong> ( ultimately, your Shortcode will produce this snippet )<br />' . "\n";
369
- echo '<textarea id="ws-plugin--s2member-modification-button" rows="8" wrap="off" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;">';
370
- $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/button.html"));
371
- $ws_plugin__s2member_temp_s = preg_replace ('/name\="modify" value\="(.*?)"/', 'name="modify" value="1"', $ws_plugin__s2member_temp_s);
372
- $ws_plugin__s2member_temp_s = preg_replace ("/%%endpoint%%/", (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "www.sandbox.paypal.com" : "www.paypal.com"), $ws_plugin__s2member_temp_s);
373
- $ws_plugin__s2member_temp_s = preg_replace ("/%%paypal_business%%/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"], $ws_plugin__s2member_temp_s);
374
- $ws_plugin__s2member_temp_s = preg_replace ("/%%level_label%%/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_label"], $ws_plugin__s2member_temp_s);
375
- $ws_plugin__s2member_temp_s = preg_replace ("/%%cancel_return%%/", get_bloginfo ("url"), $ws_plugin__s2member_temp_s);
376
- $ws_plugin__s2member_temp_s = preg_replace ("/%%notify_url%%/", get_bloginfo ("url") . "/?s2member_paypal_notify=1", $ws_plugin__s2member_temp_s);
377
- $ws_plugin__s2member_temp_s = preg_replace ("/%%return%%/", get_bloginfo ("url") . "/?s2member_paypal_return=1", $ws_plugin__s2member_temp_s);
378
- $ws_plugin__s2member_temp_s = preg_replace ("/%%domain%%/", strtolower ($_SERVER["HTTP_HOST"]), $ws_plugin__s2member_temp_s);
379
- $ws_plugin__s2member_temp_s = preg_replace ("/%%level%%/", "2", $ws_plugin__s2member_temp_s);
380
- echo format_to_edit ($ws_plugin__s2member_temp_s);
381
- echo '</textarea><br />' . "\n";
382
- echo '&uarr; Use this more advanced Code if you\'re building a theme or plugin that integrates with s2Member.' . "\n";
383
- echo '</form>' . "\n";
384
- echo '</td>' . "\n";
385
- /**/
386
- echo '</tr>' . "\n";
387
- echo '</tbody>' . "\n";
388
- echo '</table>' . "\n";
389
- echo '</div>' . "\n";
390
- /**/
391
- echo '</div>' . "\n";
392
- /**/
393
- do_action ("ws_plugin__s2member_during_options_page_during_left_sections_after_modification_buttons", get_defined_vars ());
394
- }
395
- /**/
396
- if (apply_filters ("ws_plugin__s2member_during_buttons_page_during_left_sections_display_cancellation_buttons", true, get_defined_vars ()))
397
- {
398
- do_action ("ws_plugin__s2member_during_options_page_during_left_sections_before_cancellation_buttons", get_defined_vars ());
399
- /**/
400
- echo '<div class="ws-menu-page-group" title="PayPal® Subscr Cancellation Buttons">' . "\n";
401
- /**/
402
- echo '<div class="ws-menu-page-section ws-plugin--s2member-cancellation-buttons-section">' . "\n";
403
- echo '<h3>One Button Does It All For Cancellations ( copy/paste )</h3>' . "\n";
404
- echo '<p>Since every paid Membership is associated with a PayPal® Subscription; and every PayPal® Subscription is associated with a PayPal® Account; your Members will always have a PayPal® Account of their own, which is tied to their Membership with you. So... a Member can simply log into their own PayPal® account and cancel their Subscription(s) with you at anytime, all on their own. However, some Customers do not realize this. So, if you would like to make it clearer ( easier ) for Members to cancel their own Subscription(s), you can provide this Cancellation Button for them on your Login Welcome Page, or somewhere in the support section of your website. Note... you don\'t have to use this Cancellation Button at all, if you don\'t want to. It\'s completely optional.</p>' . "\n";
405
- echo '<p><em><strong>*Cancellation Process*</strong> Very simple. A Member clicks the Cancellation Button. PayPal® asks them to log into their PayPal® account. Once they\'re logged in, PayPal® will display a list of all active Subscriptions they have with you. They choose which ones they want to cancel, and s2Member is notified silently behind-the-scene, through the PayPal® IPN service.</em></p>' . "\n";
406
- do_action ("ws_plugin__s2member_during_options_page_during_left_sections_during_cancellation_buttons", get_defined_vars ());
407
- /**/
408
- echo '<table class="form-table">' . "\n";
409
- echo '<tbody>' . "\n";
410
- echo '<tr>' . "\n";
411
- /**/
412
- echo '<th class="ws-menu-page-th-side">' . "\n";
413
- echo '<label for="ws-plugin--s2member-cancellation-shortcode">' . "\n";
414
- echo 'Button Code<br />For Cancellations:<br /><br />' . "\n";
415
- echo '<div id="ws-plugin--s2member-cancellation-button-prev">' . "\n";
416
- $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/c-button.html"));
417
- $ws_plugin__s2member_temp_s = preg_replace ("/%%endpoint%%/", (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "www.sandbox.paypal.com" : "www.paypal.com"), $ws_plugin__s2member_temp_s);
418
- $ws_plugin__s2member_temp_s = preg_replace ("/%%paypal_business%%/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"], $ws_plugin__s2member_temp_s);
419
- echo preg_replace ("/\<a/", '<a target="_blank"', $ws_plugin__s2member_temp_s);
420
- echo '</div>' . "\n";
421
- echo '</label>' . "\n";
422
- echo '</th>' . "\n";
423
- /**/
424
- echo '<td>' . "\n";
425
- echo '<form onsubmit="return false;">' . "\n";
426
- echo '<p>No configuration necessary.</p>' . "\n";
427
- echo '</form>' . "\n";
428
- echo '</td>' . "\n";
429
- /**/
430
- echo '</tr>' . "\n";
431
- echo '<tr>' . "\n";
432
- /**/
433
- echo '<td colspan="2">' . "\n";
434
- echo '<form onsubmit="return false;">' . "\n";
435
- do_action ("ws_plugin__s2member_during_options_page_during_left_sections_during_cancellation_buttons_before_shortcode", get_defined_vars ());
436
- echo '<strong>WordPress® Shortcode:</strong> ( recommended for both the WordPress® Visual &amp; HTML Editors )<br />' . "\n";
437
- $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/shortcodes/c-shortcode.html"));
438
- echo '<input id="ws-plugin--s2member-cancellation-shortcode" type="text" value="' . format_to_edit ($ws_plugin__s2member_temp_s) . '" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;" /><br /><br />' . "\n";
439
- echo '<strong>Resulting PayPal® Button Code:</strong> ( ultimately, your Shortcode will produce this snippet )<br />' . "\n";
440
- echo '<textarea id="ws-plugin--s2member-cancellation-button" rows="8" wrap="off" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;">';
441
- $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/c-button.html"));
442
- $ws_plugin__s2member_temp_s = preg_replace ("/%%endpoint%%/", (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "www.sandbox.paypal.com" : "www.paypal.com"), $ws_plugin__s2member_temp_s);
443
- $ws_plugin__s2member_temp_s = preg_replace ("/%%paypal_business%%/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"], $ws_plugin__s2member_temp_s);
444
- echo format_to_edit ($ws_plugin__s2member_temp_s);
445
- echo '</textarea><br />' . "\n";
446
- echo '&uarr; Use this more advanced Code if you\'re building a theme or plugin that integrates with s2Member.' . "\n";
447
- echo '</form>' . "\n";
448
- echo '</td>' . "\n";
449
- /**/
450
- echo '</tr>' . "\n";
451
- echo '</tbody>' . "\n";
452
- echo '</table>' . "\n";
453
- echo '</div>' . "\n";
454
- /**/
455
- echo '</div>' . "\n";
456
- /**/
457
- do_action ("ws_plugin__s2member_during_options_page_during_left_sections_after_cancellation_buttons", get_defined_vars ());
458
- }
459
- /**/
460
- if (apply_filters ("ws_plugin__s2member_during_buttons_page_during_left_sections_display_sp_buttons", true, get_defined_vars ()))
461
- {
462
- do_action ("ws_plugin__s2member_during_options_page_during_left_sections_before_sp_buttons", get_defined_vars ());
463
- /**/
464
- echo '<div class="ws-menu-page-group" title="PayPal® Specific Post/Page (Buy Now) Buttons">' . "\n";
465
- /**/
466
- echo '<div class="ws-menu-page-section ws-plugin--s2member-sp-buttons-section">' . "\n";
467
- echo '<h3>Button Code Generator For Specific Post/Page Buttons</h3>' . "\n";
468
- echo '<p>s2Member now supports an additional layer of functionality ( very powerful ), which allows you to sell access to specific Posts/Pages that you\'ve created in WordPress®. Specific Post/Page Access works independently from Member Level Access. That is, you can sell an unlimited number of Posts/Pages using "Buy Now" Buttons, and your Customers will NOT be required to have a Membership Account with your site in order to receive access. If they are already a Member, that\'s fine, but they won\'t need to be.</p>' . "\n";
469
- echo '<p>In other words, Customers will NOT need to login, just to receive access to the Specific Post/Page they purchased access to. s2Member will immediately redirect the Customer to the Specific Post/Page after checkout is completed successfully. An email is also sent to the Customer with a link ( see: <code>s2Member -> PayPal® Options -> Specific Post/Page Email</code> ). Authentication is handled automatically through self-expiring links, good for 72 hours by default.</p>' . "\n";
470
- echo '<p>Specific Post/Page Access, is sort of like selling a product. Only, instead of shipping anything to the Customer, you just give them access to a specific Post/Page on your site; one that you created in WordPress®. A Specific Post/Page that is protected by s2Member, might contain a download link for your eBook, access to file &amp; music downloads, access to additional support services, and the list goes on and on. The possibilities with this are endless; as long as your digital product can be delivered through access to a WordPress® Post/Page that you\'ve created. To protect Specific Posts/Pages, please see: <code>s2Member -> General Options -> Specific Post/Page Access Restrictions</code>. Once you\'ve configured your Specific Post/Page Restrictions, those Posts/Pages will be available in the menus below.</p>' . "\n";
471
- echo '<p>Very simple. All you do is customize the form fields provided, for each Post/Page that you plan to sell. Then press (Generate Button Code). These special PayPal® Buttons are customized to work with s2Member seamlessly. You can even Package Additional Posts/Pages together into one transaction.</p>' . "\n";
472
- echo '<p><em>* Buttons are NOT saved here. This is only a Button Generator. Once you\'ve generated your Button, copy/paste it into your WordPress® Editor, wherever you feel it would be most appropriate. If you lose your Button Code, you\'ll need to come back &amp; re-generate a new one. If you\'re in Sandbox Test-Mode, and you\'re NOT using the Shortcode Format, please remember to come back and re-generate your Buttons before you go live.</em></p>' . "\n";
473
- do_action ("ws_plugin__s2member_during_options_page_during_left_sections_during_sp_buttons", get_defined_vars ());
474
- /**/
475
- echo '<table class="form-table">' . "\n";
476
- echo '<tbody>' . "\n";
477
- echo '<tr>' . "\n";
478
- /**/
479
- echo '<th class="ws-menu-page-th-side">' . "\n";
480
- echo '<label for="ws-plugin--s2member-sp-shortcode">' . "\n";
481
- echo 'Button Code<br />Specific Posts/Pages:<br /><br />' . "\n";
482
- echo '<div id="ws-plugin--s2member-sp-button-prev"></div>' . "\n";
483
- echo '</label>' . "\n";
484
- echo '</th>' . "\n";
485
- /**/
486
- echo '<td>' . "\n";
487
- echo '<form onsubmit="return false;">' . "\n";
488
- echo '<p><select id="ws-plugin--s2member-sp-leading-id">' . "\n";
489
- echo '<option value="">&mdash; Select a Leading Post/Page that you\'ve protected &mdash;</option>' . "\n";
490
- $ws_plugin__s2member_temp_a_pp = ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"]) ?/**/
491
- array_merge ((array)get_posts ("include=" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"]),/**/
492
- (array)get_pages ("include=" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"])) : array ();
493
- foreach (($ws_plugin__s2member_temp_a = $ws_plugin__s2member_temp_a_pp) as $ws_plugin__s2member_temp_o)
494
- if ($ws_plugin__s2member_temp_o->ID != $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"])
495
- if ($ws_plugin__s2member_temp_o->ID != $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
496
- if ($ws_plugin__s2member_temp_o->ID != $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"])
497
- if (!in_array ($ws_plugin__s2member_temp_o->ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_pages"])))
498
- if (!in_array ($ws_plugin__s2member_temp_o->ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_pages"])))
499
- if (!in_array ($ws_plugin__s2member_temp_o->ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_pages"])))
500
- if (!in_array ($ws_plugin__s2member_temp_o->ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_pages"])))
501
- echo '<option value="' . esc_attr ($ws_plugin__s2member_temp_o->ID) . '">' . esc_html ($ws_plugin__s2member_temp_o->post_title) . '</option>' . "\n";
502
- /**/
503
- echo '</select> <a href="#" onclick="alert(\'Required. The Leading Post/Page, is what your Customers will land on after checkout.\n\n*Tip* If there are no Posts/Pages in the menu, it\\\'s because you\\\'ve not configured s2Member for Specific Post/Page Access yet. See: s2Member -> General Options -> Specific Post/Page Access Restrictions.\'); return false;">[?]</a></p>' . "\n";
504
- /**/
505
- echo '<p><select id="ws-plugin--s2member-sp-additional-ids" multiple="multiple" style="height:100px;">' . "\n";
506
- echo '<optgroup label="&mdash; Package Additional Posts/Pages that you\'ve protected &mdash;">' . "\n";
507
- foreach (($ws_plugin__s2member_temp_a = $ws_plugin__s2member_temp_a_pp) as $ws_plugin__s2member_temp_o)
508
- if ($ws_plugin__s2member_temp_o->ID != $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"])
509
- if ($ws_plugin__s2member_temp_o->ID != $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
510
- if ($ws_plugin__s2member_temp_o->ID != $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"])
511
- if (!in_array ($ws_plugin__s2member_temp_o->ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_pages"])))
512
- if (!in_array ($ws_plugin__s2member_temp_o->ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_pages"])))
513
- if (!in_array ($ws_plugin__s2member_temp_o->ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_pages"])))
514
- if (!in_array ($ws_plugin__s2member_temp_o->ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_pages"])))
515
- echo '<option value="' . esc_attr ($ws_plugin__s2member_temp_o->ID) . '">' . esc_html ($ws_plugin__s2member_temp_o->post_title) . '</option>' . "\n";
516
- /**/
517
- echo '</optgroup></select> <a href="#" onclick="alert(\'Hold down your `Ctrl` key to select multiples.\\n\\nOptional. If you include Additional Posts/Pages, Customers will still land on your Leading Post/Page; BUT, they\\\'ll ALSO have access to some Additional Posts/Pages that you\\\'ve protected. This gives you the ability to create Post/Page Packages.\\n\\nIn other words, a Customer is sold a Specific Post/Page ( they\\\'ll land on your Leading Post/Page after checkout ), which might contain links to some other Posts/Pages that you\\\'ve packaged together under one transaction.\\n\\nBundling Additional Posts/Pages into one Package, authenticates the Customer for access to the Additional Posts/Pages automatically ( e.g. only one Access Link is needed, and s2Member generates this automatically ). However, you will STILL need to design your Leading Post/Page ( which is what a Customer will actually land on ), with links pointing to the other Posts/Pages. This way your Customers will have clickable links to everything they\\\'ve paid for.\\n\\n*Quick Summary* s2Member sends Customers to your Leading Post/Page, and also authenticates them for access to any Additional Posts/Pages automatically. You handle it from there.\\n\\n*Tip* If there are no Posts/Pages in this menu, it\\\'s because you\\\'ve not configured s2Member for Specific Post/Page Access yet. See: s2Member -> General Options -> Specific Post/Page Access Restrictions.\'); return false;">[?]</a></p>' . "\n";
518
- /**/
519
- echo '<p>Description: <input type="text" id="ws-plugin--s2member-sp-desc" value="" size="68" /></p>' . "\n";
520
- echo '<p>I want to charge: $<input type="text" id="ws-plugin--s2member-sp-amount" value="0.01" size="4" /> / <select id="ws-plugin--s2member-sp-hours">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/sp-hours.html") . '</select></p>' . "\n";
521
- echo '<p>Checkout Page Style <a href="#" onclick="alert(\'Optional. This can be configured inside your PayPal® account. PayPal® allows you to create Custom Page Styles, and assign a unique name to them. You can add your own header image and color selection to the checkout form. Once you\\\'ve created a Custom Page Style at PayPal®, you can enter that Page Style here.\\n\\nIn addition. The Shortcode below, provided by s2Member; supports an image attribute: image=\\\'\\\'default\\\'\\\'. This can be changed to a full URL, pointing to a custom image of your own; instead of the default PayPal® Button image.\'); return false;">[?]</a>: <input type="text" id="ws-plugin--s2member-sp-page-style" value="paypal" size="18" /> <select id="ws-plugin--s2member-sp-currency">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/currencies.html") . '</select> <input type="button" value="Generate Button Code" onclick="ws_plugin__s2member_paypalSpButtonGenerate();" class="button-primary" /></p>' . "\n";
522
- echo '</form>' . "\n";
523
- echo '</td>' . "\n";
524
- /**/
525
- echo '</tr>' . "\n";
526
- echo '<tr>' . "\n";
527
- /**/
528
- echo '<td colspan="2">' . "\n";
529
- echo '<form onsubmit="return false;">' . "\n";
530
- do_action ("ws_plugin__s2member_during_options_page_during_left_sections_during_sp_buttons_before_shortcode", get_defined_vars ());
531
- echo '<strong>WordPress® Shortcode:</strong> ( recommended for both the WordPress® Visual &amp; HTML Editors )<br />' . "\n";
532
- $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/shortcodes/sp-shortcode.html"));
533
- $ws_plugin__s2member_temp_s = preg_replace ("/%%domain%%/", strtolower ($_SERVER["HTTP_HOST"]), $ws_plugin__s2member_temp_s);
534
- echo '<input id="ws-plugin--s2member-sp-shortcode" type="text" value="' . format_to_edit ($ws_plugin__s2member_temp_s) . '" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;" /><br /><br />' . "\n";
535
- echo '<strong>Resulting PayPal® Button Code:</strong> ( ultimately, your Shortcode will produce this snippet )<br />' . "\n";
536
- echo '<textarea id="ws-plugin--s2member-sp-button" rows="8" wrap="off" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;">';
537
- $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/sp-button.html"));
538
- $ws_plugin__s2member_temp_s = preg_replace ("/%%endpoint%%/", (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "www.sandbox.paypal.com" : "www.paypal.com"), $ws_plugin__s2member_temp_s);
539
- $ws_plugin__s2member_temp_s = preg_replace ("/%%paypal_business%%/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"], $ws_plugin__s2member_temp_s);
540
- $ws_plugin__s2member_temp_s = preg_replace ("/%%cancel_return%%/", get_bloginfo ("url"), $ws_plugin__s2member_temp_s);
541
- $ws_plugin__s2member_temp_s = preg_replace ("/%%notify_url%%/", get_bloginfo ("url") . "/?s2member_paypal_notify=1", $ws_plugin__s2member_temp_s);
542
- $ws_plugin__s2member_temp_s = preg_replace ("/%%return%%/", get_bloginfo ("url") . "/?s2member_paypal_return=1", $ws_plugin__s2member_temp_s);
543
- $ws_plugin__s2member_temp_s = preg_replace ("/%%domain%%/", strtolower ($_SERVER["HTTP_HOST"]), $ws_plugin__s2member_temp_s);
544
- echo format_to_edit ($ws_plugin__s2member_temp_s);
545
- echo '</textarea><br />' . "\n";
546
- echo '&uarr; Use this more advanced Code if you\'re building a theme or plugin that integrates with s2Member.' . "\n";
547
- echo '</form>' . "\n";
548
- echo '</td>' . "\n";
549
- /**/
550
- echo '</tr>' . "\n";
551
- echo '</tbody>' . "\n";
552
- echo '</table>' . "\n";
553
- echo '</div>' . "\n";
554
- /**/
555
- echo '</div>' . "\n";
556
- /**/
557
- do_action ("ws_plugin__s2member_during_options_page_during_left_sections_after_sp_buttons", get_defined_vars ());
558
- }
559
- /**/
560
- if (apply_filters ("ws_plugin__s2member_during_buttons_page_during_left_sections_display_sp_links", true, get_defined_vars ()))
561
- {
562
- do_action ("ws_plugin__s2member_during_options_page_during_left_sections_before_sp_links", get_defined_vars ());
563
- /**/
564
- echo '<div class="ws-menu-page-group" title="PayPal® Specific Post/Page Access Links">' . "\n";
565
- /**/
566
- echo '<div class="ws-menu-page-section ws-plugin--s2member-sp-links-section">' . "\n";
567
- echo '<h3>Specific Post/Page Link Generator ( for Customer Service )</h3>' . "\n";
568
- echo '<p>s2Member automatically generates Specific Post/Page Links for your Customers after checkout, and also sends them a link in a Confirmation Email. However, if you ever need to deal with a Customer Service issue that requires a new Specific Post/Page Link to be created manually, you can use this tool for that.</p>' . "\n";
569
- do_action ("ws_plugin__s2member_during_options_page_during_left_sections_during_sp_links", get_defined_vars ());
570
- /**/
571
- echo '<table class="form-table">' . "\n";
572
- echo '<tbody>' . "\n";
573
- echo '<tr>' . "\n";
574
- /**/
575
- echo '<td>' . "\n";
576
- echo '<form onsubmit="return false;">' . "\n";
577
- echo '<p><select id="ws-plugin--s2member-sp-link-leading-id">' . "\n";
578
- echo '<option value="">&mdash; Select a Leading Post/Page that you\'ve protected &mdash;</option>' . "\n";
579
- foreach (($ws_plugin__s2member_temp_a = $ws_plugin__s2member_temp_a_pp) as $ws_plugin__s2member_temp_o)
580
- if ($ws_plugin__s2member_temp_o->ID != $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"])
581
- if ($ws_plugin__s2member_temp_o->ID != $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
582
- if ($ws_plugin__s2member_temp_o->ID != $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"])
583
- if (!in_array ($ws_plugin__s2member_temp_o->ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_pages"])))
584
- if (!in_array ($ws_plugin__s2member_temp_o->ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_pages"])))
585
- if (!in_array ($ws_plugin__s2member_temp_o->ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_pages"])))
586
- if (!in_array ($ws_plugin__s2member_temp_o->ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_pages"])))
587
- echo '<option value="' . esc_attr ($ws_plugin__s2member_temp_o->ID) . '">' . esc_html ($ws_plugin__s2member_temp_o->post_title) . '</option>' . "\n";
588
- /**/
589
- echo '</select> <a href="#" onclick="alert(\'Required. The Leading Post/Page, is what your Customers will land on after checkout.\n\n*Tip* If there are no Posts/Pages in the menu, it\\\'s because you\\\'ve not configured s2Member for Specific Post/Page Access yet. See: s2Member -> General Options -> Specific Post/Page Access Restrictions.\'); return false;">[?]</a></p>' . "\n";
590
- /**/
591
- echo '<p><select id="ws-plugin--s2member-sp-link-additional-ids" multiple="multiple" style="height:100px;">' . "\n";
592
- echo '<optgroup label="&mdash; Package Additional Posts/Pages that you\'ve protected &mdash;">' . "\n";
593
- foreach (($ws_plugin__s2member_temp_a = $ws_plugin__s2member_temp_a_pp) as $ws_plugin__s2member_temp_o)
594
- if ($ws_plugin__s2member_temp_o->ID != $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"])
595
- if ($ws_plugin__s2member_temp_o->ID != $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
596
- if ($ws_plugin__s2member_temp_o->ID != $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"])
597
- if (!in_array ($ws_plugin__s2member_temp_o->ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_pages"])))
598
- if (!in_array ($ws_plugin__s2member_temp_o->ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_pages"])))
599
- if (!in_array ($ws_plugin__s2member_temp_o->ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_pages"])))
600
- if (!in_array ($ws_plugin__s2member_temp_o->ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_pages"])))
601
- echo '<option value="' . esc_attr ($ws_plugin__s2member_temp_o->ID) . '">' . esc_html ($ws_plugin__s2member_temp_o->post_title) . '</option>' . "\n";
602
- /**/
603
- echo '</optgroup></select> <a href="#" onclick="alert(\'Hold down your `Ctrl` key to select multiples.\\n\\nOptional. If you include Additional Posts/Pages, Customers will still land on your Leading Post/Page; BUT, they\\\'ll ALSO have access to some Additional Posts/Pages that you\\\'ve protected. This gives you the ability to create Post/Page Packages.\\n\\nIn other words, a Customer is sold a Specific Post/Page ( they\\\'ll land on your Leading Post/Page after checkout ), which might contain links to some other Posts/Pages that you\\\'ve packaged together under one transaction.\\n\\nBundling Additional Posts/Pages into one Package, authenticates the Customer for access to the Additional Posts/Pages automatically ( e.g. only one Access Link is needed, and s2Member generates this automatically ). However, you will STILL need to design your Leading Post/Page ( which is what a Customer will actually land on ), with links pointing to the other Posts/Pages. This way your Customers will have clickable links to everything they\\\'ve paid for.\\n\\n*Quick Summary* s2Member sends Customers to your Leading Post/Page, and also authenticates them for access to any Additional Posts/Pages automatically. You handle it from there.\\n\\n*Tip* If there are no Posts/Pages in this menu, it\\\'s because you\\\'ve not configured s2Member for Specific Post/Page Access yet. See: s2Member -> General Options -> Specific Post/Page Access Restrictions.\'); return false;">[?]</a></p>' . "\n";
604
- /**/
605
- echo '<p><select id="ws-plugin--s2member-sp-link-hours">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/sp-hours.html") . '</select> <input type="button" value="Generate Access Link" onclick="ws_plugin__s2member_paypalSpLinkGenerate();" class="button-primary" /> <img id="ws-plugin--s2member-sp-link-loading" src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/ajax-loader.gif" alt="" style="display:none;" /></p>' . "\n";
606
- echo '<p id="ws-plugin--s2member-sp-link" style="font-family:Consolas, monospace; display:none;"></p>' . "\n";
607
- echo '</form>' . "\n";
608
- echo '</td>' . "\n";
609
- /**/
610
- echo '</tr>' . "\n";
611
- echo '</tbody>' . "\n";
612
- echo '</table>' . "\n";
613
- echo '</div>' . "\n";
614
- /**/
615
- echo '</div>' . "\n";
616
- /**/
617
- do_action ("ws_plugin__s2member_during_options_page_during_left_sections_after_sp_links", get_defined_vars ());
618
- }
619
- /**/
620
- do_action ("ws_plugin__s2member_during_buttons_page_after_left_sections", get_defined_vars ());
621
- }
622
- else /* They need to first configure the options. */
623
- echo '<p>Please configure the s2Member PayPal® Options first. Once your PayPal® Options have been properly configured, return to this page &amp; generate your PayPal® Button(s).</p>' . "\n";
624
- /**/
625
- echo '</td>' . "\n";
626
- /**/
627
- echo '<td class="ws-menu-page-table-r">' . "\n";
628
- /**/
629
- do_action ("ws_plugin__s2member_during_buttons_page_before_right_sections", get_defined_vars ());
630
- do_action ("ws_plugin__s2member_during_menu_pages_before_right_sections", get_defined_vars ());
631
- /**/
632
- echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["installation"]) ? '<div class="ws-menu-page-installation"><a href="' . ws_plugin__s2member_parse_readme_value ("Professional Installation URI") . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-installation.png" alt="." /></a></div>' . "\n" : '';
633
- echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["tools"]) ? '<div class="ws-menu-page-tools"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-tools.png" alt="." /></div>' . "\n" : '';
634
- echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["support"]) ? '<div class="ws-menu-page-support"><a href="' . ws_plugin__s2member_parse_readme_value ("Forum URI") . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-support.png" alt="." /></a></div>' . "\n" : '';
635
- echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["donations"]) ? '<div class="ws-menu-page-donations"><a href="' . ws_plugin__s2member_parse_readme_value ("Donate link") . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-donations.jpg" alt="." /></a></div>' . "\n" : '';
636
- /**/
637
- do_action ("ws_plugin__s2member_during_menu_pages_after_right_sections", get_defined_vars ());
638
- do_action ("ws_plugin__s2member_during_buttons_page_after_right_sections", get_defined_vars ());
639
- /**/
640
- echo '</td>' . "\n";
641
- /**/
642
- echo '</tr>' . "\n";
643
- echo '</tbody>' . "\n";
644
- echo '</table>' . "\n";
645
- /**/
646
- echo '</div>' . "\n";
647
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/menu-pages/code-samples/ccap-file-downloads.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ http://www.example.com/?s2member_file_download=access-s2member-ccap-music/file.mp3
2
+ http://www.example.com/?s2member_file_download=access-s2member-ccap-videos/file.avi
includes/menu-pages/code-samples/current-user-access-label.php CHANGED
@@ -1,3 +1,3 @@
1
  <?php echo S2MEMBER_CURRENT_USER_ACCESS_LABEL; ?>
2
  This may output something like: Gold Membership
3
- ( or whatever label you've configured for their membership level )
1
  <?php echo S2MEMBER_CURRENT_USER_ACCESS_LABEL; ?>
2
  This may output something like: Gold Membership
3
+ ( or whatever Label you've configured for their Membership Level )
includes/menu-pages/code-samples/current-user-can-specific-content.php CHANGED
@@ -6,7 +6,7 @@
6
  Some premium content for Level 2 Members.
7
  <?php } else if (is_user_logged_in() && current_user_can("access_s2member_level1")){ ?>
8
  Some premium content for Level 1 Members.
9
- <?php } else if (is_user_logged_in()){ ?>
10
  Some content for Free Subscribers.
11
  <?php } else { ?>
12
  Some public content.
6
  Some premium content for Level 2 Members.
7
  <?php } else if (is_user_logged_in() && current_user_can("access_s2member_level1")){ ?>
8
  Some premium content for Level 1 Members.
9
+ <?php } else if (is_user_logged_in() && current_user_can("access_s2member_level0")){ ?>
10
  Some content for Free Subscribers.
11
  <?php } else { ?>
12
  Some public content.
includes/menu-pages/code-samples/level0-file-downloads-allowed-days.php ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ Level #0 Users are allowed to download
2
+ <?php echo S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED; ?> files
3
+ every <?php S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED_DAYS; ?> days.
includes/menu-pages/code-samples/level0-file-downloads-allowed.php ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ Level #0 Users are allowed to download
2
+ <?php echo S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED; ?> files
3
+ every <?php S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED_DAYS; ?> days.
includes/menu-pages/code-samples/level0-label.php ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <?php echo S2MEMBER_LEVEL0_LABEL; ?>
2
+ This may output something like: Free
3
+ ( or whatever Label you've configured for Level #0 )
includes/menu-pages/code-samples/level1-file-downloads-allowed-days.php CHANGED
@@ -1,3 +1,3 @@
1
- Level #1 users are allowed to download
2
  <?php echo S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED; ?> files
3
  every <?php S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED_DAYS; ?> days.
1
+ Level #1 Members are allowed to download
2
  <?php echo S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED; ?> files
3
  every <?php S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED_DAYS; ?> days.
includes/menu-pages/code-samples/level1-file-downloads-allowed.php CHANGED
@@ -1,3 +1,3 @@
1
- Level #1 users are allowed to download
2
  <?php echo S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED; ?> files
3
  every <?php S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED_DAYS; ?> days.
1
+ Level #1 Members are allowed to download
2
  <?php echo S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED; ?> files
3
  every <?php S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED_DAYS; ?> days.
includes/menu-pages/code-samples/level1-label.php CHANGED
@@ -1,3 +1,3 @@
1
  <?php echo S2MEMBER_LEVEL1_LABEL; ?>
2
  This may output something like: Bronze Membership
3
- ( or whatever label you've configured for level #1 )
1
  <?php echo S2MEMBER_LEVEL1_LABEL; ?>
2
  This may output something like: Bronze Membership
3
+ ( or whatever Label you've configured for Level #1 )
includes/menu-pages/code-samples/level2-file-downloads-allowed-days.php CHANGED
@@ -1,3 +1,3 @@
1
- Level #2 users are allowed to download
2
  <?php echo S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED; ?> files
3
  every <?php S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED_DAYS; ?> days.
1
+ Level #2 Members are allowed to download
2
  <?php echo S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED; ?> files
3
  every <?php S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED_DAYS; ?> days.
includes/menu-pages/code-samples/level2-file-downloads-allowed.php CHANGED
@@ -1,3 +1,3 @@
1
- Level #2 users are allowed to download
2
  <?php echo S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED; ?> files
3
  every <?php S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED_DAYS; ?> days.
1
+ Level #2 Members are allowed to download
2
  <?php echo S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED; ?> files
3
  every <?php S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED_DAYS; ?> days.
includes/menu-pages/code-samples/level2-label.php CHANGED
@@ -1,3 +1,3 @@
1
  <?php echo S2MEMBER_LEVEL2_LABEL; ?>
2
  This may output something like: Silver Membership
3
- ( or whatever label you've configured for level #2 )
1
  <?php echo S2MEMBER_LEVEL2_LABEL; ?>
2
  This may output something like: Silver Membership
3
+ ( or whatever Label you've configured for Level #2 )
includes/menu-pages/code-samples/level3-file-downloads-allowed-days.php CHANGED
@@ -1,3 +1,3 @@
1
- Level #3 users are allowed to download
2
  <?php echo S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED; ?> files
3
  every <?php S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED_DAYS; ?> days.
1
+ Level #3 Members are allowed to download
2
  <?php echo S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED; ?> files
3
  every <?php S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED_DAYS; ?> days.
includes/menu-pages/code-samples/level3-file-downloads-allowed.php CHANGED
@@ -1,3 +1,3 @@
1
- Level #3 users are allowed to download
2
  <?php echo S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED; ?> files
3
  every <?php S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED_DAYS; ?> days.
1
+ Level #3 Members are allowed to download
2
  <?php echo S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED; ?> files
3
  every <?php S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED_DAYS; ?> days.
includes/menu-pages/code-samples/level3-label.php CHANGED
@@ -1,3 +1,3 @@
1
  <?php echo S2MEMBER_LEVEL3_LABEL; ?>
2
  This may output something like: Gold Membership
3
- ( or whatever label you've configured for level #3 )
1
  <?php echo S2MEMBER_LEVEL3_LABEL; ?>
2
  This may output something like: Gold Membership
3
+ ( or whatever Label you've configured for Level #3 )
includes/menu-pages/code-samples/level4-file-downloads-allowed-days.php CHANGED
@@ -1,3 +1,3 @@
1
- Level #4 users are allowed to download
2
  <?php echo S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED; ?> files
3
  every <?php S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED_DAYS; ?> days.
1
+ Level #4 Members are allowed to download
2
  <?php echo S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED; ?> files
3
  every <?php S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED_DAYS; ?> days.
includes/menu-pages/code-samples/level4-file-downloads-allowed.php CHANGED
@@ -1,3 +1,3 @@
1
- Level #4 users are allowed to download
2
  <?php echo S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED; ?> files
3
  every <?php S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED_DAYS; ?> days.
1
+ Level #4 Members are allowed to download
2
  <?php echo S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED; ?> files
3
  every <?php S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED_DAYS; ?> days.
includes/menu-pages/code-samples/level4-label.php CHANGED
@@ -1,3 +1,3 @@
1
  <?php echo S2MEMBER_LEVEL4_LABEL; ?>
2
  This may output something like: Platinum Membership
3
- ( or whatever label you've configured for level #4 )
1
  <?php echo S2MEMBER_LEVEL4_LABEL; ?>
2
  This may output something like: Platinum Membership
3
+ ( or whatever Label you've configured for Level #4 )
includes/menu-pages/down-ops.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
  /*
17
  Download Options page.
18
  */
@@ -34,28 +34,27 @@ echo '<input type="hidden" name="ws_plugin__s2member_configured" id="ws-plugin--
34
  /**/
35
  do_action ("ws_plugin__s2member_during_down_ops_page_before_left_sections", get_defined_vars ());
36
  /**/
37
- if (apply_filters ("ws_plugin__s2member_during_down_ops_page_during_left_sections_display_download_restrictions", true, get_defined_vars ()))
38
  {
39
- do_action ("ws_plugin__s2member_during_down_ops_page_during_left_sections_before_download_restrictions", get_defined_vars ());
40
  /**/
41
  echo '<div class="ws-menu-page-group" title="Protected File Downloads">' . "\n";
42
  /**/
43
- echo '<div class="ws-menu-page-section ws-plugin--s2member-download-restrictions-section">' . "\n";
44
  echo '<h3>File Download Restrictions ( required, if providing access to protected files )</h3>' . "\n";
45
- echo '<p>If your membership offering allows access to restricted files, you\'ll need to configure these options.</p>' . "\n";
46
- do_action ("ws_plugin__s2member_during_down_ops_page_during_left_sections_during_download_restrictions", get_defined_vars ());
47
  /**/
48
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
49
  /**/
50
- echo '<h3>Upload restricted files to this security-enabled directory:<br /> <code>' . preg_replace ("/^" . preg_quote ($_SERVER["DOCUMENT_ROOT"], "/") . "/", "", $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"]) . '</code></h3>' . "\n";
51
- echo '<p>- Then, you can link to these restricted files using this special format:<br />&nbsp;&nbsp;<code>' . get_bloginfo ("url") . '/?<strong>s2member_file_download</strong>=example-file.zip</code><br />&nbsp;&nbsp;<small><em><strong>s2member_file_download</strong> = location of the file, relative to the /' . esc_html (basename ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/ directory. In other words, just the file name.</em></small></p>' . "\n";
52
- echo '<p>- If needed, you can make certain files available free, using an extra variable:<br />&nbsp;&nbsp;<code>' . get_bloginfo ("url") . '/?<strong>s2member_file_download</strong>=example-file.zip&<strong>s2member_free_file_download_key</strong>=&lt;?php echo md5(s2member_xencrypt("example-file.zip")); ?&gt;</code><br />&nbsp;&nbsp;<small><em><strong>s2member_free_file_download_key</strong> = &lt;?php echo md5(s2member_xencrypt("location of the file, relative to the /' . esc_html (basename ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/ directory")); ?&gt;</em></small></p>' . "\n";
53
  /**/
54
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
55
  /**/
56
- echo '<p>s2Member will allow access to these protected files, based on the configuration you specify below. <em>* Note: repeated downloads of the same exact file are NOT tabulated against the totals below. Once a file has been downloaded, future downloads of the same exact file, by the same exact Member will not be counted against them. In other words, if a Member downloads the same file three times, the system only counts that as one unique download.</em></p>' . "\n";
57
  echo '<p>s2Member will automatically detect links, anywhere in your content, and/or anywhere in your theme files, that contain <code>?s2member_file_download</code>. Whenever a logged-in Member clicks a link that contains <code>?s2member_file_download</code>, the system will politely ask the user to confirm the download using a very intuitive JavaScript confirmation prompt that contains specific details about download limitations. This way your Members will be aware of how many files they\'ve downloaded in the current period; and they\'ll be able to make a conscious decision about whether to proceed with a specific download or not.</p>' . "\n";
58
- echo '<p><em>* The above only applies to users who are logged in as Members. For all other users in the general public, the <code>?s2member_file_download</code> links will redirect them your Membership Options Page, so that new users can signup, in order to gain access, by becoming a Member.</em></p>' . "\n";
59
  /**/
60
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
61
  /**/
@@ -64,6 +63,23 @@ if (apply_filters ("ws_plugin__s2member_during_down_ops_page_during_left_section
64
  echo '<tr>' . "\n";
65
  /**/
66
  echo '<th>' . "\n";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  echo '<label for="ws-plugin--s2member-level1-file-downloads-allowed">' . "\n";
68
  echo 'File Downloads ( Level #1 Or Higher ):' . "\n";
69
  echo '</label>' . "\n";
@@ -135,7 +151,7 @@ if (apply_filters ("ws_plugin__s2member_during_down_ops_page_during_left_section
135
  /**/
136
  echo '</div>' . "\n";
137
  /**/
138
- do_action ("ws_plugin__s2member_during_down_ops_page_during_left_sections_after_download_restrictions", get_defined_vars ());
139
  }
140
  /**/
141
  if (apply_filters ("ws_plugin__s2member_during_down_ops_page_during_left_sections_display_limit_exceeded_page", true, get_defined_vars ()))
@@ -181,6 +197,30 @@ if (apply_filters ("ws_plugin__s2member_during_down_ops_page_during_left_section
181
  do_action ("ws_plugin__s2member_during_down_ops_page_during_left_sections_after_limit_exceeded_page", get_defined_vars ());
182
  }
183
  /**/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
184
  if (apply_filters ("ws_plugin__s2member_during_down_ops_page_during_left_sections_display_inline_extensions", true, get_defined_vars ()))
185
  {
186
  do_action ("ws_plugin__s2member_during_down_ops_page_during_left_sections_before_inline_extensions", get_defined_vars ());
@@ -236,6 +276,7 @@ echo '<td class="ws-menu-page-table-r">' . "\n";
236
  do_action ("ws_plugin__s2member_during_down_ops_page_before_right_sections", get_defined_vars ());
237
  do_action ("ws_plugin__s2member_during_menu_pages_before_right_sections", get_defined_vars ());
238
  /**/
 
239
  echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["installation"]) ? '<div class="ws-menu-page-installation"><a href="' . ws_plugin__s2member_parse_readme_value ("Professional Installation URI") . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-installation.png" alt="." /></a></div>' . "\n" : '';
240
  echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["tools"]) ? '<div class="ws-menu-page-tools"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-tools.png" alt="." /></div>' . "\n" : '';
241
  echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["support"]) ? '<div class="ws-menu-page-support"><a href="' . ws_plugin__s2member_parse_readme_value ("Forum URI") . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-support.png" alt="." /></a></div>' . "\n" : '';
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit("Do not access this file directly.");
16
  /*
17
  Download Options page.
18
  */
34
  /**/
35
  do_action ("ws_plugin__s2member_during_down_ops_page_before_left_sections", get_defined_vars ());
36
  /**/
37
+ if (apply_filters ("ws_plugin__s2member_during_down_ops_page_during_left_sections_display_restrictions", true, get_defined_vars ()))
38
  {
39
+ do_action ("ws_plugin__s2member_during_down_ops_page_during_left_sections_before_restrictions", get_defined_vars ());
40
  /**/
41
  echo '<div class="ws-menu-page-group" title="Protected File Downloads">' . "\n";
42
  /**/
43
+ echo '<div class="ws-menu-page-section ws-plugin--s2member-restrictions-section">' . "\n";
44
  echo '<h3>File Download Restrictions ( required, if providing access to protected files )</h3>' . "\n";
45
+ echo '<p>If your membership offering allows access to restricted files, you\'ll want to configure these options.</p>' . "\n";
46
+ do_action ("ws_plugin__s2member_during_down_ops_page_during_left_sections_during_restrictions", get_defined_vars ());
47
  /**/
48
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
49
  /**/
50
+ echo '<p><strong>Upload restricted files to this security-enabled directory:</strong><br /><code>' . preg_replace ("/^" . preg_quote ($_SERVER["DOCUMENT_ROOT"], "/") . "/", "", $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"]) . '</code></p>' . "\n";
51
+ echo '<p>- Now, you can link to any protected file, using this special format:<br />&nbsp;&nbsp;<code>' . get_bloginfo ("url") . '/?s2member_file_download=example-file.zip</code><br />&nbsp;&nbsp;<small><em><strong>s2member_file_download</strong> = location of the file, relative to the /' . esc_html (basename ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/ directory. In other words, just the file name.</em></small></p>' . "\n";
 
52
  /**/
53
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
54
  /**/
55
+ echo '<p>s2Member will allow access to these protected files, based on the configuration you specify below. Repeated downloads of the same exact file are NOT tabulated against the totals below. Once a file has been downloaded, future downloads of the same exact file, by the same exact Member will not be counted against them. In other words, if a Member downloads the same file three times, the system only counts that as one unique download.</p>' . "\n";
56
  echo '<p>s2Member will automatically detect links, anywhere in your content, and/or anywhere in your theme files, that contain <code>?s2member_file_download</code>. Whenever a logged-in Member clicks a link that contains <code>?s2member_file_download</code>, the system will politely ask the user to confirm the download using a very intuitive JavaScript confirmation prompt that contains specific details about download limitations. This way your Members will be aware of how many files they\'ve downloaded in the current period; and they\'ll be able to make a conscious decision about whether to proceed with a specific download or not.</p>' . "\n";
57
+ echo '<p><em>* The above only applies to Users who are logged in as Members. For all other visitors in the general public, the <code>?s2member_file_download</code> links will redirect them your Membership Options Page, so that new visitors can signup, in order to gain access, by becoming a Member.</em></p>' . "\n";
58
  /**/
59
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
60
  /**/
63
  echo '<tr>' . "\n";
64
  /**/
65
  echo '<th>' . "\n";
66
+ echo '<label for="ws-plugin--s2member-level0-file-downloads-allowed">' . "\n";
67
+ echo 'File Downloads ( Level #0 Or Higher ):' . "\n";
68
+ echo '</label>' . "\n";
69
+ echo '</th>' . "\n";
70
+ /**/
71
+ echo '</tr>' . "\n";
72
+ echo '<tr>' . "\n";
73
+ /**/
74
+ echo '<td>' . "\n";
75
+ echo '<input type="text" name="ws_plugin__s2member_level0_file_downloads_allowed" id="ws-plugin--s2member-level0-file-downloads-allowed" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_file_downloads_allowed"]) . '" style="width:200px;" maxlength="9" /> every <input type="text" name="ws_plugin__s2member_level0_file_downloads_allowed_days" id="ws-plugin--s2member-level0-file-downloads-allowed-days" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_file_downloads_allowed_days"]) . '" style="width:200px;" maxlength="3" onkeyup="if(this.value > 365){ alert(\'( 365 days is the maximum ).\\nThis keeps the logs optimized.\'); this.value = 365; }" /> days.<br />' . "\n";
76
+ echo 'Only this many unique downloads ( <code><em>999999999 = unlimited</em></code> ) will be permitted every X days.' . "\n";
77
+ echo '</td>' . "\n";
78
+ /**/
79
+ echo '</tr>' . "\n";
80
+ echo '<tr>' . "\n";
81
+ /**/
82
+ echo '<th>' . "\n";
83
  echo '<label for="ws-plugin--s2member-level1-file-downloads-allowed">' . "\n";
84
  echo 'File Downloads ( Level #1 Or Higher ):' . "\n";
85
  echo '</label>' . "\n";
151
  /**/
152
  echo '</div>' . "\n";
153
  /**/
154
+ do_action ("ws_plugin__s2member_during_down_ops_page_during_left_sections_after_restrictions", get_defined_vars ());
155
  }
156
  /**/
157
  if (apply_filters ("ws_plugin__s2member_during_down_ops_page_during_left_sections_display_limit_exceeded_page", true, get_defined_vars ()))
197
  do_action ("ws_plugin__s2member_during_down_ops_page_during_left_sections_after_limit_exceeded_page", get_defined_vars ());
198
  }
199
  /**/
200
+ if (apply_filters ("ws_plugin__s2member_during_down_ops_page_during_left_sections_display_advanced_restrictions", true, get_defined_vars ()))
201
+ {
202
+ do_action ("ws_plugin__s2member_during_down_ops_page_during_left_sections_before_advanced_restrictions", get_defined_vars ());
203
+ /**/
204
+ echo '<div class="ws-menu-page-group" title="Advanced Download Restrictions">' . "\n";
205
+ /**/
206
+ echo '<div class="ws-menu-page-section ws-plugin--s2member-restrictions-section">' . "\n";
207
+ echo '<h3>Advanced Download Restrictions ( optional, for greater flexibility )</h3>' . "\n";
208
+ echo '<p>By default, s2Member uses your Basic Download Restrictions - as configured above. However, you can force s2Member to allow file downloads, using an extra query string parameter ( <code>s2member_file_download_key</code> ). A file download `Key` is passed through this parameter, and it tells s2Member to allow the download of this particular file, regardless of Membership Level; and WITHOUT checking any Basic Restrictions, that you may, or may not, have configured above.</p>' . "\n";
209
+ echo '<p><code>' . get_bloginfo ("url") . '/?s2member_file_download=example-file.zip&amp;s2member_file_download_key=&lt;?php echo s2member_file_download_key("example-file.zip"); ?&gt;</code><br />&nbsp;&nbsp;<small><em><strong>s2member_file_download_key</strong> = &lt;?php echo s2member_file_download_key("location of the file, relative to the /' . esc_html (basename ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/ directory"); ?&gt;</em></small></p>' . "\n";
210
+ do_action ("ws_plugin__s2member_during_down_ops_page_during_left_sections_during_advanced_restrictions", get_defined_vars ());
211
+ /**/
212
+ echo '<div class="ws-menu-page-hr"></div>' . "\n";
213
+ /**/
214
+ echo '<p>The function `<code>s2member_file_download_key()</code>`, is part of the s2Member API. It produces a time-sensitive File Download Key that is unique to each and every visitor. Each Key it produces ( at the time it is produced ), will be valid for the current day, and only for a specific IP address and User-Agent string; as detected by s2Member. This makes it possible for you to create links on your site, which provide access to protected file downloads; and without having to worry about one visitor sharing their link with another. So let\'s take a quick look at what <code>s2member_file_download_key()</code> actually produces.</p>' . "\n";
215
+ echo '<p><code><strong>s2member_file_download_key("example-file.zip")</strong> = <em>a site-specific hash of s2member_encrypt(date("Y-m-d") . $_SERVER["REMOTE_ADDR"] . $_SERVER["HTTP_USER_AGENT"] . $file)</em></p>' . "\n";
216
+ echo '<p>When <code>s2member_file_download_key</code> is passed in with a valid Key, it works independently from Member Level Access. That is, a visitor does NOT have to be logged in to receive access; they just need a valid Key. Using this advanced technique, you could extend s2Member\'s file protection routines, or even combine them with Specific Post/Page Access, and more. The possibilities are limitless really.</p>' . "\n";
217
+ echo '</div>' . "\n";
218
+ /**/
219
+ echo '</div>' . "\n";
220
+ /**/
221
+ do_action ("ws_plugin__s2member_during_down_ops_page_during_left_sections_after_advanced_restrictions", get_defined_vars ());
222
+ }
223
+ /**/
224
  if (apply_filters ("ws_plugin__s2member_during_down_ops_page_during_left_sections_display_inline_extensions", true, get_defined_vars ()))
225
  {
226
  do_action ("ws_plugin__s2member_during_down_ops_page_during_left_sections_before_inline_extensions", get_defined_vars ());
276
  do_action ("ws_plugin__s2member_during_down_ops_page_before_right_sections", get_defined_vars ());
277
  do_action ("ws_plugin__s2member_during_menu_pages_before_right_sections", get_defined_vars ());
278
  /**/
279
+ echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["upsell-pro"]) ? '<div class="ws-menu-page-others"><a href="' . ws_plugin__s2member_parse_readme_value ("Pro Module / Licensing") . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-upsell-pro.png" alt="." /></a></div>' . "\n" : '';
280
  echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["installation"]) ? '<div class="ws-menu-page-installation"><a href="' . ws_plugin__s2member_parse_readme_value ("Professional Installation URI") . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-installation.png" alt="." /></a></div>' . "\n" : '';
281
  echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["tools"]) ? '<div class="ws-menu-page-tools"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-tools.png" alt="." /></div>' . "\n" : '';
282
  echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["support"]) ? '<div class="ws-menu-page-support"><a href="' . ws_plugin__s2member_parse_readme_value ("Forum URI") . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-support.png" alt="." /></a></div>' . "\n" : '';
includes/menu-pages/els-ops.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
  /*
17
  PayPal® Options page.
18
  */
@@ -364,6 +364,7 @@ echo '<td class="ws-menu-page-table-r">' . "\n";
364
  do_action ("ws_plugin__s2member_during_els_ops_page_before_right_sections", get_defined_vars ());
365
  do_action ("ws_plugin__s2member_during_menu_pages_before_right_sections", get_defined_vars ());
366
  /**/
 
367
  echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["installation"]) ? '<div class="ws-menu-page-installation"><a href="' . ws_plugin__s2member_parse_readme_value ("Professional Installation URI") . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-installation.png" alt="." /></a></div>' . "\n" : '';
368
  echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["tools"]) ? '<div class="ws-menu-page-tools"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-tools.png" alt="." /></div>' . "\n" : '';
369
  echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["support"]) ? '<div class="ws-menu-page-support"><a href="' . ws_plugin__s2member_parse_readme_value ("Forum URI") . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-support.png" alt="." /></a></div>' . "\n" : '';
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
  /*
17
  PayPal® Options page.
18
  */
364
  do_action ("ws_plugin__s2member_during_els_ops_page_before_right_sections", get_defined_vars ());
365
  do_action ("ws_plugin__s2member_during_menu_pages_before_right_sections", get_defined_vars ());
366
  /**/
367
+ echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["upsell-pro"]) ? '<div class="ws-menu-page-others"><a href="' . ws_plugin__s2member_parse_readme_value ("Pro Module / Licensing") . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-upsell-pro.png" alt="." /></a></div>' . "\n" : '';
368
  echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["installation"]) ? '<div class="ws-menu-page-installation"><a href="' . ws_plugin__s2member_parse_readme_value ("Professional Installation URI") . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-installation.png" alt="." /></a></div>' . "\n" : '';
369
  echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["tools"]) ? '<div class="ws-menu-page-tools"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-tools.png" alt="." /></div>' . "\n" : '';
370
  echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["support"]) ? '<div class="ws-menu-page-support"><a href="' . ws_plugin__s2member_parse_readme_value ("Forum URI") . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-support.png" alt="." /></a></div>' . "\n" : '';
includes/menu-pages/info.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
  /*
17
  s2Member Info page.
18
  */
@@ -55,6 +55,7 @@ echo '<td class="ws-menu-page-table-r">' . "\n";
55
  do_action ("ws_plugin__s2member_during_info_page_before_right_sections", get_defined_vars ());
56
  do_action ("ws_plugin__s2member_during_menu_pages_before_right_sections", get_defined_vars ());
57
  /**/
 
58
  echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["installation"]) ? '<div class="ws-menu-page-installation"><a href="' . ws_plugin__s2member_parse_readme_value ("Professional Installation URI") . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-installation.png" alt="." /></a></div>' . "\n" : '';
59
  echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["tools"]) ? '<div class="ws-menu-page-tools"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-tools.png" alt="." /></div>' . "\n" : '';
60
  echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["support"]) ? '<div class="ws-menu-page-support"><a href="' . ws_plugin__s2member_parse_readme_value ("Forum URI") . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-support.png" alt="." /></a></div>' . "\n" : '';
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
  /*
17
  s2Member Info page.
18
  */
55
  do_action ("ws_plugin__s2member_during_info_page_before_right_sections", get_defined_vars ());
56
  do_action ("ws_plugin__s2member_during_menu_pages_before_right_sections", get_defined_vars ());
57
  /**/
58
+ echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["upsell-pro"]) ? '<div class="ws-menu-page-others"><a href="' . ws_plugin__s2member_parse_readme_value ("Pro Module / Licensing") . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-upsell-pro.png" alt="." /></a></div>' . "\n" : '';
59
  echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["installation"]) ? '<div class="ws-menu-page-installation"><a href="' . ws_plugin__s2member_parse_readme_value ("Professional Installation URI") . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-installation.png" alt="." /></a></div>' . "\n" : '';
60
  echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["tools"]) ? '<div class="ws-menu-page-tools"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-tools.png" alt="." /></div>' . "\n" : '';
61
  echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["support"]) ? '<div class="ws-menu-page-support"><a href="' . ws_plugin__s2member_parse_readme_value ("Forum URI") . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-support.png" alt="." /></a></div>' . "\n" : '';
includes/menu-pages/menu-pages-s.js CHANGED
@@ -10,7 +10,7 @@ If not, see: <http://www.gnu.org/licenses/>.
10
  /*
11
  These routines are all specific to this software.
12
  */
13
- jQuery(document).ready (function($)
14
  {
15
  if (location.href.match (/page\=ws-plugin--s2member-options/))
16
  {
@@ -25,24 +25,24 @@ jQuery(document).ready (function($)
25
  };
26
  /**/
27
  var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()';
28
- for (var i = 0, key = ''; i < 56; i++) key += chars.substr (mt_rand(0, chars.length - 1), 1);
29
  /**/
30
- $('input#ws-plugin--s2member-sec-encryption-key').val (key);
31
  /**/
32
  return false;
33
  };
34
  /**/
35
  ws_plugin__s2member_enableSecurityKey = function() /* Allow Security Key editing?? */
36
  {
37
- if (confirm('Edit Key? Are you sure?\nThis could break your installation!\n\n*Note* If you\'ve been testing s2Member, feel free to change this Key before you go live. Just don\'t go live, and then change it. You\'ll have some very unhappy Customers. Data corruption WILL occur!\n\nFor your safety, s2Member keeps a history of the last 10 Keys that you\'ve used. If you get yourself into a real situation, s2Member will let you revert back to a previous Key.'))
38
- $('input#ws-plugin--s2member-sec-encryption-key').attr ('disabled', false);
39
  /**/
40
  return false;
41
  };
42
  /**/
43
  ws_plugin__s2member_securityKeyHistory = function() /* Displays history of Keys. */
44
  {
45
- $('div#ws-plugin--s2member-sec-encryption-key-history').toggle ();
46
  /**/
47
  return false;
48
  };
@@ -50,10 +50,10 @@ jQuery(document).ready (function($)
50
  /**/
51
  else if (location.href.match (/page\=ws-plugin--s2member-paypal-ops/))
52
  {
53
- $('select#ws-plugin--s2member-auto-eot-system-enabled').change (function()
54
  {
55
- var $this = $(this), val = $this.val ();
56
- var $viaCron = $('p#ws-plugin--s2member-auto-eot-system-enabled-via-cron');
57
  /**/
58
  if (val == 2) /* Display Cron instructions. */
59
  $viaCron.show ()
@@ -64,11 +64,11 @@ jQuery(document).ready (function($)
64
  /**/
65
  else if (location.href.match (/page\=ws-plugin--s2member-els-ops/))
66
  {
67
- $('select#ws-plugin--s2member-custom-reg-opt-in').change (function()
68
  {
69
- var $this = $(this), val = $this.val ();
70
- var $rows = $('tr.ws-plugin--s2member-custom-reg-opt-in-label-row');
71
- var $prevImg = $('img.ws-plugin--s2member-custom-reg-opt-in-label-prev-img');
72
  /**/
73
  if (val <= 0) /* Checkbox disabled. */
74
  $rows.css ('display', 'none'), $prevImg.attr ('src', $prevImg.attr ('src').replace (/\/checked\.png$/, '/unchecked.png'));
@@ -81,18 +81,19 @@ jQuery(document).ready (function($)
81
  });
82
  }
83
  /**/
84
- else if (location.href.match (/page\=ws-plugin--s2member-buttons/))
85
  {
86
- $('select#ws-plugin--s2member-level1-term, select#ws-plugin--s2member-level2-term, select#ws-plugin--s2member-level3-term, select#ws-plugin--s2member-level4-term, select#ws-plugin--s2member-modification-term').change (function()
87
  {
88
  var button = this.id.replace (/^ws-plugin--s2member-(.+?)-term$/g, '$1');
89
- var trialDisabled = ($(this).val ().split ('-')[2].replace (/[^0-1BN]/g, '') === 'BN') ? 1 : 0;
90
- $('p#ws-plugin--s2member-' + button + '-trial-line').css ('display', (trialDisabled ? 'none' : ''));
91
- $('span#ws-plugin--s2member-' + button + '-trial-then').css ('display', (trialDisabled ? 'none' : ''));
92
- $('span#ws-plugin--s2member-' + button + '-20p-rule').css ('display', (trialDisabled ? 'none' : ''));
 
93
  });
94
  /**/
95
- $('input#ws-plugin--s2member-level1-ccaps, input#ws-plugin--s2member-level2-ccaps, input#ws-plugin--s2member-level3-ccaps, input#ws-plugin--s2member-level4-ccaps, input#ws-plugin--s2member-modification-ccaps').keyup (function()
96
  {
97
  this.value = $.trim ($.trim (this.value).replace (/[ \-]/g, '_').replace (/[^A-Z_0-9,]/gi, '').toLowerCase ());
98
  });
@@ -101,41 +102,64 @@ jQuery(document).ready (function($)
101
  {
102
  var shortCodeTemplate = '[s2Member-PayPal-Button %%attrs%% image="default" /]', shortCodeTemplateAttrs = '', labels = {};
103
  /**/
 
104
  labels['level1'] = '<?php echo ws_plugin__s2member_esc_sq ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_label"]); ?>';
105
  labels['level2'] = '<?php echo ws_plugin__s2member_esc_sq ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_label"]); ?>';
106
  labels['level3'] = '<?php echo ws_plugin__s2member_esc_sq ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_label"]); ?>';
107
  labels['level4'] = '<?php echo ws_plugin__s2member_esc_sq ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_label"]); ?>';
108
  /**/
109
- var shortCode = $('input#ws-plugin--s2member-' + button + '-shortcode');
110
- var code = $('textarea#ws-plugin--s2member-' + button + '-button');
111
- var modLevel = $('select#ws-plugin--s2member-modification-level');
112
  /**/
113
  var level = (button === 'modification') ? modLevel.val ().split (':', 2)[1] : button.replace (/^level/, '');
114
  var label = labels['level' + level].replace (/"/g, "'"); /* Label cannot contain double-quotes. */
115
- var trialPeriod = $('input#ws-plugin--s2member-' + button + '-trial-period').val ().replace (/[^0-9]/g, '');
116
- var trialTerm = $('select#ws-plugin--s2member-' + button + '-trial-term').val ().replace (/[^A-Z]/g, '');
117
- var regAmount = $('input#ws-plugin--s2member-' + button + '-amount').val ().replace (/[^0-9\.]/g, '');
118
- var regPeriod = $('select#ws-plugin--s2member-' + button + '-term').val ().split ('-')[0].replace (/[^0-9]/g, '');
119
- var regTerm = $('select#ws-plugin--s2member-' + button + '-term').val ().split ('-')[1].replace (/[^A-Z]/g, '');
120
- var regRecur = $('select#ws-plugin--s2member-' + button + '-term').val ().split ('-')[2].replace (/[^0-1BN]/g, '');
121
- var pageStyle = $.trim ($('input#ws-plugin--s2member-' + button + '-page-style').val ().replace (/"/g, ''));
122
- var currencyCode = $('select#ws-plugin--s2member-' + button + '-currency').val ().replace (/[^A-Z]/g, '');
123
- var cCaps = $.trim ($.trim ($('input#ws-plugin--s2member-' + button + '-ccaps').val ()).replace (/[ \-]/g, '_').replace (/[^A-Z_0-9,]/gi, '').toLowerCase ());
124
  trialPeriod = (regRecur === 'BN') ? '0' : trialPeriod; /* Lifetime ( 1-L-BN ) and Buy Now ( BN ) access is NOT compatible w/ free trials. */
125
  var levelCcapsPer = (regRecur === 'BN' && regTerm !== 'L') ? level + ':' + cCaps + ':' + regPeriod + ' ' + regTerm : level + ':' + cCaps;
126
  levelCcapsPer = levelCcapsPer.replace (/\:+$/g, ''); /* Clean any trailing separators from this string. */
127
  /**/
128
- if (trialTerm === 'D' && trialPeriod > 90) /* Some validation on the trial period. Max days: 90. */
129
- alert('* WARNING: Maximum Free Days is: 90.\nIf you want to offer more than 90 days free, please choose Weeks or Months from the drop-down.'), trialPeriod = 90;
130
- else if (trialTerm === 'W' && trialPeriod > 52) /* Some validation on the trial period. 52 max. */
131
- alert('* WARNING: Maximum Free Weeks is: 52.\nIf you want to offer more than 52 weeks free, please choose Months from the drop-down.'), trialPeriod = 52;
132
- else if (trialTerm === 'M' && trialPeriod > 24) /* Some validation on the trial period. 24 max. */
133
- alert('* WARNING: Maximum Free Months is: 24.\nIf you want to offer more than 24 months free, please choose Years from the drop-down.'), trialPeriod = 24;
134
- else if (trialTerm === 'Y' && trialPeriod > 5) /* 5 years max. */
135
- alert('* WARNING: Maximum Free Years is: 5.'), trialPeriod = 5;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
136
  /**/
137
  code.val (code.val ().replace (/ \<\!--(\<input type\="hidden" name\="(amount|src|sra|a1|p1|t1|a3|p3|t3)" value\="(.*?)" \/\>)--\>/g, " $1"));
138
- (parseInt(trialPeriod) <= 0) ? code.val (code.val ().replace (/ (\<input type\="hidden" name\="(a1|p1|t1)" value\="(.*?)" \/\>)/g, " <!--$1-->")) : null;
139
  (regRecur === 'BN') ? code.val (code.val ().replace (/ (\<input type\="hidden" name\="cmd" value\=")(.*?)(" \/\>)/g, " $1_xclick$3")) : null;
140
  (regRecur === 'BN') ? code.val (code.val ().replace (/ (\<input type\="hidden" name\="(src|sra|a1|p1|t1|a3|p3|t3)" value\="(.*?)" \/\>)/g, " <!--$1-->")) : null;
141
  (regRecur !== 'BN') ? code.val (code.val ().replace (/ (\<input type\="hidden" name\="cmd" value\=")(.*?)(" \/\>)/g, " $1_xclick-subscriptions$3")) : null;
@@ -143,7 +167,7 @@ jQuery(document).ready (function($)
143
  /**/
144
  shortCodeTemplateAttrs += 'level="' + level + '" ccaps="' + cCaps + '" desc="' + label + '" ps="' + pageStyle + '" cc="' + currencyCode + '" custom="<?php echo $_SERVER["HTTP_HOST"]; ?>"';
145
  shortCodeTemplateAttrs += ' tp="' + trialPeriod + '" tt="' + trialTerm + '" ra="' + regAmount + '" rp="' + regPeriod + '" rt="' + regTerm + '" rr="' + regRecur + '"';
146
- shortCodeTemplateAttrs += (button === 'modification') ? ' mb="1"' : ''; /* For modification buttons. */
147
  shortCode.val (shortCodeTemplate.replace (/%%attrs%%/, shortCodeTemplateAttrs));
148
  /**/
149
  code.val (code.val ().replace (/ name\="item_name" value\="(.*?)"/, ' name="item_name" value="' + label + '"'));
@@ -160,14 +184,11 @@ jQuery(document).ready (function($)
160
  code.val (code.val ().replace (/ name\="p3" value\="(.*?)"/, ' name="p3" value="' + regPeriod + '"'));
161
  code.val (code.val ().replace (/ name\="t3" value\="(.*?)"/, ' name="t3" value="' + regTerm + '"'));
162
  /**/
163
- $('div#ws-plugin--s2member-' + button + '-button-prev').html (code.val ().replace (/\<form/, '<form target="_blank"').replace (/\<\?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_(ON0|OS0); \?\>/g, ''));
164
  /**/
165
  <?php do_action ("ws_plugin__s2member_during_menu_pages_js_during_paypal_button_generate", get_defined_vars ()); ?>
166
  /**/
167
- if (button === 'modification')
168
- alert('Your Modification Button has been generated.\nPlease copy/paste the Shortcode Format into your Login Welcome Page, or wherever you feel it would be most appropriate.');
169
- else
170
- alert('Your Codes for Membership Level #' + level + ' have been generated. Please copy/paste the Shortcode Format into your Membership Options Page.');
171
  /**/
172
  shortCode.each (function() /* Focus and select the recommended Shortcode. */
173
  {
@@ -181,22 +202,35 @@ jQuery(document).ready (function($)
181
  {
182
  var shortCodeTemplate = '[s2Member-PayPal-Button %%attrs%% image="default" /]', shortCodeTemplateAttrs = '';
183
  /**/
184
- var shortCode = $('input#ws-plugin--s2member-sp-shortcode');
185
- var code = $('textarea#ws-plugin--s2member-sp-button');
186
  /**/
187
- var leading = $('select#ws-plugin--s2member-sp-leading-id').val ().replace (/[^0-9]/g, '');
188
- var additionals = $('select#ws-plugin--s2member-sp-additional-ids').val () || [];
189
- var hours = $('select#ws-plugin--s2member-sp-hours').val ().replace (/[^0-9]/g, '');
190
- var desc = $.trim ($('input#ws-plugin--s2member-sp-desc').val ().replace (/"/g, ''));
 
 
 
191
  /**/
192
  if (!leading) /* Must have a Leading Post/Page ID to work with. Otherwise, Link generation will fail. */
193
  {
194
- alert('Please select a Leading Post/Page.\n\n*Tip* If there are no Posts/Pages in the menu, it\'s because you\'ve not configured s2Member for Specific Post/Page Access yet. See: s2Member -> General Options -> Specific Post/Page Access Restrictions.');
 
 
 
 
 
 
 
 
 
 
195
  return false;
196
  }
197
- else if (!desc) /* Each Specific Post/Page purchase should have a description. */
198
  {
199
- alert('Please type a description for this purchase.');
200
  return false;
201
  }
202
  /**/
@@ -204,26 +238,24 @@ jQuery(document).ready (function($)
204
  if (additionals[i] && additionals[i] !== leading)
205
  ids += ',' + additionals[i];
206
  /**/
207
- var regAmount = $('input#ws-plugin--s2member-sp-amount').val ().replace (/[^0-9\.]/g, '');
208
- var pageStyle = $.trim ($('input#ws-plugin--s2member-sp-page-style').val ().replace (/"/g, ''));
209
- var currencyCode = $('select#ws-plugin--s2member-sp-currency').val ().replace (/[^A-Z]/g, '');
210
  /**/
211
  shortCodeTemplateAttrs += 'ids="' + ids + '" exp="' + hours + '" desc="' + desc + '" ps="' + pageStyle + '" cc="' + currencyCode + '"';
212
  shortCodeTemplateAttrs += ' custom="<?php echo $_SERVER["HTTP_HOST"]; ?>" ra="' + regAmount + '" sp="1"';
213
  shortCode.val (shortCodeTemplate.replace (/%%attrs%%/, shortCodeTemplateAttrs));
214
  /**/
215
  code.val (code.val ().replace (/ name\="item_name" value\="(.*?)"/, ' name="item_name" value="' + desc + '"'));
216
- code.val (code.val ().replace (/ name\="item_number" value\="(.*?)"/, ' name="item_number" value="sp:' + ids + ':' + hours + '"'));
217
  code.val (code.val ().replace (/ name\="page_style" value\="(.*?)"/, ' name="page_style" value="' + pageStyle + '"'));
218
  code.val (code.val ().replace (/ name\="currency_code" value\="(.*?)"/, ' name="currency_code" value="' + currencyCode + '"'));
219
  code.val (code.val ().replace (/ name\="custom" value\="(.*?)"/, ' name="custom" value="<?php echo $_SERVER["HTTP_HOST"]; ?>"'));
220
  code.val (code.val ().replace (/ name\="amount" value\="(.*?)"/, ' name="amount" value="' + regAmount + '"'));
221
  /**/
222
- $('div#ws-plugin--s2member-sp-button-prev').html (code.val ().replace (/\<form/, '<form target="_blank"'));
223
  /**/
224
  <?php do_action ("ws_plugin__s2member_during_menu_pages_js_during_paypal_sp_button_generate", get_defined_vars ()); ?>
225
  /**/
226
- alert('Your Codes have been generated.\nPlease copy/paste the Shortcode Format into your Membership Options Page.');
227
  /**/
228
  shortCode.each (function() /* Focus and select the recommended Shortcode. */
229
  {
@@ -233,16 +265,16 @@ jQuery(document).ready (function($)
233
  return false;
234
  };
235
  /**/
236
- ws_plugin__s2member_paypalSpLinkGenerate = function() /* Handles PayPal® Link Generation for Specific Post/Page Access. */
237
  {
238
- var leading = $('select#ws-plugin--s2member-sp-link-leading-id').val ().replace (/[^0-9]/g, '');
239
- var additionals = $('select#ws-plugin--s2member-sp-link-additional-ids').val () || [];
240
- var hours = $('select#ws-plugin--s2member-sp-link-hours').val ().replace (/[^0-9]/g, '');
241
- var $link = $('p#ws-plugin--s2member-sp-link'), $loading = $('img#ws-plugin--s2member-sp-link-loading');
242
  /**/
243
  if (!leading) /* Must have a Leading Post/Page ID to work with. Otherwise, Link generation will fail. */
244
  {
245
- alert('Please select a Leading Post/Page.\n\n*Tip* If there are no Posts/Pages in the menu, it\'s because you\'ve not configured s2Member for Specific Post/Page Access yet. See: s2Member -> General Options -> Specific Post/Page Access Restrictions.');
246
  return false;
247
  }
248
  /**/
10
  /*
11
  These routines are all specific to this software.
12
  */
13
+ jQuery (document).ready (function($)
14
  {
15
  if (location.href.match (/page\=ws-plugin--s2member-options/))
16
  {
25
  };
26
  /**/
27
  var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()';
28
+ for (var i = 0, key = ''; i < 56; i++) key += chars.substr (mt_rand (0, chars.length - 1), 1);
29
  /**/
30
+ $ ('input#ws-plugin--s2member-sec-encryption-key').val (key);
31
  /**/
32
  return false;
33
  };
34
  /**/
35
  ws_plugin__s2member_enableSecurityKey = function() /* Allow Security Key editing?? */
36
  {
37
+ if (confirm ('Edit Key? Are you sure?\nThis could break your installation!\n\n*Note* If you\'ve been testing s2Member, feel free to change this Key before you go live. Just don\'t go live, and then change it. You\'ll have some very unhappy Customers. Data corruption WILL occur!\n\nFor your safety, s2Member keeps a history of the last 10 Keys that you\'ve used. If you get yourself into a real situation, s2Member will let you revert back to a previous Key.'))
38
+ $ ('input#ws-plugin--s2member-sec-encryption-key').attr ('disabled', false);
39
  /**/
40
  return false;
41
  };
42
  /**/
43
  ws_plugin__s2member_securityKeyHistory = function() /* Displays history of Keys. */
44
  {
45
+ $ ('div#ws-plugin--s2member-sec-encryption-key-history').toggle ();
46
  /**/
47
  return false;
48
  };
50
  /**/
51
  else if (location.href.match (/page\=ws-plugin--s2member-paypal-ops/))
52
  {
53
+ $ ('select#ws-plugin--s2member-auto-eot-system-enabled').change (function()
54
  {
55
+ var $this = $ (this), val = $this.val ();
56
+ var $viaCron = $ ('p#ws-plugin--s2member-auto-eot-system-enabled-via-cron');
57
  /**/
58
  if (val == 2) /* Display Cron instructions. */
59
  $viaCron.show ()
64
  /**/
65
  else if (location.href.match (/page\=ws-plugin--s2member-els-ops/))
66
  {
67
+ $ ('select#ws-plugin--s2member-custom-reg-opt-in').change (function()
68
  {
69
+ var $this = $ (this), val = $this.val ();
70
+ var $rows = $ ('tr.ws-plugin--s2member-custom-reg-opt-in-label-row');
71
+ var $prevImg = $ ('img.ws-plugin--s2member-custom-reg-opt-in-label-prev-img');
72
  /**/
73
  if (val <= 0) /* Checkbox disabled. */
74
  $rows.css ('display', 'none'), $prevImg.attr ('src', $prevImg.attr ('src').replace (/\/checked\.png$/, '/unchecked.png'));
81
  });
82
  }
83
  /**/
84
+ else if (location.href.match (/page\=ws-plugin--s2member-paypal-buttons/))
85
  {
86
+ $ ('select#ws-plugin--s2member-level1-term, select#ws-plugin--s2member-level2-term, select#ws-plugin--s2member-level3-term, select#ws-plugin--s2member-level4-term, select#ws-plugin--s2member-modification-term').change (function()
87
  {
88
  var button = this.id.replace (/^ws-plugin--s2member-(.+?)-term$/g, '$1');
89
+ var trialDisabled = ($ (this).val ().split ('-')[2].replace (/[^0-1BN]/g, '') === 'BN') ? 1 : 0;
90
+ $ ('p#ws-plugin--s2member-' + button + '-trial-line').css ('display', (trialDisabled ? 'none' : ''));
91
+ $ ('span#ws-plugin--s2member-' + button + '-trial-then').css ('display', (trialDisabled ? 'none' : ''));
92
+ $ ('span#ws-plugin--s2member-' + button + '-20p-rule').css ('display', (trialDisabled ? 'none' : ''));
93
+ (trialDisabled) ? $ ('input#ws-plugin--s2member-' + form + '-trial-period').val (0) : null;
94
  });
95
  /**/
96
+ $ ('input#ws-plugin--s2member-level1-ccaps, input#ws-plugin--s2member-level2-ccaps, input#ws-plugin--s2member-level3-ccaps, input#ws-plugin--s2member-level4-ccaps, input#ws-plugin--s2member-modification-ccaps').keyup (function()
97
  {
98
  this.value = $.trim ($.trim (this.value).replace (/[ \-]/g, '_').replace (/[^A-Z_0-9,]/gi, '').toLowerCase ());
99
  });
102
  {
103
  var shortCodeTemplate = '[s2Member-PayPal-Button %%attrs%% image="default" /]', shortCodeTemplateAttrs = '', labels = {};
104
  /**/
105
+ labels['level0'] = '<?php echo ws_plugin__s2member_esc_sq ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_label"]); ?>';
106
  labels['level1'] = '<?php echo ws_plugin__s2member_esc_sq ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_label"]); ?>';
107
  labels['level2'] = '<?php echo ws_plugin__s2member_esc_sq ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_label"]); ?>';
108
  labels['level3'] = '<?php echo ws_plugin__s2member_esc_sq ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_label"]); ?>';
109
  labels['level4'] = '<?php echo ws_plugin__s2member_esc_sq ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_label"]); ?>';
110
  /**/
111
+ var shortCode = $ ('input#ws-plugin--s2member-' + button + '-shortcode');
112
+ var code = $ ('textarea#ws-plugin--s2member-' + button + '-button');
113
+ var modLevel = $ ('select#ws-plugin--s2member-modification-level');
114
  /**/
115
  var level = (button === 'modification') ? modLevel.val ().split (':', 2)[1] : button.replace (/^level/, '');
116
  var label = labels['level' + level].replace (/"/g, "'"); /* Label cannot contain double-quotes. */
117
+ var trialPeriod = $ ('input#ws-plugin--s2member-' + button + '-trial-period').val ().replace (/[^0-9]/g, '');
118
+ var trialTerm = $ ('select#ws-plugin--s2member-' + button + '-trial-term').val ().replace (/[^A-Z]/g, '');
119
+ var regAmount = $ ('input#ws-plugin--s2member-' + button + '-amount').val ().replace (/[^0-9\.]/g, '');
120
+ var regPeriod = $ ('select#ws-plugin--s2member-' + button + '-term').val ().split ('-')[0].replace (/[^0-9]/g, '');
121
+ var regTerm = $ ('select#ws-plugin--s2member-' + button + '-term').val ().split ('-')[1].replace (/[^A-Z]/g, '');
122
+ var regRecur = $ ('select#ws-plugin--s2member-' + button + '-term').val ().split ('-')[2].replace (/[^0-1BN]/g, '');
123
+ var pageStyle = $.trim ($ ('input#ws-plugin--s2member-' + button + '-page-style').val ().replace (/"/g, ''));
124
+ var currencyCode = $ ('select#ws-plugin--s2member-' + button + '-currency').val ().replace (/[^A-Z]/g, '');
125
+ var cCaps = $.trim ($.trim ($ ('input#ws-plugin--s2member-' + button + '-ccaps').val ()).replace (/[ \-]/g, '_').replace (/[^A-Z_0-9,]/gi, '').toLowerCase ());
126
  trialPeriod = (regRecur === 'BN') ? '0' : trialPeriod; /* Lifetime ( 1-L-BN ) and Buy Now ( BN ) access is NOT compatible w/ free trials. */
127
  var levelCcapsPer = (regRecur === 'BN' && regTerm !== 'L') ? level + ':' + cCaps + ':' + regPeriod + ' ' + regTerm : level + ':' + cCaps;
128
  levelCcapsPer = levelCcapsPer.replace (/\:+$/g, ''); /* Clean any trailing separators from this string. */
129
  /**/
130
+ if (trialTerm === 'D' && trialPeriod > 7) /* Some validation on the Trial Period. Max days: 7. */
131
+ {
132
+ alert ('Oops, a slight problem:\n\nMaximum Free Days is: 7.\nIf you want to offer more than 7 days free, please choose Weeks or Months from the drop-down.');
133
+ return false;
134
+ }
135
+ else if (trialTerm === 'W' && trialPeriod > 52) /* Some validation on the Trial Period. 52 max. */
136
+ {
137
+ alert ('Oops, a slight problem:\n\nMaximum Free Weeks is: 52.\nIf you want to offer more than 52 weeks free, please choose Months from the drop-down.');
138
+ return false;
139
+ }
140
+ else if (trialTerm === 'M' && trialPeriod > 12) /* Some validation on the Trial Period. 12 max. */
141
+ {
142
+ alert ('Oops, a slight problem:\n\nMaximum Free Months is: 12.\nIf you want to offer more than 12 months free, please choose Years from the drop-down.');
143
+ return false;
144
+ }
145
+ else if (trialTerm === 'Y' && trialPeriod > 1) /* 1 year max for PayPal®. */
146
+ {
147
+ alert ('Oops, a slight problem:\n\nMax Trial Period Years is: 1. *This is a PayPal® limitation.');
148
+ return false;
149
+ }
150
+ else if (!regAmount || isNaN (regAmount) || regAmount < 0.01)
151
+ {
152
+ alert ('Oops, a slight problem:\n\nAmount must be >= 0.01');
153
+ return false;
154
+ }
155
+ else if (regAmount > 10000.00) /* $10,000.00 maximum. */
156
+ {
157
+ alert ('Oops, a slight problem:\n\nMaximum amount is: 10000.00');
158
+ return false;
159
+ }
160
  /**/
161
  code.val (code.val ().replace (/ \<\!--(\<input type\="hidden" name\="(amount|src|sra|a1|p1|t1|a3|p3|t3)" value\="(.*?)" \/\>)--\>/g, " $1"));
162
+ (parseInt (trialPeriod) <= 0) ? code.val (code.val ().replace (/ (\<input type\="hidden" name\="(a1|p1|t1)" value\="(.*?)" \/\>)/g, " <!--$1-->")) : null;
163
  (regRecur === 'BN') ? code.val (code.val ().replace (/ (\<input type\="hidden" name\="cmd" value\=")(.*?)(" \/\>)/g, " $1_xclick$3")) : null;
164
  (regRecur === 'BN') ? code.val (code.val ().replace (/ (\<input type\="hidden" name\="(src|sra|a1|p1|t1|a3|p3|t3)" value\="(.*?)" \/\>)/g, " <!--$1-->")) : null;
165
  (regRecur !== 'BN') ? code.val (code.val ().replace (/ (\<input type\="hidden" name\="cmd" value\=")(.*?)(" \/\>)/g, " $1_xclick-subscriptions$3")) : null;
167
  /**/
168
  shortCodeTemplateAttrs += 'level="' + level + '" ccaps="' + cCaps + '" desc="' + label + '" ps="' + pageStyle + '" cc="' + currencyCode + '" custom="<?php echo $_SERVER["HTTP_HOST"]; ?>"';
169
  shortCodeTemplateAttrs += ' tp="' + trialPeriod + '" tt="' + trialTerm + '" ra="' + regAmount + '" rp="' + regPeriod + '" rt="' + regTerm + '" rr="' + regRecur + '"';
170
+ shortCodeTemplateAttrs += (button === 'modification') ? ' modify="1"' : ''; /* For modification buttons. */
171
  shortCode.val (shortCodeTemplate.replace (/%%attrs%%/, shortCodeTemplateAttrs));
172
  /**/
173
  code.val (code.val ().replace (/ name\="item_name" value\="(.*?)"/, ' name="item_name" value="' + label + '"'));
184
  code.val (code.val ().replace (/ name\="p3" value\="(.*?)"/, ' name="p3" value="' + regPeriod + '"'));
185
  code.val (code.val ().replace (/ name\="t3" value\="(.*?)"/, ' name="t3" value="' + regTerm + '"'));
186
  /**/
187
+ $ ('div#ws-plugin--s2member-' + button + '-button-prev').html (code.val ().replace (/\<form/, '<form target="_blank"').replace (/\<\?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_(ON0|OS0); \?\>/g, ''));
188
  /**/
189
  <?php do_action ("ws_plugin__s2member_during_menu_pages_js_during_paypal_button_generate", get_defined_vars ()); ?>
190
  /**/
191
+ (button === 'modification') ? alert ('Your Modification Button has been generated.\nPlease copy/paste the Shortcode Format into your Login Welcome Page, or wherever you feel it would be most appropriate.') : alert ('Your Button has been generated.\nPlease copy/paste the Shortcode Format into your Membership Options Page.');
 
 
 
192
  /**/
193
  shortCode.each (function() /* Focus and select the recommended Shortcode. */
194
  {
202
  {
203
  var shortCodeTemplate = '[s2Member-PayPal-Button %%attrs%% image="default" /]', shortCodeTemplateAttrs = '';
204
  /**/
205
+ var shortCode = $ ('input#ws-plugin--s2member-sp-shortcode');
206
+ var code = $ ('textarea#ws-plugin--s2member-sp-button');
207
  /**/
208
+ var leading = $ ('select#ws-plugin--s2member-sp-leading-id').val ().replace (/[^0-9]/g, '');
209
+ var additionals = $ ('select#ws-plugin--s2member-sp-additional-ids').val () || [];
210
+ var hours = $ ('select#ws-plugin--s2member-sp-hours').val ().replace (/[^0-9]/g, '');
211
+ var regAmount = $ ('input#ws-plugin--s2member-sp-amount').val ().replace (/[^0-9\.]/g, '');
212
+ var desc = $.trim ($ ('input#ws-plugin--s2member-sp-desc').val ().replace (/"/g, ''));
213
+ var pageStyle = $.trim ($ ('input#ws-plugin--s2member-sp-page-style').val ().replace (/"/g, ''));
214
+ var currencyCode = $ ('select#ws-plugin--s2member-sp-currency').val ().replace (/[^A-Z]/g, '');
215
  /**/
216
  if (!leading) /* Must have a Leading Post/Page ID to work with. Otherwise, Link generation will fail. */
217
  {
218
+ alert ('Oops, a slight problem:\n\nPlease select a Leading Post/Page.\n\n*Tip* If there are no Posts/Pages in the menu, it\'s because you\'ve not configured s2Member for Specific Post/Page Access yet. See: s2Member -> General Options -> Specific Post/Page Access Restrictions.');
219
+ return false;
220
+ }
221
+ else if (!regAmount || isNaN (regAmount) || regAmount < 0.01)
222
+ {
223
+ alert ('Oops, a slight problem:\n\nAmount must be >= 0.01');
224
+ return false;
225
+ }
226
+ else if (regAmount > 10000.00) /* $10,000.00 maximum. */
227
+ {
228
+ alert ('Oops, a slight problem:\n\nMaximum amount is: 10000.00');
229
  return false;
230
  }
231
+ else if (!desc) /* Each Button should have a Description. */
232
  {
233
+ alert ('Oops, a slight problem:\n\nPlease type a Description for this Button.');
234
  return false;
235
  }
236
  /**/
238
  if (additionals[i] && additionals[i] !== leading)
239
  ids += ',' + additionals[i];
240
  /**/
241
+ var spIdsHours = 'sp:' + ids + ':' + hours; /* Combined sp:ids:expiration hours. */
 
 
242
  /**/
243
  shortCodeTemplateAttrs += 'ids="' + ids + '" exp="' + hours + '" desc="' + desc + '" ps="' + pageStyle + '" cc="' + currencyCode + '"';
244
  shortCodeTemplateAttrs += ' custom="<?php echo $_SERVER["HTTP_HOST"]; ?>" ra="' + regAmount + '" sp="1"';
245
  shortCode.val (shortCodeTemplate.replace (/%%attrs%%/, shortCodeTemplateAttrs));
246
  /**/
247
  code.val (code.val ().replace (/ name\="item_name" value\="(.*?)"/, ' name="item_name" value="' + desc + '"'));
248
+ code.val (code.val ().replace (/ name\="item_number" value\="(.*?)"/, ' name="item_number" value="' + spIdsHours + '"'));
249
  code.val (code.val ().replace (/ name\="page_style" value\="(.*?)"/, ' name="page_style" value="' + pageStyle + '"'));
250
  code.val (code.val ().replace (/ name\="currency_code" value\="(.*?)"/, ' name="currency_code" value="' + currencyCode + '"'));
251
  code.val (code.val ().replace (/ name\="custom" value\="(.*?)"/, ' name="custom" value="<?php echo $_SERVER["HTTP_HOST"]; ?>"'));
252
  code.val (code.val ().replace (/ name\="amount" value\="(.*?)"/, ' name="amount" value="' + regAmount + '"'));
253
  /**/
254
+ $ ('div#ws-plugin--s2member-sp-button-prev').html (code.val ().replace (/\<form/, '<form target="_blank"'));
255
  /**/
256
  <?php do_action ("ws_plugin__s2member_during_menu_pages_js_during_paypal_sp_button_generate", get_defined_vars ()); ?>
257
  /**/
258
+ alert ('Your Button has been generated.\nPlease copy/paste the Shortcode Format into your Membership Options Page.');
259
  /**/
260
  shortCode.each (function() /* Focus and select the recommended Shortcode. */
261
  {
265
  return false;
266
  };
267
  /**/
268
+ ws_plugin__s2member_paypalSpLinkGenerate = function() /* Handles PayPal® Link Generation. */
269
  {
270
+ var leading = $ ('select#ws-plugin--s2member-sp-link-leading-id').val ().replace (/[^0-9]/g, '');
271
+ var additionals = $ ('select#ws-plugin--s2member-sp-link-additional-ids').val () || [];
272
+ var hours = $ ('select#ws-plugin--s2member-sp-link-hours').val ().replace (/[^0-9]/g, '');
273
+ var $link = $ ('p#ws-plugin--s2member-sp-link'), $loading = $ ('img#ws-plugin--s2member-sp-link-loading');
274
  /**/
275
  if (!leading) /* Must have a Leading Post/Page ID to work with. Otherwise, Link generation will fail. */
276
  {
277
+ alert ('Oops, a slight problem:\n\nPlease select a Leading Post/Page.\n\n*Tip* If there are no Posts/Pages in the menu, it\'s because you\'ve not configured s2Member for Specific Post/Page Access yet. See: s2Member -> General Options -> Specific Post/Page Access Restrictions.');
278
  return false;
279
  }
280
  /**/
includes/menu-pages/options.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
  /*
17
  General Options page.
18
  */
@@ -351,12 +351,17 @@ if (apply_filters ("ws_plugin__s2member_during_options_page_during_left_sections
351
  /**/
352
  echo '<div class="ws-menu-page-section ws-plugin--s2member-custom-reg-fields-section">' . "\n";
353
  echo '<h3>Custom Registration Fields ( optional, for further customization )</h3>' . "\n";
 
354
  echo '<p>This allows you to customize the Fields in your Registration Form:<br />( <a href="' . add_query_arg ("action", "register", wp_login_url ()) . '" target="_blank" rel="external">' . esc_html (add_query_arg ("action", "register", wp_login_url ())) . '</a> )</p>' . "\n";
 
355
  echo '<p>This is a comma delimited list of additional form fields to collect during registration. By default, all of your Custom Fields will remain optional to the User. That is, the User will NOT be required to enter any of these values. If you want specific fields to be *required*, wrap those Custom Fields inside *asterisks*. Some fields are already built-in by default. The defaults are: <code>*Username*, *Email*, *First Name*, *Last Name*</code>. If you need to add other Custom Fields, in addition to these defaults, you can do that here.</p>' . "\n";
356
- if (defined ("BP_VERSION")) /* Notify the site owner about the conflict with Custom Fields and BuddyPress. */
357
- echo '<p><em class="ws-menu-page-error">* Custom Registration Fields are NOT applicable with BuddyPress. Instead, use <code>BuddyPress -> Profile Field Setup</code>.</em></p>' . "\n";
 
 
358
  if (!function_exists ("ws_plugin__s2member_generate_password"))
359
  echo '<p><em class="ws-menu-page-error">* Custom Passwords CANNOT be used with your installation of s2Member. This is due to a minor conflict with another plugin that is using <code>wp_generate_password()</code>. If you really want to allow Custom Passwords during registration, please disable some of your other plugins until this warning goes away.</em></p>' . "\n";
 
360
  do_action ("ws_plugin__s2member_during_options_page_during_left_sections_during_custom_reg_fields", get_defined_vars ());
361
  /**/
362
  echo '<table class="form-table">' . "\n";
@@ -443,26 +448,6 @@ if (apply_filters ("ws_plugin__s2member_during_options_page_during_left_sections
443
  echo '</td>' . "\n";
444
  /**/
445
  echo '</tr>' . "\n";
446
- echo '<tr>' . "\n";
447
- /**/
448
- echo '<th>' . "\n";
449
- echo '<label for="ws-plugin--s2member-allow-subscribers-in">' . "\n";
450
- echo 'Allow Free Subscribers Access To This Page?' . "\n";
451
- echo '</label>' . "\n";
452
- echo '</th>' . "\n";
453
- /**/
454
- echo '</tr>' . "\n";
455
- echo '<tr>' . "\n";
456
- /**/
457
- echo '<td>' . "\n";
458
- echo '<select name="ws_plugin__s2member_allow_subscribers_in" id="ws-plugin--s2member-allow-subscribers-in">' . "\n";
459
- echo '<option value="0"' . ((!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["allow_subscribers_in"]) ? ' selected="selected"' : '') . '>No ( only Members can access their Login Welcome Page )</option>' . "\n";
460
- echo '<option value="1"' . (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["allow_subscribers_in"]) ? ' selected="selected"' : '') . '>Yes ( if a Free Subscriber is logged in, they can also access this Page )</option>' . "\n";
461
- echo '</select><br />' . "\n";
462
- echo 'If you set this to <code>Yes</code>, it means that you\'re giving Free Subscribers the ability to access this special Page that is normally intended only for Members. If you set this to <code>Yes</code>, you\'re also turning on the `Anyone Can Register` option that is built into WordPress®. So what this means, is that you\'re allowing people to signup for free, as a Free Subscriber, who will then have access to the Login Welcome Page, even though they\'re NOT a paid Member. This is only useful if you plan to let Users signup for free ( <a href="' . add_query_arg ("action", "register", wp_login_url ()) . '" target="_blank" rel="external">' . esc_html (add_query_arg ("action", "register", wp_login_url ())) . '</a> ). See <code>s2Member -> API Scripting -> Advanced Conditionals</code>, for details on how to customize your Login Welcome Page with Conditionals; based on Membership Level.' . "\n";
463
- echo '</td>' . "\n";
464
- /**/
465
- echo '</tr>' . "\n";
466
  echo '</tbody>' . "\n";
467
  echo '</table>' . "\n";
468
  echo '</div>' . "\n";
@@ -472,40 +457,24 @@ if (apply_filters ("ws_plugin__s2member_during_options_page_during_left_sections
472
  do_action ("ws_plugin__s2member_during_options_page_during_left_sections_after_login_welcome_page", get_defined_vars ());
473
  }
474
  /**/
475
- if (apply_filters ("ws_plugin__s2member_during_options_page_during_left_sections_display_profile_modifications", true, get_defined_vars ()))
476
  {
477
- do_action ("ws_plugin__s2member_during_options_page_during_left_sections_before_profile_modifications", get_defined_vars ());
478
- /**/
479
- echo '<div class="ws-menu-page-group" title="Member Profile Modifications">' . "\n";
480
- /**/
481
- echo '<div class="ws-menu-page-section ws-plugin--s2member-profile-modifications-section">' . "\n";
482
- echo '<h3>Giving Members The Ability To Modify Their Profile</h3>' . "\n";
483
- echo '<p>s2Member can be configured to redirect Members away from the <a href="profile.php" target="_blank" rel="external">default Profile Editing Panel</a> that is built into WordPress®. When/if a Member attempts to access the default Profile Editing Panel, they\'ll instead, be redirected to the Login Welcome Page that you\'ve configured through s2Member. <strong>Why would I redirect?</strong> Unless you\'ve made some drastic modifications to your WordPress® installation, the default Profile Editing Panel that ships with WordPress®, is NOT really suited for public access, even by a Member.</p>' . "\n";
484
- echo '<p>So instead of using this default Profile Editing Panel; s2Member creates an added layer of functionality, on top of WordPress®. It does this by providing you ( as the site owner ), with the ability to send your Members to a <a href="' . get_bloginfo ("url") . '/?s2member_profile=1" target="_blank" rel="external">special Stand-Alone page</a>, where your Members can modify their entire Profile, including all Custom Fields, and their Password. This special Stand-Alone Editing Panel, has been designed ( with a bare-bones format ), intentionally. This makes it possible for you to <a href="#" onclick="if(!window.open(\'' . get_bloginfo ("url") . '/?s2member_profile=1\', \'_popup\', \'height=350,width=400,left=100,screenX=100,top=100,screenY=100, location=0,menubar=0,toolbar=0,status=0,scrollbars=1,resizable=1\')) alert(\'Please disable popup blockers and try again!\'); return false;" rel="external">open it up in a popup window</a>, or embed it into your Login Welcome Page using an IFRAME. Code samples are provided below.</p>' . "\n";
485
- do_action ("ws_plugin__s2member_during_options_page_during_left_sections_during_profile_modifications", get_defined_vars ());
486
- /**/
487
- echo '<div class="ws-menu-page-hr"></div>' . "\n";
488
- /**/
489
- echo '<p>Stand-Alone page where Members can modify their Profile:<br />' . "\n";
490
- echo '<code><a href="' . get_bloginfo ("url") . '/?s2member_profile=1" target="_blank" rel="external">' . get_bloginfo ("url") . '/?s2member_profile=1</a></code></p>' . "\n";
491
- /**/
492
- echo '<div class="ws-menu-page-hr"></div>' . "\n";
493
  /**/
494
- echo '<p><strong>Code Sample #1</strong> ( standard link tag ):</p>' . "\n";
495
- echo '<p>' . highlight_string (preg_replace ("/\<\?php echo S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL; \?\>/", get_bloginfo ("url") . "/?s2member_profile=1", file_get_contents (dirname (__FILE__) . "/code-samples/current-user-profile-modification-page-url-1.php")), true) . '</p>' . "\n";
496
  /**/
497
- echo '<p><strong>Code Sample #2</strong> ( open the link in a popup window ):</p>' . "\n";
498
- echo '<p>' . highlight_string (preg_replace ("/\<\?php echo S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL; \?\>/", get_bloginfo ("url") . "/?s2member_profile=1", file_get_contents (dirname (__FILE__) . "/code-samples/current-user-profile-modification-page-url-2.php")), true) . '</p>' . "\n";
 
 
499
  /**/
500
- echo '<p><strong>Code Sample #3</strong> ( embed the form into a Post/Page using an IFRAME tag ):</p>' . "\n";
501
- echo '<p>' . highlight_string (preg_replace ("/\<\?php echo S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL; \?\>/", get_bloginfo ("url") . "/?s2member_profile=1", file_get_contents (dirname (__FILE__) . "/code-samples/current-user-profile-modification-page-url-3.php")), true) . '</p>' . "\n";
502
  echo '<table class="form-table">' . "\n";
503
  echo '<tbody>' . "\n";
504
  echo '<tr>' . "\n";
505
  /**/
506
  echo '<th>' . "\n";
507
- echo '<label for="ws-plugin--s2member-force-admin-lockouts">' . "\n";
508
- echo 'Redirect Members away from the Default Profile Panel?' . "\n";
509
  echo '</label>' . "\n";
510
  echo '</th>' . "\n";
511
  /**/
@@ -513,12 +482,12 @@ if (apply_filters ("ws_plugin__s2member_during_options_page_during_left_sections
513
  echo '<tr>' . "\n";
514
  /**/
515
  echo '<td>' . "\n";
516
- echo '<select name="ws_plugin__s2member_force_admin_lockouts" id="ws-plugin--s2member-force-admin-lockouts">' . "\n";
517
- echo '<option value="0"' . ((!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["force_admin_lockouts"]) ? ' selected="selected"' : '') . '>No ( I want to leave all options available to my Members )</option>' . "\n";
518
- echo '<option value="1"' . (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["force_admin_lockouts"]) ? ' selected="selected"' : '') . '>Yes ( redirect Members to their Login Welcome Page )</option>' . "\n";
 
519
  echo '</select><br />' . "\n";
520
- echo 'Recommended setting ( <code>Yes</code> ). The Stand-Alone version is better.<br />' . "\n";
521
- echo 'You\'ll want to embed the Stand-Alone version into your Login Welcome Page.<br />' . "\n";
522
  echo '</td>' . "\n";
523
  /**/
524
  echo '</tr>' . "\n";
@@ -528,27 +497,27 @@ if (apply_filters ("ws_plugin__s2member_during_options_page_during_left_sections
528
  /**/
529
  echo '</div>' . "\n";
530
  /**/
531
- do_action ("ws_plugin__s2member_during_options_page_during_left_sections_after_profile_modifications", get_defined_vars ());
532
  }
533
  /**/
534
- if (apply_filters ("ws_plugin__s2member_during_options_page_during_left_sections_display_membership_options_page", true, get_defined_vars ()))
535
  {
536
- do_action ("ws_plugin__s2member_during_options_page_during_left_sections_before_membership_options_page", get_defined_vars ());
537
  /**/
538
- echo '<div class="ws-menu-page-group" title="Membership Options Page">' . "\n";
539
  /**/
540
- echo '<div class="ws-menu-page-section ws-plugin--s2member-membership-options-page-section">' . "\n";
541
- echo '<h3>Membership Options Page ( required, please customize this )</h3>' . "\n";
542
- echo '<p>Please create and/or choose an existing Page that showcases your membership subscription options. This special Page is where you will insert the PayPal® Subscription Buttons generated for you by s2Member. This Page serves as your signup page. It should detail all of the features that come with membership to your site, and provide a PayPal® Subscription Button for each Level of access you plan to offer. This is also the page that Users will be redirected to, should they attempt to access an area of your site that requires membership.</p>' . "\n";
543
- do_action ("ws_plugin__s2member_during_options_page_during_left_sections_during_membership_options_page", get_defined_vars ());
544
  /**/
545
  echo '<table class="form-table">' . "\n";
546
  echo '<tbody>' . "\n";
547
  echo '<tr>' . "\n";
548
  /**/
549
  echo '<th>' . "\n";
550
- echo '<label for="ws-plugin--s2member-membership-options-page">' . "\n";
551
- echo 'Membership Options Page:' . "\n";
552
  echo '</label>' . "\n";
553
  echo '</th>' . "\n";
554
  /**/
@@ -556,12 +525,11 @@ if (apply_filters ("ws_plugin__s2member_during_options_page_during_left_sections
556
  echo '<tr>' . "\n";
557
  /**/
558
  echo '<td>' . "\n";
559
- echo '<select name="ws_plugin__s2member_membership_options_page" id="ws-plugin--s2member-membership-options-page">' . "\n";
560
- echo '<option value="">&mdash; Select &mdash;</option>' . "\n";
561
- foreach (($ws_plugin__s2member_temp_a = array_merge ((array)get_pages ())) as $ws_plugin__s2member_temp_o)
562
- echo '<option value="' . esc_attr ($ws_plugin__s2member_temp_o->ID) . '"' . (($ws_plugin__s2member_temp_o->ID == $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]) ? ' selected="selected"' : '') . '>' . esc_html ($ws_plugin__s2member_temp_o->post_title) . '</option>' . "\n";
563
  echo '</select><br />' . "\n";
564
- echo 'Please choose a Page that provides Users a way to signup for membership. This Page should also contain your PayPal&reg Subscription button(s). We recommend the following title: <code>Membership Signup</code>.' . "\n";
565
  echo '</td>' . "\n";
566
  /**/
567
  echo '</tr>' . "\n";
@@ -571,7 +539,7 @@ if (apply_filters ("ws_plugin__s2member_during_options_page_during_left_sections
571
  /**/
572
  echo '</div>' . "\n";
573
  /**/
574
- do_action ("ws_plugin__s2member_during_options_page_during_left_sections_after_membership_options_page", get_defined_vars ());
575
  }
576
  /**/
577
  if (apply_filters ("ws_plugin__s2member_during_options_page_during_left_sections_display_membership_levels", true, get_defined_vars ()))
@@ -582,7 +550,7 @@ if (apply_filters ("ws_plugin__s2member_during_options_page_during_left_sections
582
  /**/
583
  echo '<div class="ws-menu-page-section ws-plugin--s2member-membership-levels-section">' . "\n";
584
  echo '<h3>Membership Levels ( required, please customize these )</h3>' . "\n";
585
- echo '<p>The default Membership Levels are labeled generically; feel free to modify them as needed. s2Member supports up to 4 Primary Levels of membership, and unlimited Custom Capabilities. However, you don\'t have to use all of the Membership Levels if you don\'t want to. To use only 1 or 2 of these Levels, just create and/or modify your Membership Options Page, so that it only includes PayPal® Subscription Buttons for the Levels you wish to use.</p>' . "\n";
586
  echo '<p><em>Support for Custom Capabilities is available. If you\'re an advanced site owner, a theme designer, or a web developer integrating s2Member for a client, please see: <code>s2Member -> API Scripting -> Custom Capabilities</code></em></p>' . "\n";
587
  do_action ("ws_plugin__s2member_during_options_page_during_left_sections_during_membership_levels", get_defined_vars ());
588
  /**/
@@ -591,6 +559,23 @@ if (apply_filters ("ws_plugin__s2member_during_options_page_during_left_sections
591
  echo '<tr>' . "\n";
592
  /**/
593
  echo '<th>' . "\n";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
594
  echo '<label for="ws-plugin--s2member-level1-label">' . "\n";
595
  echo 'Membership Level #1 Label:' . "\n";
596
  echo '</label>' . "\n";
@@ -681,6 +666,23 @@ if (apply_filters ("ws_plugin__s2member_during_options_page_during_left_sections
681
  echo '<tr>' . "\n";
682
  /**/
683
  echo '<th>' . "\n";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
684
  echo '<label for="ws-plugin--s2member-level1-posts">' . "\n";
685
  echo 'Posts That Require Level #1 Or Higher:' . "\n";
686
  echo '</label>' . "\n";
@@ -771,6 +773,23 @@ if (apply_filters ("ws_plugin__s2member_during_options_page_during_left_sections
771
  echo '<tr>' . "\n";
772
  /**/
773
  echo '<th>' . "\n";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
774
  echo '<label for="ws-plugin--s2member-level1-pages">' . "\n";
775
  echo 'Pages That Require Level #1 Or Higher:' . "\n";
776
  echo '</label>' . "\n";
@@ -861,6 +880,23 @@ if (apply_filters ("ws_plugin__s2member_during_options_page_during_left_sections
861
  echo '<tr>' . "\n";
862
  /**/
863
  echo '<th>' . "\n";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
864
  echo '<label for="ws-plugin--s2member-level1-ptags">' . "\n";
865
  echo 'Tags That Require Level #1 Or Higher:' . "\n";
866
  echo '</label>' . "\n";
@@ -951,6 +987,23 @@ if (apply_filters ("ws_plugin__s2member_during_options_page_during_left_sections
951
  echo '<tr>' . "\n";
952
  /**/
953
  echo '<th>' . "\n";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
954
  echo '<label for="ws-plugin--s2member-level1-catgs">' . "\n";
955
  echo 'Categories That Require Level #1 Or Higher:' . "\n";
956
  echo '</label>' . "\n";
@@ -1042,6 +1095,23 @@ if (apply_filters ("ws_plugin__s2member_during_options_page_during_left_sections
1042
  echo '<tr>' . "\n";
1043
  /**/
1044
  echo '<th>' . "\n";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1045
  echo '<label for="ws-plugin--s2member-level1-ruris">' . "\n";
1046
  echo 'URIs That Require Level #1 Or Higher:' . "\n";
1047
  echo '</label>' . "\n";
@@ -1238,6 +1308,65 @@ if (apply_filters ("ws_plugin__s2member_during_options_page_during_left_sections
1238
  do_action ("ws_plugin__s2member_during_options_page_during_left_sections_after_ip_restrictions", get_defined_vars ());
1239
  }
1240
  /**/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1241
  if (apply_filters ("ws_plugin__s2member_during_options_page_during_left_sections_display_deactivation", true, get_defined_vars ()))
1242
  {
1243
  do_action ("ws_plugin__s2member_during_options_page_during_left_sections_before_deactivation", get_defined_vars ());
@@ -1295,6 +1424,7 @@ echo '<td class="ws-menu-page-table-r">' . "\n";
1295
  do_action ("ws_plugin__s2member_during_options_page_before_right_sections", get_defined_vars ());
1296
  do_action ("ws_plugin__s2member_during_menu_pages_before_right_sections", get_defined_vars ());
1297
  /**/
 
1298
  echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["installation"]) ? '<div class="ws-menu-page-installation"><a href="' . ws_plugin__s2member_parse_readme_value ("Professional Installation URI") . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-installation.png" alt="." /></a></div>' . "\n" : '';
1299
  echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["tools"]) ? '<div class="ws-menu-page-tools"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-tools.png" alt="." /></div>' . "\n" : '';
1300
  echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["support"]) ? '<div class="ws-menu-page-support"><a href="' . ws_plugin__s2member_parse_readme_value ("Forum URI") . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-support.png" alt="." /></a></div>' . "\n" : '';
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
  /*
17
  General Options page.
18
  */
351
  /**/
352
  echo '<div class="ws-menu-page-section ws-plugin--s2member-custom-reg-fields-section">' . "\n";
353
  echo '<h3>Custom Registration Fields ( optional, for further customization )</h3>' . "\n";
354
+ /**/
355
  echo '<p>This allows you to customize the Fields in your Registration Form:<br />( <a href="' . add_query_arg ("action", "register", wp_login_url ()) . '" target="_blank" rel="external">' . esc_html (add_query_arg ("action", "register", wp_login_url ())) . '</a> )</p>' . "\n";
356
+ /**/
357
  echo '<p>This is a comma delimited list of additional form fields to collect during registration. By default, all of your Custom Fields will remain optional to the User. That is, the User will NOT be required to enter any of these values. If you want specific fields to be *required*, wrap those Custom Fields inside *asterisks*. Some fields are already built-in by default. The defaults are: <code>*Username*, *Email*, *First Name*, *Last Name*</code>. If you need to add other Custom Fields, in addition to these defaults, you can do that here.</p>' . "\n";
358
+ /**/
359
+ if (defined ("BP_VERSION"))
360
+ echo '<p><em class="ws-menu-page-hilite">* With BuddyPress installed, Custom Registration Fields are NOT applicable. BuddyPress themes usually come with their own Registration Form ( i.e. BuddyPress redirects you away from the default Registration Form, over to a special <code>/register</code> page ); BuddyPress also has its own Profile Field Configuration Tool, under <code>BuddyPress -> Profile Field Setup</code>. When BuddyPress is installed, the use of s2Member\'s Custom Fields is not advised; that is... UNLESS you\'re using the s2Member Pro Module. With the s2Member Pro Module, Custom Fields <strong>will</strong> be included in all PayPal® Pro Forms, including even Free Registration Forms generated by the s2Member Pro Module.</em></p>' . "\n";
361
+ /**/
362
  if (!function_exists ("ws_plugin__s2member_generate_password"))
363
  echo '<p><em class="ws-menu-page-error">* Custom Passwords CANNOT be used with your installation of s2Member. This is due to a minor conflict with another plugin that is using <code>wp_generate_password()</code>. If you really want to allow Custom Passwords during registration, please disable some of your other plugins until this warning goes away.</em></p>' . "\n";
364
+ /**/
365
  do_action ("ws_plugin__s2member_during_options_page_during_left_sections_during_custom_reg_fields", get_defined_vars ());
366
  /**/
367
  echo '<table class="form-table">' . "\n";
448
  echo '</td>' . "\n";
449
  /**/
450
  echo '</tr>' . "\n";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
451
  echo '</tbody>' . "\n";
452
  echo '</table>' . "\n";
453
  echo '</div>' . "\n";
457
  do_action ("ws_plugin__s2member_during_options_page_during_left_sections_after_login_welcome_page", get_defined_vars ());
458
  }
459
  /**/
460
+ if (apply_filters ("ws_plugin__s2member_during_options_page_during_left_sections_display_membership_options_page", true, get_defined_vars ()))
461
  {
462
+ do_action ("ws_plugin__s2member_during_options_page_during_left_sections_before_membership_options_page", get_defined_vars ());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
463
  /**/
464
+ echo '<div class="ws-menu-page-group" title="Membership Options Page">' . "\n";
 
465
  /**/
466
+ echo '<div class="ws-menu-page-section ws-plugin--s2member-membership-options-page-section">' . "\n";
467
+ echo '<h3>Membership Options Page ( required, please customize this )</h3>' . "\n";
468
+ echo '<p>Please create and/or choose an existing Page that showcases your membership subscription options. This special Page is where you will insert the PayPal® Subscription Buttons generated for you by s2Member. This Page serves as your signup page. It should detail all of the features that come with membership to your site, and provide a PayPal® Subscription Button for each Level of access you plan to offer. This is also the page that Users will be redirected to, should they attempt to access an area of your site that requires membership.</p>' . "\n";
469
+ do_action ("ws_plugin__s2member_during_options_page_during_left_sections_during_membership_options_page", get_defined_vars ());
470
  /**/
 
 
471
  echo '<table class="form-table">' . "\n";
472
  echo '<tbody>' . "\n";
473
  echo '<tr>' . "\n";
474
  /**/
475
  echo '<th>' . "\n";
476
+ echo '<label for="ws-plugin--s2member-membership-options-page">' . "\n";
477
+ echo 'Membership Options Page:' . "\n";
478
  echo '</label>' . "\n";
479
  echo '</th>' . "\n";
480
  /**/
482
  echo '<tr>' . "\n";
483
  /**/
484
  echo '<td>' . "\n";
485
+ echo '<select name="ws_plugin__s2member_membership_options_page" id="ws-plugin--s2member-membership-options-page">' . "\n";
486
+ echo '<option value="">&mdash; Select &mdash;</option>' . "\n";
487
+ foreach (($ws_plugin__s2member_temp_a = array_merge ((array)get_pages ())) as $ws_plugin__s2member_temp_o)
488
+ echo '<option value="' . esc_attr ($ws_plugin__s2member_temp_o->ID) . '"' . (($ws_plugin__s2member_temp_o->ID == $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]) ? ' selected="selected"' : '') . '>' . esc_html ($ws_plugin__s2member_temp_o->post_title) . '</option>' . "\n";
489
  echo '</select><br />' . "\n";
490
+ echo 'Please choose a Page that provides Users a way to signup for membership. This Page should also contain your PayPal&reg Subscription button(s). We recommend the following title: <code>Membership Signup</code>.' . "\n";
 
491
  echo '</td>' . "\n";
492
  /**/
493
  echo '</tr>' . "\n";
497
  /**/
498
  echo '</div>' . "\n";
499
  /**/
500
+ do_action ("ws_plugin__s2member_during_options_page_during_left_sections_after_membership_options_page", get_defined_vars ());
501
  }
502
  /**/
503
+ if (apply_filters ("ws_plugin__s2member_during_options_page_during_left_sections_display_free_subscribers", true, get_defined_vars ()))
504
  {
505
+ do_action ("ws_plugin__s2member_during_options_page_during_left_sections_before_free_subscribers", get_defined_vars ());
506
  /**/
507
+ echo '<div class="ws-menu-page-group" title="Open Registration / Free Subscribers">' . "\n";
508
  /**/
509
+ echo '<div class="ws-menu-page-section ws-plugin--s2member-free-subscribers-section">' . "\n";
510
+ echo '<h3>Open Registration / Free Subscribers ( optional )</h3>' . "\n";
511
+ echo '<p>s2Member supports Free Subscribers ( at Level #0 ), along with four Primary Levels [1-4] of paid membership. If you want visitors to be capable of registering absolutely free, you will want to "allow" Open Registration. Whenever a visitor registers without paying, they\'ll automatically become a Free Subscriber, at Level #0.</p>' . "\n";
512
+ do_action ("ws_plugin__s2member_during_options_page_during_left_sections_during_free_subscribers", get_defined_vars ());
513
  /**/
514
  echo '<table class="form-table">' . "\n";
515
  echo '<tbody>' . "\n";
516
  echo '<tr>' . "\n";
517
  /**/
518
  echo '<th>' . "\n";
519
+ echo '<label for="ws-plugin--s2member-allow-subscribers-in">' . "\n";
520
+ echo 'Allow Open Registration? ( Free Subscribers )' . "\n";
521
  echo '</label>' . "\n";
522
  echo '</th>' . "\n";
523
  /**/
525
  echo '<tr>' . "\n";
526
  /**/
527
  echo '<td>' . "\n";
528
+ echo '<select name="ws_plugin__s2member_allow_subscribers_in" id="ws-plugin--s2member-allow-subscribers-in">' . "\n";
529
+ echo '<option value="0"' . ((!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["allow_subscribers_in"]) ? ' selected="selected"' : '') . '>No ( do NOT allow Open Registration )</option>' . "\n";
530
+ echo '<option value="1"' . (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["allow_subscribers_in"]) ? ' selected="selected"' : '') . '>Yes ( allow Open Registration; Free Subscribers at Level #0 )</option>' . "\n";
 
531
  echo '</select><br />' . "\n";
532
+ echo 'If you set this to <code>Yes</code>, you\'re unlocking <a href="' . add_query_arg ("action", "register", wp_login_url ()) . '" target="_blank" rel="external">registration</a>. When a visitor registers without paying, they\'ll automatically become a Free Subscriber, at Level #0. The s2Member software reserves Level #0; to be used ONLY used for Free Subscribers. All other Membership Levels [1-4] require payment. Starting with s2Member v3.0.5+, you can set Post, Page, Tag, Category, and even URI restrictions for Level #0 as well. So this is a very powerful new feature.' . "\n";
533
  echo '</td>' . "\n";
534
  /**/
535
  echo '</tr>' . "\n";
539
  /**/
540
  echo '</div>' . "\n";
541
  /**/
542
+ do_action ("ws_plugin__s2member_during_options_page_during_left_sections_after_free_subscribers", get_defined_vars ());
543
  }
544
  /**/
545
  if (apply_filters ("ws_plugin__s2member_during_options_page_during_left_sections_display_membership_levels", true, get_defined_vars ()))
550
  /**/
551
  echo '<div class="ws-menu-page-section ws-plugin--s2member-membership-levels-section">' . "\n";
552
  echo '<h3>Membership Levels ( required, please customize these )</h3>' . "\n";
553
+ echo '<p>The default Membership Levels are labeled generically; feel free to modify them as needed. s2Member supports Free Subscribers ( at Level #0 ), along with four Primary Levels [1-4] of paid membership; plus unlimited Custom Capability packages. That being said, you don\'t have to use all of the Membership Levels if you don\'t want to. To use only 1 or 2 of these Levels, just create and/or modify your Membership Options Page, so that it only includes PayPal® Subscription Buttons for the Levels you wish to use.</p>' . "\n";
554
  echo '<p><em>Support for Custom Capabilities is available. If you\'re an advanced site owner, a theme designer, or a web developer integrating s2Member for a client, please see: <code>s2Member -> API Scripting -> Custom Capabilities</code></em></p>' . "\n";
555
  do_action ("ws_plugin__s2member_during_options_page_during_left_sections_during_membership_levels", get_defined_vars ());
556
  /**/
559
  echo '<tr>' . "\n";
560
  /**/
561
  echo '<th>' . "\n";
562
+ echo '<label for="ws-plugin--s2member-level0-label">' . "\n";
563
+ echo 'Level #0 ( Free Subscribers ):' . "\n";
564
+ echo '</label>' . "\n";
565
+ echo '</th>' . "\n";
566
+ /**/
567
+ echo '</tr>' . "\n";
568
+ echo '<tr>' . "\n";
569
+ /**/
570
+ echo '<td>' . "\n";
571
+ echo '<input type="text" name="ws_plugin__s2member_level0_label" id="ws-plugin--s2member-level0-label" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_label"]) . '" /><br />' . "\n";
572
+ echo 'This is the Label for Level 0 ( reserved for Free Subscribers ).<br />' . "\n";
573
+ echo '</td>' . "\n";
574
+ /**/
575
+ echo '</tr>' . "\n";
576
+ echo '<tr>' . "\n";
577
+ /**/
578
+ echo '<th>' . "\n";
579
  echo '<label for="ws-plugin--s2member-level1-label">' . "\n";
580
  echo 'Membership Level #1 Label:' . "\n";
581
  echo '</label>' . "\n";
666
  echo '<tr>' . "\n";
667
  /**/
668
  echo '<th>' . "\n";
669
+ echo '<label for="ws-plugin--s2member-level0-posts">' . "\n";
670
+ echo 'Posts That Require Level #0 Or Higher:' . "\n";
671
+ echo '</label>' . "\n";
672
+ echo '</th>' . "\n";
673
+ /**/
674
+ echo '</tr>' . "\n";
675
+ echo '<tr>' . "\n";
676
+ /**/
677
+ echo '<td>' . "\n";
678
+ echo '<input type="text" name="ws_plugin__s2member_level0_posts" id="ws-plugin--s2member-level0-posts" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_posts"]) . '" /><br />' . "\n";
679
+ echo 'Post IDs in comma delimited format. Example: <code>1,2,3,34,8,21</code> — or you can type: <code>all</code>.' . "\n";
680
+ echo '</td>' . "\n";
681
+ /**/
682
+ echo '</tr>' . "\n";
683
+ echo '<tr>' . "\n";
684
+ /**/
685
+ echo '<th>' . "\n";
686
  echo '<label for="ws-plugin--s2member-level1-posts">' . "\n";
687
  echo 'Posts That Require Level #1 Or Higher:' . "\n";
688
  echo '</label>' . "\n";
773
  echo '<tr>' . "\n";
774
  /**/
775
  echo '<th>' . "\n";
776
+ echo '<label for="ws-plugin--s2member-level0-pages">' . "\n";
777
+ echo 'Pages That Require Level #0 Or Higher:' . "\n";
778
+ echo '</label>' . "\n";
779
+ echo '</th>' . "\n";
780
+ /**/
781
+ echo '</tr>' . "\n";
782
+ echo '<tr>' . "\n";
783
+ /**/
784
+ echo '<td>' . "\n";
785
+ echo '<input type="text" name="ws_plugin__s2member_level0_pages" id="ws-plugin--s2member-level0-pages" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_pages"]) . '" /><br />' . "\n";
786
+ echo 'Page IDs in comma delimited format. Example: <code>1,2,3,34,8,21</code> — or you can type: <code>all</code>.' . "\n";
787
+ echo '</td>' . "\n";
788
+ /**/
789
+ echo '</tr>' . "\n";
790
+ echo '<tr>' . "\n";
791
+ /**/
792
+ echo '<th>' . "\n";
793
  echo '<label for="ws-plugin--s2member-level1-pages">' . "\n";
794
  echo 'Pages That Require Level #1 Or Higher:' . "\n";
795
  echo '</label>' . "\n";
880
  echo '<tr>' . "\n";
881
  /**/
882
  echo '<th>' . "\n";
883
+ echo '<label for="ws-plugin--s2member-level0-ptags">' . "\n";
884
+ echo 'Tags That Require Level #0 Or Higher:' . "\n";
885
+ echo '</label>' . "\n";
886
+ echo '</th>' . "\n";
887
+ /**/
888
+ echo '</tr>' . "\n";
889
+ echo '<tr>' . "\n";
890
+ /**/
891
+ echo '<td>' . "\n";
892
+ echo '<input type="text" name="ws_plugin__s2member_level0_ptags" id="ws-plugin--s2member-level0-ptags" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_ptags"]) . '" /><br />' . "\n";
893
+ echo 'Tags in comma delimited format. Example: <code>free,registration required</code> — or you can type: <code>all</code>.' . "\n";
894
+ echo '</td>' . "\n";
895
+ /**/
896
+ echo '</tr>' . "\n";
897
+ echo '<tr>' . "\n";
898
+ /**/
899
+ echo '<th>' . "\n";
900
  echo '<label for="ws-plugin--s2member-level1-ptags">' . "\n";
901
  echo 'Tags That Require Level #1 Or Higher:' . "\n";
902
  echo '</label>' . "\n";
987
  echo '<tr>' . "\n";
988
  /**/
989
  echo '<th>' . "\n";
990
+ echo '<label for="ws-plugin--s2member-level0-catgs">' . "\n";
991
+ echo 'Categories That Require Level #0 Or Higher:' . "\n";
992
+ echo '</label>' . "\n";
993
+ echo '</th>' . "\n";
994
+ /**/
995
+ echo '</tr>' . "\n";
996
+ echo '<tr>' . "\n";
997
+ /**/
998
+ echo '<td>' . "\n";
999
+ echo '<input type="text" name="ws_plugin__s2member_level0_catgs" id="ws-plugin--s2member-level0-catgs" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_catgs"]) . '" /><br />' . "\n";
1000
+ echo 'Category IDs in comma delimited format. Example: <code>1,2,3,34,8,21</code> — or you can type: <code>all</code>.' . "\n";
1001
+ echo '</td>' . "\n";
1002
+ /**/
1003
+ echo '</tr>' . "\n";
1004
+ echo '<tr>' . "\n";
1005
+ /**/
1006
+ echo '<th>' . "\n";
1007
  echo '<label for="ws-plugin--s2member-level1-catgs">' . "\n";
1008
  echo 'Categories That Require Level #1 Or Higher:' . "\n";
1009
  echo '</label>' . "\n";
1095
  echo '<tr>' . "\n";
1096
  /**/
1097
  echo '<th>' . "\n";
1098
+ echo '<label for="ws-plugin--s2member-level0-ruris">' . "\n";
1099
+ echo 'URIs That Require Level #0 Or Higher:' . "\n";
1100
+ echo '</label>' . "\n";
1101
+ echo '</th>' . "\n";
1102
+ /**/
1103
+ echo '</tr>' . "\n";
1104
+ echo '<tr>' . "\n";
1105
+ /**/
1106
+ echo '<td>' . "\n";
1107
+ echo '<textarea name="ws_plugin__s2member_level0_ruris" id="ws-plugin--s2member-level0-ruris" rows="3" wrap="off" spellcheck="false">' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_ruris"]) . '</textarea><br />' . "\n";
1108
+ echo 'URIs and/or word fragments found in URIs. One per line please.' . "\n";
1109
+ echo '</td>' . "\n";
1110
+ /**/
1111
+ echo '</tr>' . "\n";
1112
+ echo '<tr>' . "\n";
1113
+ /**/
1114
+ echo '<th>' . "\n";
1115
  echo '<label for="ws-plugin--s2member-level1-ruris">' . "\n";
1116
  echo 'URIs That Require Level #1 Or Higher:' . "\n";
1117
  echo '</label>' . "\n";
1308
  do_action ("ws_plugin__s2member_during_options_page_during_left_sections_after_ip_restrictions", get_defined_vars ());
1309
  }
1310
  /**/
1311
+ if (apply_filters ("ws_plugin__s2member_during_options_page_during_left_sections_display_profile_modifications", true, get_defined_vars ()))
1312
+ {
1313
+ do_action ("ws_plugin__s2member_during_options_page_during_left_sections_before_profile_modifications", get_defined_vars ());
1314
+ /**/
1315
+ echo '<div class="ws-menu-page-group" title="Member Profile Modifications">' . "\n";
1316
+ /**/
1317
+ echo '<div class="ws-menu-page-section ws-plugin--s2member-profile-modifications-section">' . "\n";
1318
+ echo '<h3>Giving Members The Ability To Modify Their Profile</h3>' . "\n";
1319
+ echo '<p>s2Member can be configured to redirect Members away from the <a href="profile.php" target="_blank" rel="external">default Profile Editing Panel</a> that is built into WordPress®. When/if a Member attempts to access the default Profile Editing Panel, they\'ll instead, be redirected to the Login Welcome Page that you\'ve configured through s2Member. <strong>Why would I redirect?</strong> Unless you\'ve made some drastic modifications to your WordPress® installation, the default Profile Editing Panel that ships with WordPress®, is NOT really suited for public access, even by a Member.</p>' . "\n";
1320
+ echo '<p>So instead of using this default Profile Editing Panel; s2Member creates an added layer of functionality, on top of WordPress®. It does this by providing you ( as the site owner ), with the ability to send your Members to a <a href="' . get_bloginfo ("url") . '/?s2member_profile=1" target="_blank" rel="external">special Stand-Alone page</a>, where your Members can modify their entire Profile, including all Custom Fields, and their Password. This special Stand-Alone Editing Panel, has been designed ( with a bare-bones format ), intentionally. This makes it possible for you to <a href="#" onclick="if(!window.open(\'' . get_bloginfo ("url") . '/?s2member_profile=1\', \'_popup\', \'height=350,width=400,left=100,screenX=100,top=100,screenY=100, location=0,menubar=0,toolbar=0,status=0,scrollbars=1,resizable=1\')) alert(\'Please disable popup blockers and try again!\'); return false;" rel="external">open it up in a popup window</a>, or embed it into your Login Welcome Page using an IFRAME. Code samples are provided below.</p>' . "\n";
1321
+ do_action ("ws_plugin__s2member_during_options_page_during_left_sections_during_profile_modifications", get_defined_vars ());
1322
+ /**/
1323
+ echo '<div class="ws-menu-page-hr"></div>' . "\n";
1324
+ /**/
1325
+ echo '<p>Stand-Alone page where Members can modify their Profile:<br />' . "\n";
1326
+ echo '<code><a href="' . get_bloginfo ("url") . '/?s2member_profile=1" target="_blank" rel="external">' . get_bloginfo ("url") . '/?s2member_profile=1</a></code></p>' . "\n";
1327
+ /**/
1328
+ echo '<div class="ws-menu-page-hr"></div>' . "\n";
1329
+ /**/
1330
+ echo '<p><strong>Code Sample #1</strong> ( standard link tag ):</p>' . "\n";
1331
+ echo '<p>' . highlight_string (preg_replace ("/\<\?php echo S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL; \?\>/", ws_plugin__s2member_esc_ds (get_bloginfo ("url") . "/?s2member_profile=1"), file_get_contents (dirname (__FILE__) . "/code-samples/current-user-profile-modification-page-url-1.php")), true) . '</p>' . "\n";
1332
+ /**/
1333
+ echo '<p><strong>Code Sample #2</strong> ( open the link in a popup window ):</p>' . "\n";
1334
+ echo '<p>' . highlight_string (preg_replace ("/\<\?php echo S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL; \?\>/", ws_plugin__s2member_esc_ds (get_bloginfo ("url") . "/?s2member_profile=1"), file_get_contents (dirname (__FILE__) . "/code-samples/current-user-profile-modification-page-url-2.php")), true) . '</p>' . "\n";
1335
+ /**/
1336
+ echo '<p><strong>Code Sample #3</strong> ( embed the form into a Post/Page using an IFRAME tag ):</p>' . "\n";
1337
+ echo '<p>' . highlight_string (preg_replace ("/\<\?php echo S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL; \?\>/", ws_plugin__s2member_esc_ds (get_bloginfo ("url") . "/?s2member_profile=1"), file_get_contents (dirname (__FILE__) . "/code-samples/current-user-profile-modification-page-url-3.php")), true) . '</p>' . "\n";
1338
+ echo '<table class="form-table">' . "\n";
1339
+ echo '<tbody>' . "\n";
1340
+ echo '<tr>' . "\n";
1341
+ /**/
1342
+ echo '<th>' . "\n";
1343
+ echo '<label for="ws-plugin--s2member-force-admin-lockouts">' . "\n";
1344
+ echo 'Redirect Members away from the Default Profile Panel?' . "\n";
1345
+ echo '</label>' . "\n";
1346
+ echo '</th>' . "\n";
1347
+ /**/
1348
+ echo '</tr>' . "\n";
1349
+ echo '<tr>' . "\n";
1350
+ /**/
1351
+ echo '<td>' . "\n";
1352
+ echo '<select name="ws_plugin__s2member_force_admin_lockouts" id="ws-plugin--s2member-force-admin-lockouts">' . "\n";
1353
+ echo '<option value="0"' . ((!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["force_admin_lockouts"]) ? ' selected="selected"' : '') . '>No ( I want to leave all options available to my Members )</option>' . "\n";
1354
+ echo '<option value="1"' . (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["force_admin_lockouts"]) ? ' selected="selected"' : '') . '>Yes ( redirect Members to their Login Welcome Page )</option>' . "\n";
1355
+ echo '</select><br />' . "\n";
1356
+ echo 'Recommended setting ( <code>Yes</code> ). The Stand-Alone version is better.<br />' . "\n";
1357
+ echo 'You\'ll want to embed the Stand-Alone version into your Login Welcome Page.<br />' . "\n";
1358
+ echo '</td>' . "\n";
1359
+ /**/
1360
+ echo '</tr>' . "\n";
1361
+ echo '</tbody>' . "\n";
1362
+ echo '</table>' . "\n";
1363
+ echo '</div>' . "\n";
1364
+ /**/
1365
+ echo '</div>' . "\n";
1366
+ /**/
1367
+ do_action ("ws_plugin__s2member_during_options_page_during_left_sections_after_profile_modifications", get_defined_vars ());
1368
+ }
1369
+ /**/
1370
  if (apply_filters ("ws_plugin__s2member_during_options_page_during_left_sections_display_deactivation", true, get_defined_vars ()))
1371
  {
1372
  do_action ("ws_plugin__s2member_during_options_page_during_left_sections_before_deactivation", get_defined_vars ());
1424
  do_action ("ws_plugin__s2member_during_options_page_before_right_sections", get_defined_vars ());
1425
  do_action ("ws_plugin__s2member_during_menu_pages_before_right_sections", get_defined_vars ());
1426
  /**/
1427
+ echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["upsell-pro"]) ? '<div class="ws-menu-page-others"><a href="' . ws_plugin__s2member_parse_readme_value ("Pro Module / Licensing") . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-upsell-pro.png" alt="." /></a></div>' . "\n" : '';
1428
  echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["installation"]) ? '<div class="ws-menu-page-installation"><a href="' . ws_plugin__s2member_parse_readme_value ("Professional Installation URI") . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-installation.png" alt="." /></a></div>' . "\n" : '';
1429
  echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["tools"]) ? '<div class="ws-menu-page-tools"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-tools.png" alt="." /></div>' . "\n" : '';
1430
  echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["support"]) ? '<div class="ws-menu-page-support"><a href="' . ws_plugin__s2member_parse_readme_value ("Forum URI") . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-support.png" alt="." /></a></div>' . "\n" : '';
includes/menu-pages/paypal-buttons.inc.php ADDED
@@ -0,0 +1,650 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Copyright: © 2009 WebSharks, Inc. ( coded in the USA )
4
+ <mailto:support@websharks-inc.com> <http://www.websharks-inc.com/>
5
+
6
+ Released under the terms of the GNU General Public License.
7
+ You should have received a copy of the GNU General Public License,
8
+ along with this software. In the main directory, see: /licensing/
9
+ If not, see: <http://www.gnu.org/licenses/>.
10
+ */
11
+ /*
12
+ Direct access denial.
13
+ */
14
+ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
+ /*
17
+ PayPal® Button Generating page.
18
+ */
19
+ echo '<div class="wrap ws-menu-page">' . "\n";
20
+ /**/
21
+ echo '<div id="icon-plugins" class="icon32"><br /></div>' . "\n";
22
+ echo '<h2><div>Developed by <a href="' . ws_plugin__s2member_parse_readme_value ("Plugin URI") . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-light.png" alt="." /></a></div>s2Member / PayPal® Buttons</h2>' . "\n";
23
+ /**/
24
+ echo '<div class="ws-menu-page-hr"></div>' . "\n";
25
+ /**/
26
+ echo '<table class="ws-menu-page-table">' . "\n";
27
+ echo '<tbody class="ws-menu-page-table-tbody">' . "\n";
28
+ echo '<tr class="ws-menu-page-table-tr">' . "\n";
29
+ echo '<td class="ws-menu-page-table-l">' . "\n";
30
+ /**/
31
+ do_action ("ws_plugin__s2member_during_paypal_buttons_page_before_left_sections", get_defined_vars ());
32
+ /**/
33
+ if (apply_filters ("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_display_level1_buttons", true, get_defined_vars ()))
34
+ {
35
+ do_action ("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_before_level1_buttons", get_defined_vars ());
36
+ /**/
37
+ echo '<div class="ws-menu-page-group" title="PayPal® Buttons For Level #1 Access">' . "\n";
38
+ /**/
39
+ echo '<div class="ws-menu-page-section ws-plugin--s2member-level1-buttons-section">' . "\n";
40
+ echo '<h3>Button Code Generator For Level #1 Access</h3>' . "\n";
41
+ echo '<p>Very simple. All you do is customize the form fields provided, for each Membership Level that you plan to offer. Then press (Generate Button Code). These special PayPal® Buttons are customized to work with s2Member seamlessly. Member accounts will be activated instantly, in an automated fashion. When you, or a Member, cancels their membership, or fails to make payments on time, s2Member will automatically terminate their membership privileges. s2Member makes extensive use of the PayPal® IPN service. s2Member receives updates from PayPal® behind-the-scene.</p>' . "\n";
42
+ echo '<p><em>* Buttons are NOT saved here. This is only a Button Generator. Once you\'ve generated your Button, copy/paste it into your Membership Options Page. If you lose your Button Code, you\'ll need to come back &amp; re-generate a new one. If you\'re in Sandbox Test-Mode, and you\'re NOT using the Shortcode Format, please remember to come back and re-generate your Buttons before you go live.</em></p>' . "\n";
43
+ do_action ("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_during_level1_buttons", get_defined_vars ());
44
+ /**/
45
+ echo '<table class="form-table">' . "\n";
46
+ echo '<tbody>' . "\n";
47
+ echo '<tr>' . "\n";
48
+ /**/
49
+ echo '<th class="ws-menu-page-th-side">' . "\n";
50
+ echo '<label for="ws-plugin--s2member-level1-shortcode">' . "\n";
51
+ echo 'Button Code<br />For Level #1:<br /><br />' . "\n";
52
+ echo '<div id="ws-plugin--s2member-level1-button-prev"></div>' . "\n";
53
+ echo '</label>' . "\n";
54
+ echo '</th>' . "\n";
55
+ /**/
56
+ echo '<td>' . "\n";
57
+ echo '<form onsubmit="return false;">' . "\n";
58
+ echo '<p id="ws-plugin--s2member-level1-trial-line">I\'ll offer the first <input type="text" id="ws-plugin--s2member-level1-trial-period" value="0" size="6" /> <select id="ws-plugin--s2member-level1-trial-term">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/paypal-membership-trial-terms.html") . '</select> free.</p>' . "\n";
59
+ echo '<p><span id="ws-plugin--s2member-level1-trial-then">Then, </span>I want to charge: $<input type="text" id="ws-plugin--s2member-level1-amount" value="0.01" size="4" /> / <select id="ws-plugin--s2member-level1-term">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/paypal-membership-regular-terms.html") . '</select></p>' . "\n";
60
+ echo '<p>Checkout Page Style <a href="#" onclick="alert(\'Optional. This can be configured inside your PayPal® account. PayPal® allows you to create Custom Page Styles, and assign a unique name to them. You can add your own header image and color selection to the checkout form. Once you\\\'ve created a Custom Page Style at PayPal®, you can enter that Page Style here.\\n\\nIn addition. The Shortcode below, provided by s2Member; supports an image attribute: image=\\\'\\\'default\\\'\\\'. This can be changed to a full URL, pointing to a custom image of your own; instead of the default PayPal® Button image.\'); return false;">[?]</a>: <input type="text" id="ws-plugin--s2member-level1-page-style" value="paypal" size="18" /> <select id="ws-plugin--s2member-level1-currency">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/paypal-currencies.html") . '</select> <input type="button" value="Generate Button Code" onclick="ws_plugin__s2member_paypalButtonGenerate(\'level1\');" class="button-primary" /></p>' . "\n";
61
+ echo '<p>Custom Capabilities ( comma delimited ) <a href="#" onclick="alert(\'Optional. This is VERY advanced. For full details, see:\\ns2Member -> API Scripting -> Custom Capabilities.\'); return false;">[?]</a> <input type="text" id="ws-plugin--s2member-level1-ccaps" size="40" maxlength="125" /></p>' . "\n";
62
+ echo '</form>' . "\n";
63
+ echo '</td>' . "\n";
64
+ /**/
65
+ echo '</tr>' . "\n";
66
+ echo '<tr>' . "\n";
67
+ /**/
68
+ echo '<td colspan="2">' . "\n";
69
+ echo '<form onsubmit="return false;">' . "\n";
70
+ do_action ("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_during_level1_buttons_before_shortcode", get_defined_vars ());
71
+ echo '<strong>WordPress® Shortcode:</strong> ( recommended for both the WordPress® Visual &amp; HTML Editors )<br />' . "\n";
72
+ $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/shortcodes/paypal-checkout-button-shortcode.html"));
73
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%domain%%/", ws_plugin__s2member_esc_ds (strtolower ($_SERVER["HTTP_HOST"])), $ws_plugin__s2member_temp_s);
74
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%level%%/", "1", $ws_plugin__s2member_temp_s);
75
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%level_label%%/", ws_plugin__s2member_esc_ds ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_label"]), $ws_plugin__s2member_temp_s);
76
+ echo '<input id="ws-plugin--s2member-level1-shortcode" type="text" value="' . format_to_edit ($ws_plugin__s2member_temp_s) . '" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;" /><br /><br />' . "\n";
77
+ echo '<strong>Resulting PayPal® Button Code:</strong> ( ultimately, your Shortcode will produce this snippet )<br />' . "\n";
78
+ echo '<textarea id="ws-plugin--s2member-level1-button" rows="8" wrap="off" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;">';
79
+ $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/paypal-checkout-button.html"));
80
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%endpoint%%/", (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "www.sandbox.paypal.com" : "www.paypal.com"), $ws_plugin__s2member_temp_s);
81
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%paypal_business%%/", ws_plugin__s2member_esc_ds ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"]), $ws_plugin__s2member_temp_s);
82
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%level_label%%/", ws_plugin__s2member_esc_ds ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_label"]), $ws_plugin__s2member_temp_s);
83
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%cancel_return%%/", ws_plugin__s2member_esc_ds (get_bloginfo ("url")), $ws_plugin__s2member_temp_s);
84
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%notify_url%%/", ws_plugin__s2member_esc_ds (get_bloginfo ("url") . "/?s2member_paypal_notify=1"), $ws_plugin__s2member_temp_s);
85
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%return%%/", ws_plugin__s2member_esc_ds (get_bloginfo ("url") . "/?s2member_paypal_return=1"), $ws_plugin__s2member_temp_s);
86
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%domain%%/", ws_plugin__s2member_esc_ds (strtolower ($_SERVER["HTTP_HOST"])), $ws_plugin__s2member_temp_s);
87
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%level%%/", "1", $ws_plugin__s2member_temp_s);
88
+ echo format_to_edit ($ws_plugin__s2member_temp_s);
89
+ echo '</textarea><br />' . "\n";
90
+ echo '&uarr; Use this more advanced Code if you\'re building a theme or plugin that integrates with s2Member.' . "\n";
91
+ echo '</form>' . "\n";
92
+ echo '</td>' . "\n";
93
+ /**/
94
+ echo '</tr>' . "\n";
95
+ echo '</tbody>' . "\n";
96
+ echo '</table>' . "\n";
97
+ echo '</div>' . "\n";
98
+ /**/
99
+ echo '</div>' . "\n";
100
+ /**/
101
+ do_action ("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_after_level1_buttons", get_defined_vars ());
102
+ }
103
+ /**/
104
+ if (apply_filters ("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_display_level2_buttons", true, get_defined_vars ()))
105
+ {
106
+ do_action ("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_before_level2_buttons", get_defined_vars ());
107
+ /**/
108
+ echo '<div class="ws-menu-page-group" title="PayPal® Buttons For Level #2 Access">' . "\n";
109
+ /**/
110
+ echo '<div class="ws-menu-page-section ws-plugin--s2member-level2-buttons-section">' . "\n";
111
+ echo '<h3>Button Code Generator For Level #2 Access</h3>' . "\n";
112
+ echo '<p>Very simple. All you do is customize the form fields provided, for each Membership Level that you plan to offer. Then press (Generate Button Code). These special PayPal® Buttons are customized to work with s2Member seamlessly. Member accounts will be activated instantly, in an automated fashion. When you, or a Member, cancels their membership, or fails to make payments on time, s2Member will automatically terminate their membership privileges. s2Member makes extensive use of the PayPal® IPN service. s2Member receives updates from PayPal® behind-the-scene.</p>' . "\n";
113
+ echo '<p><em>* Buttons are NOT saved here. This is only a Button Generator. Once you\'ve generated your Button, copy/paste it into your Membership Options Page. If you lose your Button Code, you\'ll need to come back &amp; re-generate a new one. If you\'re in Sandbox Test-Mode, and you\'re NOT using the Shortcode Format, please remember to come back and re-generate your Buttons before you go live.</em></p>' . "\n";
114
+ do_action ("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_during_level2_buttons", get_defined_vars ());
115
+ /**/
116
+ echo '<table class="form-table">' . "\n";
117
+ echo '<tbody>' . "\n";
118
+ echo '<tr>' . "\n";
119
+ /**/
120
+ echo '<th class="ws-menu-page-th-side">' . "\n";
121
+ echo '<label for="ws-plugin--s2member-level2-shortcode">' . "\n";
122
+ echo 'Button Code<br />For Level #2:<br /><br />' . "\n";
123
+ echo '<div id="ws-plugin--s2member-level2-button-prev"></div>' . "\n";
124
+ echo '</label>' . "\n";
125
+ echo '</th>' . "\n";
126
+ /**/
127
+ echo '<td>' . "\n";
128
+ echo '<form onsubmit="return false;">' . "\n";
129
+ echo '<p id="ws-plugin--s2member-level2-trial-line">I\'ll offer the first <input type="text" id="ws-plugin--s2member-level2-trial-period" value="0" size="6" /> <select id="ws-plugin--s2member-level2-trial-term">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/paypal-membership-trial-terms.html") . '</select> free.</p>' . "\n";
130
+ echo '<p><span id="ws-plugin--s2member-level2-trial-then">Then, </span>I want to charge: $<input type="text" id="ws-plugin--s2member-level2-amount" value="0.01" size="4" /> / <select id="ws-plugin--s2member-level2-term">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/paypal-membership-regular-terms.html") . '</select></p>' . "\n";
131
+ echo '<p>Checkout Page Style <a href="#" onclick="alert(\'Optional. This can be configured inside your PayPal® account. PayPal® allows you to create Custom Page Styles, and assign a unique name to them. You can add your own header image and color selection to the checkout form. Once you\\\'ve created a Custom Page Style at PayPal®, you can enter that Page Style here.\\n\\nIn addition. The Shortcode below, provided by s2Member; supports an image attribute: image=\\\'\\\'default\\\'\\\'. This can be changed to a full URL, pointing to a custom image of your own; instead of the default PayPal® Button image.\'); return false;">[?]</a>: <input type="text" id="ws-plugin--s2member-level2-page-style" value="paypal" size="18" /> <select id="ws-plugin--s2member-level2-currency">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/paypal-currencies.html") . '</select> <input type="button" value="Generate Button Code" onclick="ws_plugin__s2member_paypalButtonGenerate(\'level2\');" class="button-primary" /></p>' . "\n";
132
+ echo '<p>Custom Capabilities ( comma delimited ) <a href="#" onclick="alert(\'Optional. This is VERY advanced. For full details, see:\\ns2Member -> API Scripting -> Custom Capabilities.\'); return false;">[?]</a> <input type="text" id="ws-plugin--s2member-level2-ccaps" size="40" maxlength="125" /></p>' . "\n";
133
+ echo '</form>' . "\n";
134
+ echo '</td>' . "\n";
135
+ /**/
136
+ echo '</tr>' . "\n";
137
+ echo '<tr>' . "\n";
138
+ /**/
139
+ echo '<td colspan="2">' . "\n";
140
+ echo '<form onsubmit="return false;">' . "\n";
141
+ do_action ("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_during_level2_buttons_before_shortcode", get_defined_vars ());
142
+ echo '<strong>WordPress® Shortcode:</strong> ( recommended for both the WordPress® Visual &amp; HTML Editors )<br />' . "\n";
143
+ $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/shortcodes/paypal-checkout-button-shortcode.html"));
144
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%domain%%/", ws_plugin__s2member_esc_ds (strtolower ($_SERVER["HTTP_HOST"])), $ws_plugin__s2member_temp_s);
145
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%level%%/", "2", $ws_plugin__s2member_temp_s);
146
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%level_label%%/", ws_plugin__s2member_esc_ds ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_label"]), $ws_plugin__s2member_temp_s);
147
+ echo '<input id="ws-plugin--s2member-level2-shortcode" type="text" value="' . format_to_edit ($ws_plugin__s2member_temp_s) . '" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;" /><br /><br />' . "\n";
148
+ echo '<strong>Resulting PayPal® Button Code:</strong> ( ultimately, your Shortcode will produce this snippet )<br />' . "\n";
149
+ echo '<textarea id="ws-plugin--s2member-level2-button" rows="8" wrap="off" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;">';
150
+ $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/paypal-checkout-button.html"));
151
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%endpoint%%/", (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "www.sandbox.paypal.com" : "www.paypal.com"), $ws_plugin__s2member_temp_s);
152
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%paypal_business%%/", ws_plugin__s2member_esc_ds ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"]), $ws_plugin__s2member_temp_s);
153
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%level_label%%/", ws_plugin__s2member_esc_ds ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_label"]), $ws_plugin__s2member_temp_s);
154
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%cancel_return%%/", ws_plugin__s2member_esc_ds (get_bloginfo ("url")), $ws_plugin__s2member_temp_s);
155
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%notify_url%%/", ws_plugin__s2member_esc_ds (get_bloginfo ("url") . "/?s2member_paypal_notify=1"), $ws_plugin__s2member_temp_s);
156
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%return%%/", ws_plugin__s2member_esc_ds (get_bloginfo ("url") . "/?s2member_paypal_return=1"), $ws_plugin__s2member_temp_s);
157
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%domain%%/", ws_plugin__s2member_esc_ds (strtolower ($_SERVER["HTTP_HOST"])), $ws_plugin__s2member_temp_s);
158
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%level%%/", "2", $ws_plugin__s2member_temp_s);
159
+ echo format_to_edit ($ws_plugin__s2member_temp_s);
160
+ echo '</textarea><br />' . "\n";
161
+ echo '&uarr; Use this more advanced Code if you\'re building a theme or plugin that integrates with s2Member.' . "\n";
162
+ echo '</form>' . "\n";
163
+ echo '</td>' . "\n";
164
+ /**/
165
+ echo '</tr>' . "\n";
166
+ echo '</tbody>' . "\n";
167
+ echo '</table>' . "\n";
168
+ echo '</div>' . "\n";
169
+ /**/
170
+ echo '</div>' . "\n";
171
+ /**/
172
+ do_action ("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_after_level2_buttons", get_defined_vars ());
173
+ }
174
+ /**/
175
+ if (apply_filters ("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_display_level3_buttons", true, get_defined_vars ()))
176
+ {
177
+ do_action ("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_before_level3_buttons", get_defined_vars ());
178
+ /**/
179
+ echo '<div class="ws-menu-page-group" title="PayPal® Buttons For Level #3 Access">' . "\n";
180
+ /**/
181
+ echo '<div class="ws-menu-page-section ws-plugin--s2member-level3-buttons-section">' . "\n";
182
+ echo '<h3>Button Code Generator For Level #3 Access</h3>' . "\n";
183
+ echo '<p>Very simple. All you do is customize the form fields provided, for each Membership Level that you plan to offer. Then press (Generate Button Code). These special PayPal® Buttons are customized to work with s2Member seamlessly. Member accounts will be activated instantly, in an automated fashion. When you, or a Member, cancels their membership, or fails to make payments on time, s2Member will automatically terminate their membership privileges. s2Member makes extensive use of the PayPal® IPN service. s2Member receives updates from PayPal® behind-the-scene.</p>' . "\n";
184
+ echo '<p><em>* Buttons are NOT saved here. This is only a Button Generator. Once you\'ve generated your Button, copy/paste it into your Membership Options Page. If you lose your Button Code, you\'ll need to come back &amp; re-generate a new one. If you\'re in Sandbox Test-Mode, and you\'re NOT using the Shortcode Format, please remember to come back and re-generate your Buttons before you go live.</em></p>' . "\n";
185
+ do_action ("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_during_level3_buttons", get_defined_vars ());
186
+ /**/
187
+ echo '<table class="form-table">' . "\n";
188
+ echo '<tbody>' . "\n";
189
+ echo '<tr>' . "\n";
190
+ /**/
191
+ echo '<th class="ws-menu-page-th-side">' . "\n";
192
+ echo '<label for="ws-plugin--s2member-level3-shortcode">' . "\n";
193
+ echo 'Button Code<br />For Level #3:<br /><br />' . "\n";
194
+ echo '<div id="ws-plugin--s2member-level3-button-prev"></div>' . "\n";
195
+ echo '</label>' . "\n";
196
+ echo '</th>' . "\n";
197
+ /**/
198
+ echo '<td>' . "\n";
199
+ echo '<form onsubmit="return false;">' . "\n";
200
+ echo '<p id="ws-plugin--s2member-level3-trial-line">I\'ll offer the first <input type="text" id="ws-plugin--s2member-level3-trial-period" value="0" size="6" /> <select id="ws-plugin--s2member-level3-trial-term">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/paypal-membership-trial-terms.html") . '</select> free.</p>' . "\n";
201
+ echo '<p><span id="ws-plugin--s2member-level3-trial-then">Then, </span>I want to charge: $<input type="text" id="ws-plugin--s2member-level3-amount" value="0.01" size="4" /> / <select id="ws-plugin--s2member-level3-term">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/paypal-membership-regular-terms.html") . '</select></p>' . "\n";
202
+ echo '<p>Checkout Page Style <a href="#" onclick="alert(\'Optional. This can be configured inside your PayPal® account. PayPal® allows you to create Custom Page Styles, and assign a unique name to them. You can add your own header image and color selection to the checkout form. Once you\\\'ve created a Custom Page Style at PayPal®, you can enter that Page Style here.\\n\\nIn addition. The Shortcode below, provided by s2Member; supports an image attribute: image=\\\'\\\'default\\\'\\\'. This can be changed to a full URL, pointing to a custom image of your own; instead of the default PayPal® Button image.\'); return false;">[?]</a>: <input type="text" id="ws-plugin--s2member-level3-page-style" value="paypal" size="18" /> <select id="ws-plugin--s2member-level3-currency">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/paypal-currencies.html") . '</select> <input type="button" value="Generate Button Code" onclick="ws_plugin__s2member_paypalButtonGenerate(\'level3\');" class="button-primary" /></p>' . "\n";
203
+ echo '<p>Custom Capabilities ( comma delimited ) <a href="#" onclick="alert(\'Optional. This is VERY advanced. For full details, see:\\ns2Member -> API Scripting -> Custom Capabilities.\'); return false;">[?]</a> <input type="text" id="ws-plugin--s2member-level3-ccaps" size="40" maxlength="125" /></p>' . "\n";
204
+ echo '</form>' . "\n";
205
+ echo '</td>' . "\n";
206
+ /**/
207
+ echo '</tr>' . "\n";
208
+ echo '<tr>' . "\n";
209
+ /**/
210
+ echo '<td colspan="2">' . "\n";
211
+ echo '<form onsubmit="return false;">' . "\n";
212
+ do_action ("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_during_level3_buttons_before_shortcode", get_defined_vars ());
213
+ echo '<strong>WordPress® Shortcode:</strong> ( recommended for both the WordPress® Visual &amp; HTML Editors )<br />' . "\n";
214
+ $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/shortcodes/paypal-checkout-button-shortcode.html"));
215
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%domain%%/", ws_plugin__s2member_esc_ds (strtolower ($_SERVER["HTTP_HOST"])), $ws_plugin__s2member_temp_s);
216
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%level%%/", "3", $ws_plugin__s2member_temp_s);
217
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%level_label%%/", ws_plugin__s2member_esc_ds ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_label"]), $ws_plugin__s2member_temp_s);
218
+ echo '<input id="ws-plugin--s2member-level3-shortcode" type="text" value="' . format_to_edit ($ws_plugin__s2member_temp_s) . '" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;" /><br /><br />' . "\n";
219
+ echo '<strong>Resulting PayPal® Button Code:</strong> ( ultimately, your Shortcode will produce this snippet )<br />' . "\n";
220
+ echo '<textarea id="ws-plugin--s2member-level3-button" rows="8" wrap="off" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;">';
221
+ $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/paypal-checkout-button.html"));
222
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%endpoint%%/", (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "www.sandbox.paypal.com" : "www.paypal.com"), $ws_plugin__s2member_temp_s);
223
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%paypal_business%%/", ws_plugin__s2member_esc_ds ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"]), $ws_plugin__s2member_temp_s);
224
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%level_label%%/", ws_plugin__s2member_esc_ds ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_label"]), $ws_plugin__s2member_temp_s);
225
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%cancel_return%%/", ws_plugin__s2member_esc_ds (get_bloginfo ("url")), $ws_plugin__s2member_temp_s);
226
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%notify_url%%/", ws_plugin__s2member_esc_ds (get_bloginfo ("url") . "/?s2member_paypal_notify=1"), $ws_plugin__s2member_temp_s);
227
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%return%%/", ws_plugin__s2member_esc_ds (get_bloginfo ("url") . "/?s2member_paypal_return=1"), $ws_plugin__s2member_temp_s);
228
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%domain%%/", ws_plugin__s2member_esc_ds (strtolower ($_SERVER["HTTP_HOST"])), $ws_plugin__s2member_temp_s);
229
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%level%%/", "3", $ws_plugin__s2member_temp_s);
230
+ echo format_to_edit ($ws_plugin__s2member_temp_s);
231
+ echo '</textarea><br />' . "\n";
232
+ echo '&uarr; Use this more advanced Code if you\'re building a theme or plugin that integrates with s2Member.' . "\n";
233
+ echo '</form>' . "\n";
234
+ echo '</td>' . "\n";
235
+ /**/
236
+ echo '</tr>' . "\n";
237
+ echo '</tbody>' . "\n";
238
+ echo '</table>' . "\n";
239
+ echo '</div>' . "\n";
240
+ /**/
241
+ echo '</div>' . "\n";
242
+ /**/
243
+ do_action ("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_after_level3_buttons", get_defined_vars ());
244
+ }
245
+ /**/
246
+ if (apply_filters ("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_display_level4_buttons", true, get_defined_vars ()))
247
+ {
248
+ do_action ("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_before_level4_buttons", get_defined_vars ());
249
+ /**/
250
+ echo '<div class="ws-menu-page-group" title="PayPal® Buttons For Level #4 Access">' . "\n";
251
+ /**/
252
+ echo '<div class="ws-menu-page-section ws-plugin--s2member-level4-buttons-section">' . "\n";
253
+ echo '<h3>Button Code Generator For Level #4 Access</h3>' . "\n";
254
+ echo '<p>Very simple. All you do is customize the form fields provided, for each Membership Level that you plan to offer. Then press (Generate Button Code). These special PayPal® Buttons are customized to work with s2Member seamlessly. Member accounts will be activated instantly, in an automated fashion. When you, or a Member, cancels their membership, or fails to make payments on time, s2Member will automatically terminate their membership privileges. s2Member makes extensive use of the PayPal® IPN service. s2Member receives updates from PayPal® behind-the-scene.</p>' . "\n";
255
+ echo '<p><em>* Buttons are NOT saved here. This is only a Button Generator. Once you\'ve generated your Button, copy/paste it into your Membership Options Page. If you lose your Button Code, you\'ll need to come back &amp; re-generate a new one. If you\'re in Sandbox Test-Mode, and you\'re NOT using the Shortcode Format, please remember to come back and re-generate your Buttons before you go live.</em></p>' . "\n";
256
+ do_action ("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_during_level4_buttons", get_defined_vars ());
257
+ /**/
258
+ echo '<table class="form-table">' . "\n";
259
+ echo '<tbody>' . "\n";
260
+ echo '<tr>' . "\n";
261
+ /**/
262
+ echo '<th class="ws-menu-page-th-side">' . "\n";
263
+ echo '<label for="ws-plugin--s2member-level4-shortcode">' . "\n";
264
+ echo 'Button Code<br />For Level #4:<br /><br />' . "\n";
265
+ echo '<div id="ws-plugin--s2member-level4-button-prev"></div>' . "\n";
266
+ echo '</label>' . "\n";
267
+ echo '</th>' . "\n";
268
+ /**/
269
+ echo '<td>' . "\n";
270
+ echo '<form onsubmit="return false;">' . "\n";
271
+ echo '<p id="ws-plugin--s2member-level4-trial-line">I\'ll offer the first <input type="text" id="ws-plugin--s2member-level4-trial-period" value="0" size="6" /> <select id="ws-plugin--s2member-level4-trial-term">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/paypal-membership-trial-terms.html") . '</select> free.</p>' . "\n";
272
+ echo '<p><span id="ws-plugin--s2member-level4-trial-then">Then, </span>I want to charge: $<input type="text" id="ws-plugin--s2member-level4-amount" value="0.01" size="4" /> / <select id="ws-plugin--s2member-level4-term">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/paypal-membership-regular-terms.html") . '</select></p>' . "\n";
273
+ echo '<p>Checkout Page Style <a href="#" onclick="alert(\'Optional. This can be configured inside your PayPal® account. PayPal® allows you to create Custom Page Styles, and assign a unique name to them. You can add your own header image and color selection to the checkout form. Once you\\\'ve created a Custom Page Style at PayPal®, you can enter that Page Style here.\\n\\nIn addition. The Shortcode below, provided by s2Member; supports an image attribute: image=\\\'\\\'default\\\'\\\'. This can be changed to a full URL, pointing to a custom image of your own; instead of the default PayPal® Button image.\'); return false;">[?]</a>: <input type="text" id="ws-plugin--s2member-level4-page-style" value="paypal" size="18" /> <select id="ws-plugin--s2member-level4-currency">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/paypal-currencies.html") . '</select> <input type="button" value="Generate Button Code" onclick="ws_plugin__s2member_paypalButtonGenerate(\'level4\');" class="button-primary" /></p>' . "\n";
274
+ echo '<p>Custom Capabilities ( comma delimited ) <a href="#" onclick="alert(\'Optional. This is VERY advanced. For full details, see:\\ns2Member -> API Scripting -> Custom Capabilities.\'); return false;">[?]</a> <input type="text" id="ws-plugin--s2member-level4-ccaps" size="40" maxlength="125" /></p>' . "\n";
275
+ echo '</form>' . "\n";
276
+ echo '</td>' . "\n";
277
+ /**/
278
+ echo '</tr>' . "\n";
279
+ echo '<tr>' . "\n";
280
+ /**/
281
+ echo '<td colspan="2">' . "\n";
282
+ echo '<form onsubmit="return false;">' . "\n";
283
+ do_action ("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_during_level4_buttons_before_shortcode", get_defined_vars ());
284
+ echo '<strong>WordPress® Shortcode:</strong> ( recommended for both the WordPress® Visual &amp; HTML Editors )<br />' . "\n";
285
+ $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/shortcodes/paypal-checkout-button-shortcode.html"));
286
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%domain%%/", ws_plugin__s2member_esc_ds (strtolower ($_SERVER["HTTP_HOST"])), $ws_plugin__s2member_temp_s);
287
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%level%%/", "4", $ws_plugin__s2member_temp_s);
288
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%level_label%%/", ws_plugin__s2member_esc_ds ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_label"]), $ws_plugin__s2member_temp_s);
289
+ echo '<input id="ws-plugin--s2member-level4-shortcode" type="text" value="' . format_to_edit ($ws_plugin__s2member_temp_s) . '" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;" /><br /><br />' . "\n";
290
+ echo '<strong>Resulting PayPal® Button Code:</strong> ( ultimately, your Shortcode will produce this snippet )<br />' . "\n";
291
+ echo '<textarea id="ws-plugin--s2member-level4-button" rows="8" wrap="off" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;">';
292
+ $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/paypal-checkout-button.html"));
293
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%endpoint%%/", (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "www.sandbox.paypal.com" : "www.paypal.com"), $ws_plugin__s2member_temp_s);
294
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%paypal_business%%/", ws_plugin__s2member_esc_ds ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"]), $ws_plugin__s2member_temp_s);
295
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%level_label%%/", ws_plugin__s2member_esc_ds ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_label"]), $ws_plugin__s2member_temp_s);
296
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%cancel_return%%/", ws_plugin__s2member_esc_ds (get_bloginfo ("url")), $ws_plugin__s2member_temp_s);
297
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%notify_url%%/", ws_plugin__s2member_esc_ds (get_bloginfo ("url") . "/?s2member_paypal_notify=1"), $ws_plugin__s2member_temp_s);
298
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%return%%/", ws_plugin__s2member_esc_ds (get_bloginfo ("url") . "/?s2member_paypal_return=1"), $ws_plugin__s2member_temp_s);
299
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%domain%%/", ws_plugin__s2member_esc_ds (strtolower ($_SERVER["HTTP_HOST"])), $ws_plugin__s2member_temp_s);
300
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%level%%/", "4", $ws_plugin__s2member_temp_s);
301
+ echo format_to_edit ($ws_plugin__s2member_temp_s);
302
+ echo '</textarea><br />' . "\n";
303
+ echo '&uarr; Use this more advanced Code if you\'re building a theme or plugin that integrates with s2Member.' . "\n";
304
+ echo '</form>' . "\n";
305
+ echo '</td>' . "\n";
306
+ /**/
307
+ echo '</tr>' . "\n";
308
+ echo '</tbody>' . "\n";
309
+ echo '</table>' . "\n";
310
+ echo '</div>' . "\n";
311
+ /**/
312
+ echo '</div>' . "\n";
313
+ /**/
314
+ do_action ("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_after_level4_buttons", get_defined_vars ());
315
+ }
316
+ /**/
317
+ if (apply_filters ("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_display_modification_buttons", true, get_defined_vars ()))
318
+ {
319
+ do_action ("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_before_modification_buttons", get_defined_vars ());
320
+ /**/
321
+ echo '<div class="ws-menu-page-group" title="PayPal® Subscr Modification Buttons">' . "\n";
322
+ /**/
323
+ echo '<div class="ws-menu-page-section ws-plugin--s2member-modification-buttons-section">' . "\n";
324
+ echo '<h3>Button Code Generator For Subscription Modifications</h3>' . "\n";
325
+ echo '<p>If you\'d like to give your Members ( and/or your Free Subscribers ) the ability to modify their billing plan, by switching to a more expensive option, or a less expensive option; generate a new PayPal® Modification Button here. Configure the updated Level, pricing, terms, etc. Then, make that new Modification Button available to Members who are logged into their existing account with you. For example, you might want to insert a "Level #2" Upgrade Button into your Login Welcome Page, which would up-sell existing Level #1 Members to a more expensive plan that you offer.</p>' . "\n";
326
+ echo '<p><em><strong>*Modification Process*</strong> When you send a Member to PayPal® using a Subscription Modification Button, PayPal® will ask them to login. Once they\'re logged in, instead of being able to signup for a new membership, PayPal® will provide them with the ability to upgrade and/or downgrade their existing membership with you, by allowing them to switch to the Membership Plan that was specified in the Subscription Modification Button. PayPal® handles this nicely, and you\'ll be happy to know that s2Member has been pre-configured to deal with this scenario as well, so that everything remains automated. Their Membership Access Level will either be promoted, or demoted, based on the actions they took at PayPal® during the modification process. Once an existing Member completes their Subscription Modification at PayPal®, they\'ll be brought back to their Login Welcome Page, instead of the registration screen.</em></p>' . "\n";
327
+ echo '<p><em><strong>*Also Works For Free Subscribers*</strong> Although a Free Subscriber does not have an existing PayPal® Subscription, s2Member is capable of adapting to this scenario gracefully. Just make sure that your existing Free Subscribers ( the ones who wish to upgrade ) pay for their Membership through a Modification Button generated by s2Member. That will allow them to continue using their existing account with you. In other words, they can keep their existing Username ( and anything already associated with that Username ), rather than being forced to re-register after checkout.</em></p>' . "\n";
328
+ echo '<p><em><strong>*Make It More User-Friendly*</strong> You can make the Subscription Modification Process, more user-friendly, by setting up a <a href="#" onclick="alert(\'Optional. This can be configured inside your PayPal® account. PayPal® allows you to create Custom Page Styles, and assign a unique name to them. You can add your own header image and color selection to the checkout form. Once you\\\'ve created a Custom Page Style at PayPal®, you can tell s2Member to use that Page Style whenever you generate your Button Code.\'); return false;">Custom Page Style at PayPal®</a>, specifically for Subscription Modification Buttons. Use a custom header image, with a brief explanation to the Customer. Something like, "Log into PayPal®", "You can Modify your Subscription!".</em></p>' . "\n";
329
+ echo '<p><em>* Buttons are NOT saved here. This is only a Button Generator. Once you\'ve generated your Button, copy/paste it into your Login Welcome Page, or wherever you feel it would be most appropriate. If you lose your Button Code, you\'ll need to come back &amp; re-generate a new one. If you\'re in Sandbox Test-Mode, and you\'re NOT using the Shortcode Format, please remember to come back and re-generate your Buttons before you go live.</em></p>' . "\n";
330
+ do_action ("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_during_modification_buttons", get_defined_vars ());
331
+ /**/
332
+ echo '<table class="form-table">' . "\n";
333
+ echo '<tbody>' . "\n";
334
+ echo '<tr>' . "\n";
335
+ /**/
336
+ echo '<th class="ws-menu-page-th-side">' . "\n";
337
+ echo '<label for="ws-plugin--s2member-modification-shortcode">' . "\n";
338
+ echo 'Button Code<br />For Modifications:<br /><br />' . "\n";
339
+ echo '<div id="ws-plugin--s2member-modification-button-prev"></div>' . "\n";
340
+ echo '</label>' . "\n";
341
+ echo '</th>' . "\n";
342
+ /**/
343
+ echo '<td>' . "\n";
344
+ echo '<form onsubmit="return false;">' . "\n";
345
+ echo '<p>Modification: <select id="ws-plugin--s2member-modification-level">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/paypal-membership-modification-levels.html") . '</select></p>' . "\n";
346
+ echo '<p id="ws-plugin--s2member-modification-trial-line">I\'ll offer the first <input type="text" id="ws-plugin--s2member-modification-trial-period" value="0" size="6" /> <select id="ws-plugin--s2member-modification-trial-term">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/paypal-membership-trial-terms.html") . '</select> free.</p>' . "\n";
347
+ echo '<p><span id="ws-plugin--s2member-modification-trial-then">Then, </span>I want to charge: $<input type="text" id="ws-plugin--s2member-modification-amount" value="0.01" size="4" /> / <select id="ws-plugin--s2member-modification-term">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/paypal-membership-regular-terms.html") . '</select><span id="ws-plugin--s2member-modification-20p-rule"><br /><small>** Watch out for <a href="https://www.x.com/thread/41748" target="_blank" rel="external">the 20% rule</a>. Additional details on the 20% rule are <a href="https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_WPRecurringPayments#id086530108PM__id08653060UE6" target="_blank" rel="external">documented here</a>.</small></span></p>' . "\n";
348
+ echo '<p>Checkout Page Style <a href="#" onclick="alert(\'Optional. This can be configured inside your PayPal® account. PayPal® allows you to create Custom Page Styles, and assign a unique name to them. You can add your own header image and color selection to the checkout form. Once you\\\'ve created a Custom Page Style at PayPal®, you can enter that Page Style here.\\n\\nIn addition. The Shortcode below, provided by s2Member; supports an image attribute: image=\\\'\\\'default\\\'\\\'. This can be changed to a full URL, pointing to a custom image of your own; instead of the default PayPal® Button image.\'); return false;">[?]</a>: <input type="text" id="ws-plugin--s2member-modification-page-style" value="paypal" size="18" /> <select id="ws-plugin--s2member-modification-currency">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/paypal-currencies.html") . '</select> <input type="button" value="Generate Button Code" onclick="ws_plugin__s2member_paypalButtonGenerate(\'modification\');" class="button-primary" /></p>' . "\n";
349
+ echo '<p>Custom Capabilities ( comma delimited ) <a href="#" onclick="alert(\'Optional. This is VERY advanced. For full details, see:\\ns2Member -> API Scripting -> Custom Capabilities.\'); return false;">[?]</a> <input type="text" id="ws-plugin--s2member-modification-ccaps" size="40" maxlength="125" /></p>' . "\n";
350
+ echo '</form>' . "\n";
351
+ echo '</td>' . "\n";
352
+ /**/
353
+ echo '</tr>' . "\n";
354
+ echo '<tr>' . "\n";
355
+ /**/
356
+ echo '<td colspan="2">' . "\n";
357
+ echo '<form onsubmit="return false;">' . "\n";
358
+ do_action ("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_during_modification_buttons_before_shortcode", get_defined_vars ());
359
+ echo '<strong>WordPress® Shortcode:</strong> ( recommended for both the WordPress® Visual &amp; HTML Editors )<br />' . "\n";
360
+ $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/shortcodes/paypal-checkout-button-shortcode.html"));
361
+ $ws_plugin__s2member_temp_s = preg_replace ("/\/]$/", 'modify="1" /]', $ws_plugin__s2member_temp_s);
362
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%domain%%/", ws_plugin__s2member_esc_ds (strtolower ($_SERVER["HTTP_HOST"])), $ws_plugin__s2member_temp_s);
363
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%level%%/", "2", $ws_plugin__s2member_temp_s);
364
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%level_label%%/", ws_plugin__s2member_esc_ds ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_label"]), $ws_plugin__s2member_temp_s);
365
+ echo '<input id="ws-plugin--s2member-modification-shortcode" type="text" value="' . format_to_edit ($ws_plugin__s2member_temp_s) . '" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;" /><br /><br />' . "\n";
366
+ echo '<strong>Resulting PayPal® Button Code:</strong> ( ultimately, your Shortcode will produce this snippet )<br />' . "\n";
367
+ echo '<textarea id="ws-plugin--s2member-modification-button" rows="8" wrap="off" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;">';
368
+ $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/paypal-checkout-button.html"));
369
+ $ws_plugin__s2member_temp_s = preg_replace ('/name\="modify" value\="(.*?)"/', 'name="modify" value="1"', $ws_plugin__s2member_temp_s);
370
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%endpoint%%/", (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "www.sandbox.paypal.com" : "www.paypal.com"), $ws_plugin__s2member_temp_s);
371
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%paypal_business%%/", ws_plugin__s2member_esc_ds ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"]), $ws_plugin__s2member_temp_s);
372
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%level_label%%/", ws_plugin__s2member_esc_ds ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_label"]), $ws_plugin__s2member_temp_s);
373
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%cancel_return%%/", ws_plugin__s2member_esc_ds (get_bloginfo ("url")), $ws_plugin__s2member_temp_s);
374
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%notify_url%%/", ws_plugin__s2member_esc_ds (get_bloginfo ("url") . "/?s2member_paypal_notify=1"), $ws_plugin__s2member_temp_s);
375
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%return%%/", ws_plugin__s2member_esc_ds (get_bloginfo ("url") . "/?s2member_paypal_return=1"), $ws_plugin__s2member_temp_s);
376
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%domain%%/", ws_plugin__s2member_esc_ds (strtolower ($_SERVER["HTTP_HOST"])), $ws_plugin__s2member_temp_s);
377
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%level%%/", "2", $ws_plugin__s2member_temp_s);
378
+ echo format_to_edit ($ws_plugin__s2member_temp_s);
379
+ echo '</textarea><br />' . "\n";
380
+ echo '&uarr; Use this more advanced Code if you\'re building a theme or plugin that integrates with s2Member.' . "\n";
381
+ echo '</form>' . "\n";
382
+ echo '</td>' . "\n";
383
+ /**/
384
+ echo '</tr>' . "\n";
385
+ echo '</tbody>' . "\n";
386
+ echo '</table>' . "\n";
387
+ echo '</div>' . "\n";
388
+ /**/
389
+ echo '</div>' . "\n";
390
+ /**/
391
+ do_action ("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_after_modification_buttons", get_defined_vars ());
392
+ }
393
+ /**/
394
+ if (apply_filters ("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_display_cancellation_buttons", true, get_defined_vars ()))
395
+ {
396
+ do_action ("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_before_cancellation_buttons", get_defined_vars ());
397
+ /**/
398
+ echo '<div class="ws-menu-page-group" title="PayPal® Subscr Cancellation Buttons">' . "\n";
399
+ /**/
400
+ echo '<div class="ws-menu-page-section ws-plugin--s2member-cancellation-buttons-section">' . "\n";
401
+ echo '<h3>One Button Does It All For Cancellations ( copy/paste )</h3>' . "\n";
402
+ echo '<p>Since every paid Membership is associated with a PayPal® Subscription; and every PayPal® Subscription is associated with a PayPal® Account; your Members will always have a PayPal® Account of their own, which is tied to their Membership with you. So... a Member can simply log into their own PayPal® account and cancel their Subscription(s) with you at anytime, all on their own. However, some Customers do not realize this. So, if you would like to make it clearer ( easier ) for Members to cancel their own Subscription(s), you can provide this Cancellation Button for them on your Login Welcome Page, or somewhere in the support section of your website. Note... you don\'t have to use this Cancellation Button at all, if you don\'t want to. It\'s completely optional.</p>' . "\n";
403
+ echo '<p><em><strong>*Cancellation Process*</strong> Very simple. A Member clicks the Cancellation Button. PayPal® asks them to log into their PayPal® account. Once they\'re logged in, PayPal® will display a list of all active Subscriptions they have with you. They choose which ones they want to cancel, and s2Member is notified silently behind-the-scene, through the PayPal® IPN service.</em></p>' . "\n";
404
+ do_action ("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_during_cancellation_buttons", get_defined_vars ());
405
+ /**/
406
+ echo '<table class="form-table">' . "\n";
407
+ echo '<tbody>' . "\n";
408
+ echo '<tr>' . "\n";
409
+ /**/
410
+ echo '<th class="ws-menu-page-th-side">' . "\n";
411
+ echo '<label for="ws-plugin--s2member-cancellation-shortcode">' . "\n";
412
+ echo 'Button Code<br />For Cancellations:<br /><br />' . "\n";
413
+ echo '<div id="ws-plugin--s2member-cancellation-button-prev">' . "\n";
414
+ $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/paypal-cancellation-button.html"));
415
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%endpoint%%/", (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "www.sandbox.paypal.com" : "www.paypal.com"), $ws_plugin__s2member_temp_s);
416
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%paypal_business%%/", ws_plugin__s2member_esc_ds ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"]), $ws_plugin__s2member_temp_s);
417
+ echo preg_replace ("/\<a/", '<a target="_blank"', $ws_plugin__s2member_temp_s);
418
+ echo '</div>' . "\n";
419
+ echo '</label>' . "\n";
420
+ echo '</th>' . "\n";
421
+ /**/
422
+ echo '<td>' . "\n";
423
+ echo '<form onsubmit="return false;">' . "\n";
424
+ echo '<p>No configuration necessary.</p>' . "\n";
425
+ echo '</form>' . "\n";
426
+ echo '</td>' . "\n";
427
+ /**/
428
+ echo '</tr>' . "\n";
429
+ echo '<tr>' . "\n";
430
+ /**/
431
+ echo '<td colspan="2">' . "\n";
432
+ echo '<form onsubmit="return false;">' . "\n";
433
+ do_action ("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_during_cancellation_buttons_before_shortcode", get_defined_vars ());
434
+ echo '<strong>WordPress® Shortcode:</strong> ( recommended for both the WordPress® Visual &amp; HTML Editors )<br />' . "\n";
435
+ $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/shortcodes/paypal-cancellation-button-shortcode.html"));
436
+ echo '<input id="ws-plugin--s2member-cancellation-shortcode" type="text" value="' . format_to_edit ($ws_plugin__s2member_temp_s) . '" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;" /><br /><br />' . "\n";
437
+ echo '<strong>Resulting PayPal® Button Code:</strong> ( ultimately, your Shortcode will produce this snippet )<br />' . "\n";
438
+ echo '<textarea id="ws-plugin--s2member-cancellation-button" rows="8" wrap="off" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;">';
439
+ $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/paypal-cancellation-button.html"));
440
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%endpoint%%/", (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "www.sandbox.paypal.com" : "www.paypal.com"), $ws_plugin__s2member_temp_s);
441
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%paypal_business%%/", ws_plugin__s2member_esc_ds ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"]), $ws_plugin__s2member_temp_s);
442
+ echo format_to_edit ($ws_plugin__s2member_temp_s);
443
+ echo '</textarea><br />' . "\n";
444
+ echo '&uarr; Use this more advanced Code if you\'re building a theme or plugin that integrates with s2Member.' . "\n";
445
+ echo '</form>' . "\n";
446
+ echo '</td>' . "\n";
447
+ /**/
448
+ echo '</tr>' . "\n";
449
+ echo '</tbody>' . "\n";
450
+ echo '</table>' . "\n";
451
+ echo '</div>' . "\n";
452
+ /**/
453
+ echo '</div>' . "\n";
454
+ /**/
455
+ do_action ("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_after_cancellation_buttons", get_defined_vars ());
456
+ }
457
+ /**/
458
+ if (apply_filters ("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_display_sp_buttons", true, get_defined_vars ()))
459
+ {
460
+ do_action ("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_before_sp_buttons", get_defined_vars ());
461
+ /**/
462
+ echo '<div class="ws-menu-page-group" title="PayPal® Specific Post/Page (Buy Now) Buttons">' . "\n";
463
+ /**/
464
+ echo '<div class="ws-menu-page-section ws-plugin--s2member-sp-buttons-section">' . "\n";
465
+ echo '<h3>Button Code Generator For Specific Post/Page Buttons</h3>' . "\n";
466
+ echo '<p>s2Member now supports an additional layer of functionality ( very powerful ), which allows you to sell access to specific Posts/Pages that you\'ve created in WordPress®. Specific Post/Page Access works independently from Member Level Access. That is, you can sell an unlimited number of Posts/Pages using "Buy Now" Buttons, and your Customers will NOT be required to have a Membership Account with your site in order to receive access. If they are already a Member, that\'s fine, but they won\'t need to be.</p>' . "\n";
467
+ echo '<p>In other words, Customers will NOT need to login, just to receive access to the Specific Post/Page they purchased access to. s2Member will immediately redirect the Customer to the Specific Post/Page after checkout is completed successfully. An email is also sent to the Customer with a link ( see: <code>s2Member -> PayPal® Options -> Specific Post/Page Email</code> ). Authentication is handled automatically through self-expiring links, good for 72 hours by default.</p>' . "\n";
468
+ echo '<p>Specific Post/Page Access, is sort of like selling a product. Only, instead of shipping anything to the Customer, you just give them access to a specific Post/Page on your site; one that you created in WordPress®. A Specific Post/Page that is protected by s2Member, might contain a download link for your eBook, access to file &amp; music downloads, access to additional support services, and the list goes on and on. The possibilities with this are endless; as long as your digital product can be delivered through access to a WordPress® Post/Page that you\'ve created. To protect Specific Posts/Pages, please see: <code>s2Member -> General Options -> Specific Post/Page Access Restrictions</code>. Once you\'ve configured your Specific Post/Page Restrictions, those Posts/Pages will be available in the menus below.</p>' . "\n";
469
+ echo '<p>Very simple. All you do is customize the form fields provided, for each Post/Page that you plan to sell. Then press (Generate Button Code). These special PayPal® Buttons are customized to work with s2Member seamlessly. You can even Package Additional Posts/Pages together into one transaction.</p>' . "\n";
470
+ echo '<p><em>* Buttons are NOT saved here. This is only a Button Generator. Once you\'ve generated your Button, copy/paste it into your WordPress® Editor, wherever you feel it would be most appropriate. If you lose your Button Code, you\'ll need to come back &amp; re-generate a new one. If you\'re in Sandbox Test-Mode, and you\'re NOT using the Shortcode Format, please remember to come back and re-generate your Buttons before you go live.</em></p>' . "\n";
471
+ do_action ("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_during_sp_buttons", get_defined_vars ());
472
+ /**/
473
+ echo '<table class="form-table">' . "\n";
474
+ echo '<tbody>' . "\n";
475
+ echo '<tr>' . "\n";
476
+ /**/
477
+ echo '<th class="ws-menu-page-th-side">' . "\n";
478
+ echo '<label for="ws-plugin--s2member-sp-shortcode">' . "\n";
479
+ echo 'Button Code<br />Specific Posts/Pages:<br /><br />' . "\n";
480
+ echo '<div id="ws-plugin--s2member-sp-button-prev"></div>' . "\n";
481
+ echo '</label>' . "\n";
482
+ echo '</th>' . "\n";
483
+ /**/
484
+ echo '<td>' . "\n";
485
+ echo '<form onsubmit="return false;">' . "\n";
486
+ echo '<p><select id="ws-plugin--s2member-sp-leading-id">' . "\n";
487
+ echo '<option value="">&mdash; Select a Leading Post/Page that you\'ve protected &mdash;</option>' . "\n";
488
+ $ws_plugin__s2member_temp_a_pp = ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"]) ?/**/
489
+ array_merge ((array)get_posts ("include=" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"]),/**/
490
+ (array)get_pages ("include=" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"])) : array ();
491
+ foreach (($ws_plugin__s2member_temp_a = $ws_plugin__s2member_temp_a_pp) as $ws_plugin__s2member_temp_o)
492
+ if ($ws_plugin__s2member_temp_o->ID != $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"])
493
+ if ($ws_plugin__s2member_temp_o->ID != $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
494
+ if ($ws_plugin__s2member_temp_o->ID != $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"])
495
+ if (!in_array ($ws_plugin__s2member_temp_o->ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_pages"])))
496
+ if (!in_array ($ws_plugin__s2member_temp_o->ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_pages"])))
497
+ if (!in_array ($ws_plugin__s2member_temp_o->ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_pages"])))
498
+ if (!in_array ($ws_plugin__s2member_temp_o->ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_pages"])))
499
+ echo '<option value="' . esc_attr ($ws_plugin__s2member_temp_o->ID) . '">' . esc_html ($ws_plugin__s2member_temp_o->post_title) . '</option>' . "\n";
500
+ /**/
501
+ echo '</select> <a href="#" onclick="alert(\'Required. The Leading Post/Page, is what your Customers will land on after checkout.\n\n*Tip* If there are no Posts/Pages in the menu, it\\\'s because you\\\'ve not configured s2Member for Specific Post/Page Access yet. See: s2Member -> General Options -> Specific Post/Page Access Restrictions.\'); return false;">[?]</a></p>' . "\n";
502
+ /**/
503
+ echo '<p><select id="ws-plugin--s2member-sp-additional-ids" multiple="multiple" style="height:100px;">' . "\n";
504
+ echo '<optgroup label="&mdash; Package Additional Posts/Pages that you\'ve protected &mdash;">' . "\n";
505
+ foreach (($ws_plugin__s2member_temp_a = $ws_plugin__s2member_temp_a_pp) as $ws_plugin__s2member_temp_o)
506
+ if ($ws_plugin__s2member_temp_o->ID != $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"])
507
+ if ($ws_plugin__s2member_temp_o->ID != $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
508
+ if ($ws_plugin__s2member_temp_o->ID != $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"])
509
+ if (!in_array ($ws_plugin__s2member_temp_o->ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_pages"])))
510
+ if (!in_array ($ws_plugin__s2member_temp_o->ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_pages"])))
511
+ if (!in_array ($ws_plugin__s2member_temp_o->ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_pages"])))
512
+ if (!in_array ($ws_plugin__s2member_temp_o->ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_pages"])))
513
+ echo '<option value="' . esc_attr ($ws_plugin__s2member_temp_o->ID) . '">' . esc_html ($ws_plugin__s2member_temp_o->post_title) . '</option>' . "\n";
514
+ /**/
515
+ echo '</optgroup></select> <a href="#" onclick="alert(\'Hold down your `Ctrl` key to select multiples.\\n\\nOptional. If you include Additional Posts/Pages, Customers will still land on your Leading Post/Page; BUT, they\\\'ll ALSO have access to some Additional Posts/Pages that you\\\'ve protected. This gives you the ability to create Post/Page Packages.\\n\\nIn other words, a Customer is sold a Specific Post/Page ( they\\\'ll land on your Leading Post/Page after checkout ), which might contain links to some other Posts/Pages that you\\\'ve packaged together under one transaction.\\n\\nBundling Additional Posts/Pages into one Package, authenticates the Customer for access to the Additional Posts/Pages automatically ( e.g. only one Access Link is needed, and s2Member generates this automatically ). However, you will STILL need to design your Leading Post/Page ( which is what a Customer will actually land on ), with links pointing to the other Posts/Pages. This way your Customers will have clickable links to everything they\\\'ve paid for.\\n\\n*Quick Summary* s2Member sends Customers to your Leading Post/Page, and also authenticates them for access to any Additional Posts/Pages automatically. You handle it from there.\\n\\n*Tip* If there are no Posts/Pages in this menu, it\\\'s because you\\\'ve not configured s2Member for Specific Post/Page Access yet. See: s2Member -> General Options -> Specific Post/Page Access Restrictions.\'); return false;">[?]</a></p>' . "\n";
516
+ /**/
517
+ echo '<p>I want to charge: $<input type="text" id="ws-plugin--s2member-sp-amount" value="0.01" size="4" /> / <select id="ws-plugin--s2member-sp-hours">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/paypal-sp-hours.html") . '</select></p>' . "\n";
518
+ echo '<p>Description: <input type="text" id="ws-plugin--s2member-sp-desc" value="Description and pricing details here." size="68" /></p>' . "\n";
519
+ echo '<p>Checkout Page Style <a href="#" onclick="alert(\'Optional. This can be configured inside your PayPal® account. PayPal® allows you to create Custom Page Styles, and assign a unique name to them. You can add your own header image and color selection to the checkout form. Once you\\\'ve created a Custom Page Style at PayPal®, you can enter that Page Style here.\\n\\nIn addition. The Shortcode below, provided by s2Member; supports an image attribute: image=\\\'\\\'default\\\'\\\'. This can be changed to a full URL, pointing to a custom image of your own; instead of the default PayPal® Button image.\'); return false;">[?]</a>: <input type="text" id="ws-plugin--s2member-sp-page-style" value="paypal" size="18" /> <select id="ws-plugin--s2member-sp-currency">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/paypal-currencies.html") . '</select> <input type="button" value="Generate Button Code" onclick="ws_plugin__s2member_paypalSpButtonGenerate();" class="button-primary" /></p>' . "\n";
520
+ echo '</form>' . "\n";
521
+ echo '</td>' . "\n";
522
+ /**/
523
+ echo '</tr>' . "\n";
524
+ echo '<tr>' . "\n";
525
+ /**/
526
+ echo '<td colspan="2">' . "\n";
527
+ echo '<form onsubmit="return false;">' . "\n";
528
+ do_action ("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_during_sp_buttons_before_shortcode", get_defined_vars ());
529
+ echo '<strong>WordPress® Shortcode:</strong> ( recommended for both the WordPress® Visual &amp; HTML Editors )<br />' . "\n";
530
+ $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/shortcodes/paypal-sp-checkout-button-shortcode.html"));
531
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%domain%%/", ws_plugin__s2member_esc_ds (strtolower ($_SERVER["HTTP_HOST"])), $ws_plugin__s2member_temp_s);
532
+ echo '<input id="ws-plugin--s2member-sp-shortcode" type="text" value="' . format_to_edit ($ws_plugin__s2member_temp_s) . '" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;" /><br /><br />' . "\n";
533
+ echo '<strong>Resulting PayPal® Button Code:</strong> ( ultimately, your Shortcode will produce this snippet )<br />' . "\n";
534
+ echo '<textarea id="ws-plugin--s2member-sp-button" rows="8" wrap="off" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;">';
535
+ $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/paypal-sp-checkout-button.html"));
536
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%endpoint%%/", (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "www.sandbox.paypal.com" : "www.paypal.com"), $ws_plugin__s2member_temp_s);
537
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%paypal_business%%/", ws_plugin__s2member_esc_ds ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"]), $ws_plugin__s2member_temp_s);
538
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%cancel_return%%/", ws_plugin__s2member_esc_ds (get_bloginfo ("url")), $ws_plugin__s2member_temp_s);
539
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%notify_url%%/", ws_plugin__s2member_esc_ds (get_bloginfo ("url") . "/?s2member_paypal_notify=1"), $ws_plugin__s2member_temp_s);
540
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%return%%/", ws_plugin__s2member_esc_ds (get_bloginfo ("url") . "/?s2member_paypal_return=1"), $ws_plugin__s2member_temp_s);
541
+ $ws_plugin__s2member_temp_s = preg_replace ("/%%domain%%/", ws_plugin__s2member_esc_ds (strtolower ($_SERVER["HTTP_HOST"])), $ws_plugin__s2member_temp_s);
542
+ echo format_to_edit ($ws_plugin__s2member_temp_s);
543
+ echo '</textarea><br />' . "\n";
544
+ echo '&uarr; Use this more advanced Code if you\'re building a theme or plugin that integrates with s2Member.' . "\n";
545
+ echo '</form>' . "\n";
546
+ echo '</td>' . "\n";
547
+ /**/
548
+ echo '</tr>' . "\n";
549
+ echo '</tbody>' . "\n";
550
+ echo '</table>' . "\n";
551
+ echo '</div>' . "\n";
552
+ /**/
553
+ echo '</div>' . "\n";
554
+ /**/
555
+ do_action ("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_after_sp_buttons", get_defined_vars ());
556
+ }
557
+ /**/
558
+ if (apply_filters ("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_display_sp_links", true, get_defined_vars ()))
559
+ {
560
+ do_action ("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_before_sp_links", get_defined_vars ());
561
+ /**/
562
+ echo '<div class="ws-menu-page-group" title="PayPal® Specific Post/Page Access Links">' . "\n";
563
+ /**/
564
+ echo '<div class="ws-menu-page-section ws-plugin--s2member-sp-links-section">' . "\n";
565
+ echo '<h3>Specific Post/Page Link Generator ( for Customer Service )</h3>' . "\n";
566
+ echo '<p>s2Member automatically generates Specific Post/Page Links for your Customers after checkout, and also sends them a link in a Confirmation Email. However, if you ever need to deal with a Customer Service issue that requires a new Specific Post/Page Link to be created manually, you can use this tool for that.</p>' . "\n";
567
+ do_action ("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_during_sp_links", get_defined_vars ());
568
+ /**/
569
+ echo '<table class="form-table">' . "\n";
570
+ echo '<tbody>' . "\n";
571
+ echo '<tr>' . "\n";
572
+ /**/
573
+ echo '<th class="ws-menu-page-th-side">' . "\n";
574
+ echo '<label for="ws-plugin--s2member-sp-link-leading-id">' . "\n";
575
+ echo 'Access Link<br />For Customer Service:<br /><br />' . "\n";
576
+ echo '<div id="ws-plugin--s2member-sp-link-prev"></div>' . "\n";
577
+ echo '</label>' . "\n";
578
+ echo '</th>' . "\n";
579
+ /**/
580
+ echo '<td>' . "\n";
581
+ echo '<form onsubmit="return false;">' . "\n";
582
+ echo '<p><select id="ws-plugin--s2member-sp-link-leading-id">' . "\n";
583
+ echo '<option value="">&mdash; Select a Leading Post/Page that you\'ve protected &mdash;</option>' . "\n";
584
+ foreach (($ws_plugin__s2member_temp_a = $ws_plugin__s2member_temp_a_pp) as $ws_plugin__s2member_temp_o)
585
+ if ($ws_plugin__s2member_temp_o->ID != $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"])
586
+ if ($ws_plugin__s2member_temp_o->ID != $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
587
+ if ($ws_plugin__s2member_temp_o->ID != $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"])
588
+ if (!in_array ($ws_plugin__s2member_temp_o->ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_pages"])))
589
+ if (!in_array ($ws_plugin__s2member_temp_o->ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_pages"])))
590
+ if (!in_array ($ws_plugin__s2member_temp_o->ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_pages"])))
591
+ if (!in_array ($ws_plugin__s2member_temp_o->ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_pages"])))
592
+ echo '<option value="' . esc_attr ($ws_plugin__s2member_temp_o->ID) . '">' . esc_html ($ws_plugin__s2member_temp_o->post_title) . '</option>' . "\n";
593
+ /**/
594
+ echo '</select> <a href="#" onclick="alert(\'Required. The Leading Post/Page, is what your Customers will land on after checkout.\n\n*Tip* If there are no Posts/Pages in the menu, it\\\'s because you\\\'ve not configured s2Member for Specific Post/Page Access yet. See: s2Member -> General Options -> Specific Post/Page Access Restrictions.\'); return false;">[?]</a></p>' . "\n";
595
+ /**/
596
+ echo '<p><select id="ws-plugin--s2member-sp-link-additional-ids" multiple="multiple" style="height:100px;">' . "\n";
597
+ echo '<optgroup label="&mdash; Package Additional Posts/Pages that you\'ve protected &mdash;">' . "\n";
598
+ foreach (($ws_plugin__s2member_temp_a = $ws_plugin__s2member_temp_a_pp) as $ws_plugin__s2member_temp_o)
599
+ if ($ws_plugin__s2member_temp_o->ID != $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"])
600
+ if ($ws_plugin__s2member_temp_o->ID != $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
601
+ if ($ws_plugin__s2member_temp_o->ID != $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"])
602
+ if (!in_array ($ws_plugin__s2member_temp_o->ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_pages"])))
603
+ if (!in_array ($ws_plugin__s2member_temp_o->ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_pages"])))
604
+ if (!in_array ($ws_plugin__s2member_temp_o->ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_pages"])))
605
+ if (!in_array ($ws_plugin__s2member_temp_o->ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_pages"])))
606
+ echo '<option value="' . esc_attr ($ws_plugin__s2member_temp_o->ID) . '">' . esc_html ($ws_plugin__s2member_temp_o->post_title) . '</option>' . "\n";
607
+ /**/
608
+ echo '</optgroup></select> <a href="#" onclick="alert(\'Hold down your `Ctrl` key to select multiples.\\n\\nOptional. If you include Additional Posts/Pages, Customers will still land on your Leading Post/Page; BUT, they\\\'ll ALSO have access to some Additional Posts/Pages that you\\\'ve protected. This gives you the ability to create Post/Page Packages.\\n\\nIn other words, a Customer is sold a Specific Post/Page ( they\\\'ll land on your Leading Post/Page after checkout ), which might contain links to some other Posts/Pages that you\\\'ve packaged together under one transaction.\\n\\nBundling Additional Posts/Pages into one Package, authenticates the Customer for access to the Additional Posts/Pages automatically ( e.g. only one Access Link is needed, and s2Member generates this automatically ). However, you will STILL need to design your Leading Post/Page ( which is what a Customer will actually land on ), with links pointing to the other Posts/Pages. This way your Customers will have clickable links to everything they\\\'ve paid for.\\n\\n*Quick Summary* s2Member sends Customers to your Leading Post/Page, and also authenticates them for access to any Additional Posts/Pages automatically. You handle it from there.\\n\\n*Tip* If there are no Posts/Pages in this menu, it\\\'s because you\\\'ve not configured s2Member for Specific Post/Page Access yet. See: s2Member -> General Options -> Specific Post/Page Access Restrictions.\'); return false;">[?]</a></p>' . "\n";
609
+ /**/
610
+ echo '<p><select id="ws-plugin--s2member-sp-link-hours">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/paypal-sp-hours.html") . '</select> <input type="button" value="Generate Access Link" onclick="ws_plugin__s2member_paypalSpLinkGenerate();" class="button-primary" /> <img id="ws-plugin--s2member-sp-link-loading" src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/ajax-loader.gif" alt="" style="display:none;" /></p>' . "\n";
611
+ echo '<p id="ws-plugin--s2member-sp-link" style="font-family:Consolas, monospace; display:none;"></p>' . "\n";
612
+ echo '</form>' . "\n";
613
+ echo '</td>' . "\n";
614
+ /**/
615
+ echo '</tr>' . "\n";
616
+ echo '</tbody>' . "\n";
617
+ echo '</table>' . "\n";
618
+ echo '</div>' . "\n";
619
+ /**/
620
+ echo '</div>' . "\n";
621
+ /**/
622
+ do_action ("ws_plugin__s2member_during_paypal_buttons_page_during_left_sections_after_sp_links", get_defined_vars ());
623
+ }
624
+ /**/
625
+ do_action ("ws_plugin__s2member_during_paypal_buttons_page_after_left_sections", get_defined_vars ());
626
+ /**/
627
+ echo '</td>' . "\n";
628
+ /**/
629
+ echo '<td class="ws-menu-page-table-r">' . "\n";
630
+ /**/
631
+ do_action ("ws_plugin__s2member_during_paypal_buttons_page_before_right_sections", get_defined_vars ());
632
+ do_action ("ws_plugin__s2member_during_menu_pages_before_right_sections", get_defined_vars ());
633
+ /**/
634
+ echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["upsell-pro"]) ? '<div class="ws-menu-page-others"><a href="' . ws_plugin__s2member_parse_readme_value ("Pro Module / Licensing") . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-upsell-pro.png" alt="." /></a></div>' . "\n" : '';
635
+ echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["installation"]) ? '<div class="ws-menu-page-installation"><a href="' . ws_plugin__s2member_parse_readme_value ("Professional Installation URI") . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-installation.png" alt="." /></a></div>' . "\n" : '';
636
+ echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["tools"]) ? '<div class="ws-menu-page-tools"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-tools.png" alt="." /></div>' . "\n" : '';
637
+ echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["support"]) ? '<div class="ws-menu-page-support"><a href="' . ws_plugin__s2member_parse_readme_value ("Forum URI") . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-support.png" alt="." /></a></div>' . "\n" : '';
638
+ echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["donations"]) ? '<div class="ws-menu-page-donations"><a href="' . ws_plugin__s2member_parse_readme_value ("Donate link") . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-donations.jpg" alt="." /></a></div>' . "\n" : '';
639
+ /**/
640
+ do_action ("ws_plugin__s2member_during_menu_pages_after_right_sections", get_defined_vars ());
641
+ do_action ("ws_plugin__s2member_during_paypal_buttons_page_after_right_sections", get_defined_vars ());
642
+ /**/
643
+ echo '</td>' . "\n";
644
+ /**/
645
+ echo '</tr>' . "\n";
646
+ echo '</tbody>' . "\n";
647
+ echo '</table>' . "\n";
648
+ /**/
649
+ echo '</div>' . "\n";
650
+ ?>
includes/menu-pages/paypal-ops.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
  /*
17
  PayPal® Options page.
18
  */
@@ -41,6 +41,7 @@ if (apply_filters ("ws_plugin__s2member_during_paypal_ops_page_during_left_secti
41
  echo '<div class="ws-menu-page-group" title="PayPal® Account Details">' . "\n";
42
  /**/
43
  echo '<div class="ws-menu-page-section ws-plugin--s2member-paypal-email-section">' . "\n";
 
44
  echo '<h3>PayPal® EMail Address ( required, please customize this )</h3>' . "\n";
45
  echo '<p>This plugin works in conjunction with <a href="https://www.paypal.com/us/mrb/pal=K8S5Y97AKWYY8" target="_blank" rel="external">PayPal® Website Payments Standard</a>, for businesses. You do NOT need a PayPal® Pro account. You just need to upgrade your Personal PayPal® account to a Business status, which is free. A PayPal® account can be <a href="http://pages.ebay.com/help/buy/questions/upgrade-paypal-account.html" target="_blank" rel="external">upgraded</a> from a Personal account to a Business account, simply by going to the `Profile` button under the `My Account` tab, selecting the `Personal Business Information` button, and then clicking the `Upgrade Your Account` button.</p>' . "\n";
46
  do_action ("ws_plugin__s2member_during_paypal_ops_page_during_left_sections_during_paypal_account_details", get_defined_vars ());
@@ -64,6 +65,9 @@ if (apply_filters ("ws_plugin__s2member_during_paypal_ops_page_during_left_secti
64
  echo '</td>' . "\n";
65
  /**/
66
  echo '</tr>' . "\n";
 
 
 
67
  echo '<tr>' . "\n";
68
  /**/
69
  echo '<th>' . "\n";
@@ -77,7 +81,7 @@ if (apply_filters ("ws_plugin__s2member_during_paypal_ops_page_during_left_secti
77
  /**/
78
  echo '<td>' . "\n";
79
  echo '<input type="radio" name="ws_plugin__s2member_paypal_sandbox" id="ws-plugin--s2member-paypal-sandbox-0" value="0"' . ((!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? ' checked="checked"' : '') . ' /> <label for="ws-plugin--s2member-paypal-sandbox-0">No</label> &nbsp;&nbsp;&nbsp; <input type="radio" name="ws_plugin__s2member_paypal_sandbox" id="ws-plugin--s2member-paypal-sandbox-1" value="1"' . (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? ' checked="checked"' : '') . ' /> <label for="ws-plugin--s2member-paypal-sandbox-1">Yes, enable support for Sandbox testing.</label><br />' . "\n";
80
- echo '<em>Only enable this if you\'ve provided a Sandbox email address above.<br />This puts the IPN, PDT and Button Generator into Sandbox mode.<br />See: <a href="https://developer.paypal.com/" target="_blank" rel="external">https://developer.paypal.com</a></em>' . "\n";
81
  echo '</td>' . "\n";
82
  /**/
83
  echo '</tr>' . "\n";
@@ -102,6 +106,7 @@ if (apply_filters ("ws_plugin__s2member_during_paypal_ops_page_during_left_secti
102
  echo '</table>' . "\n";
103
  /**/
104
  echo '<p><em><strong>*Sandbox Tip*</strong> If you\'re testing your site through a PayPal® Sandbox account, please remember that Email Confirmations from s2Member will NOT be received after a test purchase. s2Member sends its Confirmation Emails to the PayPal® Email Address of the Customer. Since PayPal® Sandbox addresses are usually bogus ( for testing ), you will have to run live transactions before Email Confirmations from s2Member are received. That being said, all other s2Member functionality CAN be tested through a PayPal® Sandbox account. Email Confirmations are the only hang-up.</em></p>' . "\n";
 
105
  echo '</div>' . "\n";
106
  /**/
107
  echo '</div>' . "\n";
@@ -120,7 +125,8 @@ if (apply_filters ("ws_plugin__s2member_during_paypal_ops_page_during_left_secti
120
  echo '<p>Log into your PayPal® account and navigate to this section:<br /><code>Account Profile -> Instant Payment Notification Preferences</code></p>' . "\n";
121
  echo '<p>Edit your IPN settings &amp; turn IPN Notifications: <strong><code>On</code></strong></p>' . "\n";
122
  echo '<p>You\'ll need your IPN URL, which is:<br /><code>' . get_bloginfo ("url") . '/?s2member_paypal_notify=1</code></p>' . "\n";
123
- echo '<p><em><strong>*Quick Tip*</strong> In addition to the default IPN Settings inside your PayPal® account, the IPN URL is also set on a per-transaction basis by the special PayPal® Button Code that s2Member provides you with. In other words, if you have multiple sites operating on one PayPal® account, that\'s OK. s2Member dynamically sets the IPN URL for each transaction. The result is that the IPN URL configured from within your PayPal® account, becomes the default, which is then overwritten on a per transaction basis. In fact, PayPal® recently updated their system to support IPN URL preservation. One PayPal® account can handle multiple sites, all using different IPN URLs.</em></p>' . "\n";
 
124
  echo '<p><em><strong>*More Information*</strong> You\'ll be happy to know that s2Member handles cancellations, expirations, failed payments, terminations ( e.g. refunds &amp; chargebacks ) for you automatically. If you log into your PayPal® account and cancel a Member\'s Subscription, or, if the Member logs into their PayPal® account and cancels their own Subscription, s2Member will be notified of these important changes and react accordingly through the PayPal® IPN service that runs silently behind-the-scene. The PayPal® IPN service will notify s2Member whenever a Member\'s payments have been failing, and/or whenever a Member\'s Subscription has expired for any reason. Even refunds &amp; chargeback reversals are supported through the IPN service. If you issue a refund to an unhappy Customer through PayPal®, s2Member will be notified, and the account for that Customer will either be demoted to a Free Subscriber, or deleted automatically ( based on your configuration ). The communication from PayPal® -> s2Member is seamless.</em></p>' . "\n";
125
  echo '<p><em><strong>*2010 PayPal® Accounts*</strong> s2Member has been updated to support newer PayPal® accounts ( those opened after Oct 15th, 2009 ). Newer PayPal® accounts do NOT send a <strong>IPN</strong>/<code>subscr_eot</code> in all cases. s2Member deals with this gracefully, by keeping a record of payments/periods/changes, and monitoring other signals sent by PayPal® over an extended period. This allows s2Member to take control of the situation at the appropriate time. The communication from PayPal® -> s2Member is seamless; even in PayPal® accounts created after October 15th, 2009. You can learn more about <code>subscr_eot</code> changes <a href="https://www.x.com/search.jspa?q=subscr+eot" target="_blank" rel="external">here</a>.</em></p>' . "\n";
126
  do_action ("ws_plugin__s2member_during_paypal_ops_page_during_left_sections_during_paypal_ipn", get_defined_vars ());
@@ -143,7 +149,8 @@ if (apply_filters ("ws_plugin__s2member_during_paypal_ops_page_during_left_secti
143
  echo '<p>Turn the Auto-Return feature: <strong><code>On</code></strong></p>' . "\n";
144
  echo '<p>You\'ll need your Auto-Return URL, which is:<br /><code>' . get_bloginfo ("url") . '/?s2member_paypal_return=1</code></p>' . "\n";
145
  echo '<p>You MUST also enable PDT ( Payment Data Transfer ): <strong><code>On</code></strong><br /><em>You\'ll be issued an Identity Token that you MUST enter below.</em></p>' . "\n";
146
- echo '<p><em><strong>*Quick Tip*</strong> In addition to your default PayPal® account configuration, the Auto-Return URL is also set on a per-transaction basis from within the special PayPal® Button Code that s2Member provides you with. In other words, if you have multiple sites operating on one PayPal® account, that\'s OK. s2Member dynamically sets the Auto-Return URL for each transaction. The result is that the Auto-Return URL configured from within your PayPal® account, becomes the default, which is then overwritten on a per transaction basis.</em></p>' . "\n";
 
147
  do_action ("ws_plugin__s2member_during_paypal_ops_page_during_left_sections_during_paypal_pdt", get_defined_vars ());
148
  /**/
149
  echo '<table class="form-table">' . "\n";
@@ -182,7 +189,7 @@ if (apply_filters ("ws_plugin__s2member_during_paypal_ops_page_during_left_secti
182
  /**/
183
  echo '<div class="ws-menu-page-section ws-plugin--s2member-signup-confirmation-email-section">' . "\n";
184
  echo '<h3>Signup Confirmation Email ( required, but the default works fine )</h3>' . "\n";
185
- echo '<p>This email is sent to new Customers after they return from a successful signup at PayPal®. The <strong>primary</strong> purpose of this email, is to provide the Customer with instructions, along with a link to register a Username for their Membership. You may also customize this further by providing details that are specifically geared to your site.</p>' . "\n";
186
  do_action ("ws_plugin__s2member_during_paypal_ops_page_during_left_sections_during_signup_confirmation_email", get_defined_vars ());
187
  /**/
188
  echo '<table class="form-table">' . "\n";
@@ -218,7 +225,7 @@ if (apply_filters ("ws_plugin__s2member_during_paypal_ops_page_during_left_secti
218
  echo '<td>' . "\n";
219
  echo '<textarea name="ws_plugin__s2member_signup_email_message" id="ws-plugin--s2member-signup-email-message" rows="10">' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["signup_email_message"]) . '</textarea><br />' . "\n";
220
  echo 'Message Body used in the email sent to a Customer after a successful signup has occurred through PayPal®.<br /><br />' . "\n";
221
- echo '<strong>You can also use these special replacement codes if you need them:</strong>' . "\n";
222
  echo '<ul>' . "\n";
223
  echo '<li><code>%%registration_url%% = The full URL ( generated by s2Member ) where the Customer can get registered.</code></li>' . "\n";
224
  echo '<li><code>%%subscr_id%% = The PayPal® Subscription ID, which remains constant throughout any &amp; all future payments.</code> [ <a href="#" onclick="alert(\'There is one exception. If you are selling Lifetime or Fixed-Term ( non-recurring ) access, using a Buy It Now button; the %%subscr_id%% is actually set to the Transaction ID for the purchase.\\n\\nPayPal® does not provide a specific Subscription ID for Buy It Now purchases. Since Lifetime &amp; Fixed-Term Subscriptions are NOT recurring ( i.e. there is only ONE payment ), using the Transaction ID as the Subscription ID is a graceful way to deal with this minor conflict.\'); return false;">?</a> ]</li>' . "\n";
@@ -232,16 +239,19 @@ if (apply_filters ("ws_plugin__s2member_during_paypal_ops_page_during_left_secti
232
  echo '<li><code>%%item_number%% = The Item Number ( colon separated <em>level:custom_capabilities:fixed term</em> ) that the Subscription is for.</code></li>' . "\n";
233
  echo '<li><code>%%item_name%% = The Item Name ( in other words, the associated membership Level Label that briefly describes the item number ).</code></li>' . "\n";
234
  echo '<li><code>%%initial_term%% = This is the term length of the initial period. This will be a numeric value, followed by a space, then a single letter.</code> [ <a href="#" onclick="alert(\'Here are some examples:\\n\\n%%initial_term%% = 1 D ( this means 1 Day )\\n%%initial_term%% = 1 W ( this means 1 Week )\\n%%initial_term%% = 1 M ( this means 1 Month )\\n%%initial_term%% = 1 Y ( this means 1 Year )\\n\\nThe initial period never recurs, so this only lasts for the term length specified, then it is over. If no initial period was even offered, the value of %%initial_term%% will just be: 0 D, meaning zero days.\'); return false;">?</a> ]</li>' . "\n";
 
235
  echo '<li><code>%%regular_term%% = This is the term length of the regular period. This will be a numeric value, followed by a space, then a single letter.</code> [ <a href="#" onclick="alert(\'Here are some examples:\\n\\n%%regular_term%% = 1 D ( this means 1 Day )\\n%%regular_term%% = 1 W ( this means 1 Week )\\n%%regular_term%% = 1 M ( this means 1 Month )\\n%%regular_term%% = 1 Y ( this means 1 Year )\\n%%regular_term%% = 1 L ( this means 1 Lifetime )\\n\\nThe regular term is usually recurring. So the regular term value represents the period ( or duration ) of each recurring period. If %%recurring%% = 0, then the regular term only applies once, because it is not recurring. So if it is not recurring, the value of %%regular_term%% simply represents how long their membership privileges are going to last after the %%initial_term%% has expired, if there was an initial term. The value of this variable ( %%regular_term%% ) will never be empty, it will always be at least: 1 D, meaning 1 day. No exceptions.\'); return false;">?</a> ]</li>' . "\n";
 
 
236
  echo '</ul>' . "\n";
237
- echo '<strong>Custom replacement codes can also be inserted using these instructions:</strong>' . "\n";
238
  echo '<ul>' . "\n";
239
- echo '<li><code>%%cv0%% = The domain of your site, which is passed through to PayPal® using the `custom` field in your PayPal® Button Code.</code></li>' . "\n";
240
- echo '<li><code>%%cv1%% = If you need to track additional custom variables, you can pipe delimit them into the `custom` field of your Button Code like this: &lt;input type="hidden" name="custom" value="' . $_SERVER["HTTP_HOST"] . '|cv1|cv2|cv3" /&gt;. You can have an unlimited number of custom variables that track IP addresses, affiliate IDs, etc. In some cases you may need to use PHP code to insert a value into the custom field dynamically. Obviously this is for advanced webmasters, but the functionality has been made available for those who need it.</li>' . "\n";
241
  echo '</ul>' . "\n";
242
  echo '<strong>This example uses cv1 to track a User\'s IP address:</strong><br />' . "\n";
243
  echo '<em>( The IP address could be referenced in your Confirmation Email using %%cv1%% )</em><br />' . "\n";
244
- echo '<code>&lt;input type="hidden" name="custom" value="' . $_SERVER["HTTP_HOST"] . '|&lt;?php echo $_SERVER["REMOTE_ADDR"]; ?&gt;" /&gt;</code>' . "\n";
245
  echo '</td>' . "\n";
246
  /**/
247
  echo '</tr>' . "\n";
@@ -280,7 +290,7 @@ if (apply_filters ("ws_plugin__s2member_during_paypal_ops_page_during_left_secti
280
  /**/
281
  echo '<td>' . "\n";
282
  echo '<input type="text" name="ws_plugin__s2member_sp_email_subject" id="ws-plugin--s2member-sp-email-subject" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_email_subject"]) . '" /><br />' . "\n";
283
- echo 'Subject Line used in the email sent to a Customer after a successful purchase has occurred through PayPal® for Specific Post/Page Access.' . "\n";
284
  echo '</td>' . "\n";
285
  /**/
286
  echo '</tr>' . "\n";
@@ -297,8 +307,8 @@ if (apply_filters ("ws_plugin__s2member_during_paypal_ops_page_during_left_secti
297
  /**/
298
  echo '<td>' . "\n";
299
  echo '<textarea name="ws_plugin__s2member_sp_email_message" id="ws-plugin--s2member-sp-email-message" rows="10">' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_email_message"]) . '</textarea><br />' . "\n";
300
- echo 'Message Body used in the email sent to a Customer after a successful purchase has occurred through PayPal® for Specific Post/Page Access.<br /><br />' . "\n";
301
- echo '<strong>You can also use these special replacement codes if you need them:</strong>' . "\n";
302
  echo '<ul>' . "\n";
303
  echo '<li><code>%%sp_access_url%% = The full URL ( generated by s2Member ) where the Customer can gain access.</code></li>' . "\n";
304
  echo '<li><code>%%sp_access_exp%% = Human readable expiration for %%sp_access_url%%. Ex: <em>( link expires in %%sp_access_exp%% )</em>.</code></li>' . "\n";
@@ -311,14 +321,14 @@ if (apply_filters ("ws_plugin__s2member_during_paypal_ops_page_during_left_secti
311
  echo '<li><code>%%item_number%% = The Item Number. Ex: <em>sp:13,24,36:72</em> ( translates to: <em>sp:comma-delimited IDs:expiration hours</em> ).</code></li>' . "\n";
312
  echo '<li><code>%%item_name%% = The Item Name. In other words, a brief description, detailing what this purchase was for.</code></li>' . "\n";
313
  echo '</ul>' . "\n";
314
- echo '<strong>Custom replacement codes can also be inserted using these instructions:</strong>' . "\n";
315
  echo '<ul>' . "\n";
316
- echo '<li><code>%%cv0%% = The domain of your site, which is passed through to PayPal® using the `custom` field in your PayPal® Button Code.</code></li>' . "\n";
317
- echo '<li><code>%%cv1%% = If you need to track additional custom variables, you can pipe delimit them into the `custom` field of your Button Code like this: &lt;input type="hidden" name="custom" value="' . $_SERVER["HTTP_HOST"] . '|cv1|cv2|cv3" /&gt;. You can have an unlimited number of custom variables that track IP addresses, affiliate IDs, etc. In some cases you may need to use PHP code to insert a value into the custom field dynamically. Obviously this is for advanced webmasters, but the functionality has been made available for those who need it.</li>' . "\n";
318
  echo '</ul>' . "\n";
319
  echo '<strong>This example uses cv1 to track a User\'s IP address:</strong><br />' . "\n";
320
  echo '<em>( The IP address could be referenced in your Confirmation Email using %%cv1%% )</em><br />' . "\n";
321
- echo '<code>&lt;input type="hidden" name="custom" value="' . $_SERVER["HTTP_HOST"] . '|&lt;?php echo $_SERVER["REMOTE_ADDR"]; ?&gt;" /&gt;</code>' . "\n";
322
  echo '</td>' . "\n";
323
  /**/
324
  echo '</tr>' . "\n";
@@ -411,6 +421,7 @@ echo '<td class="ws-menu-page-table-r">' . "\n";
411
  do_action ("ws_plugin__s2member_during_paypal_ops_page_before_right_sections", get_defined_vars ());
412
  do_action ("ws_plugin__s2member_during_menu_pages_before_right_sections", get_defined_vars ());
413
  /**/
 
414
  echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["installation"]) ? '<div class="ws-menu-page-installation"><a href="' . ws_plugin__s2member_parse_readme_value ("Professional Installation URI") . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-installation.png" alt="." /></a></div>' . "\n" : '';
415
  echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["tools"]) ? '<div class="ws-menu-page-tools"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-tools.png" alt="." /></div>' . "\n" : '';
416
  echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["support"]) ? '<div class="ws-menu-page-support"><a href="' . ws_plugin__s2member_parse_readme_value ("Forum URI") . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-support.png" alt="." /></a></div>' . "\n" : '';
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
  /*
17
  PayPal® Options page.
18
  */
41
  echo '<div class="ws-menu-page-group" title="PayPal® Account Details">' . "\n";
42
  /**/
43
  echo '<div class="ws-menu-page-section ws-plugin--s2member-paypal-email-section">' . "\n";
44
+ echo '<a href="https://www.paypal.com/us/mrb/pal=K8S5Y97AKWYY8" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/paypal-logo.png" class="ws-menu-page-right" style="width:125px; height:125px; border:0;" alt="." /></a>' . "\n";
45
  echo '<h3>PayPal® EMail Address ( required, please customize this )</h3>' . "\n";
46
  echo '<p>This plugin works in conjunction with <a href="https://www.paypal.com/us/mrb/pal=K8S5Y97AKWYY8" target="_blank" rel="external">PayPal® Website Payments Standard</a>, for businesses. You do NOT need a PayPal® Pro account. You just need to upgrade your Personal PayPal® account to a Business status, which is free. A PayPal® account can be <a href="http://pages.ebay.com/help/buy/questions/upgrade-paypal-account.html" target="_blank" rel="external">upgraded</a> from a Personal account to a Business account, simply by going to the `Profile` button under the `My Account` tab, selecting the `Personal Business Information` button, and then clicking the `Upgrade Your Account` button.</p>' . "\n";
47
  do_action ("ws_plugin__s2member_during_paypal_ops_page_during_left_sections_during_paypal_account_details", get_defined_vars ());
65
  echo '</td>' . "\n";
66
  /**/
67
  echo '</tr>' . "\n";
68
+ /**/
69
+ do_action ("ws_plugin__s2member_during_paypal_ops_page_during_left_sections_during_paypal_account_details_after_business", get_defined_vars ());
70
+ /**/
71
  echo '<tr>' . "\n";
72
  /**/
73
  echo '<th>' . "\n";
81
  /**/
82
  echo '<td>' . "\n";
83
  echo '<input type="radio" name="ws_plugin__s2member_paypal_sandbox" id="ws-plugin--s2member-paypal-sandbox-0" value="0"' . ((!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? ' checked="checked"' : '') . ' /> <label for="ws-plugin--s2member-paypal-sandbox-0">No</label> &nbsp;&nbsp;&nbsp; <input type="radio" name="ws_plugin__s2member_paypal_sandbox" id="ws-plugin--s2member-paypal-sandbox-1" value="1"' . (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? ' checked="checked"' : '') . ' /> <label for="ws-plugin--s2member-paypal-sandbox-1">Yes, enable support for Sandbox testing.</label><br />' . "\n";
84
+ echo '<em>Only enable this if you\'ve provided a Sandbox email address above.<br />This puts the API, IPN, PDT and Form/Button Generators all into Sandbox mode.<br />See: <a href="https://developer.paypal.com/" target="_blank" rel="external">https://developer.paypal.com</a></em>' . "\n";
85
  echo '</td>' . "\n";
86
  /**/
87
  echo '</tr>' . "\n";
106
  echo '</table>' . "\n";
107
  /**/
108
  echo '<p><em><strong>*Sandbox Tip*</strong> If you\'re testing your site through a PayPal® Sandbox account, please remember that Email Confirmations from s2Member will NOT be received after a test purchase. s2Member sends its Confirmation Emails to the PayPal® Email Address of the Customer. Since PayPal® Sandbox addresses are usually bogus ( for testing ), you will have to run live transactions before Email Confirmations from s2Member are received. That being said, all other s2Member functionality CAN be tested through a PayPal® Sandbox account. Email Confirmations are the only hang-up.</em></p>' . "\n";
109
+ do_action ("ws_plugin__s2member_during_paypal_ops_page_during_left_sections_during_paypal_account_details_after_sandbox_tip", get_defined_vars ());
110
  echo '</div>' . "\n";
111
  /**/
112
  echo '</div>' . "\n";
125
  echo '<p>Log into your PayPal® account and navigate to this section:<br /><code>Account Profile -> Instant Payment Notification Preferences</code></p>' . "\n";
126
  echo '<p>Edit your IPN settings &amp; turn IPN Notifications: <strong><code>On</code></strong></p>' . "\n";
127
  echo '<p>You\'ll need your IPN URL, which is:<br /><code>' . get_bloginfo ("url") . '/?s2member_paypal_notify=1</code></p>' . "\n";
128
+ echo '<p><em><strong>*Quick Tip*</strong> In addition to the default IPN Settings inside your PayPal® account, the IPN URL is also set on a per-transaction basis by the special PayPal® Button Code that s2Member provides you with. In other words, if you have multiple sites operating on one PayPal® account, that\'s OK. s2Member dynamically sets the IPN URL for each transaction. The result is that the IPN URL configured from within your PayPal® account, becomes the default, which is then overwritten on a per-transaction basis. In fact, PayPal® recently updated their system to support IPN URL preservation. One PayPal® account can handle multiple sites, all using different IPN URLs.</em></p>' . "\n";
129
+ do_action ("ws_plugin__s2member_during_paypal_ops_page_during_left_sections_during_paypal_ipn_after_quick_tip", get_defined_vars ());
130
  echo '<p><em><strong>*More Information*</strong> You\'ll be happy to know that s2Member handles cancellations, expirations, failed payments, terminations ( e.g. refunds &amp; chargebacks ) for you automatically. If you log into your PayPal® account and cancel a Member\'s Subscription, or, if the Member logs into their PayPal® account and cancels their own Subscription, s2Member will be notified of these important changes and react accordingly through the PayPal® IPN service that runs silently behind-the-scene. The PayPal® IPN service will notify s2Member whenever a Member\'s payments have been failing, and/or whenever a Member\'s Subscription has expired for any reason. Even refunds &amp; chargeback reversals are supported through the IPN service. If you issue a refund to an unhappy Customer through PayPal®, s2Member will be notified, and the account for that Customer will either be demoted to a Free Subscriber, or deleted automatically ( based on your configuration ). The communication from PayPal® -> s2Member is seamless.</em></p>' . "\n";
131
  echo '<p><em><strong>*2010 PayPal® Accounts*</strong> s2Member has been updated to support newer PayPal® accounts ( those opened after Oct 15th, 2009 ). Newer PayPal® accounts do NOT send a <strong>IPN</strong>/<code>subscr_eot</code> in all cases. s2Member deals with this gracefully, by keeping a record of payments/periods/changes, and monitoring other signals sent by PayPal® over an extended period. This allows s2Member to take control of the situation at the appropriate time. The communication from PayPal® -> s2Member is seamless; even in PayPal® accounts created after October 15th, 2009. You can learn more about <code>subscr_eot</code> changes <a href="https://www.x.com/search.jspa?q=subscr+eot" target="_blank" rel="external">here</a>.</em></p>' . "\n";
132
  do_action ("ws_plugin__s2member_during_paypal_ops_page_during_left_sections_during_paypal_ipn", get_defined_vars ());
149
  echo '<p>Turn the Auto-Return feature: <strong><code>On</code></strong></p>' . "\n";
150
  echo '<p>You\'ll need your Auto-Return URL, which is:<br /><code>' . get_bloginfo ("url") . '/?s2member_paypal_return=1</code></p>' . "\n";
151
  echo '<p>You MUST also enable PDT ( Payment Data Transfer ): <strong><code>On</code></strong><br /><em>You\'ll be issued an Identity Token that you MUST enter below.</em></p>' . "\n";
152
+ echo '<p><em><strong>*Quick Tip*</strong> In addition to your default PayPal® account configuration, the Auto-Return URL is also set on a per-transaction basis from within the special PayPal® Button Code that s2Member provides you with. In other words, if you have multiple sites operating on one PayPal® account, that\'s OK. s2Member dynamically sets the Auto-Return URL for each transaction. The result is that the Auto-Return URL configured from within your PayPal® account, becomes the default, which is then overwritten on a per-transaction basis.</em></p>' . "\n";
153
+ do_action ("ws_plugin__s2member_during_paypal_ops_page_during_left_sections_during_paypal_pdt_after_quick_tip", get_defined_vars ());
154
  do_action ("ws_plugin__s2member_during_paypal_ops_page_during_left_sections_during_paypal_pdt", get_defined_vars ());
155
  /**/
156
  echo '<table class="form-table">' . "\n";
189
  /**/
190
  echo '<div class="ws-menu-page-section ws-plugin--s2member-signup-confirmation-email-section">' . "\n";
191
  echo '<h3>Signup Confirmation Email ( required, but the default works fine )</h3>' . "\n";
192
+ echo '<p>This email is sent to new Customers after they return from a successful signup at PayPal®. The <strong>primary</strong> purpose of this email, is to provide the Customer with instructions, along with a link to register a Username for their Membership. You may also customize this further, by providing details that are specifically geared to your site.</p>' . "\n";
193
  do_action ("ws_plugin__s2member_during_paypal_ops_page_during_left_sections_during_signup_confirmation_email", get_defined_vars ());
194
  /**/
195
  echo '<table class="form-table">' . "\n";
225
  echo '<td>' . "\n";
226
  echo '<textarea name="ws_plugin__s2member_signup_email_message" id="ws-plugin--s2member-signup-email-message" rows="10">' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["signup_email_message"]) . '</textarea><br />' . "\n";
227
  echo 'Message Body used in the email sent to a Customer after a successful signup has occurred through PayPal®.<br /><br />' . "\n";
228
+ echo '<strong>You can also use these special Replacement Codes if you need them:</strong>' . "\n";
229
  echo '<ul>' . "\n";
230
  echo '<li><code>%%registration_url%% = The full URL ( generated by s2Member ) where the Customer can get registered.</code></li>' . "\n";
231
  echo '<li><code>%%subscr_id%% = The PayPal® Subscription ID, which remains constant throughout any &amp; all future payments.</code> [ <a href="#" onclick="alert(\'There is one exception. If you are selling Lifetime or Fixed-Term ( non-recurring ) access, using a Buy It Now button; the %%subscr_id%% is actually set to the Transaction ID for the purchase.\\n\\nPayPal® does not provide a specific Subscription ID for Buy It Now purchases. Since Lifetime &amp; Fixed-Term Subscriptions are NOT recurring ( i.e. there is only ONE payment ), using the Transaction ID as the Subscription ID is a graceful way to deal with this minor conflict.\'); return false;">?</a> ]</li>' . "\n";
239
  echo '<li><code>%%item_number%% = The Item Number ( colon separated <em>level:custom_capabilities:fixed term</em> ) that the Subscription is for.</code></li>' . "\n";
240
  echo '<li><code>%%item_name%% = The Item Name ( in other words, the associated membership Level Label that briefly describes the item number ).</code></li>' . "\n";
241
  echo '<li><code>%%initial_term%% = This is the term length of the initial period. This will be a numeric value, followed by a space, then a single letter.</code> [ <a href="#" onclick="alert(\'Here are some examples:\\n\\n%%initial_term%% = 1 D ( this means 1 Day )\\n%%initial_term%% = 1 W ( this means 1 Week )\\n%%initial_term%% = 1 M ( this means 1 Month )\\n%%initial_term%% = 1 Y ( this means 1 Year )\\n\\nThe initial period never recurs, so this only lasts for the term length specified, then it is over. If no initial period was even offered, the value of %%initial_term%% will just be: 0 D, meaning zero days.\'); return false;">?</a> ]</li>' . "\n";
242
+ echo '<li><code>%%initial_cycle%% = This is the %%initial_term%% from above, converted ( and reduced ) to just a cycle representation, of: <em>Daily, Weekly, Monthly, or Yearly</em>.</code></li>' . "\n";
243
  echo '<li><code>%%regular_term%% = This is the term length of the regular period. This will be a numeric value, followed by a space, then a single letter.</code> [ <a href="#" onclick="alert(\'Here are some examples:\\n\\n%%regular_term%% = 1 D ( this means 1 Day )\\n%%regular_term%% = 1 W ( this means 1 Week )\\n%%regular_term%% = 1 M ( this means 1 Month )\\n%%regular_term%% = 1 Y ( this means 1 Year )\\n%%regular_term%% = 1 L ( this means 1 Lifetime )\\n\\nThe regular term is usually recurring. So the regular term value represents the period ( or duration ) of each recurring period. If %%recurring%% = 0, then the regular term only applies once, because it is not recurring. So if it is not recurring, the value of %%regular_term%% simply represents how long their membership privileges are going to last after the %%initial_term%% has expired, if there was an initial term. The value of this variable ( %%regular_term%% ) will never be empty, it will always be at least: 1 D, meaning 1 day. No exceptions.\'); return false;">?</a> ]</li>' . "\n";
244
+ echo '<li><code>%%regular_cycle%% = This is the %%regular_term%% from above, converted ( and reduced ) to just a cycle representation, of: <em>Daily, Weekly, Monthly, Yearly, or Lifetime</em>.</code></li>' . "\n";
245
+ echo '<li><code>%%recurring/regular_cycle%% = Example ( 14.95 / Monthly ), or ... ( 0 / non-recurring ); depending on the value of %%recurring%%.</code></li>' . "\n";
246
  echo '</ul>' . "\n";
247
+ echo '<strong>Custom Replacement Codes can also be inserted using these instructions:</strong>' . "\n";
248
  echo '<ul>' . "\n";
249
+ echo '<li><code>%%cv0%% = The domain of your site, which is passed through to PayPal® using the `custom` attribute in your PayPal® Shortcode.</code></li>' . "\n";
250
+ echo '<li><code>%%cv1%% = If you need to track additional custom variables, you can pipe delimit them into the `custom` attribute, inside your Shortcode, like this: custom="' . $_SERVER["HTTP_HOST"] . '|cv1|cv2|cv3". You can have an unlimited number of custom variables that track IP addresses, affiliate IDs, etc. In some cases you may need to use PHP code to insert a value into the custom field dynamically. Obviously this is for advanced webmasters, but the functionality has been made available for those who need it.</li>' . "\n";
251
  echo '</ul>' . "\n";
252
  echo '<strong>This example uses cv1 to track a User\'s IP address:</strong><br />' . "\n";
253
  echo '<em>( The IP address could be referenced in your Confirmation Email using %%cv1%% )</em><br />' . "\n";
254
+ echo '<code>custom="' . $_SERVER["HTTP_HOST"] . '|&lt;?php echo $_SERVER["REMOTE_ADDR"]; ?&gt;"</code>' . "\n";
255
  echo '</td>' . "\n";
256
  /**/
257
  echo '</tr>' . "\n";
290
  /**/
291
  echo '<td>' . "\n";
292
  echo '<input type="text" name="ws_plugin__s2member_sp_email_subject" id="ws-plugin--s2member-sp-email-subject" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_email_subject"]) . '" /><br />' . "\n";
293
+ echo 'Subject Line used in the email sent to a Customer after a successful purchase has occurred through PayPal®, for Specific Post/Page Access.' . "\n";
294
  echo '</td>' . "\n";
295
  /**/
296
  echo '</tr>' . "\n";
307
  /**/
308
  echo '<td>' . "\n";
309
  echo '<textarea name="ws_plugin__s2member_sp_email_message" id="ws-plugin--s2member-sp-email-message" rows="10">' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_email_message"]) . '</textarea><br />' . "\n";
310
+ echo 'Message Body used in the email sent to a Customer after a successful purchase has occurred through PayPal®, for Specific Post/Page Access.<br /><br />' . "\n";
311
+ echo '<strong>You can also use these special Replacement Codes if you need them:</strong>' . "\n";
312
  echo '<ul>' . "\n";
313
  echo '<li><code>%%sp_access_url%% = The full URL ( generated by s2Member ) where the Customer can gain access.</code></li>' . "\n";
314
  echo '<li><code>%%sp_access_exp%% = Human readable expiration for %%sp_access_url%%. Ex: <em>( link expires in %%sp_access_exp%% )</em>.</code></li>' . "\n";
321
  echo '<li><code>%%item_number%% = The Item Number. Ex: <em>sp:13,24,36:72</em> ( translates to: <em>sp:comma-delimited IDs:expiration hours</em> ).</code></li>' . "\n";
322
  echo '<li><code>%%item_name%% = The Item Name. In other words, a brief description, detailing what this purchase was for.</code></li>' . "\n";
323
  echo '</ul>' . "\n";
324
+ echo '<strong>Custom Replacement Codes can also be inserted using these instructions:</strong>' . "\n";
325
  echo '<ul>' . "\n";
326
+ echo '<li><code>%%cv0%% = The domain of your site, which is passed through to PayPal® using the `custom` attribute in your PayPal® Shortcode.</code></li>' . "\n";
327
+ echo '<li><code>%%cv1%% = If you need to track additional custom variables, you can pipe delimit them into the `custom` attribute, inside your Shortcode, like this: custom="' . $_SERVER["HTTP_HOST"] . '|cv1|cv2|cv3". You can have an unlimited number of custom variables that track IP addresses, affiliate IDs, etc. In some cases you may need to use PHP code to insert a value into the custom field dynamically. Obviously this is for advanced webmasters, but the functionality has been made available for those who need it.</li>' . "\n";
328
  echo '</ul>' . "\n";
329
  echo '<strong>This example uses cv1 to track a User\'s IP address:</strong><br />' . "\n";
330
  echo '<em>( The IP address could be referenced in your Confirmation Email using %%cv1%% )</em><br />' . "\n";
331
+ echo '<code>custom="' . $_SERVER["HTTP_HOST"] . '|&lt;?php echo $_SERVER["REMOTE_ADDR"]; ?&gt;"</code>' . "\n";
332
  echo '</td>' . "\n";
333
  /**/
334
  echo '</tr>' . "\n";
421
  do_action ("ws_plugin__s2member_during_paypal_ops_page_before_right_sections", get_defined_vars ());
422
  do_action ("ws_plugin__s2member_during_menu_pages_before_right_sections", get_defined_vars ());
423
  /**/
424
+ echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["upsell-pro"]) ? '<div class="ws-menu-page-others"><a href="' . ws_plugin__s2member_parse_readme_value ("Pro Module / Licensing") . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-upsell-pro.png" alt="." /></a></div>' . "\n" : '';
425
  echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["installation"]) ? '<div class="ws-menu-page-installation"><a href="' . ws_plugin__s2member_parse_readme_value ("Professional Installation URI") . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-installation.png" alt="." /></a></div>' . "\n" : '';
426
  echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["tools"]) ? '<div class="ws-menu-page-tools"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-tools.png" alt="." /></div>' . "\n" : '';
427
  echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["support"]) ? '<div class="ws-menu-page-support"><a href="' . ws_plugin__s2member_parse_readme_value ("Forum URI") . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-support.png" alt="." /></a></div>' . "\n" : '';
includes/menu-pages/scripting.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
  /*
17
  API Scripting page.
18
  */
@@ -68,9 +68,9 @@ if (apply_filters ("ws_plugin__s2member_during_scripting_page_during_left_sectio
68
  echo '<p><strong>Example #5:</strong> Uses s2Member API Constants, instead of functions.</strong></p>' . "\n";
69
  echo '<p>' . highlight_string (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-can-constants-2.php"), true) . '</p>' . "\n";
70
  echo '<p><strong>Membership Levels provide incremental access:</strong></p>' . "\n";
71
- echo '<p>* A Member with Level 4 access, will also be able to access Levels 1, 2 &amp; 3.<br />* A Member with Level 3 access, will also be able to access Levels 1 &amp; 2.<br />* A Member with Level 2 access, will also be able to access Level 1.<br />* A Member with Level 1 access, will ONLY be able to access Level 1.</p>' . "\n";
 
72
  echo '<p><em>* WordPress® Administrators, Editors, Authors, and Contributors have Level 4 access, with respect to s2Member. All of their other Roles/Capabilities are left untouched.</em></p>' . "\n";
73
- echo '<p><em>* WordPress® Subscribers are NOT allowed Membership access, with respect to s2Member. They must be promoted to a Member. However, if you set `Allow Free Subscribers` to <code>Yes</code>, then Free Subscribers WILL be allowed to access your Login Welcome Page, <strong>but that is all</strong>. See `s2Member -> General Options -> Login Welcome Page` to learn more about this option. If you would like to extend additional access to Free Subscribers ( and/or other Levels ), use the examples above, to customize your Login Welcome Page; based on Membership Level.</em></p>' . "\n";
74
  echo '</div>' . "\n";
75
  /**/
76
  echo '</div>' . "\n";
@@ -82,11 +82,11 @@ if (apply_filters ("ws_plugin__s2member_during_scripting_page_during_left_sectio
82
  {
83
  do_action ("ws_plugin__s2member_during_scripting_page_during_left_sections_before_custom_capabilities", get_defined_vars ());
84
  /**/
85
- echo '<div class="ws-menu-page-group" title="Packaging Custom Capabilities">' . "\n";
86
  /**/
87
  echo '<div class="ws-menu-page-section ws-plugin--s2member-custom-capabilities-section">' . "\n";
88
  echo '<h3>Packaging Together Custom Capabilities w/ Membership</h3>' . "\n";
89
- echo '<p>Using the PayPal® Button Generator for s2Member, you can add Custom Capabilities in comma delimited format. s2Member builds upon existing functionality offered by WordPress® Roles/Capabilities. s2Member supports up to four Primary Roles ( i.e. s2Member Levels 1-4 ). Each s2Member Level provides <code>current_user_can("access_s2member_level1"), 2, 3, 4</code>. These are the default Capabilities that come with each Membership Level. Now... If you\'d like to package together some variations of each Membership Level that you\'re selling, you can! All you do is add some Custom Capabilities whenever you create your PayPal® Button Code ( <em>there is a field in the Button Generator where you can enter Custom Capabilities</em> ). You can sell membership packages that come with Custom Capabilities, and even with custom prices.</p>' . "\n";
90
  echo '<p>Custom Capabilities are an extension to a feature that already exists in WordPress®. The <code>current_user_can()</code> function, can be used to test for these additional Capabilities that you allow. Whenever a Member completes the checkout process, after having purchased a Membership from you ( one that included Custom Capabilities ), s2Member will add those Custom Capabilities to the account for that specific Member.</p>' . "\n";
91
  echo '<p>Custom Capabilities are always prepended with <code>access_s2member_ccap_</code>. You fill in the last part, with ONLY lowercase alpha-numerics and/or underscores. For example, let\'s say you want to sell Membership Level #1, as is. But, you also want to sell a slight variation of Membership Level #1, that includes the ability to access the Music &amp; Video sections of your site. So, instead of selling this additional access under a whole new Membership Level, you could just sell a modified version of Membership Level #1. Add the the Custom Capabilities: <code>music,videos</code>. Once a Member has these Capabilities, you can test for these Capabilities using <code>current_user_can("access_s2member_ccap_music")</code> and <code>current_user_can("access_s2member_ccap_videos")</code>.</p>' . "\n";
92
  do_action ("ws_plugin__s2member_during_scripting_page_during_left_sections_during_custom_capabilities", get_defined_vars ());
@@ -108,6 +108,33 @@ if (apply_filters ("ws_plugin__s2member_during_scripting_page_during_left_sectio
108
  do_action ("ws_plugin__s2member_during_scripting_page_during_left_sections_after_custom_capabilities", get_defined_vars ());
109
  }
110
  /**/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
  if (apply_filters ("ws_plugin__s2member_during_scripting_page_during_left_sections_display_api_advanced_dripping", true, get_defined_vars ()))
112
  {
113
  do_action ("ws_plugin__s2member_during_scripting_page_during_left_sections_before_api_advanced_dripping", get_defined_vars ());
@@ -200,9 +227,9 @@ if (apply_filters ("ws_plugin__s2member_during_scripting_page_during_left_sectio
200
  echo '<p><strong>S2MEMBER_CURRENT_USER_ACCESS_LEVEL</strong><br />This will always be (int) -1 thru 4. -1 if not logged in. 0 if logged in as a Free Subscriber.</p>' . "\n";
201
  echo '<p>' . highlight_string (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-access-level.php"), true) . '</p>' . "\n";
202
  echo '<p><strong>Membership Levels provide incremental access:</strong></p>' . "\n";
203
- echo '<p>* A Member with Level 4 access, will also be able to access Levels 1, 2 &amp; 3.<br />* A Member with Level 3 access, will also be able to access Levels 1 &amp; 2.<br />* A Member with Level 2 access, will also be able to access Level 1.<br />* A Member with Level 1 access, will ONLY be able to access Level 1.</p>' . "\n";
 
204
  echo '<p><em>* WordPress® Administrators, Editors, Authors, and Contributors have Level 4 access, with respect to s2Member. All of their other Roles/Capabilities are left untouched.</em></p>' . "\n";
205
- echo '<p><em>* WordPress® Subscribers are NOT allowed Membership access, with respect to s2Member. They must be promoted to a Member. However, if you set `Allow Free Subscribers` to <code>Yes</code>, then Free Subscribers WILL be allowed to access your Login Welcome Page, <strong>but that is all</strong>. See `s2Member -> General Options -> Login Welcome Page` to learn more about this option. If you would like to extend additional access to Free Subscribers ( and/or other Levels ), see: <code>s2Member -> API Scripting -> Advanced Conditionals</code>, for details on how to customize your Login Welcome Page with Conditionals; based on Membership Level.</em></p>' . "\n";
206
  /**/
207
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
208
  /**/
@@ -267,8 +294,6 @@ if (apply_filters ("ws_plugin__s2member_during_scripting_page_during_left_sectio
267
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
268
  /**/
269
  echo '<p><strong>S2MEMBER_CURRENT_USER_FIELDS</strong><br />This will always be a JSON encoded array, in (string) format. An empty JSON encoded array, in (string) format, if not logged in. This JSON encoded array will contain the following fields: <code>id, ip, email, login, first_name, last_name, display_name, subscr_id, custom</code>. If you\'ve configured additional Custom Fields, those Custom Fields will also be added to this array. For example, if you configured the Custom Field: <code>Street Address</code>, it would be included in this array as: <code>street_address</code>. Custom Field references are converted to lowercase format, and spaces are replaced by underscores. You can do <code>print_r(json_decode(S2MEMBER_CURRENT_USER_FIELDS, true));</code> to get a full list for testing.</p>' . "\n";
270
- if (defined ("BP_VERSION"))
271
- echo '<p><em class="ws-menu-page-error">* Custom Fields are N/A when running together with BuddyPress. Instead, use <code>BuddyPress -> Profile Field Setup</code>.</em></p>' . "\n";
272
  echo '<p>' . highlight_string (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-fields.php"), true) . '</p>' . "\n";
273
  /**/
274
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
@@ -331,6 +356,11 @@ if (apply_filters ("ws_plugin__s2member_during_scripting_page_during_left_sectio
331
  /**/
332
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
333
  /**/
 
 
 
 
 
334
  echo '<p><strong>S2MEMBER_LEVEL1_LABEL</strong><br />This is the (string) Label that you created for Membership Level 1.</p>' . "\n";
335
  echo '<p>' . highlight_string (file_get_contents (dirname (__FILE__) . "/code-samples/level1-label.php"), true) . '</p>' . "\n";
336
  /**/
@@ -351,6 +381,11 @@ if (apply_filters ("ws_plugin__s2member_during_scripting_page_during_left_sectio
351
  /**/
352
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
353
  /**/
 
 
 
 
 
354
  echo '<p><strong>S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED</strong><br />This is the (int) allowed downloads for Level 1.</p>' . "\n";
355
  echo '<p>' . highlight_string (file_get_contents (dirname (__FILE__) . "/code-samples/level1-file-downloads-allowed.php"), true) . '</p>' . "\n";
356
  /**/
@@ -371,6 +406,11 @@ if (apply_filters ("ws_plugin__s2member_during_scripting_page_during_left_sectio
371
  /**/
372
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
373
  /**/
 
 
 
 
 
374
  echo '<p><strong>S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED_DAYS</strong><br />This is the (int) allowed download days for Level 1.</p>' . "\n";
375
  echo '<p>' . highlight_string (file_get_contents (dirname (__FILE__) . "/code-samples/level1-file-downloads-allowed-days.php"), true) . '</p>' . "\n";
376
  /**/
@@ -490,6 +530,7 @@ echo '<td class="ws-menu-page-table-r">' . "\n";
490
  do_action ("ws_plugin__s2member_during_scripting_page_before_right_sections", get_defined_vars ());
491
  do_action ("ws_plugin__s2member_during_menu_pages_before_right_sections", get_defined_vars ());
492
  /**/
 
493
  echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["installation"]) ? '<div class="ws-menu-page-installation"><a href="' . ws_plugin__s2member_parse_readme_value ("Professional Installation URI") . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-installation.png" alt="." /></a></div>' . "\n" : '';
494
  echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["tools"]) ? '<div class="ws-menu-page-tools"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-tools.png" alt="." /></div>' . "\n" : '';
495
  echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["support"]) ? '<div class="ws-menu-page-support"><a href="' . ws_plugin__s2member_parse_readme_value ("Forum URI") . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-support.png" alt="." /></a></div>' . "\n" : '';
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
  /*
17
  API Scripting page.
18
  */
68
  echo '<p><strong>Example #5:</strong> Uses s2Member API Constants, instead of functions.</strong></p>' . "\n";
69
  echo '<p>' . highlight_string (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-can-constants-2.php"), true) . '</p>' . "\n";
70
  echo '<p><strong>Membership Levels provide incremental access:</strong></p>' . "\n";
71
+ echo '<p>* A Member with Level 4 access, will also be able to access Levels 0, 1, 2 &amp; 3.<br />* A Member with Level 3 access, will also be able to access Levels 0, 1 &amp; 2.<br />* A Member with Level 2 access, will also be able to access Levels 0 &amp; 1.<br />* A Member with Level 1 access, will also be able to access Level 0.<br />* A Subscriber with Level 0 access, will ONLY be able to access Level 0.</p>' . "\n";
72
+ echo '<p><em>* WordPress® Subscribers are at Membership Level 0. If you\'re allowing Open Registration, Subscribers will be at Level 0 ( a Free Subscriber ).</em></p>' . "\n";
73
  echo '<p><em>* WordPress® Administrators, Editors, Authors, and Contributors have Level 4 access, with respect to s2Member. All of their other Roles/Capabilities are left untouched.</em></p>' . "\n";
 
74
  echo '</div>' . "\n";
75
  /**/
76
  echo '</div>' . "\n";
82
  {
83
  do_action ("ws_plugin__s2member_during_scripting_page_during_left_sections_before_custom_capabilities", get_defined_vars ());
84
  /**/
85
+ echo '<div class="ws-menu-page-group" title="Custom Capability Packages">' . "\n";
86
  /**/
87
  echo '<div class="ws-menu-page-section ws-plugin--s2member-custom-capabilities-section">' . "\n";
88
  echo '<h3>Packaging Together Custom Capabilities w/ Membership</h3>' . "\n";
89
+ echo '<p>Using the PayPal® Button Generator for s2Member, you can add Custom Capabilities in comma delimited format. s2Member builds upon existing functionality offered by WordPress® Roles/Capabilities. s2Member supports Free Subscribers ( at Level #0 ), and up to four Primary Roles ( i.e. s2Member Levels 1-4 ). Each s2Member Level provides <code>current_user_can("access_s2member_level0"), 1, 2, 3, 4</code>. These are the default Capabilities that come with each Membership Level. Now... If you\'d like to package together some variations of each Membership Level that you\'re selling, you can! All you do is add some Custom Capabilities whenever you create your PayPal® Button Code ( <em>there is a field in the Button Generator where you can enter Custom Capabilities</em> ). You can sell membership packages that come with Custom Capabilities, and even with custom prices.</p>' . "\n";
90
  echo '<p>Custom Capabilities are an extension to a feature that already exists in WordPress®. The <code>current_user_can()</code> function, can be used to test for these additional Capabilities that you allow. Whenever a Member completes the checkout process, after having purchased a Membership from you ( one that included Custom Capabilities ), s2Member will add those Custom Capabilities to the account for that specific Member.</p>' . "\n";
91
  echo '<p>Custom Capabilities are always prepended with <code>access_s2member_ccap_</code>. You fill in the last part, with ONLY lowercase alpha-numerics and/or underscores. For example, let\'s say you want to sell Membership Level #1, as is. But, you also want to sell a slight variation of Membership Level #1, that includes the ability to access the Music &amp; Video sections of your site. So, instead of selling this additional access under a whole new Membership Level, you could just sell a modified version of Membership Level #1. Add the the Custom Capabilities: <code>music,videos</code>. Once a Member has these Capabilities, you can test for these Capabilities using <code>current_user_can("access_s2member_ccap_music")</code> and <code>current_user_can("access_s2member_ccap_videos")</code>.</p>' . "\n";
92
  do_action ("ws_plugin__s2member_during_scripting_page_during_left_sections_during_custom_capabilities", get_defined_vars ());
108
  do_action ("ws_plugin__s2member_during_scripting_page_during_left_sections_after_custom_capabilities", get_defined_vars ());
109
  }
110
  /**/
111
+ if (apply_filters ("ws_plugin__s2member_during_scripting_page_during_left_sections_display_custom_capability_files", true, get_defined_vars ()))
112
+ {
113
+ do_action ("ws_plugin__s2member_during_scripting_page_during_left_sections_before_custom_capability_files", get_defined_vars ());
114
+ /**/
115
+ echo '<div class="ws-menu-page-group" title="Custom Capability Files">' . "\n";
116
+ /**/
117
+ echo '<div class="ws-menu-page-section ws-plugin--s2member-custom-capability-files-section">' . "\n";
118
+ echo '<h3>Restricting Files, Based On Custom Capabilities</h3>' . "\n";
119
+ echo '<p>If you\'re NOT familiar with Custom Capabilities yet, please read the section above, titled: `Custom Capability Packages`, and also see: `s2Member -> Download Options`, both as primers; BEFORE you read this section. Once you understand the basic concept of Custom Capabilities &amp; Protected File Downloads, you\'ll see that ( by default ) s2Member does NOT handle File Download Protection with respect to Custom Capabilities. That\'s where Custom Capability Sub-directories come in.</p>' . "\n";
120
+ echo '<p>You can create Custom Capability Sub-directories under: <code>/plugins/s2member-files/</code>. For instance, if you have a Custom Capability <code>music</code>, you can place protected files that should ONLY be accessible to Members with <code>access_s2member_ccap_music</code>, inside: <code>/s2member-files/access-s2member-ccap-music/</code>. Some examples are provided below.</p>' . "\n";
121
+ do_action ("ws_plugin__s2member_during_scripting_page_during_left_sections_during_custom_capability_files", get_defined_vars ());
122
+ /**/
123
+ echo '<div class="ws-menu-page-hr"></div>' . "\n";
124
+ /**/
125
+ echo '<p><strong>Custom Capabilities:</strong> ( music,videos )</p>' . "\n";
126
+ echo '<p>Sub-Directory: <code>/s2member-files/access-s2member-ccap-music</code><br />Sub-Directory: <code>/s2member-files/access-s2member-ccap-videos</code></p>' . "\n";
127
+ echo '<p>Proteced File: <code>/s2member-files/access-s2member-ccap-music/file.mp3</code><br />Proteced File: <code>/s2member-files/access-s2member-ccap-videos/file.avi</code></p>' . "\n";
128
+ echo '<p>Now, here are some link examples, using Custom Capability Sub-directories:</p>' . "\n";
129
+ echo '<p>' . highlight_string (file_get_contents (dirname (__FILE__) . "/code-samples/ccap-file-downloads.php"), true) . '</p>' . "\n";
130
+ echo '<p><em>These links will ONLY work for Members who are logged-in, with the proper Capabilities.</em></p>' . "\n";
131
+ echo '</div>' . "\n";
132
+ /**/
133
+ echo '</div>' . "\n";
134
+ /**/
135
+ do_action ("ws_plugin__s2member_during_scripting_page_during_left_sections_after_custom_capability_files", get_defined_vars ());
136
+ }
137
+ /**/
138
  if (apply_filters ("ws_plugin__s2member_during_scripting_page_during_left_sections_display_api_advanced_dripping", true, get_defined_vars ()))
139
  {
140
  do_action ("ws_plugin__s2member_during_scripting_page_during_left_sections_before_api_advanced_dripping", get_defined_vars ());
227
  echo '<p><strong>S2MEMBER_CURRENT_USER_ACCESS_LEVEL</strong><br />This will always be (int) -1 thru 4. -1 if not logged in. 0 if logged in as a Free Subscriber.</p>' . "\n";
228
  echo '<p>' . highlight_string (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-access-level.php"), true) . '</p>' . "\n";
229
  echo '<p><strong>Membership Levels provide incremental access:</strong></p>' . "\n";
230
+ echo '<p>* A Member with Level 4 access, will also be able to access Levels 0, 1, 2 &amp; 3.<br />* A Member with Level 3 access, will also be able to access Levels 0, 1 &amp; 2.<br />* A Member with Level 2 access, will also be able to access Levels 0 &amp; 1.<br />* A Member with Level 1 access, will also be able to access Level 0.<br />* A Subscriber with Level 0 access, will ONLY be able to access Level 0.</p>' . "\n";
231
+ echo '<p><em>* WordPress® Subscribers are at Membership Level 0. If you\'re allowing Open Registration, Subscribers will be at Level 0 ( a Free Subscriber ).</em></p>' . "\n";
232
  echo '<p><em>* WordPress® Administrators, Editors, Authors, and Contributors have Level 4 access, with respect to s2Member. All of their other Roles/Capabilities are left untouched.</em></p>' . "\n";
 
233
  /**/
234
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
235
  /**/
294
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
295
  /**/
296
  echo '<p><strong>S2MEMBER_CURRENT_USER_FIELDS</strong><br />This will always be a JSON encoded array, in (string) format. An empty JSON encoded array, in (string) format, if not logged in. This JSON encoded array will contain the following fields: <code>id, ip, email, login, first_name, last_name, display_name, subscr_id, custom</code>. If you\'ve configured additional Custom Fields, those Custom Fields will also be added to this array. For example, if you configured the Custom Field: <code>Street Address</code>, it would be included in this array as: <code>street_address</code>. Custom Field references are converted to lowercase format, and spaces are replaced by underscores. You can do <code>print_r(json_decode(S2MEMBER_CURRENT_USER_FIELDS, true));</code> to get a full list for testing.</p>' . "\n";
 
 
297
  echo '<p>' . highlight_string (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-fields.php"), true) . '</p>' . "\n";
298
  /**/
299
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
356
  /**/
357
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
358
  /**/
359
+ echo '<p><strong>S2MEMBER_LEVEL0_LABEL</strong><br />This is the (string) Label that you created for Membership Level 0.</p>' . "\n";
360
+ echo '<p>' . highlight_string (file_get_contents (dirname (__FILE__) . "/code-samples/level0-label.php"), true) . '</p>' . "\n";
361
+ /**/
362
+ echo '<div class="ws-menu-page-hr"></div>' . "\n";
363
+ /**/
364
  echo '<p><strong>S2MEMBER_LEVEL1_LABEL</strong><br />This is the (string) Label that you created for Membership Level 1.</p>' . "\n";
365
  echo '<p>' . highlight_string (file_get_contents (dirname (__FILE__) . "/code-samples/level1-label.php"), true) . '</p>' . "\n";
366
  /**/
381
  /**/
382
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
383
  /**/
384
+ echo '<p><strong>S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED</strong><br />This is the (int) allowed downloads for Level 0.</p>' . "\n";
385
+ echo '<p>' . highlight_string (file_get_contents (dirname (__FILE__) . "/code-samples/level0-file-downloads-allowed.php"), true) . '</p>' . "\n";
386
+ /**/
387
+ echo '<div class="ws-menu-page-hr"></div>' . "\n";
388
+ /**/
389
  echo '<p><strong>S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED</strong><br />This is the (int) allowed downloads for Level 1.</p>' . "\n";
390
  echo '<p>' . highlight_string (file_get_contents (dirname (__FILE__) . "/code-samples/level1-file-downloads-allowed.php"), true) . '</p>' . "\n";
391
  /**/
406
  /**/
407
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
408
  /**/
409
+ echo '<p><strong>S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED_DAYS</strong><br />This is the (int) allowed download days for Level 0.</p>' . "\n";
410
+ echo '<p>' . highlight_string (file_get_contents (dirname (__FILE__) . "/code-samples/level0-file-downloads-allowed-days.php"), true) . '</p>' . "\n";
411
+ /**/
412
+ echo '<div class="ws-menu-page-hr"></div>' . "\n";
413
+ /**/
414
  echo '<p><strong>S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED_DAYS</strong><br />This is the (int) allowed download days for Level 1.</p>' . "\n";
415
  echo '<p>' . highlight_string (file_get_contents (dirname (__FILE__) . "/code-samples/level1-file-downloads-allowed-days.php"), true) . '</p>' . "\n";
416
  /**/
530
  do_action ("ws_plugin__s2member_during_scripting_page_before_right_sections", get_defined_vars ());
531
  do_action ("ws_plugin__s2member_during_menu_pages_before_right_sections", get_defined_vars ());
532
  /**/
533
+ echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["upsell-pro"]) ? '<div class="ws-menu-page-others"><a href="' . ws_plugin__s2member_parse_readme_value ("Pro Module / Licensing") . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-upsell-pro.png" alt="." /></a></div>' . "\n" : '';
534
  echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["installation"]) ? '<div class="ws-menu-page-installation"><a href="' . ws_plugin__s2member_parse_readme_value ("Professional Installation URI") . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-installation.png" alt="." /></a></div>' . "\n" : '';
535
  echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["tools"]) ? '<div class="ws-menu-page-tools"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-tools.png" alt="." /></div>' . "\n" : '';
536
  echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["support"]) ? '<div class="ws-menu-page-support"><a href="' . ws_plugin__s2member_parse_readme_value ("Forum URI") . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-support.png" alt="." /></a></div>' . "\n" : '';
includes/menu-pages/start.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
  /*
17
  Flow Of Events page.
18
  */
@@ -188,6 +188,7 @@ echo '<td class="ws-menu-page-table-r">' . "\n";
188
  do_action ("ws_plugin__s2member_during_start_page_before_right_sections", get_defined_vars ());
189
  do_action ("ws_plugin__s2member_during_menu_pages_before_right_sections", get_defined_vars ());
190
  /**/
 
191
  echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["installation"]) ? '<div class="ws-menu-page-installation"><a href="' . ws_plugin__s2member_parse_readme_value ("Professional Installation URI") . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-installation.png" alt="." /></a></div>' . "\n" : '';
192
  echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["tools"]) ? '<div class="ws-menu-page-tools"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-tools.png" alt="." /></div>' . "\n" : '';
193
  echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["support"]) ? '<div class="ws-menu-page-support"><a href="' . ws_plugin__s2member_parse_readme_value ("Forum URI") . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-support.png" alt="." /></a></div>' . "\n" : '';
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
  /*
17
  Flow Of Events page.
18
  */
188
  do_action ("ws_plugin__s2member_during_start_page_before_right_sections", get_defined_vars ());
189
  do_action ("ws_plugin__s2member_during_menu_pages_before_right_sections", get_defined_vars ());
190
  /**/
191
+ echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["upsell-pro"]) ? '<div class="ws-menu-page-others"><a href="' . ws_plugin__s2member_parse_readme_value ("Pro Module / Licensing") . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-upsell-pro.png" alt="." /></a></div>' . "\n" : '';
192
  echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["installation"]) ? '<div class="ws-menu-page-installation"><a href="' . ws_plugin__s2member_parse_readme_value ("Professional Installation URI") . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-installation.png" alt="." /></a></div>' . "\n" : '';
193
  echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["tools"]) ? '<div class="ws-menu-page-tools"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-tools.png" alt="." /></div>' . "\n" : '';
194
  echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["support"]) ? '<div class="ws-menu-page-support"><a href="' . ws_plugin__s2member_parse_readme_value ("Forum URI") . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-support.png" alt="." /></a></div>' . "\n" : '';
includes/menu-pages/trk-ops.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
  /*
17
  API Tracking page.
18
  */
@@ -62,7 +62,7 @@ if (apply_filters ("ws_plugin__s2member_during_trk_ops_page_during_left_sections
62
  echo '<td>' . "\n";
63
  echo '<textarea name="ws_plugin__s2member_signup_tracking_codes" id="ws-plugin--s2member-signup-tracking-codes" rows="8" wrap="off" spellcheck="false" style="font-family:Consolas, monospace;">' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["signup_tracking_codes"]) . '</textarea><br />' . "\n";
64
  echo 'Any valid XHTML / JavaScript' . ((!$GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["is_multisite_farm"]) ? ' ( or even PHP )' : '') . ' code will work just fine here. Just try not to put anything here that would actually be visible to the Customer. Things like 1x1 pixel images that load up silently and/or JavaScript tracking routines will be fine. Google® Analytics code works just fine, AdSense® performance tracking, as well as Yahoo® tracking and other affiliate network codes are all OK here.<br /><br />' . "\n";
65
- echo '<strong>You can also use these special replacement codes if you need them:</strong>' . "\n";
66
  echo '<ul>' . "\n";
67
  echo '<li><code>%%subscr_id%% = The PayPal® Subscription ID, which remains constant throughout any &amp; all future payments.</code> [ <a href="#" onclick="alert(\'There is one exception. If you are selling Lifetime or Fixed-Term ( non-recurring ) access, using a Buy It Now button; the %%subscr_id%% is actually set to the Transaction ID for the purchase.\\n\\nPayPal® does not provide a specific Subscription ID for Buy It Now purchases. Since Lifetime &amp; Fixed-Term Subscriptions are NOT recurring ( i.e. there is only ONE payment ), using the Transaction ID as the Subscription ID is a graceful way to deal with this minor conflict.\'); return false;">?</a> ]</li>' . "\n";
68
  echo '<li><code>%%initial%% = The Initial Fee charged during signup. If you offered a free trial, this will be 0.</code> [ <a href="#" onclick="alert(\'This will always represent the amount of money the Customer spent, whenever they initially signed up, no matter what. If a Customer signs up, under the terms of a free trial period, this will be 0.\'); return false;">?</a> ]</li>' . "\n";
@@ -77,14 +77,14 @@ if (apply_filters ("ws_plugin__s2member_during_trk_ops_page_during_left_sections
77
  echo '<li><code>%%initial_term%% = This is the term length of the initial period. This will be a numeric value, followed by a space, then a single letter.</code> [ <a href="#" onclick="alert(\'Here are some examples:\\n\\n%%initial_term%% = 1 D ( this means 1 Day )\\n%%initial_term%% = 1 W ( this means 1 Week )\\n%%initial_term%% = 1 M ( this means 1 Month )\\n%%initial_term%% = 1 Y ( this means 1 Year )\\n\\nThe initial period never recurs, so this only lasts for the term length specified, then it is over. If no initial period was even offered, the value of %%initial_term%% will just be: 0 D, meaning zero days.\'); return false;">?</a> ]</li>' . "\n";
78
  echo '<li><code>%%regular_term%% = This is the term length of the regular period. This will be a numeric value, followed by a space, then a single letter.</code> [ <a href="#" onclick="alert(\'Here are some examples:\\n\\n%%regular_term%% = 1 D ( this means 1 Day )\\n%%regular_term%% = 1 W ( this means 1 Week )\\n%%regular_term%% = 1 M ( this means 1 Month )\\n%%regular_term%% = 1 Y ( this means 1 Year )\\n%%regular_term%% = 1 L ( this means 1 Lifetime )\\n\\nThe regular term is usually recurring. So the regular term value represents the period ( or duration ) of each recurring period. If %%recurring%% = 0, then the regular term only applies once, because it is not recurring. So if it is not recurring, the value of %%regular_term%% simply represents how long their membership privileges are going to last after the %%initial_term%% has expired, if there was an initial term. The value of this variable ( %%regular_term%% ) will never be empty, it will always be at least: 1 D, meaning 1 day. No exceptions.\'); return false;">?</a> ]</li>' . "\n";
79
  echo '</ul>' . "\n";
80
- echo '<strong>Custom replacement codes can also be inserted using these instructions:</strong>' . "\n";
81
  echo '<ul>' . "\n";
82
- echo '<li><code>%%cv0%% = The domain of your site, which is passed through to PayPal® using the `custom` field in your PayPal® Button Code.</code></li>' . "\n";
83
- echo '<li><code>%%cv1%% = If you need to track additional custom variables, you can pipe delimit them into the `custom` field of your Button Code like this: &lt;input type="hidden" name="custom" value="' . $_SERVER["HTTP_HOST"] . '|cv1|cv2|cv3" /&gt;. You can have an unlimited number of custom variables that track IP addresses, affiliate IDs, etc. In some cases you may need to use PHP code to insert a value into the custom field dynamically. Obviously this is for advanced webmasters, but the functionality has been made available for those who need it.</code></li>' . "\n";
84
  echo '</ul>' . "\n";
85
  echo '<strong>This example uses cv1 to track a User\'s IP address:</strong><br />' . "\n";
86
  echo '<em>( The IP address could be referenced in your Tracking Code using %%cv1%% )</em><br />' . "\n";
87
- echo '<code>&lt;input type="hidden" name="custom" value="' . $_SERVER["HTTP_HOST"] . '|&lt;?php echo $_SERVER["REMOTE_ADDR"]; ?&gt;" /&gt;</code>' . "\n";
88
  echo '</td>' . "\n";
89
  /**/
90
  echo '</tr>' . "\n";
@@ -124,7 +124,7 @@ if (apply_filters ("ws_plugin__s2member_during_trk_ops_page_during_left_sections
124
  echo '<td>' . "\n";
125
  echo '<textarea name="ws_plugin__s2member_sp_tracking_codes" id="ws-plugin--s2member-sp-tracking-codes" rows="8" wrap="off" spellcheck="false" style="font-family:Consolas, monospace;">' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_tracking_codes"]) . '</textarea><br />' . "\n";
126
  echo 'Any valid XHTML / JavaScript' . ((!$GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["is_multisite_farm"]) ? ' ( or even PHP )' : '') . ' code will work just fine here. Just try not to put anything here that would actually be visible to the Customer. Things like 1x1 pixel images that load up silently and/or JavaScript tracking routines will be fine. Google® Analytics code works just fine, AdSense® performance tracking, as well as Yahoo® tracking and other affiliate network codes are all OK here.<br /><br />' . "\n";
127
- echo '<strong>You can also use these special replacement codes if you need them:</strong>' . "\n";
128
  echo '<ul>' . "\n";
129
  echo '<li><code>%%txn_id%% = The PayPal® Transaction ID. PayPal® assigns a unique identifier for every purchase.</code></li>' . "\n";
130
  echo '<li><code>%%amount%% = The full Amount that you charged for Specific Post/Page Access. This value will always be > 0.</code></li>' . "\n";
@@ -135,14 +135,14 @@ if (apply_filters ("ws_plugin__s2member_during_trk_ops_page_during_left_sections
135
  echo '<li><code>%%item_number%% = The Item Number. Ex: <em>sp:13,24,36:72</em> ( translates to: <em>sp:comma-delimited IDs:expiration hours</em> ).</code></li>' . "\n";
136
  echo '<li><code>%%item_name%% = The Item Name. In other words, a brief description, detailing what this purchase was for.</code></li>' . "\n";
137
  echo '</ul>' . "\n";
138
- echo '<strong>Custom replacement codes can also be inserted using these instructions:</strong>' . "\n";
139
  echo '<ul>' . "\n";
140
- echo '<li><code>%%cv0%% = The domain of your site, which is passed through to PayPal® using the `custom` field in your PayPal® Button Code.</code></li>' . "\n";
141
- echo '<li><code>%%cv1%% = If you need to track additional custom variables, you can pipe delimit them into the `custom` field of your Button Code like this: &lt;input type="hidden" name="custom" value="' . $_SERVER["HTTP_HOST"] . '|cv1|cv2|cv3" /&gt;. You can have an unlimited number of custom variables that track IP addresses, affiliate IDs, etc. In some cases you may need to use PHP code to insert a value into the custom field dynamically. Obviously this is for advanced webmasters, but the functionality has been made available for those who need it.</code></li>' . "\n";
142
  echo '</ul>' . "\n";
143
  echo '<strong>This example uses cv1 to track a User\'s IP address:</strong><br />' . "\n";
144
  echo '<em>( The IP address could be referenced in your Tracking Code using %%cv1%% )</em><br />' . "\n";
145
- echo '<code>&lt;input type="hidden" name="custom" value="' . $_SERVER["HTTP_HOST"] . '|&lt;?php echo $_SERVER["REMOTE_ADDR"]; ?&gt;" /&gt;</code>' . "\n";
146
  echo '</td>' . "\n";
147
  /**/
148
  echo '</tr>' . "\n";
@@ -165,7 +165,7 @@ if (apply_filters ("ws_plugin__s2member_during_trk_ops_page_during_left_sections
165
  echo '<h3>Integrating iDevAffiliate® ( affiliate program management )</h3>' . "\n";
166
  echo '<a href="http://www.idevdirect.com/14200.html" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/idev-logo.gif" class="ws-menu-page-right" style="width:125px; height:125px; border:0;" alt="." /></a>' . "\n";
167
  echo '<p>Adding affiliate tracking software to your site is one of the most effective ways to achieve more sales, more traffic, and more search engine ranking. <a href="http://www.idevdirect.com/14200.html" target="_blank" rel="external">iDevAffiliate®</a> ( an affiliate management portal ), installs in just minutes, and can be integrated seamlessly with s2Member. We recommend <a href="http://www.idevdirect.com/14200.html" target="_blank" rel="external">iDevAffiliate® Standard</a> ( $99 ) because of its proven track record, and its ability to integrate with s2Member using a variety of techniques. The most popular being a Hidden Image Tag.</p>' . "\n";
168
- echo '<p>If you choose to <a href="http://www.idevdirect.com/14200.html" target="_blank" rel="external">install iDevAffiliate®</a>, you will need to configure your <code>iDevAffiliate® -> Shopping Cart Integration</code>. Please choose <code>Generic Tracking Pixel</code>. Then, grab your Hidden Image Tag, and pop the code provided by iDevAffiliate® into the Custom Tracking field at the top of this page. You MUST also add replacement codes to your Hidden Image Tag. To save you some trouble, we\'ve provided two examples below. The first example is for Signup Tracking ( Membership Access ), and the second example is for Specific Post/Page Tracking. The variables are different, depending on which type of transaction you\'re tracking.</p>' . "\n";
169
  do_action ("ws_plugin__s2member_during_trk_ops_page_during_left_sections_during_idev", get_defined_vars ());
170
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
171
  echo '<p>' . highlight_string (file_get_contents (dirname (__FILE__) . "/code-samples/idev-signup-tracking-code.php"), true) . '</p>' . "\n";
@@ -191,7 +191,7 @@ if (apply_filters ("ws_plugin__s2member_during_trk_ops_page_during_left_sections
191
  echo '<h3>Integrating ShareASale® ( affiliate program management )</h3>' . "\n";
192
  echo '<a href="http://www.shareasale.com/merchantsignup.cfm" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/sas-logo.png" class="ws-menu-page-right" style="width:125px; height:125px; border:0;" alt="." /></a>' . "\n";
193
  echo '<p>Established in 2000, <a href="http://www.shareasale.com/merchantsignup.cfm" target="_blank" rel="external">ShareASale®</a> provides award winning technology and service; which will enable you to connect with a network of established affiliates, as well as recruit new ones. Joining ShareASale®, maximizes your ability to reach the greatest number of affiliates, with the least amount of work. At ShareASale®, you\'ll have access to an existing affiliate-base. You place your site on the market, and let their existing affiliates promote your products/services.</p>' . "\n";
194
- echo '<p>If you <a href="http://www.shareasale.com/merchantsignup.cfm" target="_blank" rel="external">become a Merchant at ShareASale®</a>, you will need to configure your <code>ShareASale® -> Sale Tracking</code>. Grab your Hidden Image Tag, and pop the code provided by ShareASale® into the Custom Tracking field at the top of this page. You MUST also add replacement codes to your Hidden Image Tag. To save you some trouble, we\'ve provided two examples below. The first example is for Signup Tracking ( Membership Access ), and the second example is for Specific Post/Page Tracking. The variables are different, depending on which type of transaction you\'re tracking.</p>' . "\n";
195
  do_action ("ws_plugin__s2member_during_trk_ops_page_during_left_sections_during_shareasale", get_defined_vars ());
196
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
197
  echo '<p>' . highlight_string (file_get_contents (dirname (__FILE__) . "/code-samples/sas-signup-tracking-code.php"), true) . '</p>' . "\n";
@@ -239,6 +239,7 @@ echo '<td class="ws-menu-page-table-r">' . "\n";
239
  do_action ("ws_plugin__s2member_during_trk_ops_page_before_right_sections", get_defined_vars ());
240
  do_action ("ws_plugin__s2member_during_menu_pages_before_right_sections", get_defined_vars ());
241
  /**/
 
242
  echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["installation"]) ? '<div class="ws-menu-page-installation"><a href="' . ws_plugin__s2member_parse_readme_value ("Professional Installation URI") . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-installation.png" alt="." /></a></div>' . "\n" : '';
243
  echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["tools"]) ? '<div class="ws-menu-page-tools"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-tools.png" alt="." /></div>' . "\n" : '';
244
  echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["support"]) ? '<div class="ws-menu-page-support"><a href="' . ws_plugin__s2member_parse_readme_value ("Forum URI") . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-support.png" alt="." /></a></div>' . "\n" : '';
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit("Do not access this file directly.");
16
  /*
17
  API Tracking page.
18
  */
62
  echo '<td>' . "\n";
63
  echo '<textarea name="ws_plugin__s2member_signup_tracking_codes" id="ws-plugin--s2member-signup-tracking-codes" rows="8" wrap="off" spellcheck="false" style="font-family:Consolas, monospace;">' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["signup_tracking_codes"]) . '</textarea><br />' . "\n";
64
  echo 'Any valid XHTML / JavaScript' . ((!$GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["is_multisite_farm"]) ? ' ( or even PHP )' : '') . ' code will work just fine here. Just try not to put anything here that would actually be visible to the Customer. Things like 1x1 pixel images that load up silently and/or JavaScript tracking routines will be fine. Google® Analytics code works just fine, AdSense® performance tracking, as well as Yahoo® tracking and other affiliate network codes are all OK here.<br /><br />' . "\n";
65
+ echo '<strong>You can also use these special Replacement Codes if you need them:</strong>' . "\n";
66
  echo '<ul>' . "\n";
67
  echo '<li><code>%%subscr_id%% = The PayPal® Subscription ID, which remains constant throughout any &amp; all future payments.</code> [ <a href="#" onclick="alert(\'There is one exception. If you are selling Lifetime or Fixed-Term ( non-recurring ) access, using a Buy It Now button; the %%subscr_id%% is actually set to the Transaction ID for the purchase.\\n\\nPayPal® does not provide a specific Subscription ID for Buy It Now purchases. Since Lifetime &amp; Fixed-Term Subscriptions are NOT recurring ( i.e. there is only ONE payment ), using the Transaction ID as the Subscription ID is a graceful way to deal with this minor conflict.\'); return false;">?</a> ]</li>' . "\n";
68
  echo '<li><code>%%initial%% = The Initial Fee charged during signup. If you offered a free trial, this will be 0.</code> [ <a href="#" onclick="alert(\'This will always represent the amount of money the Customer spent, whenever they initially signed up, no matter what. If a Customer signs up, under the terms of a free trial period, this will be 0.\'); return false;">?</a> ]</li>' . "\n";
77
  echo '<li><code>%%initial_term%% = This is the term length of the initial period. This will be a numeric value, followed by a space, then a single letter.</code> [ <a href="#" onclick="alert(\'Here are some examples:\\n\\n%%initial_term%% = 1 D ( this means 1 Day )\\n%%initial_term%% = 1 W ( this means 1 Week )\\n%%initial_term%% = 1 M ( this means 1 Month )\\n%%initial_term%% = 1 Y ( this means 1 Year )\\n\\nThe initial period never recurs, so this only lasts for the term length specified, then it is over. If no initial period was even offered, the value of %%initial_term%% will just be: 0 D, meaning zero days.\'); return false;">?</a> ]</li>' . "\n";
78
  echo '<li><code>%%regular_term%% = This is the term length of the regular period. This will be a numeric value, followed by a space, then a single letter.</code> [ <a href="#" onclick="alert(\'Here are some examples:\\n\\n%%regular_term%% = 1 D ( this means 1 Day )\\n%%regular_term%% = 1 W ( this means 1 Week )\\n%%regular_term%% = 1 M ( this means 1 Month )\\n%%regular_term%% = 1 Y ( this means 1 Year )\\n%%regular_term%% = 1 L ( this means 1 Lifetime )\\n\\nThe regular term is usually recurring. So the regular term value represents the period ( or duration ) of each recurring period. If %%recurring%% = 0, then the regular term only applies once, because it is not recurring. So if it is not recurring, the value of %%regular_term%% simply represents how long their membership privileges are going to last after the %%initial_term%% has expired, if there was an initial term. The value of this variable ( %%regular_term%% ) will never be empty, it will always be at least: 1 D, meaning 1 day. No exceptions.\'); return false;">?</a> ]</li>' . "\n";
79
  echo '</ul>' . "\n";
80
+ echo '<strong>Custom Replacement Codes can also be inserted using these instructions:</strong>' . "\n";
81
  echo '<ul>' . "\n";
82
+ echo '<li><code>%%cv0%% = The domain of your site, which is passed through to PayPal® using the `custom` attribute in your PayPal® Shortcode.</code></li>' . "\n";
83
+ echo '<li><code>%%cv1%% = If you need to track additional custom variables, you can pipe delimit them into the `custom` attribute, inside your Shortcode, like this: custom="' . $_SERVER["HTTP_HOST"] . '|cv1|cv2|cv3". You can have an unlimited number of custom variables that track IP addresses, affiliate IDs, etc. In some cases you may need to use PHP code to insert a value into the custom field dynamically. Obviously this is for advanced webmasters, but the functionality has been made available for those who need it.</code></li>' . "\n";
84
  echo '</ul>' . "\n";
85
  echo '<strong>This example uses cv1 to track a User\'s IP address:</strong><br />' . "\n";
86
  echo '<em>( The IP address could be referenced in your Tracking Code using %%cv1%% )</em><br />' . "\n";
87
+ echo '<code>custom="' . $_SERVER["HTTP_HOST"] . '|&lt;?php echo $_SERVER["REMOTE_ADDR"]; ?&gt;"</code>' . "\n";
88
  echo '</td>' . "\n";
89
  /**/
90
  echo '</tr>' . "\n";
124
  echo '<td>' . "\n";
125
  echo '<textarea name="ws_plugin__s2member_sp_tracking_codes" id="ws-plugin--s2member-sp-tracking-codes" rows="8" wrap="off" spellcheck="false" style="font-family:Consolas, monospace;">' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_tracking_codes"]) . '</textarea><br />' . "\n";
126
  echo 'Any valid XHTML / JavaScript' . ((!$GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["is_multisite_farm"]) ? ' ( or even PHP )' : '') . ' code will work just fine here. Just try not to put anything here that would actually be visible to the Customer. Things like 1x1 pixel images that load up silently and/or JavaScript tracking routines will be fine. Google® Analytics code works just fine, AdSense® performance tracking, as well as Yahoo® tracking and other affiliate network codes are all OK here.<br /><br />' . "\n";
127
+ echo '<strong>You can also use these special Replacement Codes if you need them:</strong>' . "\n";
128
  echo '<ul>' . "\n";
129
  echo '<li><code>%%txn_id%% = The PayPal® Transaction ID. PayPal® assigns a unique identifier for every purchase.</code></li>' . "\n";
130
  echo '<li><code>%%amount%% = The full Amount that you charged for Specific Post/Page Access. This value will always be > 0.</code></li>' . "\n";
135
  echo '<li><code>%%item_number%% = The Item Number. Ex: <em>sp:13,24,36:72</em> ( translates to: <em>sp:comma-delimited IDs:expiration hours</em> ).</code></li>' . "\n";
136
  echo '<li><code>%%item_name%% = The Item Name. In other words, a brief description, detailing what this purchase was for.</code></li>' . "\n";
137
  echo '</ul>' . "\n";
138
+ echo '<strong>Custom Replacement Codes can also be inserted using these instructions:</strong>' . "\n";
139
  echo '<ul>' . "\n";
140
+ echo '<li><code>%%cv0%% = The domain of your site, which is passed through to PayPal® using the `custom` attribute in your PayPal® Shortcode.</code></li>' . "\n";
141
+ echo '<li><code>%%cv1%% = If you need to track additional custom variables, you can pipe delimit them into the `custom` attribute, inside your Shortcode, like this: custom="' . $_SERVER["HTTP_HOST"] . '|cv1|cv2|cv3". You can have an unlimited number of custom variables that track IP addresses, affiliate IDs, etc. In some cases you may need to use PHP code to insert a value into the custom field dynamically. Obviously this is for advanced webmasters, but the functionality has been made available for those who need it.</code></li>' . "\n";
142
  echo '</ul>' . "\n";
143
  echo '<strong>This example uses cv1 to track a User\'s IP address:</strong><br />' . "\n";
144
  echo '<em>( The IP address could be referenced in your Tracking Code using %%cv1%% )</em><br />' . "\n";
145
+ echo '<code>custom="' . $_SERVER["HTTP_HOST"] . '|&lt;?php echo $_SERVER["REMOTE_ADDR"]; ?&gt;"</code>' . "\n";
146
  echo '</td>' . "\n";
147
  /**/
148
  echo '</tr>' . "\n";
165
  echo '<h3>Integrating iDevAffiliate® ( affiliate program management )</h3>' . "\n";
166
  echo '<a href="http://www.idevdirect.com/14200.html" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/idev-logo.gif" class="ws-menu-page-right" style="width:125px; height:125px; border:0;" alt="." /></a>' . "\n";
167
  echo '<p>Adding affiliate tracking software to your site is one of the most effective ways to achieve more sales, more traffic, and more search engine ranking. <a href="http://www.idevdirect.com/14200.html" target="_blank" rel="external">iDevAffiliate®</a> ( an affiliate management portal ), installs in just minutes, and can be integrated seamlessly with s2Member. We recommend <a href="http://www.idevdirect.com/14200.html" target="_blank" rel="external">iDevAffiliate® Standard</a> ( $99 ) because of its proven track record, and its ability to integrate with s2Member using a variety of techniques. The most popular being a Hidden Image Tag.</p>' . "\n";
168
+ echo '<p>If you choose to <a href="http://www.idevdirect.com/14200.html" target="_blank" rel="external">install iDevAffiliate®</a>, you will need to configure your <code>iDevAffiliate® -> Shopping Cart Integration</code>. Please choose <code>Generic Tracking Pixel</code>. Then, grab your Hidden Image Tag, and pop the code provided by iDevAffiliate® into the Custom Tracking field at the top of this page. You MUST also add Replacement Codes to your Hidden Image Tag. To save you some trouble, we\'ve provided two examples below. The first example is for Signup Tracking ( Membership Access ), and the second example is for Specific Post/Page Tracking. The variables are different, depending on which type of transaction you\'re tracking.</p>' . "\n";
169
  do_action ("ws_plugin__s2member_during_trk_ops_page_during_left_sections_during_idev", get_defined_vars ());
170
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
171
  echo '<p>' . highlight_string (file_get_contents (dirname (__FILE__) . "/code-samples/idev-signup-tracking-code.php"), true) . '</p>' . "\n";
191
  echo '<h3>Integrating ShareASale® ( affiliate program management )</h3>' . "\n";
192
  echo '<a href="http://www.shareasale.com/merchantsignup.cfm" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/sas-logo.png" class="ws-menu-page-right" style="width:125px; height:125px; border:0;" alt="." /></a>' . "\n";
193
  echo '<p>Established in 2000, <a href="http://www.shareasale.com/merchantsignup.cfm" target="_blank" rel="external">ShareASale®</a> provides award winning technology and service; which will enable you to connect with a network of established affiliates, as well as recruit new ones. Joining ShareASale®, maximizes your ability to reach the greatest number of affiliates, with the least amount of work. At ShareASale®, you\'ll have access to an existing affiliate-base. You place your site on the market, and let their existing affiliates promote your products/services.</p>' . "\n";
194
+ echo '<p>If you <a href="http://www.shareasale.com/merchantsignup.cfm" target="_blank" rel="external">become a Merchant at ShareASale®</a>, you will need to configure your <code>ShareASale® -> Sale Tracking</code>. Grab your Hidden Image Tag, and pop the code provided by ShareASale® into the Custom Tracking field at the top of this page. You MUST also add Replacement Codes to your Hidden Image Tag. To save you some trouble, we\'ve provided two examples below. The first example is for Signup Tracking ( Membership Access ), and the second example is for Specific Post/Page Tracking. The variables are different, depending on which type of transaction you\'re tracking.</p>' . "\n";
195
  do_action ("ws_plugin__s2member_during_trk_ops_page_during_left_sections_during_shareasale", get_defined_vars ());
196
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
197
  echo '<p>' . highlight_string (file_get_contents (dirname (__FILE__) . "/code-samples/sas-signup-tracking-code.php"), true) . '</p>' . "\n";
239
  do_action ("ws_plugin__s2member_during_trk_ops_page_before_right_sections", get_defined_vars ());
240
  do_action ("ws_plugin__s2member_during_menu_pages_before_right_sections", get_defined_vars ());
241
  /**/
242
+ echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["upsell-pro"]) ? '<div class="ws-menu-page-others"><a href="' . ws_plugin__s2member_parse_readme_value ("Pro Module / Licensing") . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-upsell-pro.png" alt="." /></a></div>' . "\n" : '';
243
  echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["installation"]) ? '<div class="ws-menu-page-installation"><a href="' . ws_plugin__s2member_parse_readme_value ("Professional Installation URI") . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-installation.png" alt="." /></a></div>' . "\n" : '';
244
  echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["tools"]) ? '<div class="ws-menu-page-tools"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-tools.png" alt="." /></div>' . "\n" : '';
245
  echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"]["support"]) ? '<div class="ws-menu-page-support"><a href="' . ws_plugin__s2member_parse_readme_value ("Forum URI") . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-support.png" alt="." /></a></div>' . "\n" : '';
includes/profile.inc.php CHANGED
@@ -12,12 +12,13 @@ If not, see: <http://www.gnu.org/licenses/>.
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit;
16
  /*
17
  Referenced by: /?s2member_profile=1
18
  See: s2Member -> API Scripting -> PHP Constants
19
  S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL
20
  */
 
21
  $current_user = wp_get_current_user (); /* Current user. */
22
  /**/
23
  echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\n";
@@ -31,7 +32,7 @@ echo '<script type="text/javascript" src="' . get_bloginfo ("url") . '/?ws_plugi
31
  echo '<title>My Profile</title>' . "\n";
32
  echo '</head>' . "\n";
33
  /**/
34
- echo '<body style="background:#EEEEEE; color:#333333; font-family:verdana; font-size:13px;">' . "\n";
35
  /**/
36
  echo '<form method="post" name="ws_plugin__s2member_profile" id="ws-plugin--s2member-profile">' . "\n";
37
  /**/
@@ -68,7 +69,7 @@ if (apply_filters ("ws_plugin__s2member_during_profile_during_fields_display_ema
68
  echo '<td>' . "\n";
69
  echo '<label>' . "\n";
70
  echo '<strong>Email Address *</strong><br />' . "\n";
71
- echo '<input aria-required="true" type="text" maxlength="100" name="ws_plugin__s2member_profile_email" id="ws-plugin--s2member-profile-email" style="width:99%;" value="' . format_to_edit ($current_user->user_email) . '" />' . "\n";
72
  echo '</label>' . "\n";
73
  echo '</td>' . "\n";
74
  echo '</tr>' . "\n";
@@ -84,7 +85,7 @@ if (apply_filters ("ws_plugin__s2member_during_profile_during_fields_display_fir
84
  echo '<td>' . "\n";
85
  echo '<label>' . "\n";
86
  echo '<strong>First Name *</strong><br />' . "\n";
87
- echo '<input aria-required="true" type="text" maxlength="100" name="ws_plugin__s2member_profile_first_name" id="ws-plugin--s2member-profile-first-name" style="width:99%;" value="' . format_to_edit ($current_user->user_firstname) . '" />' . "\n";
88
  echo '</label>' . "\n";
89
  echo '</td>' . "\n";
90
  echo '</tr>' . "\n";
@@ -100,7 +101,7 @@ if (apply_filters ("ws_plugin__s2member_during_profile_during_fields_display_las
100
  echo '<td>' . "\n";
101
  echo '<label>' . "\n";
102
  echo '<strong>Last Name *</strong><br />' . "\n";
103
- echo '<input aria-required="true" type="text" maxlength="100" name="ws_plugin__s2member_profile_last_name" id="ws-plugin--s2member-profile-last-name" style="width:99%;" value="' . format_to_edit ($current_user->user_lastname) . '" />' . "\n";
104
  echo '</label>' . "\n";
105
  echo '</td>' . "\n";
106
  echo '</tr>' . "\n";
@@ -123,15 +124,20 @@ if (apply_filters ("ws_plugin__s2member_during_profile_during_fields_display_cus
123
  {
124
  do_action ("ws_plugin__s2member_during_profile_during_fields_during_custom_fields_before", get_defined_vars ());
125
  /**/
126
- echo '<tr>' . "\n";
127
- echo '<td>' . "\n";
128
- echo '<label>' . "\n";
129
- echo '<strong>' . esc_html ($field) . (($req) ? " *" : "") . '</strong><br />' . "\n";
130
- $field = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field));
131
- echo '<input' . $req . ' type="text" maxlength="100" name="ws_plugin__s2member_profile_' . esc_attr ($field) . '" id="ws-plugin--s2member-profile-' . esc_attr (preg_replace ("/_/", "-", $field)) . '" style="width:99%;" value="' . format_to_edit ($fields[$field]) . '" />' . "\n";
132
- echo '</label>' . "\n";
133
- echo '</td>' . "\n";
134
- echo '</tr>' . "\n";
 
 
 
 
 
135
  /**/
136
  do_action ("ws_plugin__s2member_during_profile_during_fields_during_custom_fields_after", get_defined_vars ());
137
  }
@@ -148,7 +154,7 @@ if (apply_filters ("ws_plugin__s2member_during_profile_during_fields_display_pas
148
  echo '<td>' . "\n";
149
  echo '<label>' . "\n";
150
  echo '<strong>New Password</strong> ( only if you want to change it )<br />' . "\n";
151
- echo '<input type="password" maxlength="100" autocomplete="off" name="ws_plugin__s2member_profile_password" id="ws-plugin--s2member-profile-password" style="width:99%;" value="" />' . "\n";
152
  echo '</label>' . "\n";
153
  echo '</td>' . "\n";
154
  echo '</tr>' . "\n";
@@ -160,7 +166,7 @@ do_action ("ws_plugin__s2member_during_profile_after_fields", get_defined_vars (
160
  /**/
161
  echo '<tr>' . "\n";
162
  echo '<td>' . "\n";
163
- echo '<input type="submit" value="Save Changes" />' . "\n";
164
  echo '</td>' . "\n";
165
  echo '</tr>' . "\n";
166
  /**/
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit("Do not access this file directly.");
16
  /*
17
  Referenced by: /?s2member_profile=1
18
  See: s2Member -> API Scripting -> PHP Constants
19
  S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL
20
  */
21
+ $tabindex = 0; /* Incremented tabindex starting with 0. */
22
  $current_user = wp_get_current_user (); /* Current user. */
23
  /**/
24
  echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\n";
32
  echo '<title>My Profile</title>' . "\n";
33
  echo '</head>' . "\n";
34
  /**/
35
+ echo '<body style="background:#FFFFFF; color:#333333; font-family:\'Verdana\', sans-serif; font-size:13px;">' . "\n";
36
  /**/
37
  echo '<form method="post" name="ws_plugin__s2member_profile" id="ws-plugin--s2member-profile">' . "\n";
38
  /**/
69
  echo '<td>' . "\n";
70
  echo '<label>' . "\n";
71
  echo '<strong>Email Address *</strong><br />' . "\n";
72
+ echo '<input aria-required="true" type="text" maxlength="100" name="ws_plugin__s2member_profile_email" id="ws-plugin--s2member-profile-email" style="width:99%;" value="' . format_to_edit ($current_user->user_email) . '" tabindex="' . esc_attr (($tabindex = $tabindex + 10)) . '" />' . "\n";
73
  echo '</label>' . "\n";
74
  echo '</td>' . "\n";
75
  echo '</tr>' . "\n";
85
  echo '<td>' . "\n";
86
  echo '<label>' . "\n";
87
  echo '<strong>First Name *</strong><br />' . "\n";
88
+ echo '<input aria-required="true" type="text" maxlength="100" name="ws_plugin__s2member_profile_first_name" id="ws-plugin--s2member-profile-first-name" style="width:99%;" value="' . format_to_edit ($current_user->user_firstname) . '" tabindex="' . esc_attr (($tabindex = $tabindex + 10)) . '" />' . "\n";
89
  echo '</label>' . "\n";
90
  echo '</td>' . "\n";
91
  echo '</tr>' . "\n";
101
  echo '<td>' . "\n";
102
  echo '<label>' . "\n";
103
  echo '<strong>Last Name *</strong><br />' . "\n";
104
+ echo '<input aria-required="true" type="text" maxlength="100" name="ws_plugin__s2member_profile_last_name" id="ws-plugin--s2member-profile-last-name" style="width:99%;" value="' . format_to_edit ($current_user->user_lastname) . '" tabindex="' . esc_attr (($tabindex = $tabindex + 10)) . '" />' . "\n";
105
  echo '</label>' . "\n";
106
  echo '</td>' . "\n";
107
  echo '</tr>' . "\n";
124
  {
125
  do_action ("ws_plugin__s2member_during_profile_during_fields_during_custom_fields_before", get_defined_vars ());
126
  /**/
127
+ $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field));
128
+ $field_id_class = preg_replace ("/_/", "-", $field_var);
129
+ /**/
130
+ if (apply_filters ("ws_plugin__s2member_during_profile_during_fields_during_custom_fields_display", true, get_defined_vars ()))
131
+ {
132
+ echo '<tr>' . "\n";
133
+ echo '<td>' . "\n";
134
+ echo '<label>' . "\n";
135
+ echo '<strong>' . esc_html ($field) . (($req) ? " *" : "") . '</strong><br />' . "\n";
136
+ echo '<input' . $req . ' type="text" maxlength="100" name="ws_plugin__s2member_profile_' . $field_var . '" id="ws-plugin--s2member-profile-' . $field_id_class . '" style="width:99%;" value="' . format_to_edit ($fields[$field_var]) . '" tabindex="' . esc_attr (($tabindex = $tabindex + 10)) . '" />' . "\n";
137
+ echo '</label>' . "\n";
138
+ echo '</td>' . "\n";
139
+ echo '</tr>' . "\n";
140
+ }
141
  /**/
142
  do_action ("ws_plugin__s2member_during_profile_during_fields_during_custom_fields_after", get_defined_vars ());
143
  }
154
  echo '<td>' . "\n";
155
  echo '<label>' . "\n";
156
  echo '<strong>New Password</strong> ( only if you want to change it )<br />' . "\n";
157
+ echo '<input type="password" maxlength="100" autocomplete="off" name="ws_plugin__s2member_profile_password" id="ws-plugin--s2member-profile-password" style="width:99%;" value="" tabindex="' . esc_attr (($tabindex = $tabindex + 10)) . '"' . (($current_user->user_login === "demo") ? ' disabled="disabled"' : '') . ' />' . "\n";
158
  echo '</label>' . "\n";
159
  echo '</td>' . "\n";
160
  echo '</tr>' . "\n";
166
  /**/
167
  echo '<tr>' . "\n";
168
  echo '<td>' . "\n";
169
+ echo '<input type="submit" value="Save Changes" tabindex="' . esc_attr (($tabindex = $tabindex + 10)) . '" />' . "\n";
170
  echo '</td>' . "\n";
171
  echo '</tr>' . "\n";
172
  /**/
includes/s2member-min.js DELETED
@@ -1 +0,0 @@
1
- "%%globals%%";jQuery(document).ready(function(a){s2member_unique_files_downloaded=[];if(S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER&&S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY<S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED){a("a[href*=s2member_file_download]").click(function(){if(!this.href.match(/s2member_free_file_download_key\=(.+)/)){var b="** Please Confirm This File Download **\n\n";b+="You've downloaded "+S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY+" file"+((S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY<1||S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY>1)?"s":"")+" in the last "+S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS+" days.\n\n";b+="You're entitled to "+((S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED)?"unlimited":S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED+" unique")+" downloads every "+S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS+" day period.\n\n";if(confirm(b)){if(a.inArray(this.href,s2member_unique_files_downloaded)===-1){s2member_unique_files_downloaded.push(this.href),S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY++}return true}else{return false}}else{var b="This is a FREE download for members.\n";b+="It does not count against your membership entitlement.\n\n";b+="~Enjoy~";if(confirm(b)){return true}else{return false}}})}if(location.href.match(/\/wp-login\.php/)){a("div#login > form#registerform").submit(function(){var b="",c="";a("input[aria-required=true]",this).each(function(){if(!a.trim(this.value)&&(c=a.trim(a(this).parent("label").text().replace(/\*/,"")))){b+="• ( "+c+" ) is a required field.\n"}});if(b=a.trim(b)){alert("Oops, you missed something:\n\n"+b);return false}return true})}if(location.href.match(/\/\?s2member_profile\=1/)){a("form#ws-plugin--s2member-profile").submit(function(){var b="",c="";a("input[aria-required=true]",this).each(function(){if(!a.trim(this.value)&&(c=a.trim(a("strong",a(this).parent("label")).text().replace(/\*/,"")))){b+="• ( "+c+" ) is a required field.\n"}});if(b=a.trim(b)){alert("Oops, you missed something:\n\n"+b);return false}return true})}});
 
includes/s2member.css ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright: © 2009 WebSharks, Inc. ( coded in the USA )
3
+ <mailto:support@websharks-inc.com> <http://www.websharks-inc.com/>
4
+
5
+ Released under the terms of the GNU General Public License.
6
+ You should have received a copy of the GNU General Public License,
7
+ along with this software. In the main directory, see: /licensing/
8
+ If not, see: <http://www.gnu.org/licenses/>.
9
+ */
10
+ /*
11
+ Global styles used by s2Member.
12
+ */
includes/s2member.js CHANGED
@@ -8,52 +8,43 @@ along with this software. In the main directory, see: /licensing/
8
  If not, see: <http://www.gnu.org/licenses/>.
9
  */
10
  /*
11
- Global variables, duplicated from PHP Contants.
12
  These are inserted dynamically.
13
  */
14
- '%%globals%%';
15
  /*
16
  Other scripting routines handled on document ready state.
 
 
17
  */
18
- jQuery(document).ready (function($)
19
  {
20
  /*
21
  Attach onclick handlers to download links.
22
  Members will need to confirm download processing.
23
  */
24
- s2member_unique_files_downloaded = []; /* Maintains real-time counts. */
25
  /* This is used in case a user downloads multiple files from a single page. */
26
  /**/
27
  if (S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER && S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY < S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED)
28
  {
29
- $('a[href*=s2member_file_download]').click (function()
30
  {
31
- if (!this.href.match (/s2member_free_file_download_key\=(.+)/))
32
  {
33
  var c = '** Please Confirm This File Download **\n\n';
34
- c += 'You\'ve downloaded ' + S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY + ' file' + ((S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY < 1 || S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY > 1) ? 's' : '') + ' in the last ' + S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS + ' days.\n\n';
35
- c += 'You\'re entitled to ' + ((S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED) ? 'unlimited' : S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED + ' unique') + ' downloads every ' + S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS + ' day period.\n\n';
36
  /**/
37
- if (confirm(c)) /* Force the user to confirm before we allow processing. */
38
  {
39
- if ($.inArray (this.href, s2member_unique_files_downloaded) === -1) /* Real-time counting. */
40
- s2member_unique_files_downloaded.push (this.href), S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY++;
41
  return true; /* Allow processing. */
42
  }
43
  else /* Do not process. */
44
  return false;
45
  }
46
- else /* Else relax the user, this is free. */
47
- {
48
- var c = 'This is a FREE download for members.\n';
49
- c += 'It does not count against your membership entitlement.\n\n';
50
- c += '~Enjoy~';
51
- /**/
52
- if (confirm(c))
53
- return true;
54
- else /* ? */
55
- return false;
56
- }
57
  });
58
  }
59
  /*
@@ -61,19 +52,19 @@ jQuery(document).ready (function($)
61
  */
62
  if (location.href.match (/\/wp-login\.php/))
63
  /**/
64
- $('div#login > form#registerform').submit (function()
65
  {
66
  var fieldErrors = '', fieldLabel = '';
67
  /**/
68
- $('input[aria-required=true]', this).each (function()
69
  {
70
- if (!$.trim (this.value) && (fieldLabel = $.trim ($(this).parent ('label').text ().replace (/\*/, ''))))
71
- fieldErrors += '• ( ' + fieldLabel + ' ) is a required field.\n';
72
  });
73
  /**/
74
  if (fieldErrors = $.trim (fieldErrors))
75
  {
76
- alert('Oops, you missed something:\n\n' + fieldErrors);
77
  return false;
78
  }
79
  /**/
@@ -84,19 +75,19 @@ jQuery(document).ready (function($)
84
  */
85
  if (location.href.match (/\/\?s2member_profile\=1/))
86
  /**/
87
- $('form#ws-plugin--s2member-profile').submit (function()
88
  {
89
  var fieldErrors = '', fieldLabel = '';
90
  /**/
91
- $('input[aria-required=true]', this).each (function()
92
  {
93
- if (!$.trim (this.value) && (fieldLabel = $.trim ($('strong', $(this).parent ('label')).text ().replace (/\*/, ''))))
94
- fieldErrors += '• ( ' + fieldLabel + ' ) is a required field.\n';
95
  });
96
  /**/
97
  if (fieldErrors = $.trim (fieldErrors))
98
  {
99
- alert('Oops, you missed something:\n\n' + fieldErrors);
100
  return false;
101
  }
102
  /**/
8
  If not, see: <http://www.gnu.org/licenses/>.
9
  */
10
  /*
11
+ Global variables, duplicated from PHP / API Constants.
12
  These are inserted dynamically.
13
  */
14
+ <?php echo $g; ?>
15
  /*
16
  Other scripting routines handled on document ready state.
17
+ Note: There is only one global variable here ( no conflicts ).
18
+ ws_plugin__s2member_unique_files_downloaded
19
  */
20
+ jQuery (document).ready (function($)
21
  {
22
  /*
23
  Attach onclick handlers to download links.
24
  Members will need to confirm download processing.
25
  */
26
+ ws_plugin__s2member_unique_files_downloaded = []; /* Maintains real-time counts. */
27
  /* This is used in case a user downloads multiple files from a single page. */
28
  /**/
29
  if (S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER && S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY < S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED)
30
  {
31
+ $ ('a[href*=s2member_file_download]').click (function()
32
  {
33
+ if (!this.href.match (/file_download_key\=(.+)/)) /* ~Only for links with NO key. */
34
  {
35
  var c = '** Please Confirm This File Download **\n\n';
36
+ c += 'You\'ve downloaded ' + S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY + ' protected file' + ( (S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY < 1 || S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY > 1) ? 's' : '') + ' in the last ' + S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS + ' days.\n\n';
37
+ c += 'You\'re entitled to ' + ( (S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED) ? 'UNLIMITED downloads though ( so, no worries ).' : S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED + ' unique downloads every ' + S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS + ' day period.');
38
  /**/
39
+ if (confirm (c)) /* Force the user to confirm before we allow processing. */
40
  {
41
+ if ($.inArray (this.href, ws_plugin__s2member_unique_files_downloaded) === -1) /* Real-time counting. */
42
+ ws_plugin__s2member_unique_files_downloaded.push (this.href), S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY++;
43
  return true; /* Allow processing. */
44
  }
45
  else /* Do not process. */
46
  return false;
47
  }
 
 
 
 
 
 
 
 
 
 
 
48
  });
49
  }
50
  /*
52
  */
53
  if (location.href.match (/\/wp-login\.php/))
54
  /**/
55
+ $ ('div#login > form#registerform').submit (function()
56
  {
57
  var fieldErrors = '', fieldLabel = '';
58
  /**/
59
+ $ (':input[aria-required=true]', this).each (function()
60
  {
61
+ if (!$.trim ($ (this).val ()) && (fieldLabel = $.trim ($.trim ($ (this).parent ('label').html ()).split (/[\r\n\t\<]+/, 1)[0].replace (/\*/, ''))))
62
+ fieldErrors += '• ' + fieldLabel + '\n'; /* Required fields. */
63
  });
64
  /**/
65
  if (fieldErrors = $.trim (fieldErrors))
66
  {
67
+ alert ('Oops, you missed something:\n\n' + fieldErrors);
68
  return false;
69
  }
70
  /**/
75
  */
76
  if (location.href.match (/\/\?s2member_profile\=1/))
77
  /**/
78
+ $ ('form#ws-plugin--s2member-profile').submit (function()
79
  {
80
  var fieldErrors = '', fieldLabel = '';
81
  /**/
82
+ $ (':input[aria-required=true]', this).each (function()
83
  {
84
+ if (!$.trim ($ (this).val ()) && (fieldLabel = $.trim ($.trim ($ ('strong', $ (this).parent ('label')).html ()).split (/[\r\n\t\<]+/, 1)[0].replace (/\*/, ''))))
85
+ fieldErrors += '• ' + fieldLabel + '\n'; /* Required fields. */
86
  });
87
  /**/
88
  if (fieldErrors = $.trim (fieldErrors))
89
  {
90
+ alert ('Oops, you missed something:\n\n' + fieldErrors);
91
  return false;
92
  }
93
  /**/
includes/syscon.inc.php CHANGED
@@ -16,12 +16,7 @@ WARNING: This is a system configuration file, please DO NOT EDIT this file direc
16
  Direct access denial.
17
  */
18
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
19
- exit;
20
- /*
21
- Configure the version for this release.
22
- */
23
- $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["version"] = "3.0.4"; /* Since 3.0. */
24
- define ("WS_PLUGIN__S2MEMBER_VERSION", $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["version"]);
25
  /*
26
  Detect if this is WordPress® with Multisite/Networking.
27
  */
@@ -44,11 +39,7 @@ $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"] = get_option ("ws_plugin__s2me
44
  /*
45
  Configure the right menu options panel for this software.
46
  */
47
- $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"] = array ("installation" => true, "tools" => true, "support" => true, "donations" => true);
48
- /*
49
- Configure the file modification time for the syscon.inc.php file.
50
- */
51
- $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["filemtime"] = filemtime (__FILE__);
52
  /*
53
  Configure the directory for files protected by this plugin.
54
  */
@@ -58,9 +49,13 @@ Configure the directory for logs protected by this plugin.
58
  */
59
  $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"] = dirname (dirname (__FILE__)) . "-logs";
60
  /*
 
 
 
 
61
  Configure & validate all of the plugin options; and set their defaults.
62
  */
63
- function ws_plugin__s2member_configure_options_and_their_defaults ($options = FALSE) /* Can also be used to merge options with defaults. */
64
  {
65
  /* Here we build the default options array, which will be merged with the user options.
66
  It is important to note that sometimes default options may not or should not be pre-filled on an options form.
@@ -83,7 +78,7 @@ function ws_plugin__s2member_configure_options_and_their_defaults ($options = FA
83
  "custom_reg_opt_in" => "1", /* Use a Double Opt-In Checkbox on the Registration Form? */
84
  "custom_reg_opt_in_label" => "Yes, I want to receive updates via email.", /* Label. */
85
  /**/
86
- "allow_subscribers_in" => "0", /* Allow Subscribers to access the Login Welcome Page? */
87
  "force_admin_lockouts" => "0", /* Redirects admin Pages/Profile to the Login Welcome Page. */
88
  /**/
89
  "login_welcome_page" => "", /* Defaults to the Home Page. */
@@ -138,16 +133,19 @@ function ws_plugin__s2member_configure_options_and_their_defaults ($options = FA
138
  "ref_rev_notification_urls" => "", /* s2Member Ref/rev Notification urls. */
139
  "sp_notification_urls" => "", /* s2Member Specific Post/Page Notification urls. */
140
  /**/
 
141
  "level1_label" => "Bronze", /* This is just an initial generic Level Label. */
142
  "level2_label" => "Silver", /* This is just an initial generic Level Label. */
143
  "level3_label" => "Gold", /* This is just an initial generic Level Label. */
144
  "level4_label" => "Platinum", /* This is just an initial generic Level Label. */
145
  /**/
 
146
  "level1_file_downloads_allowed" => "", /* This should always be numeric or empty. */
147
  "level2_file_downloads_allowed" => "", /* This should always be numeric or empty. */
148
  "level3_file_downloads_allowed" => "", /* This should always be numeric or empty. */
149
  "level4_file_downloads_allowed" => "", /* This should always be numeric or empty. */
150
  /**/
 
151
  "level1_file_downloads_allowed_days" => "", /* This should be numeric or empty. */
152
  "level2_file_downloads_allowed_days" => "", /* This should be numeric or empty. */
153
  "level3_file_downloads_allowed_days" => "", /* This should be numeric or empty. */
@@ -156,26 +154,31 @@ function ws_plugin__s2member_configure_options_and_their_defaults ($options = FA
156
  "file_download_limit_exceeded_page" => "", /* Defaults to the Home Page. */
157
  "file_download_inline_extensions" => "", /* List of Extensions to serve Inline. */
158
  /**/
 
159
  "level1_ruris" => "", /* A line-delimited list of URIs, and/or URI fragments. */
160
  "level2_ruris" => "", /* A line-delimited list of URIs, and/or URI fragments. */
161
  "level3_ruris" => "", /* A line-delimited list of URIs, and/or URI fragments. */
162
  "level4_ruris" => "", /* A line-delimited list of URIs, and/or URI fragments. */
163
  /**/
 
164
  "level1_catgs" => "", /* A comma-delimited list of Category IDs to protect. */
165
  "level2_catgs" => "", /* A comma-delimited list of Category IDs to protect. */
166
  "level3_catgs" => "", /* A comma-delimited list of Category IDs to protect. */
167
  "level4_catgs" => "", /* A comma-delimited list of Category IDs to protect. */
168
  /**/
 
169
  "level1_ptags" => "", /* A comma-delimited list of Post/Page Tags to protect. */
170
  "level2_ptags" => "", /* A comma-delimited list of Post/Page Tags to protect. */
171
  "level3_ptags" => "", /* A comma-delimited list of Post/Page Tags to protect. */
172
  "level4_ptags" => "", /* A comma-delimited list of Post/Page Tags to protect. */
173
  /**/
 
174
  "level1_posts" => "", /* A comma-delimited list of Post IDs to protect. */
175
  "level2_posts" => "", /* A comma-delimited list of Post IDs to protect. */
176
  "level3_posts" => "", /* A comma-delimited list of Post IDs to protect. */
177
  "level4_posts" => "", /* A comma-delimited list of Post IDs to protect. */
178
  /**/
 
179
  "level1_pages" => "", /* A comma-delimited list of Page IDs to protect. */
180
  "level2_pages" => "", /* A comma-delimited list of Page IDs to protect. */
181
  "level3_pages" => "", /* A comma-delimited list of Page IDs to protect. */
@@ -226,8 +229,8 @@ function ws_plugin__s2member_configure_options_and_their_defaults ($options = FA
226
  foreach ($value as $k => $v)
227
  $value[$k] = trim (stripslashes ($v));
228
  /**/
229
- if (!isset ($default_options[$key]))
230
- unset($GLOBALS["WS_PLUGIN__"]["s2member"]["o"][$key]);
231
  /**/
232
  else if ($key === "options_version" && (!is_string ($value) || !is_numeric ($value)))
233
  $value = $default_options[$key];
@@ -358,22 +361,13 @@ function ws_plugin__s2member_configure_options_and_their_defaults ($options = FA
358
  else if ($key === "sp_notification_urls" && (!is_string ($value) || !strlen ($value)))
359
  $value = $default_options[$key];
360
  /**/
361
- else if ($key === "level1_label" && (!is_string ($value) || !strlen ($value)))
362
- $value = $default_options[$key];
363
- /**/
364
- else if ($key === "level2_label" && (!is_string ($value) || !strlen ($value)))
365
- $value = $default_options[$key];
366
- /**/
367
- else if ($key === "level3_label" && (!is_string ($value) || !strlen ($value)))
368
- $value = $default_options[$key];
369
- /**/
370
- else if ($key === "level4_label" && (!is_string ($value) || !strlen ($value)))
371
  $value = $default_options[$key];
372
  /**/
373
- else if (preg_match ("/^level[1-4]_file_downloads_allowed$/", $key) && (!is_string ($value) || !is_numeric ($value) || $value < 0))
374
  $value = $default_options[$key];
375
  /**/
376
- else if (preg_match ("/^level[1-4]_file_downloads_allowed_days$/", $key) && (!is_string ($value) || !is_numeric ($value) || $value < 0))
377
  $value = $default_options[$key];
378
  /**/
379
  else if ($key === "file_download_limit_exceeded_page" && (!is_string ($value) || !is_numeric ($value)))
@@ -382,19 +376,19 @@ function ws_plugin__s2member_configure_options_and_their_defaults ($options = FA
382
  else if ($key === "file_download_inline_extensions" && (!is_string ($value) || !($value = strtolower (preg_replace ("/\s+/", "", $value)))))
383
  $value = $default_options[$key];
384
  /**/
385
- else if (preg_match ("/^level[1-4]_ruris$/", $key) && (!is_string ($value) || !strlen ($value)))
386
  $value = $default_options[$key];
387
  /**/
388
- else if (preg_match ("/^level[1-4]_catgs$/", $key) && (!is_string ($value) || !($value = (($value === "all") ? $value : preg_replace ("/[^0-9,]/", "", $value)))))
389
  $value = $default_options[$key];
390
  /**/
391
- else if (preg_match ("/^level[1-4]_ptags$/", $key) && (!is_string ($value) || !($value = (($value === "all") ? $value : strtolower (preg_replace ("/( +)/", " ", trim (preg_replace ("/( *),( *)/", ",", $value))))))))
392
  $value = $default_options[$key];
393
  /**/
394
- else if (preg_match ("/^level[1-4]_posts$/", $key) && (!is_string ($value) || !($value = (($value === "all") ? $value : preg_replace ("/[^0-9,]/", "", $value)))))
395
  $value = $default_options[$key];
396
  /**/
397
- else if (preg_match ("/^level[1-4]_pages$/", $key) && (!is_string ($value) || !($value = (($value === "all") ? $value : preg_replace ("/[^0-9,]/", "", $value)))))
398
  $value = $default_options[$key];
399
  /**/
400
  else if ($key === "specific_ids" && (!is_string ($value) || !($value = preg_replace ("/[^0-9,]/", "", $value))))
@@ -418,5 +412,5 @@ function ws_plugin__s2member_configure_options_and_their_defaults ($options = FA
418
  return apply_filters ("ws_plugin__s2member_options", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]);
419
  }
420
  /**/
421
- call_user_func("ws_plugin__s2member_configure_options_and_their_defaults");
422
  ?>
16
  Direct access denial.
17
  */
18
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
19
+ exit ("Do not access this file directly.");
 
 
 
 
 
20
  /*
21
  Detect if this is WordPress® with Multisite/Networking.
22
  */
39
  /*
40
  Configure the right menu options panel for this software.
41
  */
42
+ $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"] = array ("upsell-pro" => true, "installation" => true, "tools" => true, "support" => true, "donations" => true);
 
 
 
 
43
  /*
44
  Configure the directory for files protected by this plugin.
45
  */
49
  */
50
  $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"] = dirname (dirname (__FILE__)) . "-logs";
51
  /*
52
+ Configure the file modification time for the syscon.inc.php file.
53
+ */
54
+ $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["filemtime"] = filemtime (__FILE__);
55
+ /*
56
  Configure & validate all of the plugin options; and set their defaults.
57
  */
58
+ function ws_plugin__s2member_configure_options_and_their_defaults ($options = FALSE)
59
  {
60
  /* Here we build the default options array, which will be merged with the user options.
61
  It is important to note that sometimes default options may not or should not be pre-filled on an options form.
78
  "custom_reg_opt_in" => "1", /* Use a Double Opt-In Checkbox on the Registration Form? */
79
  "custom_reg_opt_in_label" => "Yes, I want to receive updates via email.", /* Label. */
80
  /**/
81
+ "allow_subscribers_in" => "0", /* Allow Subscribers to register for absolutely free access? */
82
  "force_admin_lockouts" => "0", /* Redirects admin Pages/Profile to the Login Welcome Page. */
83
  /**/
84
  "login_welcome_page" => "", /* Defaults to the Home Page. */
133
  "ref_rev_notification_urls" => "", /* s2Member Ref/rev Notification urls. */
134
  "sp_notification_urls" => "", /* s2Member Specific Post/Page Notification urls. */
135
  /**/
136
+ "level0_label" => "Free", /* This is just an initial generic Level Label. */
137
  "level1_label" => "Bronze", /* This is just an initial generic Level Label. */
138
  "level2_label" => "Silver", /* This is just an initial generic Level Label. */
139
  "level3_label" => "Gold", /* This is just an initial generic Level Label. */
140
  "level4_label" => "Platinum", /* This is just an initial generic Level Label. */
141
  /**/
142
+ "level0_file_downloads_allowed" => "", /* This should always be numeric or empty. */
143
  "level1_file_downloads_allowed" => "", /* This should always be numeric or empty. */
144
  "level2_file_downloads_allowed" => "", /* This should always be numeric or empty. */
145
  "level3_file_downloads_allowed" => "", /* This should always be numeric or empty. */
146
  "level4_file_downloads_allowed" => "", /* This should always be numeric or empty. */
147
  /**/
148
+ "level0_file_downloads_allowed_days" => "", /* This should be numeric or empty. */
149
  "level1_file_downloads_allowed_days" => "", /* This should be numeric or empty. */
150
  "level2_file_downloads_allowed_days" => "", /* This should be numeric or empty. */
151
  "level3_file_downloads_allowed_days" => "", /* This should be numeric or empty. */
154
  "file_download_limit_exceeded_page" => "", /* Defaults to the Home Page. */
155
  "file_download_inline_extensions" => "", /* List of Extensions to serve Inline. */
156
  /**/
157
+ "level0_ruris" => "", /* A line-delimited list of URIs, and/or URI fragments. */
158
  "level1_ruris" => "", /* A line-delimited list of URIs, and/or URI fragments. */
159
  "level2_ruris" => "", /* A line-delimited list of URIs, and/or URI fragments. */
160
  "level3_ruris" => "", /* A line-delimited list of URIs, and/or URI fragments. */
161
  "level4_ruris" => "", /* A line-delimited list of URIs, and/or URI fragments. */
162
  /**/
163
+ "level0_catgs" => "", /* A comma-delimited list of Category IDs to protect. */
164
  "level1_catgs" => "", /* A comma-delimited list of Category IDs to protect. */
165
  "level2_catgs" => "", /* A comma-delimited list of Category IDs to protect. */
166
  "level3_catgs" => "", /* A comma-delimited list of Category IDs to protect. */
167
  "level4_catgs" => "", /* A comma-delimited list of Category IDs to protect. */
168
  /**/
169
+ "level0_ptags" => "", /* A comma-delimited list of Post/Page Tags to protect. */
170
  "level1_ptags" => "", /* A comma-delimited list of Post/Page Tags to protect. */
171
  "level2_ptags" => "", /* A comma-delimited list of Post/Page Tags to protect. */
172
  "level3_ptags" => "", /* A comma-delimited list of Post/Page Tags to protect. */
173
  "level4_ptags" => "", /* A comma-delimited list of Post/Page Tags to protect. */
174
  /**/
175
+ "level0_posts" => "", /* A comma-delimited list of Post IDs to protect. */
176
  "level1_posts" => "", /* A comma-delimited list of Post IDs to protect. */
177
  "level2_posts" => "", /* A comma-delimited list of Post IDs to protect. */
178
  "level3_posts" => "", /* A comma-delimited list of Post IDs to protect. */
179
  "level4_posts" => "", /* A comma-delimited list of Post IDs to protect. */
180
  /**/
181
+ "level0_pages" => "", /* A comma-delimited list of Page IDs to protect. */
182
  "level1_pages" => "", /* A comma-delimited list of Page IDs to protect. */
183
  "level2_pages" => "", /* A comma-delimited list of Page IDs to protect. */
184
  "level3_pages" => "", /* A comma-delimited list of Page IDs to protect. */
229
  foreach ($value as $k => $v)
230
  $value[$k] = trim (stripslashes ($v));
231
  /**/
232
+ if (!isset ($default_options[$key]) && !preg_match ("/^pro_/", $key))
233
+ unset ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"][$key]);
234
  /**/
235
  else if ($key === "options_version" && (!is_string ($value) || !is_numeric ($value)))
236
  $value = $default_options[$key];
361
  else if ($key === "sp_notification_urls" && (!is_string ($value) || !strlen ($value)))
362
  $value = $default_options[$key];
363
  /**/
364
+ else if (preg_match ("/^level[0-4]_label$/", $key) && (!is_string ($value) || !strlen ($value)))
 
 
 
 
 
 
 
 
 
365
  $value = $default_options[$key];
366
  /**/
367
+ else if (preg_match ("/^level[0-4]_file_downloads_allowed$/", $key) && (!is_string ($value) || !is_numeric ($value) || $value < 0))
368
  $value = $default_options[$key];
369
  /**/
370
+ else if (preg_match ("/^level[0-4]_file_downloads_allowed_days$/", $key) && (!is_string ($value) || !is_numeric ($value) || $value < 0))
371
  $value = $default_options[$key];
372
  /**/
373
  else if ($key === "file_download_limit_exceeded_page" && (!is_string ($value) || !is_numeric ($value)))
376
  else if ($key === "file_download_inline_extensions" && (!is_string ($value) || !($value = strtolower (preg_replace ("/\s+/", "", $value)))))
377
  $value = $default_options[$key];
378
  /**/
379
+ else if (preg_match ("/^level[0-4]_ruris$/", $key) && (!is_string ($value) || !strlen ($value)))
380
  $value = $default_options[$key];
381
  /**/
382
+ else if (preg_match ("/^level[0-4]_catgs$/", $key) && (!is_string ($value) || !($value = (($value === "all") ? $value : preg_replace ("/[^0-9,]/", "", $value)))))
383
  $value = $default_options[$key];
384
  /**/
385
+ else if (preg_match ("/^level[0-4]_ptags$/", $key) && (!is_string ($value) || !($value = (($value === "all") ? $value : strtolower (preg_replace ("/( +)/", " ", trim (preg_replace ("/( *),( *)/", ",", $value))))))))
386
  $value = $default_options[$key];
387
  /**/
388
+ else if (preg_match ("/^level[0-4]_posts$/", $key) && (!is_string ($value) || !($value = (($value === "all") ? $value : preg_replace ("/[^0-9,]/", "", $value)))))
389
  $value = $default_options[$key];
390
  /**/
391
+ else if (preg_match ("/^level[0-4]_pages$/", $key) && (!is_string ($value) || !($value = (($value === "all") ? $value : preg_replace ("/[^0-9,]/", "", $value)))))
392
  $value = $default_options[$key];
393
  /**/
394
  else if ($key === "specific_ids" && (!is_string ($value) || !($value = preg_replace ("/[^0-9,]/", "", $value))))
412
  return apply_filters ("ws_plugin__s2member_options", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]);
413
  }
414
  /**/
415
+ call_user_func ("ws_plugin__s2member_configure_options_and_their_defaults");
416
  ?>
includes/templates/buttons/{c-button.html → paypal-cancellation-button.html} RENAMED
File without changes
includes/templates/buttons/{button.html → paypal-checkout-button.html} RENAMED
@@ -12,7 +12,7 @@
12
  <input type="hidden" name="custom" value="%%domain%%" />
13
  <input type="hidden" name="currency_code" value="USD" />
14
  <input type="hidden" name="page_style" value="paypal" />
15
- <input type="hidden" name="item_name" value="%%level_label%%" />
16
  <input type="hidden" name="item_number" value="%%level%%" />
17
  <!-- Identifies/Updates An Existing Member After Checkout -->
18
  <input type="hidden" name="on0" value="<?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0; ?>" />
12
  <input type="hidden" name="custom" value="%%domain%%" />
13
  <input type="hidden" name="currency_code" value="USD" />
14
  <input type="hidden" name="page_style" value="paypal" />
15
+ <input type="hidden" name="item_name" value="%%level_label%% description and pricing details here." />
16
  <input type="hidden" name="item_number" value="%%level%%" />
17
  <!-- Identifies/Updates An Existing Member After Checkout -->
18
  <input type="hidden" name="on0" value="<?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0; ?>" />
includes/templates/buttons/{sp-button.html → paypal-sp-checkout-button.html} RENAMED
@@ -12,7 +12,7 @@
12
  <input type="hidden" name="custom" value="%%domain%%" />
13
  <input type="hidden" name="currency_code" value="USD" />
14
  <input type="hidden" name="page_style" value="paypal" />
15
- <input type="hidden" name="item_name" value="Specific Post/Page Access" />
16
  <input type="hidden" name="item_number" value="sp:0:72" />
17
  <input type="hidden" name="amount" value="0.01" />
18
  <!-- Displays The PayPal® Image Button -->
12
  <input type="hidden" name="custom" value="%%domain%%" />
13
  <input type="hidden" name="currency_code" value="USD" />
14
  <input type="hidden" name="page_style" value="paypal" />
15
+ <input type="hidden" name="item_name" value="Description and pricing details here." />
16
  <input type="hidden" name="item_number" value="sp:0:72" />
17
  <input type="hidden" name="amount" value="0.01" />
18
  <!-- Displays The PayPal® Image Button -->
includes/templates/options/{currencies.html → paypal-currencies.html} RENAMED
File without changes
includes/templates/options/{membership-modification-levels.html → paypal-membership-modification-levels.html} RENAMED
@@ -3,16 +3,22 @@
3
  <option value="downgrade:1">&darr; Downgrade To Level #1</option>
4
  </optgroup>
5
 
 
 
6
  <optgroup label="Level #2">
7
  <option value="upgrade:2" selected="selected">&uarr; Upgrade To Level #2</option>
8
  <option value="downgrade:2">&darr; Downgrade To Level #2</option>
9
  </optgroup>
10
 
 
 
11
  <optgroup label="Level #3">
12
  <option value="upgrade:3">&uarr; Upgrade To Level #3</option>
13
  <option value="downgrade:3">&darr; Downgrade To Level #3</option>
14
  </optgroup>
15
 
 
 
16
  <optgroup label="Level #4">
17
  <option value="upgrade:4">&uarr; Upgrade To Level #4</option>
18
  </optgroup>
3
  <option value="downgrade:1">&darr; Downgrade To Level #1</option>
4
  </optgroup>
5
 
6
+ <option disabled="disabled"></option>
7
+
8
  <optgroup label="Level #2">
9
  <option value="upgrade:2" selected="selected">&uarr; Upgrade To Level #2</option>
10
  <option value="downgrade:2">&darr; Downgrade To Level #2</option>
11
  </optgroup>
12
 
13
+ <option disabled="disabled"></option>
14
+
15
  <optgroup label="Level #3">
16
  <option value="upgrade:3">&uarr; Upgrade To Level #3</option>
17
  <option value="downgrade:3">&darr; Downgrade To Level #3</option>
18
  </optgroup>
19
 
20
+ <option disabled="disabled"></option>
21
+
22
  <optgroup label="Level #4">
23
  <option value="upgrade:4">&uarr; Upgrade To Level #4</option>
24
  </optgroup>
includes/templates/options/{membership-regular-terms.html → paypal-membership-regular-terms.html} RENAMED
@@ -1,4 +1,4 @@
1
- <optgroup label="Recurring Subscriptions">
2
  <option value="1-D-1">Daily ( recurring charge, for ongoing access )</option>
3
  <option value="1-W-1">Weekly ( recurring charge, for ongoing access )</option>
4
  <option value="1-M-1" selected="selected">Monthly ( recurring charge, for ongoing access )</option>
@@ -8,7 +8,7 @@
8
 
9
  <option disabled="disabled"></option>
10
 
11
- <optgroup label="Non-Recurring Subscriptions">
12
  <option value="1-D-0">One Time ( for 1 day access, non-recurring )</option>
13
  <option value="2-D-0">One Time ( for 2 day access, non-recurring )</option>
14
  <option value="3-D-0">One Time ( for 3 day access, non-recurring )</option>
@@ -28,15 +28,11 @@
28
  <option value="6-M-0">One Time ( for 6 month access, non-recurring )</option>
29
 
30
  <option value="1-Y-0">One Time ( for 1 year access, non-recurring )</option>
31
- <option value="2-Y-0">One Time ( for 2 year access, non-recurring )</option>
32
- <option value="3-Y-0">One Time ( for 3 year access, non-recurring )</option>
33
- <option value="4-Y-0">One Time ( for 4 year access, non-recurring )</option>
34
- <option value="5-Y-0">One Time ( for 5 year access, non-recurring )</option>
35
  </optgroup>
36
 
37
  <option disabled="disabled"></option>
38
 
39
- <optgroup label="Non-Recurring / Buy Now!">
40
  <option value="1-D-BN">One Time ( for 1 day access, non-recurring, no trial )</option>
41
  <option value="2-D-BN">One Time ( for 2 day access, non-recurring, no trial )</option>
42
  <option value="3-D-BN">One Time ( for 3 day access, non-recurring, no trial )</option>
@@ -60,5 +56,6 @@
60
  <option value="3-Y-BN">One Time ( for 3 year access, non-recurring, no trial )</option>
61
  <option value="4-Y-BN">One Time ( for 4 year access, non-recurring, no trial )</option>
62
  <option value="5-Y-BN">One Time ( for 5 year access, non-recurring, no trial )</option>
 
63
  <option value="1-L-BN">One Time ( for lifetime access, non-recurring, no trial )</option>
64
  </optgroup>
1
+ <optgroup label="PayPal® ( Subscriptions )">
2
  <option value="1-D-1">Daily ( recurring charge, for ongoing access )</option>
3
  <option value="1-W-1">Weekly ( recurring charge, for ongoing access )</option>
4
  <option value="1-M-1" selected="selected">Monthly ( recurring charge, for ongoing access )</option>
8
 
9
  <option disabled="disabled"></option>
10
 
11
+ <optgroup label="PayPal® ( Subscriptions )">
12
  <option value="1-D-0">One Time ( for 1 day access, non-recurring )</option>
13
  <option value="2-D-0">One Time ( for 2 day access, non-recurring )</option>
14
  <option value="3-D-0">One Time ( for 3 day access, non-recurring )</option>
28
  <option value="6-M-0">One Time ( for 6 month access, non-recurring )</option>
29
 
30
  <option value="1-Y-0">One Time ( for 1 year access, non-recurring )</option>
 
 
 
 
31
  </optgroup>
32
 
33
  <option disabled="disabled"></option>
34
 
35
+ <optgroup label="PayPal® ( Buy Now )">
36
  <option value="1-D-BN">One Time ( for 1 day access, non-recurring, no trial )</option>
37
  <option value="2-D-BN">One Time ( for 2 day access, non-recurring, no trial )</option>
38
  <option value="3-D-BN">One Time ( for 3 day access, non-recurring, no trial )</option>
56
  <option value="3-Y-BN">One Time ( for 3 year access, non-recurring, no trial )</option>
57
  <option value="4-Y-BN">One Time ( for 4 year access, non-recurring, no trial )</option>
58
  <option value="5-Y-BN">One Time ( for 5 year access, non-recurring, no trial )</option>
59
+
60
  <option value="1-L-BN">One Time ( for lifetime access, non-recurring, no trial )</option>
61
  </optgroup>
includes/templates/options/{membership-trial-terms.html → paypal-membership-trial-terms.html} RENAMED
File without changes
includes/templates/options/{sp-hours.html → paypal-sp-hours.html} RENAMED
@@ -7,6 +7,8 @@
7
  <option value="12">Buy Now ( Specific Post/Page, link valid for 12 hours )</option>
8
  </optgroup>
9
 
 
 
10
  <optgroup label="Expires In Days">
11
  <option value="24">Buy Now ( Specific Post/Page, link valid for 1 day )</option>
12
  <option value="48">Buy Now ( Specific Post/Page, link valid for 2 days )</option>
@@ -16,12 +18,16 @@
16
  <option value="144">Buy Now ( Specific Post/Page, link valid for 6 days )</option>
17
  </optgroup>
18
 
 
 
19
  <optgroup label="Expires In Weeks">
20
  <option value="168">Buy Now ( Specific Post/Page, link valid for 1 week )</option>
21
  <option value="336">Buy Now ( Specific Post/Page, link valid for 2 weeks )</option>
22
  <option value="504">Buy Now ( Specific Post/Page, link valid for 3 weeks )</option>
23
  </optgroup>
24
 
 
 
25
  <optgroup label="Expires In Months">
26
  <option value="720">Buy Now ( Specific Post/Page, link valid for 1 month )</option>
27
  <option value="1440">Buy Now ( Specific Post/Page, link valid for 2 months )</option>
@@ -29,6 +35,8 @@
29
  <option value="4380">Buy Now ( Specific Post/Page, link valid for 6 months )</option>
30
  </optgroup>
31
 
 
 
32
  <optgroup label="Expires In Years">
33
  <option value="8760">Buy Now ( Specific Post/Page, link valid for 1 year )</option>
34
  <option value="17520">Buy Now ( Specific Post/Page, link valid for 2 years )</option>
7
  <option value="12">Buy Now ( Specific Post/Page, link valid for 12 hours )</option>
8
  </optgroup>
9
 
10
+ <option disabled="disabled"></option>
11
+
12
  <optgroup label="Expires In Days">
13
  <option value="24">Buy Now ( Specific Post/Page, link valid for 1 day )</option>
14
  <option value="48">Buy Now ( Specific Post/Page, link valid for 2 days )</option>
18
  <option value="144">Buy Now ( Specific Post/Page, link valid for 6 days )</option>
19
  </optgroup>
20
 
21
+ <option disabled="disabled"></option>
22
+
23
  <optgroup label="Expires In Weeks">
24
  <option value="168">Buy Now ( Specific Post/Page, link valid for 1 week )</option>
25
  <option value="336">Buy Now ( Specific Post/Page, link valid for 2 weeks )</option>
26
  <option value="504">Buy Now ( Specific Post/Page, link valid for 3 weeks )</option>
27
  </optgroup>
28
 
29
+ <option disabled="disabled"></option>
30
+
31
  <optgroup label="Expires In Months">
32
  <option value="720">Buy Now ( Specific Post/Page, link valid for 1 month )</option>
33
  <option value="1440">Buy Now ( Specific Post/Page, link valid for 2 months )</option>
35
  <option value="4380">Buy Now ( Specific Post/Page, link valid for 6 months )</option>
36
  </optgroup>
37
 
38
+ <option disabled="disabled"></option>
39
+
40
  <optgroup label="Expires In Years">
41
  <option value="8760">Buy Now ( Specific Post/Page, link valid for 1 year )</option>
42
  <option value="17520">Buy Now ( Specific Post/Page, link valid for 2 years )</option>
includes/templates/shortcodes/c-shortcode.html DELETED
@@ -1 +0,0 @@
1
- [s2Member-PayPal-Button cb="1" image="default" /]
 
includes/templates/shortcodes/paypal-cancellation-button-shortcode.html ADDED
@@ -0,0 +1 @@
 
1
+ [s2Member-PayPal-Button cancel="1" image="default" /]
includes/templates/shortcodes/paypal-checkout-button-shortcode.html ADDED
@@ -0,0 +1 @@
 
1
+ [s2Member-PayPal-Button level="%%level%%" ccaps="" desc="%%level_label%% description and pricing details here." ps="paypal" cc="USD" custom="%%domain%%" tp="0" tt="D" ra="0.01" rp="1" rt="M" rr="1" image="default" /]
includes/templates/shortcodes/paypal-sp-checkout-button-shortcode.html ADDED
@@ -0,0 +1 @@
 
1
+ [s2Member-PayPal-Button ids="0" exp="72" desc="Description and pricing details here." ps="paypal" cc="USD" custom="%%domain%%" ra="0.01" sp="1" image="default" /]
includes/templates/shortcodes/shortcode.html DELETED
@@ -1 +0,0 @@
1
- [s2Member-PayPal-Button level="%%level%%" ccaps="" desc="%%level_label%%" ps="paypal" cc="USD" custom="%%domain%%" tp="0" tt="D" ra="0.01" rp="1" rt="M" rr="1" image="default" /]
 
includes/templates/shortcodes/sp-shortcode.html DELETED
@@ -1 +0,0 @@
1
- [s2Member-PayPal-Button page="0" exp="72" desc="Specific Post/Page Access" ps="paypal" cc="USD" custom="%%domain%%" ra="0.01" sp="1" image="default" /]
 
licensing/license.txt CHANGED
@@ -18,15 +18,11 @@ Credits / Additional Acknowledgments:
18
  - BSD / GPL Compatible License <http://michelf.com/projects/php-markdown/license/>
19
  - PHP Markdown <http://michelf.com/projects/php-markdown/>
20
 
21
- * MailChimp® integration, powered (in part) by the original PHP MCAPI class.
22
- - MIT / GPL Compatible License <http://www.mailchimp.com/api/downloads/>
23
- - The MCAPI class <http://www.mailchimp.com/api/>
24
-
25
  * Administration panel (tools icon) was provided by Everaldo.com.
26
  - LGPL License <http://www.everaldo.com/crystal/?action=license>
27
  - Everaldo <http://www.everaldo.com/crystal/?action=downloads>
28
 
29
- * PayPal® and its associated buttons & services have been integrated into this software via external hyperlinks.
30
  The files/services provided by PayPal® are not distributed with this software. They have their own terms & conditions.
31
  - PayPal®, a 3rd party service, is powered by eBay, Inc. <http://www.paypal.com/>
32
  - PayPal® is a trademark of eBay, Inc. <http://www.ebay.com/>
18
  - BSD / GPL Compatible License <http://michelf.com/projects/php-markdown/license/>
19
  - PHP Markdown <http://michelf.com/projects/php-markdown/>
20
 
 
 
 
 
21
  * Administration panel (tools icon) was provided by Everaldo.com.
22
  - LGPL License <http://www.everaldo.com/crystal/?action=license>
23
  - Everaldo <http://www.everaldo.com/crystal/?action=downloads>
24
 
25
+ * PayPal® and its associated API, buttons & services have been integrated into this software via external hyperlinks.
26
  The files/services provided by PayPal® are not distributed with this software. They have their own terms & conditions.
27
  - PayPal®, a 3rd party service, is powered by eBay, Inc. <http://www.paypal.com/>
28
  - PayPal® is a trademark of eBay, Inc. <http://www.ebay.com/>
readme.txt CHANGED
@@ -1,9 +1,10 @@
1
  === s2Member ( Membership w/ PayPal® Integration ) also works w/ BuddyPress ===
2
 
3
- Version: 3.0.4
4
- Stable tag: 3.0.4
5
  Framework: WS-P-3.0
6
 
 
7
  WordPress Compatible: yes
8
  BuddyPress Compatible: yes
9
  WP Multisite Compatible: soon
@@ -21,13 +22,14 @@ Author: PriMoThemes.com / WebSharks, Inc.
21
  Donate link: http://www.primothemes.com/donate/
22
 
23
  Plugin Name: s2Member
 
24
  Forum URI: http://www.primothemes.com/forums/viewforum.php?f=4
25
- Professional Installation URI: http://www.primothemes.com/support/
26
  Plugin URI: http://www.primothemes.com/post/s2member-membership-plugin-with-paypal/
 
27
  Description: Empowers WordPress® with membership capabilities. Integrates seamlessly with PayPal®. Also compatible with the BuddyPress plugin for WP.
28
  Tags: membership, members, member, register, signup, paypal, pay pal, s2member, subscriber, members only, buddypress, buddy press, buddy press compatible, shopping cart, checkout, api, options panel included, websharks framework, w3c validated code, multi widget support, includes extensive documentation, highly extensible
29
 
30
- s2Member is a full-featured membership management system for WordPress®. It empowers WordPress® with membership capabilities, integrating seamlessly with PayPal®. s2Member is also compatible with BuddyPress.
31
 
32
  == Installation ==
33
 
@@ -39,17 +41,34 @@ s2Member is a full-featured membership management system for WordPress®. It emp
39
  = Auto-installing through WordPress® ( memory errors? ) =
40
  This depends on your hosting provider and/or server configuration. Some web hosting companies impose very low limits on the amount of memory available to WordPress® during the execution of a single script. Since s2Member is a larger plugin, WordPress® may exceed conservative limits set forth by shared hosting companies. Don't feel bad, it's a very common problem. The solution is to install manually, using the instructions above. Memory limits only affect the WordPress® auto-installation routine, not the actual functionality of WordPress® or s2Member.
41
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  == Description ==
43
 
44
- s2Member is a robust/powerful ( and free ) membership management system for WordPress®. s2Member integrates seamlessly with PayPal® ( very easy ), and fully supports recurring billing, with the ability to track affiliate commissions on a recurring basis. s2Member supports custom Pages for registration ( including Custom Registration Fields ), account access, and a whole lot more.
 
 
45
 
46
- s2Member supports up to four primary Membership Levels, and unlimited Custom Capability Packages. This allows you to create an unlimited number of Membership Packages, all with different Capabilities and prices. You can label your primary Membership Levels anything you like. The defaults are Bronze, Silver, Gold, and Platinum.
47
 
48
- s2Member allows you to protect Pages, Posts, Tags, Categories, URIs, URI word fragments, URI replacement codes for BuddyPress, Specific Post/Page "Buy Now" Access, and even portions of content within Posts/Pages/themes/plugins. Everything is configurable through the s2Member Options Panel. This makes s2Member VERY easy to integrate into any WordPress®-powered site. With s2Member, you can also protect downloadable files, using special restrictions on how many downloads can occur within a certain amount of time; all based on Membership Level.
49
 
50
- Each Membership Level can have different restrictions, and you could even integrate Conditionals within your content based on Member Level. Advanced code samples are provided under `s2Member -> API Scripting -> Advanced Conditionals`. s2Member has been fully integrated with the Roles &amp; Capabilities that are already built into WordPress®. No new tables :-) It is designed to be completely seamless, without code bloat. We've carefully structured the entire framework, in order to maximize s2Member's ability to operate with other plugins installed. For instance, s2Member is compatible with BuddyPress!
51
 
52
- New! - Now you can sell Specific Post/Page Access ( membership not required ), using "Buy Now" buttons. You can even package multiple Posts/Pages together into one "Buy Now" transaction. Further details are provided under `s2Member -> PayPal® Buttons`.
53
 
54
  == Screenshots ==
55
 
@@ -76,7 +95,7 @@ No, s2Member has been fully integrated with the Roles &amp; Capabilities that ar
76
  Yes, it can even generate your PayPal® Subscription Buttons for you. Everything is fully integrated. You even get to create your own Pages within WordPress® to handle Membership Options, the Login Welcome Page, etc. For advanced webmasters, there are scripting techniques that are documented as well. These will help you further develop your site and tailor it to meet your specific needs. s2Member API Scripting is NOT required however.
77
 
78
  = How many Membership Levels are supported? =
79
- s2Member supports up to 4 Primary Membership Levels, and unlimited Custom Capabilities. This allows you to create an unlimited number of Membership Packages, all with different Capabilities and prices. You can label your Membership Levels anything you like. The defaults are Bronze, Silver, Gold, Platinum. s2Member also makes it possible to sell an unlimited number of Specific Post/Page Access Links using "Buy Now" buttons. Further details are provided under `s2Member -> PayPal® Buttons`.
80
 
81
  = Does s2Member utilize the PayPal® IPN system? =
82
  Yes, s2Member supports automation of account activation, welcome emails, confirmations, renewals, de-activation, refunds, etc. The integration with PayPal® is seamless. s2Member even provides API Notifications, which are an added layer of functionality. These are not to be confused with the IPN service. s2Member API Notifications make it easier to integrate back-office routines, affiliate programs, list servers, or any other 3rd-party applications that should react to certain events.
@@ -85,7 +104,7 @@ Yes, s2Member supports automation of account activation, welcome emails, confirm
85
  Yes, s2Member will work with PayPal® Auto-Return/PDT (Payment Data Transfer) `On`, and also with Auto-Return/PDT `Off`. If you enable Auto-Return, you MUST also enable PDT and supply s2Member with your Identity Token. If one is enabled, the other must also be enabled; and vice-versa. There is a place to enter your PayPal® Identity Token for PDT under `s2Member -> PayPal® Options`.
86
 
87
  = How does s2Member protect content from public access? =
88
- s2Member allows you to protect Pages, Posts, Tags, Categories, URIs, URI word fragments, URI replacement codes for BuddyPress, Specific Post/Page Access ( Buy Now! ), and even portions of content within Posts/Pages/themes/plugins using Advanced Conditionals. Everything is configurable through the s2Member Options Panel. This makes s2Member VERY easy to integrate into any WordPress®-powered site. With s2Member, you can also protect downloadable files, using special restrictions on how many downloads can occur within a certain amount of time. Each Membership Level can have different restrictions ( even Custom Capability Packages ). You can also integrate Conditionals within your content based on Member Level or Capabilities. Advanced code samples are provided under `s2Member -> API Scripting -> Advanced Conditionals`.
89
 
90
  = Does s2Member provide an API that I can connect to? =
91
  Yes, s2Member provides many *Advanced Scripting* techniques that are fully documented within its Option Panels. Code samples are provided for everything. There are several API functions that you can use, along with s2Member API Constants. This allows you to access many parts of its functionality, as well as specific Member information. Theme designers are welcome to integrate their themes/plugins with s2Member using the code samples that we provide under `s2Member -> API Scripting`. s2Member even provides API Notifications, which are an added layer of functionality. These are not to be confused with the IPN service. s2Member API Notifications make it easier to integrate back-office routines, affiliate programs, list servers, or any other 3rd-party application that should react to certain events.
@@ -99,32 +118,70 @@ Yes it is. In fact, we must say... the s2Member/BuddyPress combination is just a
99
  = How does s2Member know when to demote a paid Member to a Free Subscriber? =
100
  s2Member uses its built-in Auto-EOT System ( new ). EOT = End Of Term. Whenever you generate a PayPal® Button with s2Member, you'll configure a length for the Subscription. Depending on the type of Subscription you choose ( recurring, non-recurring, lifetime, or fixed-term ); s2Member will either use PayPal's IPN/`subscr_cancel,subscr_eot` notices, or it will set an Automatic EOT Time, which is processed automatically by s2Member via WP_Cron. For each Member, you can also override the EOT Time, by forcing a specific expiration date. To manually adjust the EOT Time for a specific Member, go to: `WordPress® -> Users`, and click the Edit link next the Member you want to work on.
101
 
102
- = Why do I get memory errors during intallation and/or upgrade? =
 
 
 
103
  This depends on your hosting provider and/or server configuration. Some web hosting companies impose very low limits on the amount of memory available to WordPress® during the execution of a single script. Since s2Member is a larger plugin, WordPress® may exceed conservative limits set forth by shared hosting companies. Don't feel bad, it's a very common problem. The solution is to upgrade manually. Memory limits only affect the WordPress® auto-installation/upgrade routine, not the actual functionality of WordPress® or s2Member.
104
 
105
  = How can I see more of what's going on behind-the-scene? =
106
  s2Member comes with two very sophisticated logging systems. One for its PayPal® IPN communications ( and resulting actions ). The other logs Return-Data processing. You can enable them both, by going to: `s2Member -> PayPal® Options -> Account Details -> Logging`.
107
 
 
 
 
108
  = Where can I download older versions of s2Member? =
109
  Archived releases of s2Member are maintained [here](http://wordpress.org/extend/plugins/s2member/download/).
110
 
111
- == Upgrading ==
 
112
 
113
- There are two ways to upgrade s2Member. You can either (upgrade automatically) by going to `WordPress® -> Plugins` and clicking "upgrade automatically". If that fails with memory errors, you can upgrade manually by following these instructions:
 
114
 
115
- 1. Go to: `s2Member -> General Options -> Deactivation Safeguards`. Turn Safeguards `on`, click Save.
116
- 2. Now you can safely deactivate s2Member by going to `WordPress® -> Plugins -> s2Member`.
117
- 3. Login via FTP, and delete the entire `/wp-content/plugins/s2member` directory.
118
- You can leave `/plugins/s2member-logs/` and `/plugins/s2member-files/`.
119
- 4. Now upload the new `s2member` folder to `/wp-content/plugins/`.
120
- 5. Go to: `WordPress® -> Plugins -> s2Member`, and reactivate.
121
- 6. That's it. All existing options will remain intact.
122
 
123
- = Why do I get memory errors during automatic upgrade? =
124
- This depends on your hosting provider and/or server configuration. Some web hosting companies impose very low limits on the amount of memory available to WordPress® during the execution of a single script. Since s2Member is a larger plugin, WordPress® may exceed conservative limits set forth by shared hosting companies. Don't feel bad, it's a very common problem. The solution is to upgrade manually. Memory limits only affect the WordPress® auto-installation/upgrade routine, not the actual functionality of WordPress® or s2Member.
 
 
125
 
126
  == Changelog ==
127
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
128
  = 3.0.4 =
129
  * Over 100 new Hooks/Filters have been added to the s2Member framework. Many of these Hooks/Filters now pass variables by reference.
130
  * All of s2Member's function calls have been wrapped inside `if(!function_exists()){}`. This gives developers the ability to override built-in functions - as needed. We suggest using Hooks/Filters, but when all else fails, you can now override built-in functions.
@@ -152,9 +209,9 @@ This depends on your hosting provider and/or server configuration. Some web host
152
  * Specific Post/Page Access. s2Member now supports "Specific Post/Page Packages" too ( optional ). You can choose a "Leading" Post/Page, and also include "Additional" Posts/Pages. Customers will still land on your Leading Post/Page; BUT, they'll ALSO have access to any Additional Posts/Pages you've packaged together into one transaction. See: `s2Member -> PayPal® Buttons -> Specific Post/Page Buttons` for further details.
153
  * Fixed-Term Buy Now Access. s2Member now supports Buy Now Access with fixed term lengths. In previous versions of s2Member, it was possible to create a Buy Now Button for Lifetime Membership Access, but now you can create Buy Now Buttons for specific time periods. Anything from 1 day, up to 5 years. The Lifetime option is also still available.
154
  * Improvement. Registration Configuration routines have been re-organized for a higher level of compatibility across a wide array of s2Member configurations. No functionality changes here, just smarter configuration routines in `ws_plugin__s2member_configure_user_registration()`. This will make s2Member even more compatible with other plugins.
155
- * Tracking Codes. s2Member has improved the way in which Tracking Codes are injected after returning from PayPal®. For full details, see: `s2Member -> API Tracking -> Signup Tracking Codes`. s2Member also supports Tracking Codes for Specific Post/Page Access now. Some additional replacement codes are also available through s2Member's Tracking API.
156
  * AWeber® integration. s2Member now sends AWeber® some additional details, including: `EMail Address, First Name, Last Name, Full Name, IP Address, and Membership Level`. You can map these fields using a Custom Email Parser for AWeber® - if you wish to. Otherwise, the default "PayPal® Parser" for AWeber® will do fine. Please see: `s2Member -> API List Servers -> AWeber®` for full details.
157
- * Security fix. Although unlikely, it was possible for a Site Administrator, testing extensively in the Sandbox; to perform a Subscription Modification while logged in as an Administrator; or an (Editor/Author/Contributor). The result was that their account could have been upgraded to an s2Member Role, depending on Button Configuration. This ran the risk of a built-in WP Role being locked out of their account. If this happended to you in a previous version of s2Member, please read [this article](http://codex.wordpress.org/Resetting_Your_Password) for assistance. Additional security routines have been added to prevent s2Member from EVER being able to modify an account belonging to any Administrator/Editor/Author/Contributor, under ANY circumstance.
158
  * Typo auto-correction. A typo in the default Email Confirmation template for Specific Post/Page Access, which was first introduced in v2.8.7, and later corrected in v2.8.8 ( `%%sp_access_url%%` ). The incorrect value ( `%%access_url%%` ) was lingering if v2.8.7 was installed at some point in the past. s2Member v3.0 auto-corrects this typo ( should be `%%sp_access_url%%` ), just in case it still exists from a prior installation of s2Member v2.8.7.
159
  * PayPal® Buttons. The Shortcode format for PayPal® Buttons, now supports a new attribute: `image="default"`. This can be changed to a full URL, pointing to a custom image of your own; instead of the default PayPal® image. This works for all types of PayPal® Buttons, including Member Levels 1-4, Cancellations, Modifications; and even Specific Post/Page Access Buttons.
160
  * Registration Form. s2Member now makes the Registration Form available to any Site Administrator who is logged-in, even when `Allow Free Subscribers` is set to `false`. This makes the Registration Form easier to test during configuration; and it prevents confusion for site owners that are new to the s2Member plugin. This will NOT affect the functionality of s2Member otherwise, and should have NO impact on existing installations of s2Member.
@@ -332,59 +389,6 @@ This depends on your hosting provider and/or server configuration. Some web host
332
  * Re-organized core framework. Updated to: P-2.0.
333
  * Updated to support WP 2.9+.
334
 
335
- = 2.0 =
336
- * Two new options were added for login screen customization. s2Member now supports the ability to modify the shadow and text colors too.
337
- * A new internal filter was added to suppress systematic use pages; such as the Login Welcome Page and Download Limit Exceeded Page from search results. These pages are always protected anyway, but s2Member now filters them from on-site search listings as well, just to prevent them from popping up and causing confusion.
338
- * Added some additional inline documentation for the option panels.
339
- * Replaced deprecated `split()` function with `preg_split()`.
340
-
341
- = 1.9 =
342
- * Minor bug fixed in JavaScript API. Some constants were empty ( non-zero ) when downloads were disabled.
343
- * Added some additional API Constants for Page IDs. These are intended to supplement the existing Page URLs.
344
-
345
- = 1.8 =
346
- * I broke the options panel down into smaller sub-sections because things were getting too crowded all on one page.
347
- * A new API has been added that provides extended notifications for affiliate program integration and other back-office routines.
348
- * Support for refunds and reversals ( e.g. charge backs ) has been added to the IPN integration making it 100% seamless now!
349
- * Pixel Tracking has been added to support AdSense / Yahoo / Google Analytics and other tracking codes & marketing campaigns.
350
- * Additional documentation has been added along side or beneath each option; which helps to further clarify any confusion.
351
-
352
- = 1.7 =
353
- * JavaScript prompts for (Protected File Download Confirmation) are now issued by s2Member in an intuitive way. Check your options panel under File Download Restrictions for notes on this topic.
354
- * Added a new PHP Constant: `S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED`. Check the Advanced Scripting page in your Dashboard for further details.
355
- * In the options panel, support was added for category level restrictions, tag level restrictions, and URI level restrictions.
356
- * All of the PHP runtime Constants for advanced scripting have been made available through a new JavaScript API as well.
357
- * Bug fix: `s2member_file_download` counters were counting the same file more than once. This has been corrected.
358
-
359
- = 1.6 =
360
- * Upgraded to fully support WP 2.8.4. Slight tweaks. Nothing major.
361
- * Added a `Flow Of Events` page that provides additional documentation & explanations.
362
- * Added optional support for PayPal Auto-Return with PDT ( Payment Data Transfer ).
363
-
364
- = 1.5 =
365
- * You can now customize the Login / Registration Pages with your bg & logo.
366
- * Added support for affiliate program tracking with optional custom fields.
367
- * Added support for recurring commission processing for affiliates.
368
-
369
- = 1.4 =
370
- * Added file download limitations, restrictions and .htaccess protection.
371
- * Corrected a bug with 404 errors on files that were not available.
372
- * Added support / compatibility for WP Super Cache & Quick Cache.
373
-
374
- = 1.3 =
375
- * Added full support for PayPal IPN scripting automation.
376
- * Added additional documentation & code samples for advanced scripting.
377
- * Added `s2member_xencrypt()` & `s2member_xdecrypt()` functions to the API.
378
-
379
- = 1.2 =
380
- * Added more code samples w/ PHP Constants for advanced scripting.
381
- * Added support for custom labels on different membership levels.
382
- * You can now customize the From: `"Name" <address>` used in emails.
383
-
384
- = 1.1 =
385
- * Updated to a more seamless integration with WP Roles & Capabilities.
386
- * Added ways to easily protect Pages, Posts and conditional content.
387
- * Advanced scripting now makes `current_user_can()` available.
388
-
389
- = 1.0 =
390
- * Initial release.
1
  === s2Member ( Membership w/ PayPal® Integration ) also works w/ BuddyPress ===
2
 
3
+ Version: 3.0.5
4
+ Stable tag: 3.0.5
5
  Framework: WS-P-3.0
6
 
7
+ SSL Compatible: yes
8
  WordPress Compatible: yes
9
  BuddyPress Compatible: yes
10
  WP Multisite Compatible: soon
22
  Donate link: http://www.primothemes.com/donate/
23
 
24
  Plugin Name: s2Member
25
+ Pro Module / Licensing: http://www.s2member.com/
26
  Forum URI: http://www.primothemes.com/forums/viewforum.php?f=4
 
27
  Plugin URI: http://www.primothemes.com/post/s2member-membership-plugin-with-paypal/
28
+ Professional Installation URI: http://www.primothemes.com/forums/viewtopic.php?f=4&t=107
29
  Description: Empowers WordPress® with membership capabilities. Integrates seamlessly with PayPal®. Also compatible with the BuddyPress plugin for WP.
30
  Tags: membership, members, member, register, signup, paypal, pay pal, s2member, subscriber, members only, buddypress, buddy press, buddy press compatible, shopping cart, checkout, api, options panel included, websharks framework, w3c validated code, multi widget support, includes extensive documentation, highly extensible
31
 
32
+ s2Member is an extremely powerful ( and free ) membership management system for WordPress®. It empowers WordPress® with membership capabilities, integrating seamlessly with PayPal®. s2Member is also compatible with BuddyPress.
33
 
34
  == Installation ==
35
 
41
  = Auto-installing through WordPress® ( memory errors? ) =
42
  This depends on your hosting provider and/or server configuration. Some web hosting companies impose very low limits on the amount of memory available to WordPress® during the execution of a single script. Since s2Member is a larger plugin, WordPress® may exceed conservative limits set forth by shared hosting companies. Don't feel bad, it's a very common problem. The solution is to install manually, using the instructions above. Memory limits only affect the WordPress® auto-installation routine, not the actual functionality of WordPress® or s2Member.
43
 
44
+ == Upgrading To The Latest Version ==
45
+
46
+ You can either (upgrade automatically) by going to `WordPress® -> Plugins` and clicking "upgrade automatically". If that fails with memory errors, you can upgrade manually by following these instructions:
47
+
48
+ 1. Go to: `s2Member -> General Options -> Deactivation Safeguards`. Turn Safeguards `on`, click Save.
49
+ 2. Now you can safely deactivate s2Member by going to `WordPress® -> Plugins -> s2Member`.
50
+ 3. Login via FTP, and delete the entire `/wp-content/plugins/s2member` directory.
51
+ You can leave `/plugins/s2member-logs/` and `/plugins/s2member-files/`.
52
+ 4. Now upload the latest `/s2member` folder to `/wp-content/plugins/`.
53
+ 5. Go to: `WordPress® -> Plugins -> s2Member`, and reactivate.
54
+ 6. That's it. All existing options will remain intact.
55
+
56
+ = Why do I get memory errors during automatic upgrade? =
57
+ This depends on your hosting provider and/or server configuration. Some web hosting companies impose very low limits on the amount of memory available to WordPress® during the execution of a single script. Since s2Member is a larger plugin, WordPress® may exceed conservative limits set forth by shared hosting companies. Don't feel bad, it's a very common problem. The solution is to upgrade manually. Memory limits only affect the WordPress® auto-installation/upgrade routine, not the actual functionality of WordPress® or s2Member.
58
+
59
  == Description ==
60
 
61
+ s2Member is an extremely powerful ( and free ) membership management system for WordPress®. The s2Member Framework ( free ) integrates seamlessly with PayPal® ( very easy ), and fully supports recurring billing, with the ability to track affiliate commissions on a recurring basis. s2Member supports custom Pages for registration ( including Custom Registration Fields ), account access, and a whole lot more.
62
+
63
+ s2Member supports Free Subscribers ( at Level #0 ), and up to four Primary Membership Levels, [1-4]; plus unlimited Custom Capability Packages. Custom Capabilities allow you to create an unlimited number of Membership Packages, all with different Capabilities and prices. You can label your Membership Levels anything you like. The defaults are Free, Bronze, Silver, Gold, and Platinum.
64
 
65
+ s2Member allows you to protect Pages, Posts, Tags, Categories, URIs, URI word fragments, URI Replacement Codes for BuddyPress, Specific Post/Page "Buy Now" Access, and even portions of content within Posts/Pages/themes/plugins. Everything is configurable through the s2Member Options Panel. This makes s2Member VERY easy to integrate into any WordPress®-powered site. With s2Member, you can also protect downloadable files, using special restrictions on how many downloads can occur within a certain amount of time; all based on Membership Level.
66
 
67
+ Each Membership Level can have different restrictions, and you could even integrate Conditionals within your content based on Member Level. Advanced code samples are provided under `s2Member -> API Scripting -> Advanced Conditionals`. s2Member has been fully integrated with the Roles &amp; Capabilities that are already built into WordPress®. No new tables :-) It is designed to be completely seamless, without code bloat. We've carefully structured the entire framework, in order to maximize s2Member's ability to operate with other plugins installed. For instance, s2Member is compatible with BuddyPress.
68
 
69
+ You can also sell Specific Post/Page Access ( membership not required ), using "Buy Now" buttons. You can even package multiple Posts/Pages together into one "Buy Now" transaction. Further details are provided under `s2Member -> PayPal® Buttons -> Special Posts/Pages`.
70
 
71
+ New! - [s2Member Pro](http://www.s2member.com/) is an add-on module for the free version of s2Member. [s2Member Pro](http://www.s2member.com/) adds [PayPal® Pro integration](https://merchant.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=merchant/wp_pro), a PayPal® Pro Form Generator, advanced User Import/Export tools, and more. Your purchase of s2Member Pro includes free lifetime upgrades.
72
 
73
  == Screenshots ==
74
 
95
  Yes, it can even generate your PayPal® Subscription Buttons for you. Everything is fully integrated. You even get to create your own Pages within WordPress® to handle Membership Options, the Login Welcome Page, etc. For advanced webmasters, there are scripting techniques that are documented as well. These will help you further develop your site and tailor it to meet your specific needs. s2Member API Scripting is NOT required however.
96
 
97
  = How many Membership Levels are supported? =
98
+ s2Member supports Free Subscribers ( at Level #0 ), and up to four Primary Membership Levels [1-4]; plus unlimited Custom Capability packages. Custom Capabilities allow you to create an unlimited number of Membership Packages, all with different Capabilities and prices. You can label your Membership Levels anything you like. The defaults are Free, Bronze, Silver, Gold, Platinum. s2Member also makes it possible to sell an unlimited number of Specific Post/Page Access Links using "Buy Now" buttons. Further details are provided under `s2Member -> PayPal® Buttons -> Specific Posts/Pages`.
99
 
100
  = Does s2Member utilize the PayPal® IPN system? =
101
  Yes, s2Member supports automation of account activation, welcome emails, confirmations, renewals, de-activation, refunds, etc. The integration with PayPal® is seamless. s2Member even provides API Notifications, which are an added layer of functionality. These are not to be confused with the IPN service. s2Member API Notifications make it easier to integrate back-office routines, affiliate programs, list servers, or any other 3rd-party applications that should react to certain events.
104
  Yes, s2Member will work with PayPal® Auto-Return/PDT (Payment Data Transfer) `On`, and also with Auto-Return/PDT `Off`. If you enable Auto-Return, you MUST also enable PDT and supply s2Member with your Identity Token. If one is enabled, the other must also be enabled; and vice-versa. There is a place to enter your PayPal® Identity Token for PDT under `s2Member -> PayPal® Options`.
105
 
106
  = How does s2Member protect content from public access? =
107
+ s2Member allows you to protect Pages, Posts, Tags, Categories, URIs, URI word fragments, URI Replacement Codes for BuddyPress, Specific Post/Page Access ( Buy Now! ), and even portions of content within Posts/Pages/themes/plugins using Advanced Conditionals. Everything is configurable through the s2Member Options Panel. This makes s2Member VERY easy to integrate into any WordPress®-powered site. With s2Member, you can also protect downloadable files, using special restrictions on how many downloads can occur within a certain amount of time. Each Membership Level can have different restrictions ( even Custom Capability Packages ). You can also integrate Conditionals within your content based on Member Level or Capabilities. Advanced code samples are provided under `s2Member -> API Scripting -> Advanced Conditionals`.
108
 
109
  = Does s2Member provide an API that I can connect to? =
110
  Yes, s2Member provides many *Advanced Scripting* techniques that are fully documented within its Option Panels. Code samples are provided for everything. There are several API functions that you can use, along with s2Member API Constants. This allows you to access many parts of its functionality, as well as specific Member information. Theme designers are welcome to integrate their themes/plugins with s2Member using the code samples that we provide under `s2Member -> API Scripting`. s2Member even provides API Notifications, which are an added layer of functionality. These are not to be confused with the IPN service. s2Member API Notifications make it easier to integrate back-office routines, affiliate programs, list servers, or any other 3rd-party application that should react to certain events.
118
  = How does s2Member know when to demote a paid Member to a Free Subscriber? =
119
  s2Member uses its built-in Auto-EOT System ( new ). EOT = End Of Term. Whenever you generate a PayPal® Button with s2Member, you'll configure a length for the Subscription. Depending on the type of Subscription you choose ( recurring, non-recurring, lifetime, or fixed-term ); s2Member will either use PayPal's IPN/`subscr_cancel,subscr_eot` notices, or it will set an Automatic EOT Time, which is processed automatically by s2Member via WP_Cron. For each Member, you can also override the EOT Time, by forcing a specific expiration date. To manually adjust the EOT Time for a specific Member, go to: `WordPress® -> Users`, and click the Edit link next the Member you want to work on.
120
 
121
+ = Do I need the s2Clean Theme? =
122
+ No. Both s2Member ( the [free version](http://www.primothemes.com/post/s2member-membership-plugin-with-paypal/) ), as well as the [s2Member Pro Module](http://www.s2member.com/prices/) will work in just about ANY WordPress® theme. That being said, if you're starting a brand new site, we DO suggest the [s2Clean Theme](http://www.primothemes.com/post/s2clean-theme-for-wordpress/), because it has already been setup specifically for s2Member, which will cut down on your development time. For example, the s2Clean Theme comes with a login box built into the site, and it also comes with pre-built Page Templates for s2Member's Login Welcome Page. You could create both of these inside WordPress® using any theme, even without Templates; but the s2Clean Theme makes it all much easier to work with.
123
+
124
+ = Why do I get memory errors during installation and/or upgrade? =
125
  This depends on your hosting provider and/or server configuration. Some web hosting companies impose very low limits on the amount of memory available to WordPress® during the execution of a single script. Since s2Member is a larger plugin, WordPress® may exceed conservative limits set forth by shared hosting companies. Don't feel bad, it's a very common problem. The solution is to upgrade manually. Memory limits only affect the WordPress® auto-installation/upgrade routine, not the actual functionality of WordPress® or s2Member.
126
 
127
  = How can I see more of what's going on behind-the-scene? =
128
  s2Member comes with two very sophisticated logging systems. One for its PayPal® IPN communications ( and resulting actions ). The other logs Return-Data processing. You can enable them both, by going to: `s2Member -> PayPal® Options -> Account Details -> Logging`.
129
 
130
+ = When a User/Member is demoted by the Auto-EOT System, are Custom Capabilities removed too? =
131
+ Yes, whenever a User/Member is demoted, s2Member resets their account back to a Free Subscriber. Any Custom Capabilities the User/Member had - will be removed; as they should be.
132
+
133
  = Where can I download older versions of s2Member? =
134
  Archived releases of s2Member are maintained [here](http://wordpress.org/extend/plugins/s2member/download/).
135
 
136
+ = Is the free version of s2Member still being supported by WebSharks, Inc? =
137
+ Yes, without a doubt. The free version of s2Member ( aka: the s2Member Framework ), is the foundation on which the s2Member Pro Module, and future development will occur.
138
 
139
+ = s2Member does this, but I want it to do that. Is that possible? =
140
+ We get this type of question a lot. The answer is most definitely **yes**. The entire s2Member Framework is extremely versatile. For instance, the s2Member Pro Module is built on top of the free s2Member Framework; on top of the worlds' most powerful publishing platform ( WordPress® ). That being said, you WILL need be familiar with PHP, and/or WordPress® Hooks/Filters in order to accomplish advanced customizations. We suggest hiring a freelance developer at Elance.com, or hiring Jason Caldwell ( our own Lead Developer ) @ PriMoThemes.com / WebSharks, Inc. [Jason Caldwell](http://www.primothemes.com/post/author/websharksinc-jason/) is the Lead Developer behind the s2Member plugin, and also the s2Member Pro Module.
141
 
142
+ = Can s2Member be used with ClickBank® or Google® Checkout? =
143
+ Not yet. This is coming soon though. It will be included in a future release of the s2Member Pro Module, which already works with PayPal® Pro; using direct ( on-site ) credit card processing for Visa®, MasterCard®, American Express®, Discover®, Maestro®, Solo®, and PayPal® Express Checkout. [s2Member Pro](http://www.s2member.com/) is an add-on module for the [free version](http://www.primothemes.com/post/s2member-membership-plugin-with-paypal/) of s2Member. s2Member Pro adds full PayPal® Pro integration, a PayPal® Pro Form Generator, User Import/Export tools, and more.
 
 
 
 
 
144
 
145
+ == Upgrade Notice ==
146
+
147
+ = 3.0.5 =
148
+ * Upgrade highly recommended. Several bug fixes, improvements, and some new features.
149
 
150
  == Changelog ==
151
 
152
+ = 3.0.5 =
153
+ * s2Member v3.0.5 is the first version of s2Member that is fully compatible with the s2Member Pro Module. Available now @ [s2Member.com](http://www.s2member.com/).
154
+ * New Level #0. s2Member now supports a new reserved Level #0 for Free Subscribers. s2Member has always supported Free Subscribers, but in past versions it was not possible to set custom permissions in the s2Member configuration panels for Level #0. Now you can. See: `s2Member -> General Options -> Open Registration`. You can now set Page, Post, Tag, Category, and even URI restrictions for Level #0.
155
+ * New feature. You can now create a "demo" account for public testing. Demo accounts ( where the Username MUST be "demo" ), will NOT be allowed to change their password. This will allow you to share a demo `username` / `password` with potential Customers, without having to worry about the password for the special "demo" account being changed during a demonstration. Any other restrictions you need to impose, if any; must be done through custom programming, using s2Member's Advanced Conditionals. See `s2Member -> API Scripting -> Advanced Conditionals`.
156
+ * New filter. s2Member now provides a well-hidden feature where a developer can use a WordPress® Filter to modify the default demotion Role. In other words, instead of having Members who cancel, demoted to a Free Subscriber by the s2Member Auto-EOT System, it is now possible through custom programming to modify this using `ws_plugin__s2member_force_demotion_role`.
157
+ * New feature. s2Member now supports Custom Capability Sub-directories for protected file downloads. See: `s2Member -> API Scripting -> Custom Capability Files`.
158
+ * New feature. s2Member now supports site-specific/time-sensitive and unique "Download Keys", which can be created for specific files that you've protected with s2Member. For full details, see: `s2Member -> Download Options -> Advanced Restricions`.
159
+ * Deprecated. The method `md5(s2member_xencrypt())` for protected file Keys has been deprecated; in favor of `s2member_file_download_key("location of file")`. For full details, see: `s2Member -> Download Options -> Advanced Restricions`. The older md5 method still works, but it will be removed in a future release of s2Member, so please update your site if you've been using Download Keys.
160
+ * Bug fix. When s2Member is configured to allow Custom Passwords during registration, instead of asking the User to check their email after registering, the message after registration now reads: `Registration complete. Please log in.` Since the Customer chose their own password during registration, asking them to check their email before logging in is a bit weird. This has been resolved in s2Member v3.0.5.
161
+ * Bug fix. A bug was found in two regex patterns that matched against the PayPal® `item_number` field. This was causing the registration system to fail under certain conditions, with the error: `Registration is currently not allowed`. This has been resolved in s2Member v3.0.5.
162
+ * Bug fix. Some regex patterns were being processed incorrectly by the function `preg_replace()`. This was only happening when a dollar sign was used within the second argument value. A new function has been added: `ws_plugin__s2member_esc_ds()`, which resolves the issue by escaping dollar signs before regex pattern matching is performed.
163
+ * Improvement. Improved validation routines in the PayPal® Button Generator. This helps to catch potential problems for novice/beginning site owners.
164
+ * General cleanup / attribute escaping. The function `esc_attr()` is now applied to all Shortcode processing attributes. This prevents conflicts with some plugins.
165
+ * CKEditor. It appears that the CKEditor plugin does not preserve WordPress® Shortcodes on some installations we've seen. s2Member has been updated to strip `&quot;` from Shortcode attributes, which helps to fight against this issue. That being said, we highly recommend the default WordPress® Editor. Should you install a custom Editor plugin, you may have unexpected results with WordPress® Shortcodes.
166
+ * Framework in place for additional gateways to be added in future releases of the s2Member Pro Module.
167
+ * Bug fix. A minor bug was found in a few Hooks called upon inside `menu-pages/paypal-buttons.inc.php`. These were incorrectly referencing the `options_page`. This bug was first introduced in v3.0.4 and has been corrected in v3.0.5.
168
+ * Interface. By popular demand, the background color of the Profile Modification Page has been changed from light grey, to pure white.
169
+ * Bug fix. A Special Redirection URL in the s2Member API Constant ( `S2MEMBER_LOGIN_WELCOME_PAGE_URL` ) was not being filled with possible Replacement Codes. This was only affecting the API Constant, and not the internal functionality of s2Member. None the less, this has been corrected in v3.0.5.
170
+ * API Constants. Some new API Constants have been added in support of Level #0. See: `s2Member -> API Scripting -> API Constants`.
171
+ * Positioning of the s2Member Menu panels has been moved up, so it now sits just beneath the Users menu in WordPress®.
172
+ * Bug fix. Forced type casting (int) on API Constants `S2MEMBER_CURRENT_USER_REGISTRATION_TIME` and `S2MEMBER_CURRENT_USER_REGISTRATION_DAYS`.
173
+ * Bug fix. A couple of routines using `WP_User` were not checking for the correct instantiation of the `WP_User` class. This has been corrected in v3.0.5.
174
+ * Improvement. Additional routines added to various functions in order to further optimize database queries.
175
+ * Utility function. A new function was added to `utilities.inc.php`. See: `ws_plugin__s2member_esc_dq()`.
176
+ * IPN routines cleaned up a bit. Now supports s2Member Pro/PayPal® Pro integrations - when the s2Member Pro Module is installed.
177
+ * Bug fix. IPN processing routines were sending API / Signup Notifications and creating Signup Tracking Codes whenever an account was being updated through a subscr_signup response with advanced update vars ( on0, os0 ). This was not the intended behavior. Signup Notifications and Signup Tracking Codes should only be processed ONE time for each Customer. This has now been resolved in v3.0.5.
178
+ * Bug fix. Hooks/Filters were not being given a chance inside `profile.inc.php` because s2Member was loading this on `init`, instead of through `template_redirect`. This has been resolved now in v3.0.5.
179
+ * Conditional fix. Possible Registration URL failure during IPN processing was not reporting anything in the logs. There was not much chance of this happening, but, at any rate; the log reporting mechanism has now been corrected in v3.0.5.
180
+ * Internal feature. The IPN processing routines are now capable of self-verifying proxy requests through `$_GET["s2member_paypal_proxy"]` and `$_GET["s2member_paypal_proxy_verification"]`. This is useful only for advanced site owners who are extremely familiar with s2Member. The s2Member Pro Module uses this feature.
181
+ * New Replacement Codes for Signup Confirmation Emails. These new Replacement Codes are now available: `%%initial_cycle%%`, `%%regular_cycle%%`, `%%recurring/regular_cycle%%`. These are available only for the Signup Confirmation Email; making it easier; since conditional analysis is not possible for email templates.
182
+ * FAQs updated. See: `s2Member -> s2Member Info` inside your WordPress® Dashboard.
183
+ * Changelog trimmed away at version v2.0.
184
+
185
  = 3.0.4 =
186
  * Over 100 new Hooks/Filters have been added to the s2Member framework. Many of these Hooks/Filters now pass variables by reference.
187
  * All of s2Member's function calls have been wrapped inside `if(!function_exists()){}`. This gives developers the ability to override built-in functions - as needed. We suggest using Hooks/Filters, but when all else fails, you can now override built-in functions.
209
  * Specific Post/Page Access. s2Member now supports "Specific Post/Page Packages" too ( optional ). You can choose a "Leading" Post/Page, and also include "Additional" Posts/Pages. Customers will still land on your Leading Post/Page; BUT, they'll ALSO have access to any Additional Posts/Pages you've packaged together into one transaction. See: `s2Member -> PayPal® Buttons -> Specific Post/Page Buttons` for further details.
210
  * Fixed-Term Buy Now Access. s2Member now supports Buy Now Access with fixed term lengths. In previous versions of s2Member, it was possible to create a Buy Now Button for Lifetime Membership Access, but now you can create Buy Now Buttons for specific time periods. Anything from 1 day, up to 5 years. The Lifetime option is also still available.
211
  * Improvement. Registration Configuration routines have been re-organized for a higher level of compatibility across a wide array of s2Member configurations. No functionality changes here, just smarter configuration routines in `ws_plugin__s2member_configure_user_registration()`. This will make s2Member even more compatible with other plugins.
212
+ * Tracking Codes. s2Member has improved the way in which Tracking Codes are injected after returning from PayPal®. For full details, see: `s2Member -> API Tracking -> Signup Tracking Codes`. s2Member also supports Tracking Codes for Specific Post/Page Access now. Some additional Replacement Codes are also available through s2Member's Tracking API.
213
  * AWeber® integration. s2Member now sends AWeber® some additional details, including: `EMail Address, First Name, Last Name, Full Name, IP Address, and Membership Level`. You can map these fields using a Custom Email Parser for AWeber® - if you wish to. Otherwise, the default "PayPal® Parser" for AWeber® will do fine. Please see: `s2Member -> API List Servers -> AWeber®` for full details.
214
+ * Security fix. Although unlikely, it was possible for a Site Administrator, testing extensively in the Sandbox; to perform a Subscription Modification while logged in as an Administrator; or an (Editor/Author/Contributor). The result was that their account could have been upgraded to an s2Member Role, depending on Button Configuration. This ran the risk of a built-in WP Role being locked out of their account. If this happened to you in a previous version of s2Member, please read [this article](http://codex.wordpress.org/Resetting_Your_Password) for assistance. Additional security routines have been added to prevent s2Member from EVER being able to modify an account belonging to any Administrator/Editor/Author/Contributor, under ANY circumstance.
215
  * Typo auto-correction. A typo in the default Email Confirmation template for Specific Post/Page Access, which was first introduced in v2.8.7, and later corrected in v2.8.8 ( `%%sp_access_url%%` ). The incorrect value ( `%%access_url%%` ) was lingering if v2.8.7 was installed at some point in the past. s2Member v3.0 auto-corrects this typo ( should be `%%sp_access_url%%` ), just in case it still exists from a prior installation of s2Member v2.8.7.
216
  * PayPal® Buttons. The Shortcode format for PayPal® Buttons, now supports a new attribute: `image="default"`. This can be changed to a full URL, pointing to a custom image of your own; instead of the default PayPal® image. This works for all types of PayPal® Buttons, including Member Levels 1-4, Cancellations, Modifications; and even Specific Post/Page Access Buttons.
217
  * Registration Form. s2Member now makes the Registration Form available to any Site Administrator who is logged-in, even when `Allow Free Subscribers` is set to `false`. This makes the Registration Form easier to test during configuration; and it prevents confusion for site owners that are new to the s2Member plugin. This will NOT affect the functionality of s2Member otherwise, and should have NO impact on existing installations of s2Member.
389
  * Re-organized core framework. Updated to: P-2.0.
390
  * Updated to support WP 2.9+.
391
 
392
+ = v2.0 - 1.0 =
393
+ * ... trimmed away at v2.0.
394
+ * Initial release, v1.0.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
s2member.php CHANGED
@@ -9,10 +9,11 @@ along with this software. In the main directory, see: /licensing/
9
  If not, see: <http://www.gnu.org/licenses/>.
10
  */
11
  /*
12
- Version: 3.0.4
13
- Stable tag: 3.0.4
14
  Framework: WS-P-3.0
15
 
 
16
  WordPress Compatible: yes
17
  BuddyPress Compatible: yes
18
  WP Multisite Compatible: soon
@@ -30,9 +31,10 @@ Author: PriMoThemes.com / WebSharks, Inc.
30
  Donate link: http://www.primothemes.com/donate/
31
 
32
  Plugin Name: s2Member
 
33
  Forum URI: http://www.primothemes.com/forums/viewforum.php?f=4
34
- Professional Installation URI: http://www.primothemes.com/support/
35
  Plugin URI: http://www.primothemes.com/post/s2member-membership-plugin-with-paypal/
 
36
  Description: Empowers WordPress® with membership capabilities. Integrates seamlessly with PayPal®. Also compatible with the BuddyPress plugin for WP.
37
  Tags: membership, members, member, register, signup, paypal, pay pal, s2member, subscriber, members only, buddypress, buddy press, buddy press compatible, shopping cart, checkout, api, options panel included, websharks framework, w3c validated code, multi widget support, includes extensive documentation, highly extensible
38
  */
@@ -40,17 +42,24 @@ Tags: membership, members, member, register, signup, paypal, pay pal, s2member,
40
  Direct access denial.
41
  */
42
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
43
- exit;
 
 
 
 
 
 
 
44
  /*
45
  Compatibility checks.
46
  */
47
- if (version_compare (PHP_VERSION, "5.2", ">=") && version_compare (get_bloginfo ("version"), "2.9.2", ">=") && !isset ($GLOBALS["WS_PLUGIN__"]["s2member"]))
48
  {
49
  $GLOBALS["WS_PLUGIN__"]["s2member"]["l"] = __FILE__;
50
  /*
51
  Hook before loaded.
52
  */
53
- do_action("ws_plugin__s2member_before_loaded");
54
  /*
55
  System configuraton.
56
  */
@@ -62,7 +71,11 @@ if (version_compare (PHP_VERSION, "5.2", ">=") && version_compare (get_bloginfo
62
  /*
63
  Hook after system config & hooks are loaded.
64
  */
65
- do_action("ws_plugin__s2member_config_hooks_loaded");
 
 
 
 
66
  /*
67
  Function includes.
68
  */
@@ -71,19 +84,20 @@ if (version_compare (PHP_VERSION, "5.2", ">=") && version_compare (get_bloginfo
71
  Include shortcodes.
72
  */
73
  include_once dirname (__FILE__) . "/includes/codes.inc.php";
 
 
 
 
74
  }
75
- /*
76
- Else handle incompatibilities.
77
- */
78
  else if (is_admin ()) /* Admin compatibility errors. */
79
  {
80
- if (!version_compare (PHP_VERSION, "5.2", ">="))
81
  {
82
- add_action ("admin_notices", create_function ('', 'echo \'<div class="error fade"><p>You need PHP version 5.2 or higher to use the s2Member plugin.</p></div>\';'));
83
  }
84
- else if (!version_compare (get_bloginfo ("version"), "2.9.2", ">="))
85
  {
86
- add_action ("admin_notices", create_function ('', 'echo \'<div class="error fade"><p>You need WordPress® 2.9.2 or higher to use the s2Member plugin.</p></div>\';'));
87
  }
88
  }
89
  ?>
9
  If not, see: <http://www.gnu.org/licenses/>.
10
  */
11
  /*
12
+ Version: 3.0.5
13
+ Stable tag: 3.0.5
14
  Framework: WS-P-3.0
15
 
16
+ SSL Compatible: yes
17
  WordPress Compatible: yes
18
  BuddyPress Compatible: yes
19
  WP Multisite Compatible: soon
31
  Donate link: http://www.primothemes.com/donate/
32
 
33
  Plugin Name: s2Member
34
+ Pro Module / Licensing: http://www.s2member.com/
35
  Forum URI: http://www.primothemes.com/forums/viewforum.php?f=4
 
36
  Plugin URI: http://www.primothemes.com/post/s2member-membership-plugin-with-paypal/
37
+ Professional Installation URI: http://www.primothemes.com/forums/viewtopic.php?f=4&t=107
38
  Description: Empowers WordPress® with membership capabilities. Integrates seamlessly with PayPal®. Also compatible with the BuddyPress plugin for WP.
39
  Tags: membership, members, member, register, signup, paypal, pay pal, s2member, subscriber, members only, buddypress, buddy press, buddy press compatible, shopping cart, checkout, api, options panel included, websharks framework, w3c validated code, multi widget support, includes extensive documentation, highly extensible
40
  */
42
  Direct access denial.
43
  */
44
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
45
+ exit ("Do not access this file directly.");
46
+ /*
47
+ Define versions.
48
+ */
49
+ define ("WS_PLUGIN__S2MEMBER_VERSION", "3.0.5");
50
+ define ("WS_PLUGIN__S2MEMBER_MIN_PHP_VERSION", "5.2");
51
+ define ("WS_PLUGIN__S2MEMBER_MIN_WP_VERSION", "2.9.2");
52
+ define ("WS_PLUGIN__S2MEMBER_MIN_PRO_VERSION", "1.0");
53
  /*
54
  Compatibility checks.
55
  */
56
+ if (version_compare (PHP_VERSION, WS_PLUGIN__S2MEMBER_MIN_PHP_VERSION, ">=") && version_compare (get_bloginfo ("version"), WS_PLUGIN__S2MEMBER_MIN_WP_VERSION, ">=") && !isset ($GLOBALS["WS_PLUGIN__"]["s2member"]))
57
  {
58
  $GLOBALS["WS_PLUGIN__"]["s2member"]["l"] = __FILE__;
59
  /*
60
  Hook before loaded.
61
  */
62
+ do_action ("ws_plugin__s2member_before_loaded");
63
  /*
64
  System configuraton.
65
  */
71
  /*
72
  Hook after system config & hooks are loaded.
73
  */
74
+ do_action ("ws_plugin__s2member_config_hooks_loaded");
75
+ /*
76
+ Load a possible Pro module, if/when available.
77
+ */
78
+ @include_once dirname (__FILE__) . "-pro/pro-module.php";
79
  /*
80
  Function includes.
81
  */
84
  Include shortcodes.
85
  */
86
  include_once dirname (__FILE__) . "/includes/codes.inc.php";
87
+ /*
88
+ Hook after loaded.
89
+ */
90
+ do_action ("ws_plugin__s2member_after_loaded");
91
  }
 
 
 
92
  else if (is_admin ()) /* Admin compatibility errors. */
93
  {
94
+ if (!version_compare (PHP_VERSION, WS_PLUGIN__S2MEMBER_MIN_PHP_VERSION, ">="))
95
  {
96
+ add_action ("admin_notices", create_function ('', 'echo \'<div class="error fade"><p>You need PHP v\' . WS_PLUGIN__S2MEMBER_MIN_PHP_VERSION . \'+ to use the s2Member plugin.</p></div>\';'));
97
  }
98
+ else if (!version_compare (get_bloginfo ("version"), WS_PLUGIN__S2MEMBER_MIN_WP_VERSION, ">="))
99
  {
100
+ add_action ("admin_notices", create_function ('', 'echo \'<div class="error fade"><p>You need WordPress® v\' . WS_PLUGIN__S2MEMBER_MIN_WP_VERSION . \'+ to use the s2Member plugin.</p></div>\';'));
101
  }
102
  }
103
  ?>
screenshot-10.png CHANGED
Binary file
screenshot-5.png CHANGED
Binary file
screenshot-9.png CHANGED
Binary file