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

Version Description

  • Over 100 new Hooks/Filters have been added to the s2Member framework. Many of these Hooks/Filters now pass variables by reference.
  • 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.
  • IMPORTANT: ( Attention Developers ) All of s2Member's internal Hooks/Filters have been prefixed with ws_plugin__ starting with v3.0.4. Given the number of Hooks/Filters spread throughout the s2Member framework ( now over 200 ); it was important to establish a standard for prefixing all Hooks/Filters. This will prevent future namespace clashes. If you've hooked into s2Member using your own custom programming routines, please update all of your Hooks/Filters by prefixing them with ws_plugin__.
  • Security fix. It was possible for a Customer to use a Registration Access Link generated by s2Member; coming from a previously canceled purchased, to re-register under certain circumstances. This has been resolved in v3.0.4.
Download this release

Release Info

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

Code changes from version 3.0.2 to 3.0.4

Files changed (51) hide show
  1. images/brand-donations.fla +0 -0
  2. images/brand-donations.jpg +0 -0
  3. includes/codes.inc.php +21 -0
  4. includes/funcs.inc.php +6 -6
  5. includes/functions/activate-deactivate.inc.php +165 -159
  6. includes/functions/admin-lockout.inc.php +15 -12
  7. includes/functions/admin-notices.inc.php +68 -45
  8. includes/functions/auto-eots.inc.php +130 -104
  9. includes/functions/catg-level-access.inc.php +84 -81
  10. includes/functions/constants.inc.php +178 -159
  11. includes/functions/email-configs.inc.php +26 -17
  12. includes/functions/file-download-access.inc.php +184 -170
  13. includes/functions/hide-some-systematics.inc.php +18 -9
  14. includes/functions/ip-restrictions.inc.php +44 -34
  15. includes/functions/is-systematic.inc.php +44 -43
  16. includes/functions/js-globals.inc.php +122 -106
  17. includes/functions/list-servers.inc.php +46 -34
  18. includes/functions/login-customizations.inc.php +63 -46
  19. includes/functions/login-redirection.inc.php +42 -28
  20. includes/functions/menu-pages.inc.php +333 -253
  21. includes/functions/nocache.inc.php +44 -33
  22. includes/functions/page-level-access.inc.php +46 -43
  23. includes/functions/paypal-notify.inc.php +588 -517
  24. includes/functions/paypal-return.inc.php +312 -261
  25. includes/functions/paypal-utilities.inc.php +166 -132
  26. includes/functions/post-level-access.inc.php +46 -43
  27. includes/functions/profile-modifications.inc.php +56 -46
  28. includes/functions/ptag-level-access.inc.php +68 -65
  29. includes/functions/readme-parsing.inc.php +85 -66
  30. includes/functions/register-access.inc.php +394 -293
  31. includes/functions/ruri-level-access.inc.php +47 -39
  32. includes/functions/shortcodes.inc.php +97 -87
  33. includes/functions/sp-access.inc.php +83 -62
  34. includes/functions/tracking-codes.inc.php +72 -56
  35. includes/functions/translations.inc.php +31 -34
  36. includes/functions/user-access-level.inc.php +32 -31
  37. includes/functions/user-deletions.inc.php +31 -22
  38. includes/functions/user-has-wp-role.inc.php +21 -16
  39. includes/functions/user-notes.inc.php +41 -22
  40. includes/functions/users-list.inc.php +225 -141
  41. includes/functions/utilities.inc.php +273 -222
  42. includes/hooks.inc.php +2 -3
  43. includes/menu-pages/api-ops.inc.php +370 -317
  44. includes/menu-pages/buttons.inc.php +596 -518
  45. includes/menu-pages/down-ops.inc.php +198 -167
  46. includes/menu-pages/els-ops.inc.php +327 -288
  47. includes/menu-pages/info.inc.php +26 -11
  48. includes/menu-pages/menu-pages-s.js +261 -0
  49. includes/menu-pages/menu-pages.css +27 -45
  50. includes/menu-pages/menu-pages.js +3 -248
  51. includes/menu-pages/options.inc.php +822 -1114
images/brand-donations.fla CHANGED
Binary file
images/brand-donations.jpg CHANGED
Binary file
includes/codes.inc.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ Add WordPress® Editor Shortcodes.
18
+ http://codex.wordpress.org/Shortcode_API
19
+ */
20
+ add_shortcode ("s2Member-PayPal-Button", "ws_plugin__s2member_paypal_button");
21
+ ?>
includes/funcs.inc.php CHANGED
@@ -11,14 +11,14 @@ If not, see: <http://www.gnu.org/licenses/>.
11
  /*
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
  */
19
- if (is_dir(dirname(__FILE__) . "/functions"))
20
- if ($ws_plugin__s2member_temp_r = opendir(dirname(__FILE__) . "/functions"))
21
- while (($ws_plugin__s2member_temp_s = readdir($ws_plugin__s2member_temp_r)) !== false)
22
- if (preg_match("/\.php$/", $ws_plugin__s2member_temp_s) && !preg_match("/^index\.php$/i", $ws_plugin__s2member_temp_s))
23
- include_once dirname(__FILE__) . "/functions/" . $ws_plugin__s2member_temp_s;
24
  ?>
11
  /*
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
  */
19
+ if (is_dir (dirname (__FILE__) . "/functions"))
20
+ if ($ws_plugin__s2member_temp_r = opendir (dirname (__FILE__) . "/functions"))
21
+ while (($ws_plugin__s2member_temp_s = readdir ($ws_plugin__s2member_temp_r)) !== false)
22
+ if (preg_match ("/\.php$/", $ws_plugin__s2member_temp_s) && !preg_match ("/^index\.php$/i", $ws_plugin__s2member_temp_s))
23
+ include_once dirname (__FILE__) . "/functions/" . $ws_plugin__s2member_temp_s;
24
  ?>
includes/functions/activate-deactivate.inc.php CHANGED
@@ -23,186 +23,192 @@ Initializing these options will force them to be
23
  autoloaded into WordPress® instead of generating
24
  extra queries before they are set.
25
  */
26
- function ws_plugin__s2member_activate ()
27
  {
28
- do_action ("s2member_before_activation", get_defined_vars ());
29
- /**/
30
- add_role ("s2member_level1", "s2Member Level 1");
31
- add_role ("s2member_level2", "s2Member Level 2");
32
- add_role ("s2member_level3", "s2Member Level 3");
33
- add_role ("s2member_level4", "s2Member Level 4");
34
- /**/
35
- $role = &get_role ("s2member_level1");
36
- $role->add_cap ("read");
37
- $role->add_cap ("level_0");
38
- $role->add_cap ("access_s2member_level1");
39
- /**/
40
- $role = &get_role ("s2member_level2");
41
- $role->add_cap ("read");
42
- $role->add_cap ("level_0");
43
- $role->add_cap ("access_s2member_level2");
44
- $role->add_cap ("access_s2member_level1");
45
- /**/
46
- $role = &get_role ("s2member_level3");
47
- $role->add_cap ("read");
48
- $role->add_cap ("level_0");
49
- $role->add_cap ("access_s2member_level3");
50
- $role->add_cap ("access_s2member_level2");
51
- $role->add_cap ("access_s2member_level1");
52
- /**/
53
- $role = &get_role ("s2member_level4");
54
- $role->add_cap ("read");
55
- $role->add_cap ("level_0");
56
- $role->add_cap ("access_s2member_level4");
57
- $role->add_cap ("access_s2member_level3");
58
- $role->add_cap ("access_s2member_level2");
59
- $role->add_cap ("access_s2member_level1");
60
- /**/
61
- $role = &get_role ("administrator");
62
- $role->add_cap ("access_s2member_level1");
63
- $role->add_cap ("access_s2member_level2");
64
- $role->add_cap ("access_s2member_level3");
65
- $role->add_cap ("access_s2member_level4");
66
- /**/
67
- $role = &get_role ("editor");
68
- $role->add_cap ("access_s2member_level1");
69
- $role->add_cap ("access_s2member_level2");
70
- $role->add_cap ("access_s2member_level3");
71
- $role->add_cap ("access_s2member_level4");
72
- /**/
73
- $role = &get_role ("author");
74
- $role->add_cap ("access_s2member_level1");
75
- $role->add_cap ("access_s2member_level2");
76
- $role->add_cap ("access_s2member_level3");
77
- $role->add_cap ("access_s2member_level4");
78
- /**/
79
- $role = &get_role ("contributor");
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
- if (!is_dir ($files_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"]))
86
- if (is_writable (dirname ($files_dir)))
87
- mkdir ($files_dir, 0777);
88
- /**/
89
- if (is_dir ($files_dir) && is_writable ($files_dir))
90
- if (!file_exists ($htaccess = $files_dir . "/.htaccess"))
91
- file_put_contents ($htaccess, "deny from all");
92
- /**/
93
- if (!is_dir ($logs_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"]))
94
- if (is_writable (dirname ($logs_dir)))
95
- mkdir ($logs_dir, 0777);
96
- /**/
97
- if (is_dir ($logs_dir) && is_writable ($logs_dir))
98
- if (!file_exists ($htaccess = $logs_dir . "/.htaccess"))
99
- file_put_contents ($htaccess, "deny from all");
100
- /**/
101
- if (!is_numeric (get_option ("ws_plugin__s2member_configured")))
102
- update_option ("ws_plugin__s2member_configured", "0");
103
- /**/
104
- if (!is_array (get_option ("ws_plugin__s2member_cache")))
105
- update_option ("ws_plugin__s2member_cache", array ());
106
- /**/
107
- if (!is_array (get_option ("ws_plugin__s2member_notices")))
108
- update_option ("ws_plugin__s2member_notices", array ());
109
- /**/
110
- if (!is_array (get_option ("ws_plugin__s2member_options")))
111
- update_option ("ws_plugin__s2member_options", array ());
112
- /**/
113
- if (get_option ("ws_plugin__s2member_configured")) /* If they already have s2Member configured, read the Changelog. */
114
  {
115
- $notice = '<strong>s2Member</strong> has been <strong>re-activated</strong>, with the latest version. Your existing configuration remains intact.<br />';
116
- $notice .= 'Have fun, <a href="admin.php?page=ws-plugin--s2member-info">read the Changelog</a>, and make some money! :-)';
117
- ws_plugin__s2member_enqueue_admin_notice ($notice, array ("plugins.php", "ws-plugin--s2member-options"));
118
- }
119
- else /* Otherwise, we'll help the site owner out by giving them a link to the Quick Start Guide. */
120
- {
121
- $notice = '<strong>s2Member</strong> has been <strong>activated</strong>, with the latest version. Nice work!<br />';
122
- $notice .= 'Have fun, <a href="admin.php?page=ws-plugin--s2member-start">read the Quick Start Guide</a>, and make some money! :-)';
123
- ws_plugin__s2member_enqueue_admin_notice ($notice, array ("plugins.php", "ws-plugin--s2member-options"));
124
- }
125
- /**/
126
- do_action ("s2member_after_activation", get_defined_vars ());
127
- /**/
128
- return;
129
- }
130
- /*
131
- Function for handling de-activation cleanup routines.
132
- This function should match the array key for this plugin:
133
- ws_plugin__$plugin_key_deactivate() is called by our themes.
134
- */
135
- function ws_plugin__s2member_deactivate ()
136
- {
137
- do_action ("s2member_before_deactivation", get_defined_vars ());
138
- /**/
139
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["run_deactivation_routines"])
140
- {
141
- remove_role ("s2member_level1");
142
- remove_role ("s2member_level2");
143
- remove_role ("s2member_level3");
144
- remove_role ("s2member_level4");
 
 
145
  /**/
146
  $role = &get_role ("administrator");
147
- $role->remove_cap ("access_s2member_level1");
148
- $role->remove_cap ("access_s2member_level2");
149
- $role->remove_cap ("access_s2member_level3");
150
- $role->remove_cap ("access_s2member_level4");
151
  /**/
152
  $role = &get_role ("editor");
153
- $role->remove_cap ("access_s2member_level1");
154
- $role->remove_cap ("access_s2member_level2");
155
- $role->remove_cap ("access_s2member_level3");
156
- $role->remove_cap ("access_s2member_level4");
157
  /**/
158
  $role = &get_role ("author");
159
- $role->remove_cap ("access_s2member_level1");
160
- $role->remove_cap ("access_s2member_level2");
161
- $role->remove_cap ("access_s2member_level3");
162
- $role->remove_cap ("access_s2member_level4");
163
  /**/
164
  $role = &get_role ("contributor");
165
- $role->remove_cap ("access_s2member_level1");
166
- $role->remove_cap ("access_s2member_level2");
167
- $role->remove_cap ("access_s2member_level3");
168
- $role->remove_cap ("access_s2member_level4");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
169
  /**/
170
- if (is_dir ($files_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"]))
 
 
 
 
 
 
171
  {
172
- if (file_exists ($htaccess = $files_dir . "/.htaccess"))
173
- if (is_writable ($htaccess))
174
- unlink ($htaccess);
175
- /**/
176
- @rmdir ($files_dir);
177
  }
 
 
 
 
 
 
 
 
178
  /**/
179
- if (is_dir ($logs_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"]))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
180
  {
181
- if (file_exists ($htaccess = $logs_dir . "/.htaccess"))
182
- if (is_writable ($htaccess))
183
- unlink ($htaccess);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
184
  /**/
185
- if (file_exists ($log = $logs_dir . "/paypal-ipn.log"))
186
- if (is_writable ($log))
187
- unlink ($log);
 
 
 
 
 
 
 
 
 
 
 
 
 
188
  /**/
189
- if (file_exists ($log = $logs_dir . "/paypal-rtn.log"))
190
- if (is_writable ($log))
191
- unlink ($log);
 
192
  /**/
193
- @rmdir ($logs_dir);
194
  }
195
  /**/
196
- delete_option ("ws_plugin__s2member_configured");
197
- delete_option ("ws_plugin__s2member_cache");
198
- delete_option ("ws_plugin__s2member_notices");
199
- delete_option ("ws_plugin__s2member_options");
200
  /**/
201
- do_action ("s2member_during_deactivation", get_defined_vars ());
202
  }
203
- /**/
204
- do_action ("s2member_after_deactivation", get_defined_vars ());
205
- /**/
206
- return;
207
  }
208
  ?>
23
  autoloaded into WordPress® instead of generating
24
  extra queries before they are set.
25
  */
26
+ if (!function_exists ("ws_plugin__s2member_activate"))
27
  {
28
+ function 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");
35
+ add_role ("s2member_level4", "s2Member Level 4");
36
+ /**/
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");
85
+ $role->add_cap ("access_s2member_level4");
86
+ /**/
87
+ if (!is_dir ($files_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"]))
88
+ if (is_writable (dirname ($files_dir)))
89
+ mkdir ($files_dir, 0777);
90
+ /**/
91
+ if (is_dir ($files_dir) && is_writable ($files_dir))
92
+ if (!file_exists ($htaccess = $files_dir . "/.htaccess"))
93
+ file_put_contents ($htaccess, "deny from all");
94
+ /**/
95
+ if (!is_dir ($logs_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"]))
96
+ if (is_writable (dirname ($logs_dir)))
97
+ mkdir ($logs_dir, 0777);
98
+ /**/
99
+ if (is_dir ($logs_dir) && is_writable ($logs_dir))
100
+ if (!file_exists ($htaccess = $logs_dir . "/.htaccess"))
101
+ file_put_contents ($htaccess, "deny from all");
102
+ /**/
103
+ if (!is_numeric (get_option ("ws_plugin__s2member_configured")))
104
+ update_option ("ws_plugin__s2member_configured", "0");
105
+ /**/
106
+ if (!is_array (get_option ("ws_plugin__s2member_cache")))
107
+ update_option ("ws_plugin__s2member_cache", array ());
108
  /**/
109
+ if (!is_array (get_option ("ws_plugin__s2member_notices")))
110
+ update_option ("ws_plugin__s2member_notices", array ());
111
+ /**/
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
  }
121
+ else /* Otherwise, we'll help the site owner out by giving them a link to the Quick Start Guide. */
122
+ {
123
+ $notice = '<strong>s2Member</strong> has been <strong>activated</strong>, with the latest version. Nice work!<br />';
124
+ $notice .= 'Have fun, <a href="admin.php?page=ws-plugin--s2member-start">read the Quick Start Guide</a>, and make some money! :-)';
125
+ ws_plugin__s2member_enqueue_admin_notice ($notice, array ("plugins.php", "ws-plugin--s2member-options"));
126
+ }
127
+ /**/
128
+ do_action ("ws_plugin__s2member_after_activation", get_defined_vars ());
129
  /**/
130
+ return;
131
+ }
132
+ }
133
+ /*
134
+ Function for handling de-activation cleanup routines.
135
+ This function should match the array key for this plugin:
136
+ ws_plugin__$plugin_key_deactivate() is called by our themes.
137
+ */
138
+ if (!function_exists ("ws_plugin__s2member_deactivate"))
139
+ {
140
+ function ws_plugin__s2member_deactivate ()
141
+ {
142
+ do_action ("ws_plugin__s2member_before_deactivation", get_defined_vars ());
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");
173
+ $role->remove_cap ("access_s2member_level4");
174
+ /**/
175
+ if (is_dir ($files_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"]))
176
+ {
177
+ if (file_exists ($htaccess = $files_dir . "/.htaccess"))
178
+ if (is_writable ($htaccess))
179
+ unlink ($htaccess);
180
+ /**/
181
+ @rmdir ($files_dir);
182
+ }
183
  /**/
184
+ if (is_dir ($logs_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"]))
185
+ {
186
+ if (file_exists ($htaccess = $logs_dir . "/.htaccess"))
187
+ if (is_writable ($htaccess))
188
+ unlink ($htaccess);
189
+ /**/
190
+ if (file_exists ($log = $logs_dir . "/paypal-ipn.log"))
191
+ if (is_writable ($log))
192
+ unlink ($log);
193
+ /**/
194
+ if (file_exists ($log = $logs_dir . "/paypal-rtn.log"))
195
+ if (is_writable ($log))
196
+ unlink ($log);
197
+ /**/
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");
204
+ delete_option ("ws_plugin__s2member_options");
205
  /**/
206
+ do_action ("ws_plugin__s2member_during_deactivation", get_defined_vars ());
207
  }
208
  /**/
209
+ do_action ("ws_plugin__s2member_after_deactivation", get_defined_vars ());
 
 
 
210
  /**/
211
+ return;
212
  }
 
 
 
 
213
  }
214
  ?>
includes/functions/admin-lockout.inc.php CHANGED
@@ -17,18 +17,21 @@ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
17
  Function for handling admin lockouts.
18
  Attach to: add_action("admin_init");
19
  */
20
- function ws_plugin__s2member_admin_lockout ()
21
  {
22
- do_action ("s2member_before_admin_lockouts", get_defined_vars ());
23
- /**/
24
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["force_admin_lockouts"]/**/
25
- && !current_user_can ("edit_posts") /* In other words: Subscribers and Members. */
26
- && apply_filters ("s2member_admin_lockout", true, get_defined_vars ()) && /* Give filters a chance. */
27
- wp_redirect (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"])) !== "nill")
28
- exit;
29
- /**/
30
- do_action ("s2member_after_admin_lockouts", get_defined_vars ());
31
- /**/
32
- return;
 
 
 
33
  }
34
  ?>
17
  Function for handling admin lockouts.
18
  Attach to: add_action("admin_init");
19
  */
20
+ if (!function_exists ("ws_plugin__s2member_admin_lockout"))
21
  {
22
+ function ws_plugin__s2member_admin_lockout ()
23
+ {
24
+ do_action ("ws_plugin__s2member_before_admin_lockouts", get_defined_vars ());
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
+ /**/
34
+ return;
35
+ }
36
  }
37
  ?>
includes/functions/admin-notices.inc.php CHANGED
@@ -16,79 +16,102 @@ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
16
  /*
17
  Function displays an admin notice immediately.
18
  */
19
- function ws_plugin__s2member_display_admin_notice ($notice = FALSE, $error = FALSE)
20
  {
21
- do_action ("s2member_before_display_admin_notice", get_defined_vars ());
22
- /**/
23
- if ($notice && $error) /* Special format for errors. */
24
  {
25
- echo '<div class="error fade"><p>' . $notice . '</p></div>';
26
- }
27
- else if ($notice) /* Otherwise, we just send it as an update notice. */
28
- {
29
- echo '<div class="updated fade"><p>' . $notice . '</p></div>';
 
 
 
 
 
 
 
 
 
 
 
30
  }
31
- /**/
32
- do_action ("s2member_after_display_admin_notice", get_defined_vars ());
33
- /**/
34
- return;
35
  }
36
  /*
37
  Function that enqueues admin notices.
38
  */
39
- function ws_plugin__s2member_enqueue_admin_notice ($notice = FALSE, $on_pages = FALSE, $error = FALSE, $time = FALSE)
40
  {
41
- do_action ("s2member_before_enqueue_admin_notice", get_defined_vars ());
42
- /**/
43
- if ($notice && is_string ($notice)) /* If we have a valid string. */
44
  {
45
- $notices = (array)get_option ("ws_plugin__s2member_notices");
 
 
46
  /**/
47
- array_push ($notices, array ("notice" => $notice, "on_pages" => $on_pages, "error" => $error, "time" => $time));
 
 
 
 
 
 
 
 
 
 
 
48
  /**/
49
- do_action ("s2member_during_enqueue_admin_notice", get_defined_vars ()); /* Give plugins a chance. */
50
  /**/
51
- update_option ("ws_plugin__s2member_notices", ws_plugin__s2member_array_unique ($notices));
52
  }
53
- /**/
54
- do_action ("s2member_after_enqueue_admin_notice", get_defined_vars ());
55
- /**/
56
- return;
57
  }
58
  /*
59
  Function that displays admin notices.
60
  Attach to: add_action("admin_notices");
61
  */
62
- function ws_plugin__s2member_admin_notices ()
63
  {
64
- global $pagenow; /* This holds the current page filename. */
65
- /**/
66
- do_action ("s2member_before_admin_notices", get_defined_vars ());
67
- /**/
68
- if (is_array ($notices = get_option ("ws_plugin__s2member_notices")) && !empty ($notices))
69
  {
70
- foreach ($notices as $key => $notice) /* Check time on each notice. */
 
 
 
 
71
  {
72
- if (empty ($notice["on_pages"]) || $pagenow === $notice["on_pages"] || in_array ($pagenow, (array)$notice["on_pages"]) || $_GET["page"] === $notice["on_pages"] || in_array ($_GET["page"], (array)$notice["on_pages"]))
73
  {
74
- if (strtotime ("now") >= $notice["time"]) /* Time to show it? */
75
  {
76
- unset ($notices[$key]); /* Clear this notice & display it. */
77
- /**/
78
- ws_plugin__s2member_display_admin_notice ($notice["notice"], $notice["error"]);
 
 
 
 
 
 
 
 
 
79
  }
80
  }
 
 
 
 
 
 
 
 
81
  }
82
  /**/
83
- do_action ("s2member_during_admin_notices", get_defined_vars ());
84
- /**/
85
- $notices = array_merge ($notices); /* Re-index. */
86
  /**/
87
- update_option ("ws_plugin__s2member_notices", $notices);
88
  }
89
- /**/
90
- do_action ("s2member_after_admin_notices", get_defined_vars ());
91
- /**/
92
- return;
93
  }
94
  ?>
16
  /*
17
  Function displays an admin notice immediately.
18
  */
19
+ if (!function_exists ("ws_plugin__s2member_display_admin_notice"))
20
  {
21
+ function ws_plugin__s2member_display_admin_notice ($notice = FALSE, $error = FALSE)
 
 
22
  {
23
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
24
+ do_action ("ws_plugin__s2member_before_display_admin_notice", get_defined_vars ());
25
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
26
+ /**/
27
+ if ($notice && $error) /* Special format for errors. */
28
+ {
29
+ echo '<div class="error fade"><p>' . $notice . '</p></div>';
30
+ }
31
+ else if ($notice) /* Otherwise, we just send it as an update notice. */
32
+ {
33
+ echo '<div class="updated fade"><p>' . $notice . '</p></div>';
34
+ }
35
+ /**/
36
+ do_action ("ws_plugin__s2member_after_display_admin_notice", get_defined_vars ());
37
+ /**/
38
+ return;
39
  }
 
 
 
 
40
  }
41
  /*
42
  Function that enqueues admin notices.
43
  */
44
+ if (!function_exists ("ws_plugin__s2member_enqueue_admin_notice"))
45
  {
46
+ function ws_plugin__s2member_enqueue_admin_notice ($notice = FALSE, $on_pages = FALSE, $error = FALSE, $time = FALSE)
 
 
47
  {
48
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
49
+ do_action ("ws_plugin__s2member_before_enqueue_admin_notice", get_defined_vars ());
50
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
51
  /**/
52
+ if ($notice && is_string ($notice)) /* If we have a valid string. */
53
+ {
54
+ $notices = (array)get_option ("ws_plugin__s2member_notices");
55
+ /**/
56
+ array_push ($notices, array ("notice" => $notice, "on_pages" => $on_pages, "error" => $error, "time" => $time));
57
+ /**/
58
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
59
+ do_action ("ws_plugin__s2member_during_enqueue_admin_notice", get_defined_vars ());
60
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
61
+ /**/
62
+ update_option ("ws_plugin__s2member_notices", ws_plugin__s2member_array_unique ($notices));
63
+ }
64
  /**/
65
+ do_action ("ws_plugin__s2member_after_enqueue_admin_notice", get_defined_vars ());
66
  /**/
67
+ return;
68
  }
 
 
 
 
69
  }
70
  /*
71
  Function that displays admin notices.
72
  Attach to: add_action("admin_notices");
73
  */
74
+ if (!function_exists ("ws_plugin__s2member_admin_notices"))
75
  {
76
+ function ws_plugin__s2member_admin_notices ()
 
 
 
 
77
  {
78
+ global $pagenow; /* This holds the current page filename. */
79
+ /**/
80
+ do_action ("ws_plugin__s2member_before_admin_notices", get_defined_vars ());
81
+ /**/
82
+ if (is_array ($notices = get_option ("ws_plugin__s2member_notices")) && !empty ($notices))
83
  {
84
+ foreach ($notices as $key => $notice) /* Check time on each notice. */
85
  {
86
+ if (empty ($notice["on_pages"]) || $pagenow === $notice["on_pages"] || in_array ($pagenow, (array)$notice["on_pages"]) || $_GET["page"] === $notice["on_pages"] || in_array ($_GET["page"], (array)$notice["on_pages"]))
87
  {
88
+ if (strtotime ("now") >= $notice["time"]) /* Time to show it? */
89
+ {
90
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
91
+ do_action ("ws_plugin__s2member_during_admin_notices_before_display", get_defined_vars ());
92
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
93
+ /**/
94
+ unset ($notices[$key]); /* Clear this notice & display it. */
95
+ /**/
96
+ ws_plugin__s2member_display_admin_notice ($notice["notice"], $notice["error"]);
97
+ /**/
98
+ do_action ("ws_plugin__s2member_during_admin_notices_after_display", get_defined_vars ());
99
+ }
100
  }
101
  }
102
+ /**/
103
+ $notices = array_merge ($notices); /* Re-index. */
104
+ /**/
105
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
106
+ do_action ("ws_plugin__s2member_during_admin_notices", get_defined_vars ());
107
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
108
+ /**/
109
+ update_option ("ws_plugin__s2member_notices", $notices);
110
  }
111
  /**/
112
+ do_action ("ws_plugin__s2member_after_admin_notices", get_defined_vars ());
 
 
113
  /**/
114
+ return;
115
  }
 
 
 
 
116
  }
117
  ?>
includes/functions/auto-eots.inc.php CHANGED
@@ -16,160 +16,186 @@ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
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.
19
- To increase, use: add_filter("s2member_auto_eots_per_process");
20
  */
21
- function ws_plugin__s2member_auto_eot_system ($per_process = 10)
22
  {
23
- global $wpdb; /* Need global DB obj. */
24
- /**/
25
- do_action ("s2member_before_auto_eot_system", get_defined_vars ());
26
- /**/
27
- include_once ABSPATH . "wp-admin/includes/admin.php"; /* Get Admin APIs. */
28
- /**/
29
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["auto_eot_system_enabled"]) /* Enabled? */
30
  {
31
- $per_process = apply_filters ("s2member_auto_eot_system_per_process", $per_process, get_defined_vars ());
32
  /**/
33
- 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))
 
 
 
 
34
  {
35
- foreach ($eots as $eot) /* Go through the array of eots. We need to (demote|delete) each of them. */
 
 
36
  {
37
- $user_id = $eot->user_id; /* Grab the user ID value from the query. */
38
- /**/
39
- $user = new WP_User ($user_id); /* Acquire user object. */
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. */
45
  {
46
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_eot_behavior"] === "demote")
 
 
 
 
 
 
 
47
  {
48
- $user->set_role ("subscriber");
49
- /**/
50
- $subscr_id = get_usermeta ($user_id, "s2member_subscr_id");
51
- $custom = get_usermeta ($user_id, "s2member_custom");
52
- /**/
53
- delete_usermeta ($user_id, "s2member_custom");
54
- delete_usermeta ($user_id, "s2member_subscr_id");
55
- delete_usermeta ($user_id, "s2member_last_payment_time");
56
- delete_usermeta ($user_id, "s2member_auto_eot_time");
57
- /**/
58
- foreach ($user->allcaps as $cap => $cap_enabled)
59
- if (preg_match ("/^access_s2member_ccap_/", $cap))
60
- $user->remove_cap ($ccap = $cap);
61
- /**/
62
- delete_usermeta ($user_id, "s2member_file_download_access_arc");
63
- delete_usermeta ($user_id, "s2member_file_download_access_log");
64
- /**/
65
- ws_plugin__s2member_append_user_notes ($user_id, "Demoted by s2Member: " . date ("D M j, Y g:i a T"));
66
- /**/
67
- if ($subscr_id && $custom && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"] && is_array ($cv = preg_split ("/\|/", $custom)))
68
  {
69
- foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"]) as $url) /* Handle EOT Notifications. */
70
- /**/
71
- if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)) && ($url = preg_replace ("/%%subscr_id%%/i", urlencode ($subscr_id), $url)))
72
- 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)))
73
- if (($url = preg_replace ("/%%user_full_name%%/i", urlencode (trim ($user->first_name . " " . $user->last_name)), $url)))
74
- if (($url = preg_replace ("/%%user_email%%/i", urlencode ($user->user_email), $url)))
75
- /**/
76
- if (($url = trim ($url))) /* Empty? */
77
- ws_plugin__s2member_remote ($url);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
  }
79
  /**/
80
- do_action ("s2member_during_auto_eot_system_during_demote", get_defined_vars ());
81
- }
82
- else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_eot_behavior"] === "delete")
83
- {
84
- wp_delete_user ($user_id); /* Triggers: `ws_plugin__s2member_handle_user_deletions()` */
85
- /* `ws_plugin__s2member_handle_user_deletions()` triggers `eot_del_notification_urls` */
86
- /**/
87
- do_action ("s2member_during_auto_eot_system_during_delete", get_defined_vars ());
88
  }
89
- /**/
90
- do_action ("s2member_during_auto_eot_system", get_defined_vars ());
91
  }
92
  }
93
  }
 
 
 
 
 
 
94
  }
95
- /**/
96
- do_action ("s2member_after_auto_eot_system", get_defined_vars ());
97
- /**/
98
- return;
99
  }
100
  /*
101
  This function allows the Auto-EOT Sytem to be
102
  processed through a server-side Cron Job.
103
  Attach to: add_action("init");
104
  */
105
- function ws_plugin__s2member_auto_eot_system_via_cron ()
106
  {
107
- do_action ("s2member_before_auto_eot_system_via_cron", get_defined_vars ());
108
- /**/
109
- if ($_GET["s2member_auto_eot_system_via_cron"]) /* Being called through HTTP? */
110
  {
111
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["auto_eot_system_enabled"]) /* Enabled? */
 
 
112
  {
113
- ws_plugin__s2member_auto_eot_system ();
 
 
 
 
 
114
  /**/
115
- do_action ("s2member_during_auto_eot_system_via_cron", get_defined_vars ());
116
  }
117
  /**/
118
- exit; /* Exit. */
119
  }
120
- /**/
121
- do_action ("s2member_after_auto_eot_system_via_cron", get_defined_vars ());
122
  }
123
  /*
124
  Extends the WP-Cron schedules to support 10 minute intervals.
125
  Attach to: add_filter("cron_schedules");
126
  */
127
- function ws_plugin__s2member_extend_cron_schedules ($schedules = array ())
128
  {
129
- do_action ("s2member_before_extend_cron_schedules", get_defined_vars ());
130
- /**/
131
- $array = array ("every10m" => array ("interval" => 600, "display" => "Every 10 Minutes"));
132
- /**/
133
- return apply_filters ("s2member_extend_cron_schedules", array_merge ($array, $schedules), get_defined_vars ());
 
 
 
 
 
134
  }
135
  /*
136
  Adds a scheduled task for s2Member's Auto-EOT System.
137
  */
138
- function ws_plugin__s2member_add_auto_eot_system ()
139
  {
140
- do_action ("s2member_before_add_auto_eot_system", get_defined_vars ());
141
- /**/
142
- if (!ws_plugin__s2member_delete_auto_eot_system ())
143
  {
144
- return apply_filters ("s2member_add_auto_eot_system", false, get_defined_vars ());
145
- }
146
- else if (function_exists ("wp_cron")) /* Otherwise, we can schedule. */
147
- {
148
- wp_schedule_event (time (), "every10m", "s2member_auto_eot_system");
149
  /**/
150
- return apply_filters ("s2member_add_auto_eot_system", true, get_defined_vars ());
151
- }
152
- else /* Otherwise, it would appear that WP-Cron is not available. */
153
- {
154
- return apply_filters ("s2member_add_auto_eot_system", false, get_defined_vars ());
 
 
 
 
 
 
 
 
 
155
  }
156
  }
157
  /*
158
  Delete scheduled tasks for s2Member's Auto-EOT System.
159
  */
160
- function ws_plugin__s2member_delete_auto_eot_system ()
161
  {
162
- do_action ("s2member_before_delete_auto_eot_system", get_defined_vars ());
163
- /**/
164
- if (function_exists ("wp_cron"))
165
  {
166
- wp_clear_scheduled_hook ("s2member_auto_eot_system");
167
  /**/
168
- return apply_filters ("s2member_delete_auto_eot_system", true, get_defined_vars ());
169
- }
170
- else /* Otherwise, it would appear that WP-Cron is not available. */
171
- {
172
- return apply_filters ("s2member_delete_auto_eot_system", false, get_defined_vars ());
 
 
 
 
 
 
173
  }
174
  }
175
  ?>
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.
19
+ To increase, use: add_filter ("ws_plugin__s2member_auto_eot_system_per_process");
20
  */
21
+ if (!function_exists ("ws_plugin__s2member_auto_eot_system"))
22
  {
23
+ function ws_plugin__s2member_auto_eot_system ($per_process = 10)
 
 
 
 
 
 
24
  {
25
+ global $wpdb; /* Need global DB obj. */
26
  /**/
27
+ include_once ABSPATH . "wp-admin/includes/admin.php";
28
+ /**/
29
+ do_action ("ws_plugin__s2member_before_auto_eot_system", get_defined_vars ());
30
+ /**/
31
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["auto_eot_system_enabled"]) /* Enabled? */
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
  }
102
  }
103
+ /**/
104
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
105
+ do_action ("ws_plugin__s2member_after_auto_eot_system", get_defined_vars ());
106
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
107
+ /**/
108
+ return;
109
  }
 
 
 
 
110
  }
111
  /*
112
  This function allows the Auto-EOT Sytem to be
113
  processed through a server-side Cron Job.
114
  Attach to: add_action("init");
115
  */
116
+ if (!function_exists ("ws_plugin__s2member_auto_eot_system_via_cron"))
117
  {
118
+ function ws_plugin__s2member_auto_eot_system_via_cron ()
 
 
119
  {
120
+ do_action ("ws_plugin__s2member_before_auto_eot_system_via_cron", get_defined_vars ());
121
+ /**/
122
+ if ($_GET["s2member_auto_eot_system_via_cron"]) /* Being called through HTTP? */
123
  {
124
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["auto_eot_system_enabled"])
125
+ {
126
+ ws_plugin__s2member_auto_eot_system ();
127
+ /**/
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"))
158
  {
159
+ function ws_plugin__s2member_add_auto_eot_system ()
 
 
160
  {
161
+ do_action ("ws_plugin__s2member_before_add_auto_eot_system", get_defined_vars ());
 
 
 
 
162
  /**/
163
+ if (!ws_plugin__s2member_delete_auto_eot_system ())
164
+ {
165
+ return apply_filters ("ws_plugin__s2member_add_auto_eot_system", false, get_defined_vars ());
166
+ }
167
+ else if (function_exists ("wp_cron")) /* Otherwise, we can schedule. */
168
+ {
169
+ wp_schedule_event (time (), "every10m", "ws_plugin__s2member_auto_eot_system__schedule");
170
+ /**/
171
+ return apply_filters ("ws_plugin__s2member_add_auto_eot_system", true, get_defined_vars ());
172
+ }
173
+ else /* Otherwise, it would appear that WP-Cron is not available. */
174
+ {
175
+ return apply_filters ("ws_plugin__s2member_add_auto_eot_system", false, get_defined_vars ());
176
+ }
177
  }
178
  }
179
  /*
180
  Delete scheduled tasks for s2Member's Auto-EOT System.
181
  */
182
+ if (!function_exists ("ws_plugin__s2member_delete_auto_eot_system"))
183
  {
184
+ function ws_plugin__s2member_delete_auto_eot_system ()
 
 
185
  {
186
+ do_action ("ws_plugin__s2member_before_delete_auto_eot_system", get_defined_vars ());
187
  /**/
188
+ if (function_exists ("wp_cron"))
189
+ {
190
+ wp_clear_scheduled_hook ("s2member_auto_eot_system"); /* This is for backward compatibility. */
191
+ wp_clear_scheduled_hook ("ws_plugin__s2member_auto_eot_system__schedule"); /* Since v3.0.3. */
192
+ /**/
193
+ return apply_filters ("ws_plugin__s2member_delete_auto_eot_system", true, get_defined_vars ());
194
+ }
195
+ else /* Otherwise, it would appear that WP-Cron is not available. */
196
+ {
197
+ return apply_filters ("ws_plugin__s2member_delete_auto_eot_system", false, get_defined_vars ());
198
+ }
199
  }
200
  }
201
  ?>
includes/functions/catg-level-access.inc.php CHANGED
@@ -17,99 +17,102 @@ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
17
  Function for handling category level access permissions.
18
  Attach to: add_action("template_redirect");
19
  */
20
- function ws_plugin__s2member_check_catg_level_access ()
21
  {
22
- global $post; /* get_the_ID() not yet available here. */
23
- /**/
24
- do_action ("s2member_before_check_catg_level_access", get_defined_vars ());
25
- /**/
26
- $excluded = apply_filters ("s2member_check_catg_level_access_excluded", false, get_defined_vars ());
27
- /**/
28
- if (!$excluded && ((is_category () && ($cat_ID = get_query_var ("cat"))) || (is_single () && !is_page () && is_object ($post) && ($post_ID = $post->ID))))
29
  {
30
- if (!ws_plugin__s2member_is_systematic_use_page ()) /* Never restrict systematic use pages. */
 
 
 
 
 
 
31
  {
32
- $current_user = (is_user_logged_in ()) ? wp_get_current_user () : false;
33
- /**/
34
- if (is_category () && $cat_ID) /* We also check if this is a child category of a restricted category. */
35
  {
36
- 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")
37
- exit;
38
  /**/
39
- 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")
40
- exit;
41
- /**/
42
- 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")
43
- exit;
44
- /**/
45
- 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")
46
- exit;
47
- /**/
48
- 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")
49
- exit;
50
- /**/
51
- 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")
52
- exit;
53
- /**/
54
- 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")
55
- exit;
56
- /**/
57
- 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")
58
- exit;
59
- /**/
60
- if ($level1_catgs)
61
- foreach ($level1_catgs as $catg)
62
- 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")
63
  exit;
64
- /**/
65
- if ($level2_catgs)
66
- foreach ($level2_catgs as $catg)
67
- 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")
68
  exit;
69
- /**/
70
- if ($level3_catgs)
71
- foreach ($level3_catgs as $catg)
72
- 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")
73
  exit;
74
- /**/
75
- if ($level4_catgs)
76
- foreach ($level4_catgs as $catg)
77
- 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")
78
  exit;
79
- }
80
- else if (is_single () && !is_page () && $post_ID)
81
- {
82
- 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")
83
- exit;
84
- /**/
85
- 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")
86
- exit;
87
- /**/
88
- 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")
89
- exit;
90
- /**/
91
- 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")
92
- exit;
93
- /**/
94
- 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")
95
- exit;
96
- /**/
97
- 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")
98
- exit;
99
- /**/
100
- 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")
101
- exit;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
  /**/
103
- 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")
104
- exit;
105
  }
106
- /**/
107
- do_action ("s2member_during_check_catg_level_access", get_defined_vars ());
108
  }
 
 
 
 
109
  }
110
- /**/
111
- do_action ("s2member_after_check_catg_level_access", get_defined_vars ());
112
- /**/
113
- return;
114
  }
115
  ?>
17
  Function for handling category level access permissions.
18
  Attach to: add_action("template_redirect");
19
  */
20
+ if (!function_exists ("ws_plugin__s2member_check_catg_level_access"))
21
  {
22
+ function ws_plugin__s2member_check_catg_level_access ()
 
 
 
 
 
 
23
  {
24
+ global $post; /* get_the_ID() not yet available here. */
25
+ /**/
26
+ do_action ("ws_plugin__s2member_before_check_catg_level_access", get_defined_vars ());
27
+ /**/
28
+ $excluded = apply_filters ("ws_plugin__s2member_check_catg_level_access_excluded", false, get_defined_vars ());
29
+ /**/
30
+ if (!$excluded && ((is_category () && ($cat_ID = get_query_var ("cat"))) || (is_single () && !is_page () && is_object ($post) && ($post_ID = $post->ID))))
31
  {
32
+ if (!ws_plugin__s2member_is_systematic_use_page ()) /* Never restrict systematic use pages. */
 
 
33
  {
34
+ $current_user = (is_user_logged_in ()) ? wp_get_current_user () : false;
 
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 ());
 
110
  }
 
 
111
  }
112
+ /**/
113
+ do_action ("ws_plugin__s2member_after_check_catg_level_access", get_defined_vars ());
114
+ /**/
115
+ return;
116
  }
 
 
 
 
117
  }
118
  ?>
includes/functions/constants.inc.php CHANGED
@@ -18,86 +18,95 @@ Define several API Constants for s2Member.
18
  Note that these are duplicated into the JavaScript API as well.
19
  Attach to: add_action("init");
20
  */
21
- function ws_plugin__s2member_constants ()
22
  {
23
- do_action ("s2member_before_constants", get_defined_vars ());
24
- /**/
25
- $links = ws_plugin__s2member_constant_links ();
26
- $metas = ws_plugin__s2member_constant_metas ();
27
- $level = ws_plugin__s2member_user_access_level ();
28
- $current_user = (is_user_logged_in ()) ? wp_get_current_user () : false;
29
- $file_downloads = ws_plugin__s2member_user_downloads ("", $metas["s2member_file_download_access_log"]);
30
- $login_redirection_override = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"];
31
- /**/
32
- define ("S2MEMBER_VERSION", $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["version"]); /* Always a (string) containing the version. Available since 3.0. */
33
- /**/
34
- define ("S2MEMBER_CURRENT_USER_IS_LOGGED_IN", (($current_user) ? true : false)); /* This will always be (bool) true or false. False if they are NOT currently logged in. */
35
- define ("S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER", (($current_user && $level >= 1) ? true : false)); /* This will always be (bool) true or false. Level >= 1 for Members. */
36
- define ("S2MEMBER_CURRENT_USER_ACCESS_LEVEL", (int)$level); /* This will always be (int) negative 1 thru positive 4. -1 if user is not logged in. 0 if logged in as a Subscriber. */
37
- 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. */
38
- define ("S2MEMBER_CURRENT_USER_SUBSCR_ID", (($current_user) ? (($metas["s2member_subscr_id"]) ? $metas["s2member_subscr_id"] : $current_user->ID) : "")); /* Empty if not logged in. */
39
- define ("S2MEMBER_CURRENT_USER_CUSTOM", (($current_user) ? $metas["s2member_custom"] : "")); /* This will always a (string). However, it will be empty if not logged in. */
40
- 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. */
41
- define ("S2MEMBER_CURRENT_USER_REGISTRATION_DAYS", (($current_user) ? floor ((strtotime ("now") - strtotime ($current_user->user_registered)) / 86400) : 0)); /* (int). */
42
- define ("S2MEMBER_CURRENT_USER_DISPLAY_NAME", (($current_user) ? $current_user->display_name : "")); /* This will always be a (string). Empty if not logged in. */
43
- define ("S2MEMBER_CURRENT_USER_FIRST_NAME", (($current_user) ? $current_user->user_firstname : "")); /* This will always be a (string). Empty if not logged in. */
44
- define ("S2MEMBER_CURRENT_USER_LAST_NAME", (($current_user) ? $current_user->user_lastname : "")); /* This will always be a (string). Empty if not logged in. */
45
- define ("S2MEMBER_CURRENT_USER_LOGIN", (($current_user) ? $current_user->user_login : "")); /* This will always be a (string). Empty if not logged in. */
46
- define ("S2MEMBER_CURRENT_USER_EMAIL", (($current_user) ? $current_user->user_email : "")); /* This will always be a (string). Empty if not logged in. */
47
- define ("S2MEMBER_CURRENT_USER_IP", $_SERVER["REMOTE_ADDR"]); /* This will always be a (string). It may be empty if the user is browsing anonymously. */
48
- define ("S2MEMBER_CURRENT_USER_ID", (($current_user) ? (int)$current_user->ID : 0)); /* This will always be an (int). Zero if not logged in. */
49
- define ("S2MEMBER_CURRENT_USER_FIELDS", (($current_user) ? json_encode (array_merge /* Always a json_encode (array). This includes custom fields. */
50
- (array ("id" => S2MEMBER_CURRENT_USER_ID, "ip" => S2MEMBER_CURRENT_USER_IP, "email" => S2MEMBER_CURRENT_USER_EMAIL, "login" => S2MEMBER_CURRENT_USER_LOGIN,/**/
51
- "first_name" => S2MEMBER_CURRENT_USER_FIRST_NAME, "last_name" => S2MEMBER_CURRENT_USER_LAST_NAME, "display_name" => S2MEMBER_CURRENT_USER_DISPLAY_NAME,/**/
52
- "subscr_id" => S2MEMBER_CURRENT_USER_SUBSCR_ID, "custom" => S2MEMBER_CURRENT_USER_CUSTOM), $metas["s2member_custom_fields"])) : json_encode (array ())));
53
- /**/
54
- define ("S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED", (int)$file_downloads["allowed"]); /* This will always be an integer value (int) >= 0 where 0 means no access. */
55
- define ("S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED", (($file_downloads["allowed"] >= 999999999) ? true : false)); /* This will always be (bool). */
56
- define ("S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY", (int)$file_downloads["currently"]); /* This will always be an integer value (int) >= 0 where 0 means none currently. */
57
- define ("S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS", (int)$file_downloads["allowed_days"]); /* This will always be an integer value (int) >= 0 where 0 means no access. */
58
- /**/
59
- define ("S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"]); /* The exceeded page id (int). */
60
- define ("S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]); /* Options page id, always an (int). */
61
- define ("S2MEMBER_LOGIN_WELCOME_PAGE_ID", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]); /* The welcome page id, always an (int). */
62
- /**/
63
- define ("S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL", get_bloginfo ("url") . "/?s2member_profile=1"); /* Where a user modifies their profile. */
64
- define ("S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL", $links["file_download_limit_exceeded_page"]); /* Always a string. URL to limit exceeded page. */
65
- define ("S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL", $links["membership_options_page"]); /* Always a string. This is the URL to the membership options page. */
66
- define ("S2MEMBER_LOGIN_WELCOME_PAGE_URL", (($login_redirection_override) ? $login_redirection_override : $links["login_welcome_page"])); /* Always a string. */
67
- 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(). */
68
- 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(). */
69
- /**/
70
- define ("S2MEMBER_LEVEL1_LABEL", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_label"]); /* This is the (string) label that you created for membership level number 1. */
71
- define ("S2MEMBER_LEVEL2_LABEL", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_label"]); /* This is the (string) label that you created for membership level number 2. */
72
- define ("S2MEMBER_LEVEL3_LABEL", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_label"]); /* This is the (string) label that you created for membership level number 3. */
73
- define ("S2MEMBER_LEVEL4_LABEL", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_label"]); /* This is the (string) label that you created for membership level number 4. */
74
- /**/
75
- define ("S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_file_downloads_allowed"]); /* This is the (int) allowed downloads. */
76
- define ("S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_file_downloads_allowed"]); /* This is the (int) allowed downloads. */
77
- define ("S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_file_downloads_allowed"]); /* This is the (int) allowed downloads. */
78
- define ("S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_file_downloads_allowed"]); /* This is the (int) allowed downloads. */
79
- /**/
80
- define ("S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED_DAYS", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_file_downloads_allowed_days"]); /* This is (int) allowed days. */
81
- define ("S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED_DAYS", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_file_downloads_allowed_days"]); /* This is (int) allowed days. */
82
- define ("S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED_DAYS", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_file_downloads_allowed_days"]); /* This is (int) allowed days. */
83
- define ("S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED_DAYS", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_file_downloads_allowed_days"]); /* This is (int) allowed days. */
84
- /**/
85
- define ("S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_inline_extensions"]); /* This is the (string) list of extensions. */
86
- /**/
87
- define ("S2MEMBER_REG_EMAIL_FROM_NAME", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]); /* This is the name that outgoing email messages are sent by. */
88
- define ("S2MEMBER_REG_EMAIL_FROM_EMAIL", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"]); /* This is the email that outgoing messages are sent by. */
89
- /**/
90
- define ("S2MEMBER_PAYPAL_NOTIFY_URL", get_bloginfo ("url") . "/?s2member_paypal_notify=1"); /* This will always be a (string), and it will never be an empty value. */
91
- define ("S2MEMBER_PAYPAL_RETURN_URL", get_bloginfo ("url") . "/?s2member_paypal_return=1"); /* This will always be a (string), and it will never be an empty value. */
92
- define ("S2MEMBER_PAYPAL_ENDPOINT", (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "www.sandbox.paypal.com" : "www.paypal.com")); /* Using sandbox? */
93
- define ("S2MEMBER_PAYPAL_BUSINESS", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"]); /* This is the email address that identifies your paypal business. */
94
- /**/
95
- 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" : ""));
96
- 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. */
97
- /**/
98
- do_action ("s2member_after_constants", get_defined_vars ());
99
- /**/
100
- return;
 
 
 
 
 
 
 
 
 
101
  }
102
  /*
103
  This function pulls all of the page links needed for Constants.
@@ -105,101 +114,111 @@ Page links are cached into the s2member options on 15 min intervals.
105
  This allows the API Constants to provide quick access to them without being
106
  forced to execute get_page_link() all the time, which piles up DB queries.
107
  */
108
- function ws_plugin__s2member_constant_links ()
109
  {
110
- do_action ("s2member_before_constant_links", get_defined_vars ());
111
- /**/
112
- $cache_minutes = 15; /* Could be higher? */
113
- /**/
114
- $l["login_welcome_page"] = (string)"";
115
- $l["membership_options_page"] = (string)"";
116
- $l["file_download_limit_exceeded_page"] = (string)"";
117
- /**/
118
- $login_welcome_page = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"];
119
- $membership_options_page = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"];
120
- $file_download_limit_exceeded_page = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"];
121
- /**/
122
- $login_welcome_page_cache = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["login_welcome_page"];
123
- $membership_options_page_cache = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"];
124
- $file_download_limit_exceeded_page_cache = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["file_download_limit_exceeded_page"];
125
- /**/
126
- if ($login_welcome_page && $login_welcome_page_cache["page"] === $login_welcome_page && $login_welcome_page_cache["link"] && $login_welcome_page_cache["time"] >= strtotime ("-" . $cache_minutes . " minutes"))
127
  {
128
- $l["login_welcome_page"] = $login_welcome_page_cache["link"];
129
- }
130
- else /* Otherwise, we need to query the database using get_page_link() and update the cache. */
131
- {
132
- $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["login_welcome_page"]["time"] = strtotime ("now");
133
- $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["login_welcome_page"]["page"] = $login_welcome_page;
134
- $l["login_welcome_page"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["login_welcome_page"]["link"] = get_page_link ($login_welcome_page);
135
  /**/
136
- $cache_needs_updating = true;
137
- }
138
- /**/
139
- if ($membership_options_page && $membership_options_page_cache["page"] === $membership_options_page && $membership_options_page_cache["link"] && $membership_options_page_cache["time"] >= strtotime ("-" . $cache_minutes . " minutes"))
140
- {
141
- $l["membership_options_page"] = $membership_options_page_cache["link"];
142
- }
143
- else /* Otherwise, we need to query the database using get_page_link() and update the cache. */
144
- {
145
- $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"]["time"] = strtotime ("now");
146
- $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"]["page"] = $membership_options_page;
147
- $l["membership_options_page"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"]["link"] = get_page_link ($membership_options_page);
148
  /**/
149
- $cache_needs_updating = true;
150
- }
151
- /**/
152
- if ($file_download_limit_exceeded_page && $file_download_limit_exceeded_page_cache["page"] === $file_download_limit_exceeded_page && $file_download_limit_exceeded_page_cache["link"] && $file_download_limit_exceeded_page_cache["time"] >= strtotime ("-" . $cache_minutes . " minutes"))
153
- {
154
- $l["file_download_limit_exceeded_page"] = $file_download_limit_exceeded_page_cache["link"];
155
- }
156
- else /* Otherwise, we need to query the database using get_page_link() and update the cache. */
157
- {
158
- $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["file_download_limit_exceeded_page"]["time"] = strtotime ("now");
159
- $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["file_download_limit_exceeded_page"]["page"] = $file_download_limit_exceeded_page;
160
- $l["file_download_limit_exceeded_page"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["file_download_limit_exceeded_page"]["link"] = get_page_link ($file_download_limit_exceeded_page);
161
  /**/
162
- $cache_needs_updating = true;
163
- }
164
- /**/
165
- if ($cache_needs_updating) /* The cache is also reset when options are updated from a menu page. */
166
- {
167
- update_option ("ws_plugin__s2member_cache", $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
168
  }
169
- /**/
170
- return apply_filters ("s2member_constant_links", $l, get_defined_vars ());
171
  }
172
  /*
173
  This function pulls all of the usermeta details needed for Constants.
174
  Pulling them all at once helps to prevent repeated database queries.
175
  */
176
- function ws_plugin__s2member_constant_metas ()
177
  {
178
- global $wpdb; /* The global database object. */
179
- /**/
180
- do_action ("s2member_before_constant_metas", get_defined_vars ());
181
- /**/
182
- $m["s2member_file_download_access_log"] = array ();
183
- $m["s2member_custom_fields"] = array ();
184
- $m["s2member_subscr_id"] = (string)"";
185
- $m["s2member_custom"] = (string)"";
186
- /**/
187
- if (($current_user = (is_user_logged_in ()) ? wp_get_current_user () : false))
188
  {
189
- 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")))
 
 
 
 
 
 
 
 
 
190
  {
191
- foreach ($results as $r) /* Fill in the array we need. */
192
- if ($r->meta_key === "s2member_file_download_access_log")
193
- $m["s2member_file_download_access_log"] = (array)maybe_unserialize ($r->meta_value);
194
- else if ($result->meta_key === "s2member_custom_fields")
195
- $m["s2member_custom_fields"] = (array)maybe_unserialize ($r->meta_value);
196
- else if ($r->meta_key === "s2member_subscr_id")
197
- $m["s2member_subscr_id"] = (string)$r->meta_value;
198
- else if ($result->meta_key === "s2member_custom")
199
- $m["s2member_custom"] = (string)$r->meta_value;
 
 
 
 
 
 
 
200
  }
 
 
201
  }
202
- /**/
203
- return apply_filters ("s2member_constant_metas", $m, get_defined_vars ());
204
  }
205
  ?>
18
  Note that these are duplicated into the JavaScript API as well.
19
  Attach to: add_action("init");
20
  */
21
+ if (!function_exists ("ws_plugin__s2member_constants"))
22
  {
23
+ function ws_plugin__s2member_constants ()
24
+ {
25
+ do_action ("ws_plugin__s2member_before_constants", get_defined_vars ());
26
+ /**/
27
+ $links = ws_plugin__s2member_constant_links ();
28
+ $metas = ws_plugin__s2member_constant_metas ();
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 ());
36
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
37
+ /**/
38
+ define ("S2MEMBER_VERSION", WS_PLUGIN__S2MEMBER_VERSION); /* Always a (string) containing the version. Available since 3.0. */
39
+ /**/
40
+ define ("S2MEMBER_CURRENT_USER_IS_LOGGED_IN", (($current_user) ? true : false)); /* This will always be (bool) true or false. False if they are NOT currently logged in. */
41
+ define ("S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER", (($current_user && $level >= 1) ? true : false)); /* This will always be (bool) true or false. Level >= 1 for Members. */
42
+ define ("S2MEMBER_CURRENT_USER_ACCESS_LEVEL", (int)$level); /* This will always be (int) negative 1 thru positive 4. -1 if user is not logged in. 0 if logged in as a Subscriber. */
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. */
51
+ define ("S2MEMBER_CURRENT_USER_LOGIN", (($current_user) ? $current_user->user_login : "")); /* This will always be a (string). Empty if not logged in. */
52
+ define ("S2MEMBER_CURRENT_USER_EMAIL", (($current_user) ? $current_user->user_email : "")); /* This will always be a (string). Empty if not logged in. */
53
+ define ("S2MEMBER_CURRENT_USER_IP", $_SERVER["REMOTE_ADDR"]); /* This will always be a (string). It may be empty if the user is browsing anonymously. */
54
+ define ("S2MEMBER_CURRENT_USER_ID", (($current_user) ? (int)$current_user->ID : 0)); /* This will always be an (int). Zero if not logged in. */
55
+ define ("S2MEMBER_CURRENT_USER_FIELDS", (($current_user) ? json_encode (array_merge /* Always a json_encode (array). This includes custom fields. */
56
+ (array ("id" => S2MEMBER_CURRENT_USER_ID, "ip" => S2MEMBER_CURRENT_USER_IP, "email" => S2MEMBER_CURRENT_USER_EMAIL, "login" => S2MEMBER_CURRENT_USER_LOGIN,/**/
57
+ "first_name" => S2MEMBER_CURRENT_USER_FIRST_NAME, "last_name" => S2MEMBER_CURRENT_USER_LAST_NAME, "display_name" => S2MEMBER_CURRENT_USER_DISPLAY_NAME,/**/
58
+ "subscr_id" => S2MEMBER_CURRENT_USER_SUBSCR_ID, "custom" => S2MEMBER_CURRENT_USER_CUSTOM), $metas["s2member_custom_fields"])) : json_encode (array ())));
59
+ /**/
60
+ define ("S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED", (int)$file_downloads["allowed"]); /* This will always be an integer value (int) >= 0 where 0 means no access. */
61
+ define ("S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED", (($file_downloads["allowed"] >= 999999999) ? true : false)); /* This will always be (bool). */
62
+ define ("S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY", (int)$file_downloads["currently"]); /* This will always be an integer value (int) >= 0 where 0 means none currently. */
63
+ define ("S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS", (int)$file_downloads["allowed_days"]); /* This will always be an integer value (int) >= 0 where 0 means no access. */
64
+ /**/
65
+ define ("S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"]); /* The exceeded page id (int). */
66
+ define ("S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]); /* Options page id, always an (int). */
67
+ define ("S2MEMBER_LOGIN_WELCOME_PAGE_ID", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]); /* The welcome page id, always an (int). */
68
+ /**/
69
+ define ("S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL", get_bloginfo ("url") . "/?s2member_profile=1"); /* Where a user modifies their profile. */
70
+ define ("S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL", $links["file_download_limit_exceeded_page"]); /* Always a string. URL to limit exceeded page. */
71
+ define ("S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL", $links["membership_options_page"]); /* Always a string. This is the URL to the membership options page. */
72
+ define ("S2MEMBER_LOGIN_WELCOME_PAGE_URL", (($login_redirection_override) ? $login_redirection_override : $links["login_welcome_page"])); /* Always a string. */
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. */
89
+ define ("S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED_DAYS", (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_file_downloads_allowed_days"]); /* This is (int) allowed days. */
90
+ /**/
91
+ define ("S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_inline_extensions"]); /* This is the (string) list of extensions. */
92
+ /**/
93
+ define ("S2MEMBER_REG_EMAIL_FROM_NAME", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]); /* This is the name that outgoing email messages are sent by. */
94
+ define ("S2MEMBER_REG_EMAIL_FROM_EMAIL", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"]); /* This is the email that outgoing messages are sent by. */
95
+ /**/
96
+ define ("S2MEMBER_PAYPAL_NOTIFY_URL", get_bloginfo ("url") . "/?s2member_paypal_notify=1"); /* This will always be a (string), and it will never be an empty value. */
97
+ define ("S2MEMBER_PAYPAL_RETURN_URL", get_bloginfo ("url") . "/?s2member_paypal_return=1"); /* This will always be a (string), and it will never be an empty value. */
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
+ }
110
  }
111
  /*
112
  This function pulls all of the page links needed for Constants.
114
  This allows the API Constants to provide quick access to them without being
115
  forced to execute get_page_link() all the time, which piles up DB queries.
116
  */
117
+ if (!function_exists ("ws_plugin__s2member_constant_links"))
118
  {
119
+ function ws_plugin__s2member_constant_links ()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120
  {
121
+ do_action ("ws_plugin__s2member_before_constant_links", get_defined_vars ());
 
 
 
 
 
 
122
  /**/
123
+ $cache_minutes = 15; /* Could be higher? */
 
 
 
 
 
 
 
 
 
 
 
124
  /**/
125
+ $l["login_welcome_page"] = (string)"";
126
+ $l["membership_options_page"] = (string)"";
127
+ $l["file_download_limit_exceeded_page"] = (string)"";
 
 
 
 
 
 
 
 
 
128
  /**/
129
+ $login_welcome_page = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"];
130
+ $membership_options_page = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"];
131
+ $file_download_limit_exceeded_page = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"];
132
+ /**/
133
+ $login_welcome_page_cache = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["login_welcome_page"];
134
+ $membership_options_page_cache = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"];
135
+ $file_download_limit_exceeded_page_cache = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["file_download_limit_exceeded_page"];
136
+ /**/
137
+ if ($login_welcome_page && $login_welcome_page_cache["page"] === $login_welcome_page && $login_welcome_page_cache["link"] && $login_welcome_page_cache["time"] >= strtotime ("-" . $cache_minutes . " minutes"))
138
+ {
139
+ $l["login_welcome_page"] = $login_welcome_page_cache["link"];
140
+ }
141
+ else /* Otherwise, we need to query the database using get_page_link() and update the cache. */
142
+ {
143
+ $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["login_welcome_page"]["time"] = strtotime ("now");
144
+ $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["login_welcome_page"]["page"] = $login_welcome_page;
145
+ $l["login_welcome_page"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["login_welcome_page"]["link"] = get_page_link ($login_welcome_page);
146
+ /**/
147
+ $cache_needs_updating = true;
148
+ }
149
+ /**/
150
+ if ($membership_options_page && $membership_options_page_cache["page"] === $membership_options_page && $membership_options_page_cache["link"] && $membership_options_page_cache["time"] >= strtotime ("-" . $cache_minutes . " minutes"))
151
+ {
152
+ $l["membership_options_page"] = $membership_options_page_cache["link"];
153
+ }
154
+ else /* Otherwise, we need to query the database using get_page_link() and update the cache. */
155
+ {
156
+ $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"]["time"] = strtotime ("now");
157
+ $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"]["page"] = $membership_options_page;
158
+ $l["membership_options_page"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"]["link"] = get_page_link ($membership_options_page);
159
+ /**/
160
+ $cache_needs_updating = true;
161
+ }
162
+ /**/
163
+ if ($file_download_limit_exceeded_page && $file_download_limit_exceeded_page_cache["page"] === $file_download_limit_exceeded_page && $file_download_limit_exceeded_page_cache["link"] && $file_download_limit_exceeded_page_cache["time"] >= strtotime ("-" . $cache_minutes . " minutes"))
164
+ {
165
+ $l["file_download_limit_exceeded_page"] = $file_download_limit_exceeded_page_cache["link"];
166
+ }
167
+ else /* Otherwise, we need to query the database using get_page_link() and update the cache. */
168
+ {
169
+ $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["file_download_limit_exceeded_page"]["time"] = strtotime ("now");
170
+ $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["file_download_limit_exceeded_page"]["page"] = $file_download_limit_exceeded_page;
171
+ $l["file_download_limit_exceeded_page"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["file_download_limit_exceeded_page"]["link"] = get_page_link ($file_download_limit_exceeded_page);
172
+ /**/
173
+ $cache_needs_updating = true;
174
+ }
175
+ /**/
176
+ if ($cache_needs_updating) /* The cache is also reset when options are updated from a menu page. */
177
+ {
178
+ update_option ("ws_plugin__s2member_cache", $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]);
179
+ }
180
+ /**/
181
+ return apply_filters ("ws_plugin__s2member_constant_links", $l, get_defined_vars ());
182
  }
 
 
183
  }
184
  /*
185
  This function pulls all of the usermeta details needed for Constants.
186
  Pulling them all at once helps to prevent repeated database queries.
187
  */
188
+ if (!function_exists ("ws_plugin__s2member_constant_metas"))
189
  {
190
+ function ws_plugin__s2member_constant_metas ()
 
 
 
 
 
 
 
 
 
191
  {
192
+ global $wpdb; /* The global database object. */
193
+ /**/
194
+ do_action ("ws_plugin__s2member_before_constant_metas", get_defined_vars ());
195
+ /**/
196
+ $m["s2member_file_download_access_log"] = array ();
197
+ $m["s2member_custom_fields"] = array ();
198
+ $m["s2member_subscr_id"] = (string)"";
199
+ $m["s2member_custom"] = (string)"";
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")
207
+ $m["s2member_file_download_access_log"] = (array)maybe_unserialize ($r->meta_value);
208
+ else if ($result->meta_key === "s2member_custom_fields")
209
+ $m["s2member_custom_fields"] = (array)maybe_unserialize ($r->meta_value);
210
+ else if ($r->meta_key === "s2member_subscr_id")
211
+ $m["s2member_subscr_id"] = (string)$r->meta_value;
212
+ else if ($result->meta_key === "s2member_custom")
213
+ $m["s2member_custom"] = (string)$r->meta_value;
214
+ /**/
215
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
216
+ do_action ("ws_plugin__s2member_during_constant_metas", get_defined_vars ());
217
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
218
+ }
219
  }
220
+ /**/
221
+ return apply_filters ("ws_plugin__s2member_constant_metas", $m, get_defined_vars ());
222
  }
 
 
223
  }
224
  ?>
includes/functions/email-configs.inc.php CHANGED
@@ -16,29 +16,38 @@ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
16
  /*
17
  Functions that modify the email From: name/address.
18
  */
19
- function ws_plugin__s2member_email_config ()
20
  {
21
- do_action ("s2member_before_email_config", get_defined_vars ());
22
- /**/
23
- add_filter ("wp_mail_from", "_ws_plugin__s2member_email_config_email");
24
- add_filter ("wp_mail_from_name", "_ws_plugin__s2member_email_config_name");
25
- /**/
26
- do_action ("s2member_after_email_config", get_defined_vars ());
27
- /**/
28
- return;
 
 
 
29
  }
30
  /**/
31
- function _ws_plugin__s2member_email_config_email ($email = FALSE)
32
  {
33
- do_action ("s2member_before_email_config_email", get_defined_vars ());
34
- /**/
35
- return apply_filters ("s2member_email_config_email", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"], get_defined_vars ());
 
 
 
36
  }
37
  /**/
38
- function _ws_plugin__s2member_email_config_name ($name = FALSE)
39
  {
40
- do_action ("s2member_before_email_config_name", get_defined_vars ());
41
- /**/
42
- return apply_filters ("s2member_email_config_name", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"], get_defined_vars ());
 
 
 
43
  }
44
  ?>
16
  /*
17
  Functions that modify the email From: name/address.
18
  */
19
+ if (!function_exists ("ws_plugin__s2member_email_config"))
20
  {
21
+ function ws_plugin__s2member_email_config ()
22
+ {
23
+ do_action ("ws_plugin__s2member_before_email_config", get_defined_vars ());
24
+ /**/
25
+ add_filter ("wp_mail_from", "_ws_plugin__s2member_email_config_email");
26
+ add_filter ("wp_mail_from_name", "_ws_plugin__s2member_email_config_name");
27
+ /**/
28
+ do_action ("ws_plugin__s2member_after_email_config", get_defined_vars ());
29
+ /**/
30
+ return;
31
+ }
32
  }
33
  /**/
34
+ if (!function_exists ("_ws_plugin__s2member_email_config_email"))
35
  {
36
+ function _ws_plugin__s2member_email_config_email ($email = FALSE)
37
+ {
38
+ do_action ("_ws_plugin__s2member_before_email_config_email", get_defined_vars ());
39
+ /**/
40
+ return apply_filters ("_ws_plugin__s2member_email_config_email", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"], get_defined_vars ());
41
+ }
42
  }
43
  /**/
44
+ if (!function_exists ("_ws_plugin__s2member_email_config_name"))
45
  {
46
+ function _ws_plugin__s2member_email_config_name ($name = FALSE)
47
+ {
48
+ do_action ("_ws_plugin__s2member_before_email_config_name", get_defined_vars ());
49
+ /**/
50
+ return apply_filters ("_ws_plugin__s2member_email_config_name", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"], get_defined_vars ());
51
+ }
52
  }
53
  ?>
includes/functions/file-download-access.inc.php CHANGED
@@ -17,222 +17,236 @@ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
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.
19
  */
20
- function ws_plugin__s2member_max_download_period ()
21
  {
22
- do_action ("s2member_before_max_download_period", get_defined_vars ());
23
- /**/
24
- if ($days = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_file_downloads_allowed_days"])
25
  {
26
- $max = ($max < $days) ? $days : $max;
27
- }
28
- /**/
29
- if ($days = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_file_downloads_allowed_days"])
30
- {
31
- $max = ($max < $days) ? $days : $max;
32
- }
33
- /**/
34
- if ($days = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_file_downloads_allowed_days"])
35
- {
36
- $max = ($max < $days) ? $days : $max;
37
- }
38
- /**/
39
- if ($days = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_file_downloads_allowed_days"])
40
- {
41
- $max = ($max < $days) ? $days : $max;
 
 
 
 
 
 
 
42
  }
43
- /**/
44
- return apply_filters ("s2member_max_download_period", (($max > 365) ? 365 : (int)$max), get_defined_vars ());
45
  }
46
  /*
47
  Function determines how many downloads allowed - etc, etc.
48
  Returns an array with 3 elements: allowed, allowed_days, currently.
49
  The 2nd parameter can be used to prevent another database connection.
50
  */
51
- function ws_plugin__s2member_user_downloads ($not_counting_this_particular_file = false, $log = null)
52
  {
53
- do_action ("s2member_before_user_downloads", get_defined_vars ());
54
- /**/
55
- if (($current_user = (is_user_logged_in ()) ? wp_get_current_user () : false))
56
  {
57
- if (current_user_can ("access_s2member_level1") && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_file_downloads_allowed"])
58
- {
59
- $allowed = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_file_downloads_allowed"];
60
- $allowed_days = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_file_downloads_allowed_days"];
61
- }
62
  /**/
63
- if (current_user_can ("access_s2member_level2") && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_file_downloads_allowed"])
64
  {
65
- $allowed = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_file_downloads_allowed"];
66
- $allowed_days = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_file_downloads_allowed_days"];
67
- }
68
- /**/
69
- if (current_user_can ("access_s2member_level3") && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_file_downloads_allowed"])
70
- {
71
- $allowed = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_file_downloads_allowed"];
72
- $allowed_days = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_file_downloads_allowed_days"];
73
- }
74
- /**/
75
- if (current_user_can ("access_s2member_level4") && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_file_downloads_allowed"])
76
- {
77
- $allowed = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_file_downloads_allowed"];
78
- $allowed_days = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_file_downloads_allowed_days"];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  }
80
  /**/
81
- $file_download_access_log = (isset ($log)) ? (array)$log : (array)get_usermeta ($current_user->ID, "s2member_file_download_access_log");
82
- foreach ($file_download_access_log as $file_download_access_log_entry_key => $file_download_access_log_entry)
83
- if (strtotime ($file_download_access_log_entry["date"]) >= strtotime ("-" . (int)$allowed_days . " days"))
84
- if ($file_download_access_log_entry["file"] !== $not_counting_this_particular_file)
85
- $currently = ($currently) ? $currently + 1 : 1;
86
  }
87
- /**/
88
- return apply_filters ("s2member_user_downloads", array ("allowed" => (int)$allowed, "allowed_days" => (int)$allowed_days, "currently" => (int)$currently), get_defined_vars ());
89
  }
90
  /*
91
  Function determines the minimum level required for file download access.
92
  Returns 0-4, where 0 means no access to file downloads has been allowed.
93
  */
94
- function ws_plugin__s2member_min_level_4_downloads ()
95
  {
96
- do_action ("s2member_before_min_level_4_downloads", get_defined_vars ());
97
- /**/
98
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_file_downloads_allowed"] && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_file_downloads_allowed_days"])
99
- {
100
- $file_download_access_is_allowed = $min_level_4_downloads = 1;
101
- }
102
- else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_file_downloads_allowed"] && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_file_downloads_allowed_days"])
103
  {
104
- $file_download_access_is_allowed = $min_level_4_downloads = 2;
105
- }
106
- else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_file_downloads_allowed"] && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_file_downloads_allowed_days"])
107
- {
108
- $file_download_access_is_allowed = $min_level_4_downloads = 3;
109
- }
110
- else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_file_downloads_allowed"] && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_file_downloads_allowed_days"])
111
- {
112
- $file_download_access_is_allowed = $min_level_4_downloads = 4;
 
 
 
 
 
 
 
 
 
 
 
113
  }
114
- /**/
115
- return apply_filters ("s2member_min_level_4_downloads", (int)$min_level_4_downloads, get_defined_vars ());
116
  }
117
  /*
118
  Function for handling download access permissions.
119
  Attach to: add_action("init");
120
  */
121
- function ws_plugin__s2member_check_file_download_access ()
122
  {
123
- do_action ("s2member_before_file_download_access", get_defined_vars ());
124
- /**/
125
- if ($_GET["s2member_file_download"]) /* Filter $excluded to force free downloads. */
126
  {
127
- $excluded = apply_filters ("s2member_check_file_download_access_excluded", false, get_defined_vars ()); /* Or use $_GET["s2member_free_file_download_key"] with a hash of the xencrypted version. */
128
  /**/
129
- if (!$excluded && (!$_GET["s2member_free_file_download_key"] || ($_GET["s2member_free_file_download_key"] !== md5 (ws_plugin__s2member_xencrypt ($_GET["s2member_file_download"]))/**/
130
- /* For backward compatiblity, we also check the xencrypted value, without the hash. This is decprecated as of v2.9. It will be removed completely in a future version. */
131
- && $_GET["s2member_free_file_download_key"] !== ws_plugin__s2member_xencrypt ($_GET["s2member_file_download"]))))
132
  {
133
- $_GET["s2member_file_download"] = trim ($_GET["s2member_file_download"], "/");
134
- /**/
135
- $file_download_access_is_allowed = $minimum_level_required_to_download_files = ws_plugin__s2member_min_level_4_downloads ();
136
- /**/
137
- if (!($current_user = (is_user_logged_in ()) ? wp_get_current_user () : false) /* Redirect Users who are not logged in. */
138
- && 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")
139
- exit;
140
- /**/
141
- else if (!$file_download_access_is_allowed) /* Have file downloads even been enabled? */
142
- {
143
- header ("HTTP/1.0 503 Service Temporarily Unavailable");
144
- echo '503: File Downloads Are Not Enabled.';
145
- exit;
146
- }
147
- /**/
148
- else if (!file_exists ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"] . "/" . $_GET["s2member_file_download"]))
149
- {
150
- header ("HTTP/1.0 404 Not Found"); /* The file does not even exist. */
151
- echo '404: File Download Not Found.';
152
- exit;
153
- }
154
- /**/
155
- else if ((!is_array ($file_downloads = ws_plugin__s2member_user_downloads ()) || !$file_downloads["allowed"] || !$file_downloads["allowed_days"])/**/
156
- && 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")
157
- exit;
158
- /**/
159
- $previous_file_downloads = 0; /* Here we're going to count how many downloads they've performed. */
160
- $max_days_logged = ws_plugin__s2member_max_download_period (); /* The longest period in days. */
161
- $file_download_access_log = (array)get_usermeta ($current_user->ID, "s2member_file_download_access_log");
162
- $file_download_access_arc = (array)get_usermeta ($current_user->ID, "s2member_file_download_access_arc");
163
  /**/
164
- foreach ($file_download_access_log as $file_download_access_log_entry_key => $file_download_access_log_entry)
165
  {
166
- if (strtotime ($file_download_access_log_entry["date"]) < strtotime ("-" . $max_days_logged . " days"))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
167
  {
168
- unset ($file_download_access_log[$file_download_access_log_entry_key]);
169
- $file_download_access_arc[] = $file_download_access_log_entry;
 
170
  }
171
- else if (strtotime ($file_download_access_log_entry["date"]) >= strtotime ("-" . $file_downloads["allowed_days"] . " days"))
 
 
 
 
 
 
 
 
 
 
172
  {
173
- $previous_file_downloads++;
174
- /* Here we check if this file has already been downloaded. */
175
- if ($file_download_access_log_entry["file"] === $_GET["s2member_file_download"])
176
- $already_downloaded = true;
 
 
 
 
 
 
 
 
177
  }
 
 
 
 
 
 
 
 
 
 
178
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
179
  /**/
180
- if (!$already_downloaded && $previous_file_downloads >= $file_downloads["allowed"] /* They have NOT already downloaded this file, and they're over their limit. */
181
- && 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")
182
- exit;
 
 
 
 
183
  /**/
184
- if (!$already_downloaded) /* Only add this file to the log if they have not already downloaded it. */
185
- $file_download_access_log[] = array ("date" => date ("Y-m-d"), "file" => $_GET["s2member_file_download"]);
 
186
  /**/
187
- update_usermeta ($current_user->ID, "s2member_file_download_access_arc", ws_plugin__s2member_array_unique ($file_download_access_arc));
188
- update_usermeta ($current_user->ID, "s2member_file_download_access_log", ws_plugin__s2member_array_unique ($file_download_access_log));
189
- }
190
- else /* This is a free download that we just need to check on the existence of. */
191
- {
192
- $_GET["s2member_file_download"] = trim ($_GET["s2member_file_download"], "/");
193
  /**/
194
- if (!file_exists ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"] . "/" . $_GET["s2member_file_download"]))
195
- {
196
- header ("HTTP/1.0 404 Not Found"); /* The file does not exist. */
197
- echo '404: File Download Not Found.';
198
- exit;
199
- }
 
 
 
200
  }
201
- /*
202
- Here we are going to put together all of the file download information.
203
- */
204
- $mimetypes = parse_ini_file (dirname (dirname (dirname (__FILE__))) . "/includes/mime-types.ini");
205
- $pathinfo = pathinfo ($file = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"] . "/" . $_GET["s2member_file_download"]);
206
- $extension = strtolower ($pathinfo["extension"]); /* Convert file extension to lowercase format for MIME type lookup. */
207
- $inline = (in_array ($extension, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_inline_extensions"]))) ? true : false;
208
- $mimetype = ($mimetypes[$extension]) ? $mimetypes[$extension] : "application/octet-stream"; /* Lookup MIME type. */
209
- $basename = $pathinfo["basename"]; /* The actual file name, including its extension. */
210
- $length = filesize ($file); /* The overall file size, in bytes. */
211
- /**/
212
- do_action ("s2member_during_file_download_access", get_defined_vars ());
213
- /*
214
- Now send the file to the browser. Be sure to turn off output compression.
215
- */
216
- ini_set ("zlib.output_compression", 0); /* Must be turned off. */
217
- /**/
218
- header ("Content-Encoding: none");
219
- header ("Content-Type: " . $mimetype);
220
- header ("Content-Length: " . $length);
221
- /**/
222
- if (!$inline) /* If not inline, we default to serving the file as an attachment. */
223
- header ('Content-Disposition: attachment; filename="' . $basename . '"');
224
- /**/
225
- header ("Expires: " . gmdate ("D, d M Y H:i:s", strtotime ("-1 week")) . " GMT");
226
- header ("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
227
- header ("Cache-Control: no-cache, must-revalidate, max-age=0");
228
- header ("Cache-Control: post-check=0, pre-check=0", false);
229
- header ("Pragma: no-cache");
230
- /**/
231
- readfile ($file);
232
  /**/
233
- exit;
234
  }
235
- /**/
236
- do_action ("s2member_after_file_download_access", get_defined_vars ());
237
  }
238
  ?>
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.
19
  */
20
+ if (!function_exists ("ws_plugin__s2member_max_download_period"))
21
  {
22
+ function ws_plugin__s2member_max_download_period ()
 
 
23
  {
24
+ do_action ("ws_plugin__s2member_before_max_download_period", get_defined_vars ());
25
+ /**/
26
+ if ($days = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_file_downloads_allowed_days"])
27
+ {
28
+ $max = ($max < $days) ? $days : $max;
29
+ }
30
+ /**/
31
+ if ($days = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_file_downloads_allowed_days"])
32
+ {
33
+ $max = ($max < $days) ? $days : $max;
34
+ }
35
+ /**/
36
+ if ($days = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_file_downloads_allowed_days"])
37
+ {
38
+ $max = ($max < $days) ? $days : $max;
39
+ }
40
+ /**/
41
+ if ($days = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_file_downloads_allowed_days"])
42
+ {
43
+ $max = ($max < $days) ? $days : $max;
44
+ }
45
+ /**/
46
+ return apply_filters ("ws_plugin__s2member_max_download_period", (($max > 365) ? 365 : (int)$max), get_defined_vars ());
47
  }
 
 
48
  }
49
  /*
50
  Function determines how many downloads allowed - etc, etc.
51
  Returns an array with 3 elements: allowed, allowed_days, currently.
52
  The 2nd parameter can be used to prevent another database connection.
53
  */
54
+ if (!function_exists ("ws_plugin__s2member_user_downloads"))
55
  {
56
+ function ws_plugin__s2member_user_downloads ($not_counting_this_particular_file = false, $log = null)
 
 
57
  {
58
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
59
+ do_action ("ws_plugin__s2member_before_user_downloads", get_defined_vars ());
60
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
 
 
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"];
67
+ $allowed_days = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_file_downloads_allowed_days"];
68
+ }
69
+ /**/
70
+ if (current_user_can ("access_s2member_level2") && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_file_downloads_allowed"])
71
+ {
72
+ $allowed = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_file_downloads_allowed"];
73
+ $allowed_days = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_file_downloads_allowed_days"];
74
+ }
75
+ /**/
76
+ if (current_user_can ("access_s2member_level3") && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_file_downloads_allowed"])
77
+ {
78
+ $allowed = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_file_downloads_allowed"];
79
+ $allowed_days = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_file_downloads_allowed_days"];
80
+ }
81
+ /**/
82
+ if (current_user_can ("access_s2member_level4") && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_file_downloads_allowed"])
83
+ {
84
+ $allowed = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_file_downloads_allowed"];
85
+ $allowed_days = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_file_downloads_allowed_days"];
86
+ }
87
+ /**/
88
+ $file_download_access_log = (isset ($log)) ? (array)$log : (array)get_usermeta ($current_user->ID, "s2member_file_download_access_log");
89
+ foreach ($file_download_access_log as $file_download_access_log_entry_key => $file_download_access_log_entry)
90
+ if (strtotime ($file_download_access_log_entry["date"]) >= strtotime ("-" . (int)$allowed_days . " days"))
91
+ if ($file_download_access_log_entry["file"] !== $not_counting_this_particular_file)
92
+ $currently = ($currently) ? $currently + 1 : 1;
93
  }
94
  /**/
95
+ return apply_filters ("ws_plugin__s2member_user_downloads", array ("allowed" => (int)$allowed, "allowed_days" => (int)$allowed_days, "currently" => (int)$currently), get_defined_vars ());
 
 
 
 
96
  }
 
 
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
  {
104
+ function 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
+ }
112
+ else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_file_downloads_allowed"] && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_file_downloads_allowed_days"])
113
+ {
114
+ $file_download_access_is_allowed = $min_level_4_downloads = 2;
115
+ }
116
+ else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_file_downloads_allowed"] && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_file_downloads_allowed_days"])
117
+ {
118
+ $file_download_access_is_allowed = $min_level_4_downloads = 3;
119
+ }
120
+ else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_file_downloads_allowed"] && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_file_downloads_allowed_days"])
121
+ {
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
  /*
129
  Function for handling download access permissions.
130
  Attach to: add_action("init");
131
  */
132
+ if (!function_exists ("ws_plugin__s2member_check_file_download_access"))
133
  {
134
+ function ws_plugin__s2member_check_file_download_access ()
 
 
135
  {
136
+ do_action ("ws_plugin__s2member_before_file_download_access", get_defined_vars ());
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. */
172
+ $file_download_access_log = (array)get_usermeta ($current_user->ID, "s2member_file_download_access_log");
173
+ $file_download_access_arc = (array)get_usermeta ($current_user->ID, "s2member_file_download_access_arc");
174
+ /**/
175
+ foreach ($file_download_access_log as $file_download_access_log_entry_key => $file_download_access_log_entry)
176
  {
177
+ if (strtotime ($file_download_access_log_entry["date"]) < strtotime ("-" . $max_days_logged . " days"))
178
+ {
179
+ unset ($file_download_access_log[$file_download_access_log_entry_key]);
180
+ $file_download_access_arc[] = $file_download_access_log_entry;
181
+ }
182
+ else if (strtotime ($file_download_access_log_entry["date"]) >= strtotime ("-" . $file_downloads["allowed_days"] . " days"))
183
+ {
184
+ $previous_file_downloads++;
185
+ /* Here we check if this file has already been downloaded. */
186
+ if ($file_download_access_log_entry["file"] === $_GET["s2member_file_download"])
187
+ $already_downloaded = true;
188
+ }
189
  }
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"]);
197
+ /**/
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
+ /*
213
+ Here we are going to put together all of the file download information.
214
+ */
215
+ $mimetypes = parse_ini_file (dirname (dirname (dirname (__FILE__))) . "/includes/mime-types.ini");
216
+ $pathinfo = pathinfo ($file = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"] . "/" . $_GET["s2member_file_download"]);
217
+ $extension = strtolower ($pathinfo["extension"]); /* Convert file extension to lowercase format for MIME type lookup. */
218
+ $inline = (in_array ($extension, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_inline_extensions"]))) ? true : false;
219
+ $mimetype = ($mimetypes[$extension]) ? $mimetypes[$extension] : "application/octet-stream"; /* Lookup MIME type. */
220
+ $basename = $pathinfo["basename"]; /* The actual file name, including its extension. */
221
+ $length = filesize ($file); /* The overall file size, in bytes. */
222
  /**/
223
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
224
+ do_action ("ws_plugin__s2member_during_file_download_access", get_defined_vars ());
225
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
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);
233
+ header ("Content-Length: " . $length);
234
  /**/
235
+ if (!$inline) /* If not inline, we default to serving the file as an attachment. */
236
+ header ('Content-Disposition: attachment; filename="' . $basename . '"');
 
 
 
 
237
  /**/
238
+ header ("Expires: " . gmdate ("D, d M Y H:i:s", strtotime ("-1 week")) . " GMT");
239
+ header ("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
240
+ header ("Cache-Control: no-cache, must-revalidate, max-age=0");
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
  ?>
includes/functions/hide-some-systematics.inc.php CHANGED
@@ -17,17 +17,26 @@ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
17
  Function that hides some of the systematic use pages.
18
  Attach to: add_filter("posts_where");
19
  */
20
- function ws_plugin__s2member_hide_some_systematics ($where = FALSE)
21
  {
22
- global $wpdb; /* Need this to get the table name. */
23
- /**/
24
- do_action ("s2member_before_hide_some_systematics", get_defined_vars ());
25
- /**/
26
- if (is_search ()) /* Here we exclude a few systematic use pages from the search query. */
27
  {
28
- $where .= " AND " . $wpdb->posts . ".ID NOT IN ('" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"] . "', '" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"] . "', '" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"] . "')";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  }
30
- /**/
31
- return apply_filters ("s2member_hide_some_systematics", $where, get_defined_vars ());
32
  }
33
  ?>
17
  Function that hides some of the systematic use pages.
18
  Attach to: add_filter("posts_where");
19
  */
20
+ if (!function_exists ("ws_plugin__s2member_hide_some_systematics"))
21
  {
22
+ function ws_plugin__s2member_hide_some_systematics ($where = FALSE)
 
 
 
 
23
  {
24
+ global $wpdb; /* Need this to get the table name. */
25
+ /**/
26
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
27
+ do_action ("ws_plugin__s2member_before_hide_some_systematics", get_defined_vars ());
28
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
29
+ /**/
30
+ if (is_search ()) /* Here we exclude a few systematic use pages from the search query. */
31
+ {
32
+ $where .= " AND " . $wpdb->posts . ".ID NOT IN ('" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"] . "', '" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"] . "', '" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"] . "')";
33
+ /**/
34
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
35
+ do_action ("ws_plugin__s2member_during_hide_some_systematics", get_defined_vars ());
36
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
37
+ }
38
+ /**/
39
+ return apply_filters ("ws_plugin__s2member_hide_some_systematics", $where, get_defined_vars ());
40
  }
 
 
41
  }
42
  ?>
includes/functions/ip-restrictions.inc.php CHANGED
@@ -17,45 +17,55 @@ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
17
  Function for handling IP Restrictions.
18
  IP addresses are stored in a Transient field.
19
  */
20
- function ws_plugin__s2member_ip_restrictions_ok ($ip = FALSE, $restriction = FALSE)
21
  {
22
- do_action ("s2member_before_ip_restrictions_ok", get_defined_vars ());
23
- /**/
24
- if ($restriction) /* There MUST be a restriction. However, the IP *can* be empty. */
25
  {
26
- if (is_array ($ips = get_transient ($transient = md5 ("s2member_ip_restrictions_" . $restriction))))
27
- {
28
- if (!in_array ($ip, $ips)) /* Already on record? */
29
- $ips[] = $ip;
30
- /**/
31
- $new_ips = $ips;
32
- }
33
- else /* Otherwise, create a new IPs array. */
34
- $new_ips[] = $ip;
35
  /**/
36
- if (count ($new_ips) > $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction"])
37
  {
38
- ws_plugin__s2member_nocache_constants () . wp_clear_auth_cookie (); /* Clear cookies. */
39
- /**/
40
- do_action ("s2member_during_ip_restrictions_not_ok", get_defined_vars ());
41
- /**/
42
- header ("HTTP/1.0 503 Service Temporarily Unavailable");
43
- echo '<strong>503: Service Temporarily Unavailable</strong><br />' . "\n";
44
- echo 'Too many IP addresses accessing one account/link!<br />' . "\n";
45
- echo 'Please contact Support if you need assistance.';
46
- /**/
47
- exit; /* Exit now. */
48
- }
49
- else /* Otherwise, update the Transient array of IP addresses. They're good for now. */
50
- {
51
- do_action ("s2member_during_ip_restrictions_ok", get_defined_vars ());
52
- /**/
53
- set_transient ($transient, $new_ips, $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction_time"]);
54
- /**/
55
- return apply_filters ("s2member_ip_restrictions_ok", true, get_defined_vars ());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
  }
 
 
57
  }
58
- /**/
59
- return apply_filters ("s2member_ip_restrictions_ok", true, get_defined_vars ());
60
  }
61
  ?>
17
  Function for handling IP Restrictions.
18
  IP addresses are stored in a Transient field.
19
  */
20
+ if (!function_exists ("ws_plugin__s2member_ip_restrictions_ok"))
21
  {
22
+ function ws_plugin__s2member_ip_restrictions_ok ($ip = FALSE, $restriction = FALSE)
 
 
23
  {
24
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
25
+ do_action ("ws_plugin__s2member_before_ip_restrictions_ok", get_defined_vars ());
26
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
 
 
 
 
 
 
27
  /**/
28
+ if ($restriction) /* There MUST be a restriction. However, the IP *can* be empty. */
29
  {
30
+ if (is_array ($ips = get_transient ($transient = md5 ("s2member_ip_restrictions_" . $restriction))))
31
+ {
32
+ if (!in_array ($ip, $ips)) /* Already on record? */
33
+ $ips[] = $ip;
34
+ /**/
35
+ $new_ips = $ips;
36
+ }
37
+ else /* Otherwise, create a new IPs array. */
38
+ $new_ips[] = $ip;
39
+ /*
40
+ Now check to see if this is a security breach; with too many IP addresses.
41
+ */
42
+ if (count ($new_ips) > $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction"])
43
+ {
44
+ ws_plugin__s2member_nocache_constants () . wp_clear_auth_cookie ();
45
+ /**/
46
+ do_action ("ws_plugin__s2member_during_ip_restrictions_ok_no", get_defined_vars ());
47
+ /**/
48
+ header ("HTTP/1.0 503 Service Temporarily Unavailable");
49
+ /**/
50
+ echo '<strong>503: Service Temporarily Unavailable</strong><br />' . "\n";
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
+ {
58
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
59
+ do_action ("ws_plugin__s2member_during_ip_restrictions_ok_yes", get_defined_vars ());
60
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
61
+ /**/
62
+ set_transient ($transient, $new_ips, $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction_time"]);
63
+ /**/
64
+ return apply_filters ("ws_plugin__s2member_ip_restrictions_ok", true, get_defined_vars ());
65
+ }
66
  }
67
+ /**/
68
+ return apply_filters ("ws_plugin__s2member_ip_restrictions_ok", true, get_defined_vars ());
69
  }
 
 
70
  }
71
  ?>
includes/functions/is-systematic.inc.php CHANGED
@@ -16,51 +16,52 @@ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
16
  /*
17
  Function that determines whether we are on a systematic use page.
18
  */
19
- function ws_plugin__s2member_is_systematic_use_page ()
20
  {
21
- static $is_systematic; /* For optimization. */
22
- /**/
23
- do_action ("s2member_before_is_systematic_use_page", get_defined_vars ());
24
- /**/
25
- if (isset ($is_systematic)) /* Already cached? This saves time. */
26
  {
27
- return apply_filters ("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 ("s2member_is_systematic_use_page", true, get_defined_vars ()));
32
- }
33
- else if (preg_match ("/^cli$/i", PHP_SAPI))
34
- {
35
- return ($is_systematic = apply_filters ("s2member_is_systematic_use_page", true, get_defined_vars ()));
36
- }
37
- else if ($_SERVER["REMOTE_ADDR"] === $_SERVER["SERVER_ADDR"])
38
- {
39
- return ($is_systematic = apply_filters ("s2member_is_systematic_use_page", true, get_defined_vars ()));
40
- }
41
- else if (preg_match ("/\/wp-login\.php/", $_SERVER["REQUEST_URI"]))
42
- {
43
- return ($is_systematic = apply_filters ("s2member_is_systematic_use_page", true, get_defined_vars ()));
44
- }
45
- else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"] && is_page ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))
46
- {
47
- return ($is_systematic = apply_filters ("s2member_is_systematic_use_page", true, get_defined_vars ()));
48
- }
49
- else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"] && is_page ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]))
50
- {
51
- return ($is_systematic = apply_filters ("s2member_is_systematic_use_page", true, get_defined_vars ()));
52
- }
53
- else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"] && is_page ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"]))
54
- {
55
- return ($is_systematic = apply_filters ("s2member_is_systematic_use_page", true, get_defined_vars ()));
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 ("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
- {
63
- return ($is_systematic = apply_filters ("s2member_is_systematic_use_page", false, get_defined_vars ()));
 
 
 
 
 
64
  }
65
  }
66
  ?>
16
  /*
17
  Function that determines whether we are on a systematic use page.
18
  */
19
+ if (!function_exists ("ws_plugin__s2member_is_systematic_use_page"))
20
  {
21
+ function ws_plugin__s2member_is_systematic_use_page ()
 
 
 
 
22
  {
23
+ static $is_systematic; /* For optimization. */
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
+ }
33
+ else if (preg_match ("/^cli$/i", PHP_SAPI))
34
+ {
35
+ return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ()));
36
+ }
37
+ else if ($_SERVER["REMOTE_ADDR"] === $_SERVER["SERVER_ADDR"])
38
+ {
39
+ return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ()));
40
+ }
41
+ else if (preg_match ("/\/wp-login\.php/", $_SERVER["REQUEST_URI"]))
42
+ {
43
+ return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ()));
44
+ }
45
+ else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"] && is_page ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))
46
+ {
47
+ return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ()));
48
+ }
49
+ else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"] && is_page ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]))
50
+ {
51
+ return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ()));
52
+ }
53
+ else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"] && is_page ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"]))
54
+ {
55
+ return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ()));
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
+ {
63
+ return ($is_systematic = apply_filters ("ws_plugin__s2member_is_systematic_use_page", false, get_defined_vars ()));
64
+ }
65
  }
66
  }
67
  ?>
includes/functions/js-globals.inc.php CHANGED
@@ -19,127 +19,143 @@ 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
- function ws_plugin__s2member_add_js_w_globals ()
23
  {
24
- do_action ("s2member_before_add_js_w_globals", get_defined_vars ());
25
- /**/
26
- if (!is_admin ()) /* Not in the admin. */
27
  {
28
- if (is_user_logged_in ())
 
 
29
  {
30
- $a = get_defined_constants (true);
31
- $c = (array)$a["user"];
32
- unset ($a);
33
- /**/
34
- foreach ($c as $k => $v)
35
- if (preg_match ("/^S2MEMBER_/i", $k))
36
- $s2member[$k] = $v;
37
- /**/
38
- $md5 = md5 (serialize ($s2member)); /* This is a hash based on the global key => values. */
39
- /* The md5 hash allows the script to be cached in the browser until the globals happen to change. */
40
- /* For instance, the global variables may change when a user who is logged-in changes their profile. */
41
- 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"]);
42
- }
43
- else /* Else if they are not logged in, we distinguish the script by not including the md5 hash. */
44
- { /* This essentially creates 2 versions of the script. One while logged in & another when not. */
45
- 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"]);
 
 
 
 
 
46
  }
47
  /**/
48
- do_action ("s2member_during_add_js_w_globals", get_defined_vars ());
 
 
49
  }
50
- /**/
51
- do_action ("s2member_after_add_js_w_globals", get_defined_vars ());
52
- /**/
53
- return;
54
  }
55
  /*
56
  Function for adding s2member.js with globals.
57
  Attach to: add_action("init");
58
  */
59
- function ws_plugin__s2member_js_w_globals ()
60
  {
61
- do_action ("s2member_before_js_w_globals", get_defined_vars ());
62
- /**/
63
- if ($_GET["ws_plugin__s2member_js_w_globals"])
64
  {
65
- header ("Content-Type: text/javascript; charset=utf-8");
66
- header ("Expires: " . gmdate ("D, d M Y H:i:s", strtotime ("+1 week")) . " GMT");
67
- header ("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
68
- header ("Cache-Control: max-age=604800");
69
- header ("Pragma: public");
70
- /**/
71
- $g = "var S2MEMBER_VERSION = '" . preg_replace ("/'/", "\'", S2MEMBER_VERSION) . "',"; /* Since s2Member 3.0. */
72
- /**/
73
- $g .= "S2MEMBER_CURRENT_USER_IS_LOGGED_IN = " . ((S2MEMBER_CURRENT_USER_IS_LOGGED_IN) ? "true" : "false") . ",";
74
- $g .= "S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER = " . ((S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER) ? "true" : "false") . ",";
75
- $g .= "S2MEMBER_CURRENT_USER_ACCESS_LEVEL = " . S2MEMBER_CURRENT_USER_ACCESS_LEVEL . ",";
76
- $g .= "S2MEMBER_CURRENT_USER_ACCESS_LABEL = '" . preg_replace ("/'/", "\'", S2MEMBER_CURRENT_USER_ACCESS_LABEL) . "',";
77
- $g .= "S2MEMBER_CURRENT_USER_SUBSCR_ID = '" . preg_replace ("/'/", "\'", S2MEMBER_CURRENT_USER_SUBSCR_ID) . "',";
78
- $g .= "S2MEMBER_CURRENT_USER_CUSTOM = '" . preg_replace ("/'/", "\'", S2MEMBER_CURRENT_USER_CUSTOM) . "',";
79
- $g .= "S2MEMBER_CURRENT_USER_REGISTRATION_TIME = " . S2MEMBER_CURRENT_USER_REGISTRATION_TIME . ",";
80
- $g .= "S2MEMBER_CURRENT_USER_REGISTRATION_DAYS = " . S2MEMBER_CURRENT_USER_REGISTRATION_DAYS . ",";
81
- $g .= "S2MEMBER_CURRENT_USER_DISPLAY_NAME = '" . preg_replace ("/'/", "\'", S2MEMBER_CURRENT_USER_DISPLAY_NAME) . "',";
82
- $g .= "S2MEMBER_CURRENT_USER_FIRST_NAME = '" . preg_replace ("/'/", "\'", S2MEMBER_CURRENT_USER_FIRST_NAME) . "',";
83
- $g .= "S2MEMBER_CURRENT_USER_LAST_NAME = '" . preg_replace ("/'/", "\'", S2MEMBER_CURRENT_USER_LAST_NAME) . "',";
84
- $g .= "S2MEMBER_CURRENT_USER_LOGIN = '" . preg_replace ("/'/", "\'", S2MEMBER_CURRENT_USER_LOGIN) . "',";
85
- $g .= "S2MEMBER_CURRENT_USER_EMAIL = '" . preg_replace ("/'/", "\'", S2MEMBER_CURRENT_USER_EMAIL) . "',";
86
- $g .= "S2MEMBER_CURRENT_USER_IP = '" . preg_replace ("/'/", "\'", S2MEMBER_CURRENT_USER_IP) . "',";
87
- $g .= "S2MEMBER_CURRENT_USER_ID = " . S2MEMBER_CURRENT_USER_ID . ",";
88
- $g .= "S2MEMBER_CURRENT_USER_FIELDS = " . S2MEMBER_CURRENT_USER_FIELDS . ",";
89
- /**/
90
- $g .= "S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED = " . S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED . ",";
91
- $g .= "S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED = " . ((S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED) ? "true" : "false") . ",";
92
- $g .= "S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY = " . S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY . ",";
93
- $g .= "S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS = " . S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS . ",";
94
- /**/
95
- $g .= "S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID = " . S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID . ",";
96
- $g .= "S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID = " . S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID . ",";
97
- $g .= "S2MEMBER_LOGIN_WELCOME_PAGE_ID = " . S2MEMBER_LOGIN_WELCOME_PAGE_ID . ",";
98
- /**/
99
- $g .= "S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL = '" . preg_replace ("/'/", "\'", S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL) . "',";
100
- $g .= "S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL = '" . preg_replace ("/'/", "\'", S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL) . "',";
101
- $g .= "S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL = '" . preg_replace ("/'/", "\'", S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL) . "',";
102
- $g .= "S2MEMBER_LOGIN_WELCOME_PAGE_URL = '" . preg_replace ("/'/", "\'", S2MEMBER_LOGIN_WELCOME_PAGE_URL) . "',";
103
- $g .= "S2MEMBER_LOGOUT_PAGE_URL = '" . preg_replace ("/'/", "\'", S2MEMBER_LOGOUT_PAGE_URL) . "',";
104
- $g .= "S2MEMBER_LOGIN_PAGE_URL = '" . preg_replace ("/'/", "\'", S2MEMBER_LOGIN_PAGE_URL) . "',";
105
- /**/
106
- $g .= "S2MEMBER_LEVEL1_LABEL = '" . preg_replace ("/'/", "\'", S2MEMBER_LEVEL1_LABEL) . "',";
107
- $g .= "S2MEMBER_LEVEL2_LABEL = '" . preg_replace ("/'/", "\'", S2MEMBER_LEVEL2_LABEL) . "',";
108
- $g .= "S2MEMBER_LEVEL3_LABEL = '" . preg_replace ("/'/", "\'", S2MEMBER_LEVEL3_LABEL) . "',";
109
- $g .= "S2MEMBER_LEVEL4_LABEL = '" . preg_replace ("/'/", "\'", S2MEMBER_LEVEL4_LABEL) . "',";
110
  /**/
111
- $g .= "S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED = " . S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED . ",";
112
- $g .= "S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED = " . S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED . ",";
113
- $g .= "S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED = " . S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED . ",";
114
- $g .= "S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED = " . S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED . ",";
115
- /**/
116
- $g .= "S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED_DAYS = " . S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED_DAYS . ",";
117
- $g .= "S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED_DAYS = " . S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED_DAYS . ",";
118
- $g .= "S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED_DAYS = " . S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED_DAYS . ",";
119
- $g .= "S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED_DAYS = " . S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED_DAYS . ",";
120
- /**/
121
- $g .= "S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS = '" . preg_replace ("/'/", "\'", S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS) . "',";
122
- /**/
123
- $g .= "S2MEMBER_REG_EMAIL_FROM_NAME = '" . preg_replace ("/'/", "\'", S2MEMBER_REG_EMAIL_FROM_NAME) . "',";
124
- $g .= "S2MEMBER_REG_EMAIL_FROM_EMAIL = '" . preg_replace ("/'/", "\'", S2MEMBER_REG_EMAIL_FROM_EMAIL) . "',";
125
- /**/
126
- $g .= "S2MEMBER_PAYPAL_NOTIFY_URL = '" . preg_replace ("/'/", "\'", S2MEMBER_PAYPAL_NOTIFY_URL) . "',";
127
- $g .= "S2MEMBER_PAYPAL_RETURN_URL = '" . preg_replace ("/'/", "\'", S2MEMBER_PAYPAL_RETURN_URL) . "',";
128
- $g .= "S2MEMBER_PAYPAL_ENDPOINT = '" . preg_replace ("/'/", "\'", S2MEMBER_PAYPAL_ENDPOINT) . "',";
129
- $g .= "S2MEMBER_PAYPAL_BUSINESS = '" . preg_replace ("/'/", "\'", S2MEMBER_PAYPAL_BUSINESS) . "',";
130
- /**/
131
- $g .= "S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0 = '" . preg_replace ("/'/", "\'", S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0) . "',";
132
- $g .= "S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0 = '" . preg_replace ("/'/", "\'", S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0) . "',";
133
- /**/
134
- $g = trim ($g, " ,") . ";"; /* Trim & add semicolon. */
135
- $j = file_get_contents (dirname (dirname (__FILE__)) . "/s2member-min.js");
136
- $j = preg_replace ("/('|\")%%globals%%('|\");/", $g, $j);
137
- /**/
138
- echo apply_filters ("s2member_js_w_globals", $j, get_defined_vars ());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
139
  /**/
140
- exit;
141
  }
142
- /**/
143
- do_action ("s2member_after_js_w_globals", get_defined_vars ());
144
  }
145
  ?>
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
@@ -16,52 +16,64 @@ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
16
  /*
17
  Function that process list server integrations for s2Member.
18
  */
19
- function ws_plugin__s2member_process_list_servers ($level = FALSE, $email = FALSE, $fname = FALSE, $lname = FALSE, $ip = FALSE, $opt_in = FALSE)
20
  {
21
- do_action ("s2member_before_process_list_servers", get_defined_vars ());
22
- /**/
23
- if (strlen ($level) && is_email ($email) && $opt_in) /* Must have a level, a valid email, and opt-in permission. */
24
  {
25
- if (($mailchimp_api_key = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mailchimp_api_key"]))
26
- if (($mailchimp_list_ids = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_mailchimp_list_ids"]))
27
- {
28
- if (!class_exists ("NC_MCAPI"))
29
- include_once dirname (dirname (__FILE__)) . "/mailchimp/nc-mcapi.inc.php";
30
- /**/
31
- $MCAPI = new NC_MCAPI ($mailchimp_api_key); /* MailChimp® API class. */
32
- /**/
33
- foreach (preg_split ("/[\r\n\t\s;,]+/", $mailchimp_list_ids) as $mailchimp_list_id)
34
- $MCAPI->listSubscribe ($mailchimp_list_id, $email, array ("FNAME" => $fname, "LNAME" => $lname, "OPTINIP" => $ip));
35
- }
36
  /**/
37
- if (($aweber_list_ids = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_aweber_list_ids"]))
38
  {
39
- foreach (preg_split ("/[\r\n\t\s;,]+/", $aweber_list_ids) as $aweber_list_id)
40
- @mail ($aweber_list_id . "@aweber.com", "s2Member Subscription Request",/**/
41
- "s2Member Subscription Request\ns2Member w/ PayPal Email ID\nEMail Address: " . $email . "\nBuyer: " . $fname . " " . $lname . "\nFull Name: " . $fname . " " . $lname . "\nFirst Name: " . $fname . "\nLast Name: " . $lname . "\nIP Address: " . $ip . "\nLevel: " . $level . "\n - end.",/**/
42
- "From: \"" . preg_replace ("/\"/", "", $fname . " " . $lname) . "\" <" . $email . ">\r\nContent-Type: text/plain; charset=utf-8");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  }
44
  /**/
45
- do_action ("s2member_during_process_list_servers", get_defined_vars ());
 
 
 
 
46
  }
47
- /**/
48
- do_action ("s2member_after_process_list_servers", get_defined_vars ());
49
- /**/
50
- return;
51
  }
52
  /*
53
  Function that determines whether or not any list
54
  servers have been integrated into the s2Member options.
55
  */
56
- function ws_plugin__s2member_list_servers_integrated ()
57
  {
58
- do_action ("s2member_before_list_servers_integrated", get_defined_vars ());
59
- /**/
60
- for ($i = 0; $i <= 4; $i++)
61
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $i . "_mailchimp_list_ids"]/**/
62
- || $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $i . "_aweber_list_ids"])
63
- return apply_filters ("s2member_list_servers_integrated", true, get_defined_vars ());
64
- /**/
65
- return apply_filters ("s2member_list_servers_integrated", false, get_defined_vars ());
 
 
 
66
  }
67
  ?>
16
  /*
17
  Function that process list server integrations for s2Member.
18
  */
19
+ if (!function_exists ("ws_plugin__s2member_process_list_servers"))
20
  {
21
+ function ws_plugin__s2member_process_list_servers ($level = FALSE, $email = FALSE, $fname = FALSE, $lname = FALSE, $ip = FALSE, $opt_in = FALSE)
 
 
22
  {
23
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
24
+ do_action ("ws_plugin__s2member_before_process_list_servers", get_defined_vars ());
25
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
 
 
 
 
 
 
 
 
26
  /**/
27
+ if (strlen ($level) && is_email ($email) && $opt_in) /* Must have a level, a valid email, and opt-in permission. */
28
  {
29
+ if (($mailchimp_api_key = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mailchimp_api_key"]))
30
+ if (($mailchimp_list_ids = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_mailchimp_list_ids"]))
31
+ {
32
+ if (!class_exists ("NC_MCAPI"))
33
+ include_once dirname (dirname (__FILE__)) . "/mailchimp/nc-mcapi.inc.php";
34
+ /**/
35
+ $MCAPI = new NC_MCAPI ($mailchimp_api_key); /* MailChimp® API class. */
36
+ /**/
37
+ foreach (preg_split ("/[\r\n\t\s;,]+/", $mailchimp_list_ids) as $mailchimp_list_id)
38
+ $MCAPI->listSubscribe ($mailchimp_list_id, $email, array ("FNAME" => $fname, "LNAME" => $lname, "OPTINIP" => $ip));
39
+ }
40
+ /**/
41
+ if (($aweber_list_ids = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_aweber_list_ids"]))
42
+ {
43
+ foreach (preg_split ("/[\r\n\t\s;,]+/", $aweber_list_ids) as $aweber_list_id)
44
+ @mail ($aweber_list_id . "@aweber.com", "s2Member Subscription Request",/**/
45
+ "s2Member Subscription Request\ns2Member w/ PayPal Email ID\nEMail Address: " . $email . "\nBuyer: " . $fname . " " . $lname . "\nFull Name: " . $fname . " " . $lname . "\nFirst Name: " . $fname . "\nLast Name: " . $lname . "\nIP Address: " . $ip . "\nLevel: " . $level . "\n - end.",/**/
46
+ "From: \"" . preg_replace ("/\"/", "", $fname . " " . $lname) . "\" <" . $email . ">\r\nContent-Type: text/plain; charset=utf-8");
47
+ }
48
+ /**/
49
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
50
+ do_action ("ws_plugin__s2member_during_process_list_servers", get_defined_vars ());
51
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
52
  }
53
  /**/
54
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
55
+ do_action ("ws_plugin__s2member_after_process_list_servers", get_defined_vars ());
56
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
57
+ /**/
58
+ return;
59
  }
 
 
 
 
60
  }
61
  /*
62
  Function that determines whether or not any list
63
  servers have been integrated into the s2Member options.
64
  */
65
+ if (!function_exists ("ws_plugin__s2member_list_servers_integrated"))
66
  {
67
+ function ws_plugin__s2member_list_servers_integrated ()
68
+ {
69
+ do_action ("ws_plugin__s2member_before_list_servers_integrated", get_defined_vars ());
70
+ /**/
71
+ for ($i = 0; $i <= 4; $i++)
72
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $i . "_mailchimp_list_ids"]/**/
73
+ || $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $i . "_aweber_list_ids"])
74
+ return apply_filters ("ws_plugin__s2member_list_servers_integrated", true, get_defined_vars ());
75
+ /**/
76
+ return apply_filters ("ws_plugin__s2member_list_servers_integrated", false, get_defined_vars ());
77
+ }
78
  }
79
  ?>
includes/functions/login-customizations.inc.php CHANGED
@@ -17,64 +17,81 @@ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
17
  Function for filtering the login logo url.
18
  Attach to: add_filter("login_headerurl");
19
  */
20
- function ws_plugin__s2member_login_header_url ($url = FALSE)
21
  {
22
- do_action ("s2member_before_login_header_url", get_defined_vars ());
23
- /**/
24
- $url = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_logo_url"];
25
- /**/
26
- return apply_filters ("s2member_login_header_url", $url, get_defined_vars ());
 
 
 
27
  }
28
  /*
29
  Function for filtering the login logo title.
30
  Attach to: add_filter("login_headertitle");
31
  */
32
- function ws_plugin__s2member_login_header_title ($title = FALSE)
33
  {
34
- do_action ("s2member_before_login_header_title", get_defined_vars ());
35
- /**/
36
- $title = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_logo_title"];
37
- /**/
38
- return apply_filters ("s2member_login_header_title", $title, get_defined_vars ());
 
 
 
39
  }
40
  /*
41
  Function for creating the styles for the login panel.
42
  Attach to: add_action("login_head");
43
  */
44
- function ws_plugin__s2member_login_header_styles ()
45
  {
46
- do_action ("s2member_before_login_header_styles", get_defined_vars ());
47
- /**/
48
- $s = "\n" . '<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>' . "\n";
49
- $s .= '<script type="text/javascript" src="' . get_bloginfo ("url") . '/?ws_plugin__s2member_js_w_globals=1&amp;no-cache=' . urlencode (md5 (mt_rand ())) . '"></script>' . "\n";
50
- /**/
51
- $s .= "\n" . '<style type="text/css">' . "\n";
52
- /**/
53
- $s .= 'html, body { border: 0 !important; background: none !important; }' . "\n"; /* Clear borders & existing background. */
54
- $s .= 'html { background-color: #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_color"] . ' !important; }' . "\n";
55
- $s .= 'html { background-image: url(' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_image"] . ') !important; }' . "\n";
56
- /**/
57
- $s .= 'p#backtoblog a, p#backtoblog a:hover, p#backtoblog a:active, p#backtoblog a:focus { color: #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_text_color"] . ' !important; text-shadow: 1px 1px 3px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_text_shadow_color"] . ' !important; top: 15px !important; left: 15px !important; padding: 10px !important; border:1px solid #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . ' !important; background-color: #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_color"] . ' !important; -moz-border-radius:3px !important; -webkit-border-radius:3px !important; border-radius:3px !important; }' . "\n";
58
- /**/
59
- $s .= 'div#login { width: ' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_logo_src_width"] . 'px !important; }' . "\n";
60
- $s .= 'div#login h1 a { background: url(' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_logo_src"] . ') no-repeat top center !important; }' . "\n";
61
- $s .= 'div#login h1 a { display: block !important; width: 100% !important; height: ' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_logo_src_height"] . 'px !important; }' . "\n";
62
- $s .= 'div#login p#nav, div#login p#nav a, div#login p#nav a:hover, div#login p#nav a:active, div#login p#nav a:focus { color: #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_text_color"] . ' !important; text-shadow: 1px 1px 3px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_text_shadow_color"] . ' !important; }' . "\n";
63
- $s .= 'div#login form { -moz-box-shadow: 1px 1px 5px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . ', -1px -1px 5px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . ' !important; -webkit-box-shadow: 1px 1px 5px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . ', -1px -1px 5px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . ' !important; -khtml-box-shadow: 1px 1px 5px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . ', -1px -1px 5px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . ' !important; box-shadow: 1px 1px 5px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . ', -1px -1px 5px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . ' !important; }' . "\n";
64
- $s .= 'div#login form input[type="submit"], div#login form input[type="submit"]:hover, div#login form input[type="submit"]:active, div#login form input[type="submit"]:focus { color: #333333 !important; border: 1px solid #666666 !important; background: #CCCCCC !important; padding: 5px !important; -moz-border-radius: 3px !important; -webkit-border-radius: 3px !important; -khtml-border-radius: 3px !important; border-radius: 3px !important; }' . "\n";
65
- $s .= 'div#login form input[type="submit"]:hover, div#login form input[type="submit"]:active, div#login form input[type="submit"]:focus { color: #000000 !important; border: 1px solid #000000 !important; }' . "\n";
66
- /**/
67
- $s .= 'div#login form input.ws-plugin--s2member-custom-reg-field { background:none repeat scroll 0 0 #FBFBFB; border:1px solid #E5E5E5; font-size:24px; margin-bottom:16px; margin-right:6px; margin-top:2px; padding:3px; width:97%; }' . "\n";
68
- /**/
69
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_password"])
70
- $s .= 'p#reg_passmail { display: none; }' . "\n";
71
- /**/
72
- $s .= '</style>' . "\n\n";
73
- /**/
74
- echo apply_filters ("s2member_login_header_styles", $s, get_defined_vars ());
75
- /**/
76
- do_action ("s2member_after_login_header_styles", get_defined_vars ());
77
- /**/
78
- return;
 
 
 
 
 
 
 
 
 
 
 
79
  }
80
  ?>
17
  Function for filtering the login logo url.
18
  Attach to: add_filter("login_headerurl");
19
  */
20
+ if (!function_exists ("ws_plugin__s2member_login_header_url"))
21
  {
22
+ function ws_plugin__s2member_login_header_url ($url = FALSE)
23
+ {
24
+ do_action ("ws_plugin__s2member_before_login_header_url", get_defined_vars ());
25
+ /**/
26
+ $url = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_logo_url"];
27
+ /**/
28
+ return apply_filters ("ws_plugin__s2member_login_header_url", $url, get_defined_vars ());
29
+ }
30
  }
31
  /*
32
  Function for filtering the login logo title.
33
  Attach to: add_filter("login_headertitle");
34
  */
35
+ if (!function_exists ("ws_plugin__s2member_login_header_title"))
36
  {
37
+ function ws_plugin__s2member_login_header_title ($title = FALSE)
38
+ {
39
+ do_action ("ws_plugin__s2member_before_login_header_title", get_defined_vars ());
40
+ /**/
41
+ $title = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_logo_title"];
42
+ /**/
43
+ return apply_filters ("ws_plugin__s2member_login_header_title", $title, get_defined_vars ());
44
+ }
45
  }
46
  /*
47
  Function for creating the styles for the login panel.
48
  Attach to: add_action("login_head");
49
  */
50
+ if (!function_exists ("ws_plugin__s2member_login_header_styles"))
51
  {
52
+ function ws_plugin__s2member_login_header_styles ()
53
+ {
54
+ $s = ""; /* Initialize here to give hooks a chance. */
55
+ /**/
56
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
57
+ do_action ("ws_plugin__s2member_before_login_header_styles", get_defined_vars ());
58
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
59
+ /**/
60
+ $s .= "\n" . '<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>' . "\n";
61
+ $s .= '<script type="text/javascript" src="' . get_bloginfo ("url") . '/?ws_plugin__s2member_js_w_globals=1&amp;no-cache=' . urlencode (md5 (mt_rand ())) . '"></script>' . "\n";
62
+ /**/
63
+ $s .= "\n" . '<style type="text/css">' . "\n";
64
+ /**/
65
+ $s .= 'html, body { border: 0 !important; background: none !important; }' . "\n"; /* Clear borders & existing background. */
66
+ $s .= 'html { background-color: #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_color"] . ' !important; }' . "\n";
67
+ $s .= 'html { background-image: url(' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_image"] . ') !important; }' . "\n";
68
+ /**/
69
+ $s .= 'p#backtoblog a, p#backtoblog a:hover, p#backtoblog a:active, p#backtoblog a:focus { color: #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_text_color"] . ' !important; text-shadow: 1px 1px 3px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_text_shadow_color"] . ' !important; top: 15px !important; left: 15px !important; padding: 10px !important; border:1px solid #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . ' !important; background-color: #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_color"] . ' !important; -moz-border-radius:3px !important; -webkit-border-radius:3px !important; border-radius:3px !important; }' . "\n";
70
+ /**/
71
+ $s .= 'div#login { width: ' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_logo_src_width"] . 'px !important; }' . "\n";
72
+ $s .= 'div#login h1 a { background: url(' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_logo_src"] . ') no-repeat top center !important; }' . "\n";
73
+ $s .= 'div#login h1 a { display: block !important; width: 100% !important; height: ' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_logo_src_height"] . 'px !important; }' . "\n";
74
+ $s .= 'div#login p#nav, div#login p#nav a, div#login p#nav a:hover, div#login p#nav a:active, div#login p#nav a:focus { color: #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_text_color"] . ' !important; text-shadow: 1px 1px 3px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_text_shadow_color"] . ' !important; }' . "\n";
75
+ $s .= 'div#login form { -moz-box-shadow: 1px 1px 5px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . ', -1px -1px 5px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . ' !important; -webkit-box-shadow: 1px 1px 5px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . ', -1px -1px 5px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . ' !important; -khtml-box-shadow: 1px 1px 5px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . ', -1px -1px 5px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . ' !important; box-shadow: 1px 1px 5px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . ', -1px -1px 5px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . ' !important; }' . "\n";
76
+ $s .= 'div#login form input[type="submit"], div#login form input[type="submit"]:hover, div#login form input[type="submit"]:active, div#login form input[type="submit"]:focus { color: #333333 !important; border: 1px solid #666666 !important; background: #CCCCCC !important; padding: 5px !important; -moz-border-radius: 3px !important; -webkit-border-radius: 3px !important; -khtml-border-radius: 3px !important; border-radius: 3px !important; }' . "\n";
77
+ $s .= 'div#login form input[type="submit"]:hover, div#login form input[type="submit"]:active, div#login form input[type="submit"]:focus { color: #000000 !important; border: 1px solid #000000 !important; }' . "\n";
78
+ /**/
79
+ $s .= 'div#login form input.ws-plugin--s2member-custom-reg-field { background:none repeat scroll 0 0 #FBFBFB; border:1px solid #E5E5E5; font-size:24px; margin-bottom:16px; margin-right:6px; margin-top:2px; padding:3px; width:97%; }' . "\n";
80
+ /**/
81
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_password"])
82
+ $s .= 'p#reg_passmail { display: none; }' . "\n";
83
+ /**/
84
+ $s .= '</style>' . "\n\n";
85
+ /**/
86
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
87
+ do_action ("ws_plugin__s2member_during_login_header_styles", get_defined_vars ());
88
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
89
+ /**/
90
+ echo apply_filters ("ws_plugin__s2member_login_header_styles", $s, get_defined_vars ());
91
+ /**/
92
+ do_action ("ws_plugin__s2member_after_login_header_styles", get_defined_vars ());
93
+ /**/
94
+ return;
95
+ }
96
  }
97
  ?>
includes/functions/login-redirection.inc.php CHANGED
@@ -17,46 +17,60 @@ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
17
  Function for handling login redirections.
18
  Attach to: add_action("wp_login");
19
  */
20
- function ws_plugin__s2member_login_redirect ($username = FALSE)
21
  {
22
- do_action ("s2member_before_login_redirect", get_defined_vars ());
23
- /**/
24
- $user = new WP_User ($username); /* Get user object reference. */
25
- /**/
26
- if (!$user->has_cap ("edit_posts")) /* Subscribers & Members. */
27
  {
28
- do_action ("s2member_during_login_redirect", get_defined_vars ());
 
 
29
  /**/
30
- if (ws_plugin__s2member_ip_restrictions_ok ($_SERVER["REMOTE_ADDR"], strtolower ($username)))
 
 
31
  {
32
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"])
33
- wp_redirect (ws_plugin__s2member_fill_login_redirect_rc_vars /* Special. */
34
- ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"], $user));
 
 
 
 
 
 
 
 
 
 
35
  /**/
36
- else /* Otherwise, use the Login Welcome Page for s2Member. */
37
- wp_redirect (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]));
38
  }
39
  /**/
40
- exit;
 
 
 
 
41
  }
42
- /**/
43
- do_action ("s2member_after_login_redirect", get_defined_vars ());
44
- /**/
45
- return;
46
  }
47
  /*
48
  Function that fills replacement code variables in special redirection URLs.
49
  */
50
- function ws_plugin__s2member_fill_login_redirect_rc_vars ($url = FALSE, $current_user = FALSE)
51
  {
52
- do_action ("s2member_before_fill_login_redirect_rc_vars", get_defined_vars ());
53
- /**/
54
- $current_user_login = (is_object ($current_user)) ? strtolower ($current_user->user_login) : "";
55
- $current_user_ID = (is_object ($current_user)) ? (string)$current_user->ID : "";
56
- /**/
57
- $url = preg_replace ("/%%current_user_login%%/i", $current_user_login, $url);
58
- $url = preg_replace ("/%%current_user_ID%%/i", $current_user_ID, $url);
59
- /**/
60
- return apply_filters ("s2member_fill_login_redirect_rc_vars", $url, get_defined_vars ());
 
 
 
 
 
61
  }
62
  ?>
17
  Function for handling login redirections.
18
  Attach to: add_action("wp_login");
19
  */
20
+ if (!function_exists ("ws_plugin__s2member_login_redirect"))
21
  {
22
+ function ws_plugin__s2member_login_redirect ($username = FALSE)
 
 
 
 
23
  {
24
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
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 ());
34
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
35
+ /**/
36
+ if (ws_plugin__s2member_ip_restrictions_ok ($_SERVER["REMOTE_ADDR"], strtolower ($username)))
37
+ {
38
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"])
39
+ wp_redirect (ws_plugin__s2member_fill_login_redirect_rc_vars /* Special. */
40
+ ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"], $user));
41
+ /**/
42
+ else /* Otherwise, use the Login Welcome Page for s2Member. */
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;');
50
+ do_action ("ws_plugin__s2member_after_login_redirect", get_defined_vars ());
51
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
52
+ /**/
53
+ return;
54
  }
 
 
 
 
55
  }
56
  /*
57
  Function that fills replacement code variables in special redirection URLs.
58
  */
59
+ if (!function_exists ("ws_plugin__s2member_fill_login_redirect_rc_vars"))
60
  {
61
+ function ws_plugin__s2member_fill_login_redirect_rc_vars ($url = FALSE, $current_user = FALSE)
62
+ {
63
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
64
+ do_action ("ws_plugin__s2member_before_fill_login_redirect_rc_vars", get_defined_vars ());
65
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
66
+ /**/
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
+ }
75
  }
76
  ?>
includes/functions/menu-pages.inc.php CHANGED
@@ -16,377 +16,457 @@ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
16
  /*
17
  Function for saving all options from any page.
18
  */
19
- function ws_plugin__s2member_update_all_options ()
20
  {
21
- do_action ("s2member_before_update_all_options", get_defined_vars ());
22
- /**/
23
- if (($nonce = $_POST["ws_plugin__s2member_options_save"]) && wp_verify_nonce ($nonce, "ws-plugin--s2member-options-save"))
24
  {
25
- $options = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]; /* Get current options. */
26
  /**/
27
- foreach ($_POST as $key => $value) /* Go through each post variable and look for s2member. */
28
  {
29
- if (preg_match ("/^" . preg_quote ("ws_plugin__s2member", "/") . "/", $key)) /* Look for keys. */
 
 
30
  {
31
- if ($key === "ws_plugin__s2member_configured") /* This is a special configuration option. */
32
  {
33
- update_option ("ws_plugin__s2member_configured", trim (stripslashes ($value))); /* Update this option separately. */
34
- /**/
35
- $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["configured"] = trim (stripslashes ($value)); /* Update configuration on-the-fly. */
36
- }
37
- else /* We need to place this option into the array. Here we remove the ws_plugin__s2member_ portion on the beginning. */
38
- {
39
- (is_array ($value)) ? array_shift ($value) : null; /* Arrays should be padded, 1st key is removed. */
40
- $options[preg_replace ("/^" . preg_quote ("ws_plugin__s2member_", "/") . "/", "", $key)] = $value;
 
 
 
41
  }
42
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  }
44
  /**/
45
- $options["options_version"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["options_version"] + 0.001; /* Increment options version. */
46
- /**/
47
- $options = ws_plugin__s2member_configure_options_and_their_defaults ($options); /* Also updates the global options array. */
48
- /**/
49
- update_option ("ws_plugin__s2member_options", $options) . update_option ("ws_plugin__s2member_cache", array ());
50
  /**/
51
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["auto_eot_system_enabled"] == 1)
52
- ws_plugin__s2member_add_auto_eot_system (); /* 1 == WP-Cron. */
53
- else /* Otherwise, the Auto-EOT System via WP-Cron is disabled. */
54
- ws_plugin__s2member_delete_auto_eot_system ();
55
- /**/
56
- do_action ("s2member_during_update_all_options", get_defined_vars ());
57
- /**/
58
- ws_plugin__s2member_display_admin_notice ('<strong>Options saved.</strong>'); /* Display admin notice. */
59
  }
60
- /**/
61
- do_action ("s2member_after_update_all_options", get_defined_vars ());
62
- /**/
63
- return;
64
  }
65
  /*
66
  Add the options menus & sub-menus.
67
  Attach to: add_action("admin_menu");
68
  */
69
- function ws_plugin__s2member_add_admin_options ()
70
  {
71
- do_action ("s2member_before_add_admin_options", get_defined_vars ());
72
- /**/
73
- add_filter ("plugin_action_links", "_ws_plugin__s2member_add_settings_link", 10, 2);
74
- /**/
75
- add_menu_page ("s2Member Options", "s2Member", "edit_plugins", "ws-plugin--s2member-options", "ws_plugin__s2member_options_page");
76
- add_submenu_page ("ws-plugin--s2member-options", "s2Member General Options", "General Options", "edit_plugins", "ws-plugin--s2member-options", "ws_plugin__s2member_options_page");
77
- 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");
78
- add_submenu_page ("ws-plugin--s2member-options", "s2Member PayPal® Buttons", "PayPal® Buttons", "edit_plugins", "ws-plugin--s2member-buttons", "ws_plugin__s2member_buttons_page");
79
- 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");
80
- add_submenu_page ("ws-plugin--s2member-options", "s2Member API / Tracking", "API / Tracking", "edit_plugins", "ws-plugin--s2member-trk-ops", "ws_plugin__s2member_trk_ops_page");
81
- add_submenu_page ("ws-plugin--s2member-options", "s2Member API / List Servers", "API / List Servers", "edit_plugins", "ws-plugin--s2member-els-ops", "ws_plugin__s2member_els_ops_page");
82
- add_submenu_page ("ws-plugin--s2member-options", "s2Member API / Notifications", "API / Notifications", "edit_plugins", "ws-plugin--s2member-api-ops", "ws_plugin__s2member_api_ops_page");
83
- add_submenu_page ("ws-plugin--s2member-options", "s2Member API / Scripting", "API / Scripting", "edit_plugins", "ws-plugin--s2member-scripting", "ws_plugin__s2member_scripting_page");
84
- add_submenu_page ("ws-plugin--s2member-options", "s2Member Information", "s2Member Info", "edit_plugins", "ws-plugin--s2member-info", "ws_plugin__s2member_info_page");
85
- add_submenu_page ("ws-plugin--s2member-options", "s2Member Quick Start Guide", "Quick Start Guide", "edit_plugins", "ws-plugin--s2member-start", "ws_plugin__s2member_start_page");
86
- /**/
87
- do_action ("s2member_after_add_admin_options", get_defined_vars ());
88
- /**/
89
- return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  }
91
  /*
92
  A sort of callback function to add the settings link.
93
  */
94
- function _ws_plugin__s2member_add_settings_link ($links = array (), $file = "")
95
  {
96
- do_action ("s2member_before_add_settings_link", get_defined_vars ());
97
- /**/
98
- if (preg_match ("/" . preg_quote ($file, "/") . "$/", $GLOBALS["WS_PLUGIN__"]["s2member"]["l"]) && is_array ($links))
99
  {
100
- $settings = '<a href="admin.php?page=ws-plugin--s2member-options">Settings</a>';
101
- array_unshift ($links, apply_filters ("s2member_add_settings_link", $settings, get_defined_vars ()));
 
102
  /**/
103
- do_action ("s2member_during_add_settings_link", get_defined_vars ());
 
 
 
 
 
 
 
 
 
 
104
  }
105
- /**/
106
- return apply_filters ("s2member_add_settings_link", $links, get_defined_vars ());
107
  }
108
  /*
109
  Add scripts to admin panels.
110
  Attach to: add_action("admin_print_scripts");
111
  */
112
- function ws_plugin__s2member_add_admin_scripts ()
113
  {
114
- do_action ("s2member_before_add_admin_scripts", get_defined_vars ());
115
- /**/
116
- if ($_GET["page"] && preg_match ("/ws-plugin--s2member-/", $_GET["page"]))
117
  {
118
- wp_enqueue_script ("jquery");
119
- wp_enqueue_script ("thickbox");
120
- wp_enqueue_script ("media-upload");
121
- wp_enqueue_script ("ws-plugin--s2member-menu-pages", get_bloginfo ("url") . "/?ws_plugin__s2member_menu_pages_js=1", array ("jquery", "thickbox", "media-upload"), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["options_version"] . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["filemtime"]);
 
 
 
 
 
 
 
 
 
122
  /**/
123
- do_action ("s2member_during_add_admin_scripts", get_defined_vars ());
124
  }
125
- /**/
126
- do_action ("s2member_after_add_admin_scripts", get_defined_vars ());
127
- /**/
128
- return;
129
  }
130
  /*
131
  Add styles to admin panels.
132
  Attach to: add_action("admin_print_styles");
133
  */
134
- function ws_plugin__s2member_add_admin_styles ()
135
  {
136
- do_action ("s2member_before_add_admin_styles", get_defined_vars ());
137
- /**/
138
- if ($_GET["page"] && preg_match ("/ws-plugin--s2member-/", $_GET["page"]))
139
  {
140
- wp_enqueue_style ("thickbox");
141
- wp_enqueue_style ("ws-plugin--s2member-menu-pages", get_bloginfo ("url") . "/?ws_plugin__s2member_menu_pages_css=1", array ("thickbox"), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["options_version"] . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["filemtime"], "all");
142
  /**/
143
- do_action ("s2member_during_add_admin_styles", get_defined_vars ());
 
 
 
 
 
 
 
 
 
 
144
  }
145
- /**/
146
- do_action ("s2member_after_add_admin_styles", get_defined_vars ());
147
- /**/
148
- return;
149
  }
150
  /*
151
  Function that outputs the JS for menu pages.
152
  Attach to: add_action("init");
153
  */
154
- function ws_plugin__s2member_menu_pages_js ()
155
  {
156
- do_action ("s2member_before_menu_pages_js", get_defined_vars ());
157
- /**/
158
- if ($_GET["ws_plugin__s2member_menu_pages_js"] && is_user_logged_in () && current_user_can ("edit_plugins"))
159
  {
160
- header ("Content-Type: text/javascript; charset=utf-8");
161
- header ("Expires: " . gmdate ("D, d M Y H:i:s", strtotime ("-1 week")) . " GMT");
162
- header ("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
163
- header ("Cache-Control: no-cache, must-revalidate, max-age=0");
164
- header ("Pragma: no-cache");
165
- /**/
166
- $u = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"];
167
- $i = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images";
168
- /**/
169
- include_once dirname (dirname (__FILE__)) . "/menu-pages/menu-pages.js";
170
  /**/
171
- do_action ("s2member_during_menu_pages_js", get_defined_vars ());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
172
  /**/
173
- exit;
174
  }
175
- /**/
176
- do_action ("s2member_after_menu_pages_js", get_defined_vars ());
177
  }
178
  /*
179
  Function that outputs the CSS for menu pages.
180
  Attach to: add_action("init");
181
  */
182
- function ws_plugin__s2member_menu_pages_css ()
183
  {
184
- do_action ("s2member_before_menu_pages_css", get_defined_vars ());
185
- /**/
186
- if ($_GET["ws_plugin__s2member_menu_pages_css"] && is_user_logged_in () && current_user_can ("edit_plugins"))
187
  {
188
- header ("Content-Type: text/css; charset=utf-8");
189
- header ("Expires: " . gmdate ("D, d M Y H:i:s", strtotime ("-1 week")) . " GMT");
190
- header ("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
191
- header ("Cache-Control: no-cache, must-revalidate, max-age=0");
192
- header ("Pragma: no-cache");
193
- /**/
194
- $u = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"];
195
- $i = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images";
196
- /**/
197
- include_once dirname (dirname (__FILE__)) . "/menu-pages/menu-pages.css";
198
  /**/
199
- do_action ("s2member_during_menu_pages_css", get_defined_vars ());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
200
  /**/
201
- exit;
202
  }
203
- /**/
204
- do_action ("s2member_after_menu_pages_css", get_defined_vars ());
205
  }
206
  /*
207
  Function for building and handling the General Options page.
208
  */
209
- function ws_plugin__s2member_options_page ()
210
  {
211
- do_action ("s2member_before_options_page", get_defined_vars ());
212
- /**/
213
- ws_plugin__s2member_update_all_options ();
214
- /**/
215
- include_once dirname (dirname (__FILE__)) . "/menu-pages/options.inc.php";
216
- /**/
217
- do_action ("s2member_after_options_page", get_defined_vars ());
218
- /**/
219
- return;
 
 
 
220
  }
221
  /*
222
  Function for building and handling the Paypal Options page.
223
  */
224
- function ws_plugin__s2member_paypal_ops_page ()
225
  {
226
- do_action ("s2member_before_paypal_ops_page", get_defined_vars ());
227
- /**/
228
- ws_plugin__s2member_update_all_options ();
229
- /**/
230
- $logs_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"];
231
- /**/
232
- if (!is_dir ($logs_dir) && is_writable (dirname ($logs_dir)))
233
- mkdir ($logs_dir, 0777) . clearstatcache ();
234
- /**/
235
- $htaccess = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"] . "/.htaccess";
236
- /**/
237
- if (is_dir ($logs_dir) && is_writable ($logs_dir) && !file_exists ($htaccess))
238
- file_put_contents ($htaccess, "deny from all") . clearstatcache ();
239
- /**/
240
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_debug"]) /* If logging is enabled. */
241
  {
242
- if (!is_dir ($logs_dir)) /* If the security-enabled logs directory does not exist yet. */
243
- ws_plugin__s2member_display_admin_notice ("The security-enabled logs directory ( <code>" . preg_replace ("/^" . preg_quote ($_SERVER["DOCUMENT_ROOT"], "/") . "/", "", $logs_dir) . "</code> ) does not exist. Please create this directory manually &amp; make it writable ( chmod 777 ).", true);
244
  /**/
245
- else if (!is_writable ($logs_dir)) /* If the logs directory is not writable yet. */
246
- ws_plugin__s2member_display_admin_notice ("Permissions error. The security-enabled logs directory ( <code>" . preg_replace ("/^" . preg_quote ($_SERVER["DOCUMENT_ROOT"], "/") . "/", "", $logs_dir) . "</code> ) is not writable. Please make this directory writable ( chmod 777 ).", true);
247
  /**/
248
- if (!file_exists ($htaccess)) /* If the .htaccess file has not been created yet. */
249
- ws_plugin__s2member_display_admin_notice ("The .htaccess protection file ( <code>" . preg_replace ("/^" . preg_quote ($_SERVER["DOCUMENT_ROOT"], "/") . "/", "", $htaccess) . "</code> ) does not exist. Please create this file manually. Inside your .htaccess file, add this one line: <code>deny from all</code>.", true);
250
  /**/
251
- else if (!preg_match ("/deny from all/i", file_get_contents ($htaccess))) /* Else if the .htaccess file does not offer the required protection. */
252
- ws_plugin__s2member_display_admin_notice ("Unprotected. The .htaccess protection file ( <code>" . preg_replace ("/^" . preg_quote ($_SERVER["DOCUMENT_ROOT"], "/") . "/", "", $htaccess) . "</code> ) does not contain <code>deny from all</code>. Inside your .htaccess file, add this one line: <code>deny from all</code>.", true);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
253
  }
254
- /**/
255
- include_once dirname (dirname (__FILE__)) . "/menu-pages/paypal-ops.inc.php";
256
- /**/
257
- do_action ("s2member_after_paypal_ops_page", get_defined_vars ());
258
- /**/
259
- return;
260
  }
261
  /*
262
  Function for building and handling the Download Options page.
263
  */
264
- function ws_plugin__s2member_down_ops_page ()
265
  {
266
- do_action ("s2member_before_down_ops_page", get_defined_vars ());
267
- /**/
268
- ws_plugin__s2member_update_all_options ();
269
- /**/
270
- $files_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"];
271
- /**/
272
- if (!is_dir ($files_dir) && is_writable (dirname ($files_dir)))
273
- mkdir ($files_dir, 0777) . clearstatcache ();
274
- /**/
275
- $htaccess = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"] . "/.htaccess";
276
- /**/
277
- if (is_dir ($files_dir) && is_writable ($files_dir) && !file_exists ($htaccess))
278
- file_put_contents ($htaccess, "deny from all") . clearstatcache ();
279
- /**/
280
- if (!is_dir ($files_dir)) /* If the security-enabled files directory does not exist yet. */
281
- ws_plugin__s2member_display_admin_notice ("The security-enabled files directory ( <code>" . preg_replace ("/^" . preg_quote ($_SERVER["DOCUMENT_ROOT"], "/") . "/", "", $files_dir) . "</code> ) does not exist. Please create this directory manually.", true);
282
- /**/
283
- if (!file_exists ($htaccess)) /* If the .htaccess file has not been created yet. */
284
- ws_plugin__s2member_display_admin_notice ("The .htaccess protection file ( <code>" . preg_replace ("/^" . preg_quote ($_SERVER["DOCUMENT_ROOT"], "/") . "/", "", $htaccess) . "</code> ) does not exist. Please create this file manually. Inside your .htaccess file, add this one line: <code>deny from all</code>.", true);
285
- /**/
286
- else if (!preg_match ("/deny from all/i", file_get_contents ($htaccess))) /* Else if the .htaccess file does not offer the required protection. */
287
- ws_plugin__s2member_display_admin_notice ("Unprotected. The .htaccess protection file ( <code>" . preg_replace ("/^" . preg_quote ($_SERVER["DOCUMENT_ROOT"], "/") . "/", "", $htaccess) . "</code> ) does not contain <code>deny from all</code>. Inside your .htaccess file, add this one line: <code>deny from all</code>.", true);
288
- /**/
289
- include_once dirname (dirname (__FILE__)) . "/menu-pages/down-ops.inc.php";
290
- /**/
291
- do_action ("s2member_after_down_ops_page", get_defined_vars ());
292
- /**/
293
- return;
 
 
 
294
  }
295
  /*
296
  Function for building and handling the API Tracking options page.
297
  */
298
- function ws_plugin__s2member_trk_ops_page ()
299
  {
300
- do_action ("s2member_before_trk_ops_page", get_defined_vars ());
301
- /**/
302
- ws_plugin__s2member_update_all_options ();
303
- /**/
304
- include_once dirname (dirname (__FILE__)) . "/menu-pages/trk-ops.inc.php";
305
- /**/
306
- do_action ("s2member_after_trk_ops_page", get_defined_vars ());
307
- /**/
308
- return;
 
 
 
309
  }
310
  /*
311
  Function for building and handling the API List Server options page.
312
  */
313
- function ws_plugin__s2member_els_ops_page ()
314
  {
315
- do_action ("s2member_before_els_ops_page", get_defined_vars ());
316
- /**/
317
- ws_plugin__s2member_update_all_options ();
318
- /**/
319
- include_once dirname (dirname (__FILE__)) . "/menu-pages/els-ops.inc.php";
320
- /**/
321
- do_action ("s2member_after_els_ops_page", get_defined_vars ());
322
- /**/
323
- return;
 
 
 
324
  }
325
  /*
326
  Function for building and handling the API Notifications page.
327
  */
328
- function ws_plugin__s2member_api_ops_page ()
329
  {
330
- do_action ("s2member_before_api_ops_page", get_defined_vars ());
331
- /**/
332
- ws_plugin__s2member_update_all_options ();
333
- /**/
334
- include_once dirname (dirname (__FILE__)) . "/menu-pages/api-ops.inc.php";
335
- /**/
336
- do_action ("s2member_after_api_ops_page", get_defined_vars ());
337
- /**/
338
- return;
 
 
 
339
  }
340
  /*
341
  Function for building the PayPal Button Generator page.
342
  */
343
- function ws_plugin__s2member_buttons_page ()
344
  {
345
- do_action ("s2member_before_buttons_page", get_defined_vars ());
346
- /**/
347
- include_once dirname (dirname (__FILE__)) . "/menu-pages/buttons.inc.php";
348
- /**/
349
- do_action ("s2member_after_buttons_page", get_defined_vars ());
350
- /**/
351
- return;
 
 
 
352
  }
353
  /*
354
  Function for building the API Scripting page.
355
  */
356
- function ws_plugin__s2member_scripting_page ()
357
  {
358
- do_action ("s2member_before_scripting_page", get_defined_vars ());
359
- /**/
360
- include_once dirname (dirname (__FILE__)) . "/menu-pages/scripting.inc.php";
361
- /**/
362
- do_action ("s2member_after_scripting_page", get_defined_vars ());
363
- /**/
364
- return;
 
 
 
365
  }
366
  /*
367
  Function for building the s2Member Info page.
368
  */
369
- function ws_plugin__s2member_info_page ()
370
  {
371
- do_action ("s2member_before_info_page", get_defined_vars ());
372
- /**/
373
- include_once dirname (dirname (__FILE__)) . "/menu-pages/info.inc.php";
374
- /**/
375
- do_action ("s2member_after_info_page", get_defined_vars ());
376
- /**/
377
- return;
 
 
 
378
  }
379
  /*
380
  Function for building and handling the Quick Start page.
381
  */
382
- function ws_plugin__s2member_start_page ()
383
  {
384
- do_action ("s2member_before_start_page", get_defined_vars ());
385
- /**/
386
- include_once dirname (dirname (__FILE__)) . "/menu-pages/start.inc.php";
387
- /**/
388
- do_action ("s2member_after_start_page", get_defined_vars ());
389
- /**/
390
- return;
 
 
 
391
  }
392
  ?>
16
  /*
17
  Function for saving all options from any page.
18
  */
19
+ if (!function_exists ("ws_plugin__s2member_update_all_options"))
20
  {
21
+ function ws_plugin__s2member_update_all_options ()
 
 
22
  {
23
+ do_action ("ws_plugin__s2member_before_update_all_options", get_defined_vars ());
24
  /**/
25
+ if (($nonce = $_POST["ws_plugin__s2member_options_save"]) && wp_verify_nonce ($nonce, "ws-plugin--s2member-options-save"))
26
  {
27
+ $options = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]; /* Get current options. */
28
+ /**/
29
+ foreach ($_POST as $key => $value) /* Go through each post variable and look for s2member. */
30
  {
31
+ if (preg_match ("/^" . preg_quote ("ws_plugin__s2member", "/") . "/", $key)) /* Look for keys. */
32
  {
33
+ if ($key === "ws_plugin__s2member_configured") /* This is a special configuration option. */
34
+ {
35
+ update_option ("ws_plugin__s2member_configured", trim (stripslashes ($value))); /* Update this option separately. */
36
+ /**/
37
+ $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["configured"] = trim (stripslashes ($value)); /* Update configuration on-the-fly. */
38
+ }
39
+ else /* We need to place this option into the array. Here we remove the ws_plugin__s2member_ portion on the beginning. */
40
+ {
41
+ (is_array ($value)) ? array_shift ($value) : null; /* Arrays should be padded, 1st key is removed. */
42
+ $options[preg_replace ("/^" . preg_quote ("ws_plugin__s2member_", "/") . "/", "", $key)] = $value;
43
+ }
44
  }
45
  }
46
+ /**/
47
+ $options["options_version"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["options_version"] + 0.001; /* Increment options version. */
48
+ /**/
49
+ $options = ws_plugin__s2member_configure_options_and_their_defaults ($options); /* Also updates the global options array. */
50
+ /**/
51
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
52
+ do_action ("ws_plugin__s2member_during_update_all_options", get_defined_vars ());
53
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
54
+ /**/
55
+ update_option ("ws_plugin__s2member_options", $options) . update_option ("ws_plugin__s2member_cache", array ());
56
+ /**/
57
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["auto_eot_system_enabled"] == 1)
58
+ ws_plugin__s2member_add_auto_eot_system (); /* 1 == WP-Cron. */
59
+ else /* Otherwise, the Auto-EOT System via WP-Cron is disabled. */
60
+ ws_plugin__s2member_delete_auto_eot_system ();
61
+ /**/
62
+ ws_plugin__s2member_display_admin_notice ('<strong>Options saved.</strong>');
63
  }
64
  /**/
65
+ do_action ("ws_plugin__s2member_after_update_all_options", get_defined_vars ());
 
 
 
 
66
  /**/
67
+ return;
 
 
 
 
 
 
 
68
  }
 
 
 
 
69
  }
70
  /*
71
  Add the options menus & sub-menus.
72
  Attach to: add_action("admin_menu");
73
  */
74
+ 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");
95
+ /**/
96
+ if (apply_filters ("ws_plugin__s2member_during_add_admin_options_add_trk_ops_page", true, get_defined_vars ()))
97
+ add_submenu_page ("ws-plugin--s2member-options", "s2Member API / Tracking", "API / Tracking", "edit_plugins", "ws-plugin--s2member-trk-ops", "ws_plugin__s2member_trk_ops_page");
98
+ /**/
99
+ if (apply_filters ("ws_plugin__s2member_during_add_admin_options_add_els_ops_page", true, get_defined_vars ()))
100
+ add_submenu_page ("ws-plugin--s2member-options", "s2Member API / List Servers", "API / List Servers", "edit_plugins", "ws-plugin--s2member-els-ops", "ws_plugin__s2member_els_ops_page");
101
+ /**/
102
+ if (apply_filters ("ws_plugin__s2member_during_add_admin_options_add_api_ops_page", true, get_defined_vars ()))
103
+ add_submenu_page ("ws-plugin--s2member-options", "s2Member API / Notifications", "API / Notifications", "edit_plugins", "ws-plugin--s2member-api-ops", "ws_plugin__s2member_api_ops_page");
104
+ /**/
105
+ if (apply_filters ("ws_plugin__s2member_during_add_admin_options_add_scripting_page", true, get_defined_vars ()))
106
+ add_submenu_page ("ws-plugin--s2member-options", "s2Member API / Scripting", "API / Scripting", "edit_plugins", "ws-plugin--s2member-scripting", "ws_plugin__s2member_scripting_page");
107
+ /**/
108
+ if (apply_filters ("ws_plugin__s2member_during_add_admin_options_add_info_page", true, get_defined_vars ()))
109
+ add_submenu_page ("ws-plugin--s2member-options", "s2Member Information", "s2Member Info", "edit_plugins", "ws-plugin--s2member-info", "ws_plugin__s2member_info_page");
110
+ /**/
111
+ if (apply_filters ("ws_plugin__s2member_during_add_admin_options_add_start_page", true, get_defined_vars ()))
112
+ add_submenu_page ("ws-plugin--s2member-options", "s2Member Quick Start Guide", "Quick Start Guide", "edit_plugins", "ws-plugin--s2member-start", "ws_plugin__s2member_start_page");
113
+ }
114
+ /**/
115
+ do_action ("ws_plugin__s2member_after_add_admin_options", get_defined_vars ());
116
+ /**/
117
+ return;
118
+ }
119
  }
120
  /*
121
  A sort of callback function to add the settings link.
122
  */
123
+ if (!function_exists ("_ws_plugin__s2member_add_settings_link"))
124
  {
125
+ function _ws_plugin__s2member_add_settings_link ($links = array (), $file = "")
 
 
126
  {
127
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
128
+ do_action ("_ws_plugin__s2member_before_add_settings_link", get_defined_vars ());
129
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
130
  /**/
131
+ if (preg_match ("/" . preg_quote ($file, "/") . "$/", $GLOBALS["WS_PLUGIN__"]["s2member"]["l"]) && is_array ($links))
132
+ {
133
+ $settings = '<a href="admin.php?page=ws-plugin--s2member-options">Settings</a>';
134
+ array_unshift ($links, apply_filters ("ws_plugin__s2member_add_settings_link", $settings, get_defined_vars ()));
135
+ /**/
136
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
137
+ do_action ("_ws_plugin__s2member_during_add_settings_link", get_defined_vars ());
138
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
139
+ }
140
+ /**/
141
+ return apply_filters ("_ws_plugin__s2member_add_settings_link", $links, get_defined_vars ());
142
  }
 
 
143
  }
144
  /*
145
  Add scripts to admin panels.
146
  Attach to: add_action("admin_print_scripts");
147
  */
148
+ if (!function_exists ("ws_plugin__s2member_add_admin_scripts"))
149
  {
150
+ function ws_plugin__s2member_add_admin_scripts ()
 
 
151
  {
152
+ do_action ("ws_plugin__s2member_before_add_admin_scripts", get_defined_vars ());
153
+ /**/
154
+ if ($_GET["page"] && preg_match ("/ws-plugin--s2member-/", $_GET["page"]))
155
+ {
156
+ wp_enqueue_script ("jquery");
157
+ wp_enqueue_script ("thickbox");
158
+ wp_enqueue_script ("media-upload");
159
+ wp_enqueue_script ("ws-plugin--s2member-menu-pages", get_bloginfo ("url") . "/?ws_plugin__s2member_menu_pages_js=1", array ("jquery", "thickbox", "media-upload"), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["options_version"] . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["filemtime"]);
160
+ /**/
161
+ do_action ("ws_plugin__s2member_during_add_admin_scripts", get_defined_vars ());
162
+ }
163
+ /**/
164
+ do_action ("ws_plugin__s2member_after_add_admin_scripts", get_defined_vars ());
165
  /**/
166
+ return;
167
  }
 
 
 
 
168
  }
169
  /*
170
  Add styles to admin panels.
171
  Attach to: add_action("admin_print_styles");
172
  */
173
+ if (!function_exists ("ws_plugin__s2member_add_admin_styles"))
174
  {
175
+ function ws_plugin__s2member_add_admin_styles ()
 
 
176
  {
177
+ do_action ("ws_plugin__s2member_before_add_admin_styles", get_defined_vars ());
 
178
  /**/
179
+ if ($_GET["page"] && preg_match ("/ws-plugin--s2member-/", $_GET["page"]))
180
+ {
181
+ wp_enqueue_style ("thickbox");
182
+ wp_enqueue_style ("ws-plugin--s2member-menu-pages", get_bloginfo ("url") . "/?ws_plugin__s2member_menu_pages_css=1", array ("thickbox"), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["options_version"] . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["filemtime"], "all");
183
+ /**/
184
+ do_action ("ws_plugin__s2member_during_add_admin_styles", get_defined_vars ());
185
+ }
186
+ /**/
187
+ do_action ("ws_plugin__s2member_after_add_admin_styles", get_defined_vars ());
188
+ /**/
189
+ return;
190
  }
 
 
 
 
191
  }
192
  /*
193
  Function that outputs the JS for menu pages.
194
  Attach to: add_action("init");
195
  */
196
+ if (!function_exists ("ws_plugin__s2member_menu_pages_js"))
197
  {
198
+ function ws_plugin__s2member_menu_pages_js ()
 
 
199
  {
200
+ do_action ("ws_plugin__s2member_before_menu_pages_js", get_defined_vars ());
 
 
 
 
 
 
 
 
 
201
  /**/
202
+ if ($_GET["ws_plugin__s2member_menu_pages_js"] && is_user_logged_in () && current_user_can ("edit_plugins"))
203
+ {
204
+ header ("Content-Type: text/javascript; charset=utf-8");
205
+ header ("Expires: " . gmdate ("D, d M Y H:i:s", strtotime ("-1 week")) . " GMT");
206
+ header ("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
207
+ header ("Cache-Control: no-cache, must-revalidate, max-age=0");
208
+ header ("Pragma: no-cache");
209
+ /**/
210
+ $u = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"];
211
+ $i = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images";
212
+ /**/
213
+ include_once dirname (dirname (__FILE__)) . "/menu-pages/menu-pages.js";
214
+ @include_once dirname (dirname (__FILE__)) . "/menu-pages/menu-pages-s.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 ());
222
  }
 
 
223
  }
224
  /*
225
  Function that outputs the CSS for menu pages.
226
  Attach to: add_action("init");
227
  */
228
+ if (!function_exists ("ws_plugin__s2member_menu_pages_css"))
229
  {
230
+ function ws_plugin__s2member_menu_pages_css ()
 
 
231
  {
232
+ do_action ("ws_plugin__s2member_before_menu_pages_css", get_defined_vars ());
 
 
 
 
 
 
 
 
 
233
  /**/
234
+ if ($_GET["ws_plugin__s2member_menu_pages_css"] && is_user_logged_in () && current_user_can ("edit_plugins"))
235
+ {
236
+ header ("Content-Type: text/css; charset=utf-8");
237
+ header ("Expires: " . gmdate ("D, d M Y H:i:s", strtotime ("-1 week")) . " GMT");
238
+ header ("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
239
+ header ("Cache-Control: no-cache, must-revalidate, max-age=0");
240
+ header ("Pragma: no-cache");
241
+ /**/
242
+ $u = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"];
243
+ $i = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images";
244
+ /**/
245
+ include_once dirname (dirname (__FILE__)) . "/menu-pages/menu-pages.css";
246
+ @include_once dirname (dirname (__FILE__)) . "/menu-pages/menu-pages-s.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 ());
254
  }
 
 
255
  }
256
  /*
257
  Function for building and handling the General Options page.
258
  */
259
+ if (!function_exists ("ws_plugin__s2member_options_page"))
260
  {
261
+ function ws_plugin__s2member_options_page ()
262
+ {
263
+ do_action ("ws_plugin__s2member_before_options_page", get_defined_vars ());
264
+ /**/
265
+ ws_plugin__s2member_update_all_options ();
266
+ /**/
267
+ include_once dirname (dirname (__FILE__)) . "/menu-pages/options.inc.php";
268
+ /**/
269
+ do_action ("ws_plugin__s2member_after_options_page", get_defined_vars ());
270
+ /**/
271
+ return;
272
+ }
273
  }
274
  /*
275
  Function for building and handling the Paypal Options page.
276
  */
277
+ if (!function_exists ("ws_plugin__s2member_paypal_ops_page"))
278
  {
279
+ function ws_plugin__s2member_paypal_ops_page ()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
280
  {
281
+ do_action ("ws_plugin__s2member_before_paypal_ops_page", get_defined_vars ());
 
282
  /**/
283
+ ws_plugin__s2member_update_all_options ();
 
284
  /**/
285
+ $logs_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"];
 
286
  /**/
287
+ if (!is_dir ($logs_dir) && is_writable (dirname ($logs_dir)))
288
+ mkdir ($logs_dir, 0777) . clearstatcache ();
289
+ /**/
290
+ $htaccess = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"] . "/.htaccess";
291
+ /**/
292
+ if (is_dir ($logs_dir) && is_writable ($logs_dir) && !file_exists ($htaccess))
293
+ file_put_contents ($htaccess, "deny from all") . clearstatcache ();
294
+ /**/
295
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_debug"]) /* If logging is enabled. */
296
+ {
297
+ if (!is_dir ($logs_dir)) /* If the security-enabled logs directory does not exist yet. */
298
+ ws_plugin__s2member_display_admin_notice ("The security-enabled logs directory ( <code>" . preg_replace ("/^" . preg_quote ($_SERVER["DOCUMENT_ROOT"], "/") . "/", "", $logs_dir) . "</code> ) does not exist. Please create this directory manually &amp; make it writable ( chmod 777 ).", true);
299
+ /**/
300
+ else if (!is_writable ($logs_dir)) /* If the logs directory is not writable yet. */
301
+ ws_plugin__s2member_display_admin_notice ("Permissions error. The security-enabled logs directory ( <code>" . preg_replace ("/^" . preg_quote ($_SERVER["DOCUMENT_ROOT"], "/") . "/", "", $logs_dir) . "</code> ) is not writable. Please make this directory writable ( chmod 777 ).", true);
302
+ /**/
303
+ if (!file_exists ($htaccess)) /* If the .htaccess file has not been created yet. */
304
+ ws_plugin__s2member_display_admin_notice ("The .htaccess protection file ( <code>" . preg_replace ("/^" . preg_quote ($_SERVER["DOCUMENT_ROOT"], "/") . "/", "", $htaccess) . "</code> ) does not exist. Please create this file manually. Inside your .htaccess file, add this one line: <code>deny from all</code>.", true);
305
+ /**/
306
+ else if (!preg_match ("/deny from all/i", file_get_contents ($htaccess))) /* Else if the .htaccess file does not offer the required protection. */
307
+ ws_plugin__s2member_display_admin_notice ("Unprotected. The .htaccess protection file ( <code>" . preg_replace ("/^" . preg_quote ($_SERVER["DOCUMENT_ROOT"], "/") . "/", "", $htaccess) . "</code> ) does not contain <code>deny from all</code>. Inside your .htaccess file, add this one line: <code>deny from all</code>.", true);
308
+ }
309
+ /**/
310
+ include_once dirname (dirname (__FILE__)) . "/menu-pages/paypal-ops.inc.php";
311
+ /**/
312
+ do_action ("ws_plugin__s2member_after_paypal_ops_page", get_defined_vars ());
313
+ /**/
314
+ return;
315
  }
 
 
 
 
 
 
316
  }
317
  /*
318
  Function for building and handling the Download Options page.
319
  */
320
+ if (!function_exists ("ws_plugin__s2member_down_ops_page"))
321
  {
322
+ function ws_plugin__s2member_down_ops_page ()
323
+ {
324
+ do_action ("ws_plugin__s2member_before_down_ops_page", get_defined_vars ());
325
+ /**/
326
+ ws_plugin__s2member_update_all_options ();
327
+ /**/
328
+ $files_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"];
329
+ /**/
330
+ if (!is_dir ($files_dir) && is_writable (dirname ($files_dir)))
331
+ mkdir ($files_dir, 0777) . clearstatcache ();
332
+ /**/
333
+ $htaccess = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"] . "/.htaccess";
334
+ /**/
335
+ if (is_dir ($files_dir) && is_writable ($files_dir) && !file_exists ($htaccess))
336
+ file_put_contents ($htaccess, "deny from all") . clearstatcache ();
337
+ /**/
338
+ if (!is_dir ($files_dir)) /* If the security-enabled files directory does not exist yet. */
339
+ ws_plugin__s2member_display_admin_notice ("The security-enabled files directory ( <code>" . preg_replace ("/^" . preg_quote ($_SERVER["DOCUMENT_ROOT"], "/") . "/", "", $files_dir) . "</code> ) does not exist. Please create this directory manually.", true);
340
+ /**/
341
+ if (!file_exists ($htaccess)) /* If the .htaccess file has not been created yet. */
342
+ ws_plugin__s2member_display_admin_notice ("The .htaccess protection file ( <code>" . preg_replace ("/^" . preg_quote ($_SERVER["DOCUMENT_ROOT"], "/") . "/", "", $htaccess) . "</code> ) does not exist. Please create this file manually. Inside your .htaccess file, add this one line: <code>deny from all</code>.", true);
343
+ /**/
344
+ else if (!preg_match ("/deny from all/i", file_get_contents ($htaccess))) /* Else if the .htaccess file does not offer the required protection. */
345
+ ws_plugin__s2member_display_admin_notice ("Unprotected. The .htaccess protection file ( <code>" . preg_replace ("/^" . preg_quote ($_SERVER["DOCUMENT_ROOT"], "/") . "/", "", $htaccess) . "</code> ) does not contain <code>deny from all</code>. Inside your .htaccess file, add this one line: <code>deny from all</code>.", true);
346
+ /**/
347
+ include_once dirname (dirname (__FILE__)) . "/menu-pages/down-ops.inc.php";
348
+ /**/
349
+ do_action ("ws_plugin__s2member_after_down_ops_page", get_defined_vars ());
350
+ /**/
351
+ return;
352
+ }
353
  }
354
  /*
355
  Function for building and handling the API Tracking options page.
356
  */
357
+ if (!function_exists ("ws_plugin__s2member_trk_ops_page"))
358
  {
359
+ function ws_plugin__s2member_trk_ops_page ()
360
+ {
361
+ do_action ("ws_plugin__s2member_before_trk_ops_page", get_defined_vars ());
362
+ /**/
363
+ ws_plugin__s2member_update_all_options ();
364
+ /**/
365
+ include_once dirname (dirname (__FILE__)) . "/menu-pages/trk-ops.inc.php";
366
+ /**/
367
+ do_action ("ws_plugin__s2member_after_trk_ops_page", get_defined_vars ());
368
+ /**/
369
+ return;
370
+ }
371
  }
372
  /*
373
  Function for building and handling the API List Server options page.
374
  */
375
+ if (!function_exists ("ws_plugin__s2member_els_ops_page"))
376
  {
377
+ function ws_plugin__s2member_els_ops_page ()
378
+ {
379
+ do_action ("ws_plugin__s2member_before_els_ops_page", get_defined_vars ());
380
+ /**/
381
+ ws_plugin__s2member_update_all_options ();
382
+ /**/
383
+ include_once dirname (dirname (__FILE__)) . "/menu-pages/els-ops.inc.php";
384
+ /**/
385
+ do_action ("ws_plugin__s2member_after_els_ops_page", get_defined_vars ());
386
+ /**/
387
+ return;
388
+ }
389
  }
390
  /*
391
  Function for building and handling the API Notifications page.
392
  */
393
+ if (!function_exists ("ws_plugin__s2member_api_ops_page"))
394
  {
395
+ function ws_plugin__s2member_api_ops_page ()
396
+ {
397
+ do_action ("ws_plugin__s2member_before_api_ops_page", get_defined_vars ());
398
+ /**/
399
+ ws_plugin__s2member_update_all_options ();
400
+ /**/
401
+ include_once dirname (dirname (__FILE__)) . "/menu-pages/api-ops.inc.php";
402
+ /**/
403
+ do_action ("ws_plugin__s2member_after_api_ops_page", get_defined_vars ());
404
+ /**/
405
+ return;
406
+ }
407
  }
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
+ }
423
  }
424
  /*
425
  Function for building the API Scripting page.
426
  */
427
+ if (!function_exists ("ws_plugin__s2member_scripting_page"))
428
  {
429
+ function ws_plugin__s2member_scripting_page ()
430
+ {
431
+ do_action ("ws_plugin__s2member_before_scripting_page", get_defined_vars ());
432
+ /**/
433
+ include_once dirname (dirname (__FILE__)) . "/menu-pages/scripting.inc.php";
434
+ /**/
435
+ do_action ("ws_plugin__s2member_after_scripting_page", get_defined_vars ());
436
+ /**/
437
+ return;
438
+ }
439
  }
440
  /*
441
  Function for building the s2Member Info page.
442
  */
443
+ if (!function_exists ("ws_plugin__s2member_info_page"))
444
  {
445
+ function ws_plugin__s2member_info_page ()
446
+ {
447
+ do_action ("ws_plugin__s2member_before_info_page", get_defined_vars ());
448
+ /**/
449
+ include_once dirname (dirname (__FILE__)) . "/menu-pages/info.inc.php";
450
+ /**/
451
+ do_action ("ws_plugin__s2member_after_info_page", get_defined_vars ());
452
+ /**/
453
+ return;
454
+ }
455
  }
456
  /*
457
  Function for building and handling the Quick Start page.
458
  */
459
+ if (!function_exists ("ws_plugin__s2member_start_page"))
460
  {
461
+ function ws_plugin__s2member_start_page ()
462
+ {
463
+ do_action ("ws_plugin__s2member_before_start_page", get_defined_vars ());
464
+ /**/
465
+ include_once dirname (dirname (__FILE__)) . "/menu-pages/start.inc.php";
466
+ /**/
467
+ do_action ("ws_plugin__s2member_after_start_page", get_defined_vars ());
468
+ /**/
469
+ return;
470
+ }
471
  }
472
  ?>
includes/functions/nocache.inc.php CHANGED
@@ -18,15 +18,18 @@ Handles no-cache headers and compatible constants for s2Member.
18
  This is compatible with Quick Cache and also with WP Super Cache.
19
  Attach to: add_action("init");
20
  */
21
- function ws_plugin__s2member_nocache ()
22
  {
23
- do_action ("s2member_before_nocache", get_defined_vars ());
24
- /**/
25
- ws_plugin__s2member_nocache_constants () . ws_plugin__s2member_nocache_headers ();
26
- /**/
27
- do_action ("s2member_after_nocache", get_defined_vars ());
28
- /**/
29
- return;
 
 
 
30
  }
31
  /*
32
  Define compatible nocache constants for s2Member.
@@ -52,20 +55,25 @@ These additional supplemental routines, include:
52
  - ws_plugin__s2member_check_page_level_access()
53
  - ws_plugin__s2member_ip_restrictions_ok()
54
  */
55
- function ws_plugin__s2member_nocache_constants ($nocache = FALSE) /* Always obey the Quick Cache plugin. */
56
  {
57
- do_action ("s2member_before_nocache_constants", get_defined_vars ());
58
- /**/
59
- if (!$_GET["qcAC"] && ($nocache || is_user_logged_in () || (preg_match ("/^s2member/", $_SERVER["QUERY_STRING"]) && ($_SERVER["REQUEST_URI"] === "/" || strtolower (rtrim (get_bloginfo ("url"), "/")) === rtrim (strtolower ("http://" . $_SERVER["HTTP_HOST"]) . $_SERVER["REQUEST_URI"], "/")))))
60
  {
61
- define ("QUICK_CACHE_ALLOWED", false) . define ("DONOTCACHEPAGE", true);
 
 
 
 
 
 
 
 
 
62
  /**/
63
- do_action ("s2member_during_nocache_constants", get_defined_vars ());
 
 
64
  }
65
- /**/
66
- do_action ("s2member_after_nocache_constants", get_defined_vars ());
67
- /**/
68
- return;
69
  }
70
  /*
71
  Sends Cache-Control ( no-cache ) headers.
@@ -73,25 +81,28 @@ This uses the nocache_headers() function provided by WordPress®.
73
  This is compatible with the Quick Cache parameter ?qcABC=1 as well.
74
  * Always obey the qcABC param that specifically allows browser caching.
75
  */
76
- function ws_plugin__s2member_nocache_headers () /* Cache-Control header. */
77
  {
78
- do_action ("s2member_before_nocache_headers", get_defined_vars ());
79
- /**/
80
- if (!$_GET["qcABC"]) /* Always obey the Quick Cache plugin. */
81
  {
82
- if (is_array ($headers = headers_list ()))
83
- foreach ($headers as $k => $header)
84
- if (preg_match ("/no-cache/i", $header))
85
- $no_cache_already_sent = true;
 
 
 
 
 
 
 
 
 
 
86
  /**/
87
- if (!$no_cache_already_sent)
88
- nocache_headers ();
89
  /**/
90
- do_action ("s2member_during_nocache_headers", get_defined_vars ());
91
  }
92
- /**/
93
- do_action ("s2member_after_nocache_headers", get_defined_vars ());
94
- /**/
95
- return;
96
  }
97
  ?>
18
  This is compatible with Quick Cache and also with WP Super Cache.
19
  Attach to: add_action("init");
20
  */
21
+ if (!function_exists ("ws_plugin__s2member_nocache"))
22
  {
23
+ function ws_plugin__s2member_nocache ()
24
+ {
25
+ do_action ("ws_plugin__s2member_before_nocache", get_defined_vars ());
26
+ /**/
27
+ ws_plugin__s2member_nocache_constants () . ws_plugin__s2member_nocache_headers ();
28
+ /**/
29
+ do_action ("ws_plugin__s2member_after_nocache", get_defined_vars ());
30
+ /**/
31
+ return;
32
+ }
33
  }
34
  /*
35
  Define compatible nocache constants for s2Member.
55
  - ws_plugin__s2member_check_page_level_access()
56
  - ws_plugin__s2member_ip_restrictions_ok()
57
  */
58
+ if (!function_exists ("ws_plugin__s2member_nocache_constants"))
59
  {
60
+ function ws_plugin__s2member_nocache_constants ($nocache = FALSE)
 
 
61
  {
62
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
63
+ do_action ("ws_plugin__s2member_before_nocache_constants", get_defined_vars ());
64
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
65
+ /**/
66
+ if (!$_GET["qcAC"] && ($nocache || is_user_logged_in () || (preg_match ("/^s2member/", $_SERVER["QUERY_STRING"]) && ($_SERVER["REQUEST_URI"] === "/" || strtolower (rtrim (get_bloginfo ("url"), "/")) === rtrim (strtolower ("http://" . $_SERVER["HTTP_HOST"]) . $_SERVER["REQUEST_URI"], "/")))))
67
+ {
68
+ define ("QUICK_CACHE_ALLOWED", false) . define ("DONOTCACHEPAGE", true);
69
+ /**/
70
+ do_action ("ws_plugin__s2member_during_nocache_constants", get_defined_vars ());
71
+ }
72
  /**/
73
+ do_action ("ws_plugin__s2member_after_nocache_constants", get_defined_vars ());
74
+ /**/
75
+ return;
76
  }
 
 
 
 
77
  }
78
  /*
79
  Sends Cache-Control ( no-cache ) headers.
81
  This is compatible with the Quick Cache parameter ?qcABC=1 as well.
82
  * Always obey the qcABC param that specifically allows browser caching.
83
  */
84
+ if (!function_exists ("ws_plugin__s2member_nocache_headers"))
85
  {
86
+ function ws_plugin__s2member_nocache_headers () /* Cache-Control header. */
 
 
87
  {
88
+ do_action ("ws_plugin__s2member_before_nocache_headers", get_defined_vars ());
89
+ /**/
90
+ if (!$_GET["qcABC"]) /* Always obey the Quick Cache plugin. */
91
+ {
92
+ if (is_array ($headers = headers_list ()))
93
+ foreach ($headers as $k => $header)
94
+ if (preg_match ("/no-cache/i", $header))
95
+ $no_cache_already_sent = true;
96
+ /**/
97
+ if (!$no_cache_already_sent)
98
+ nocache_headers ();
99
+ /**/
100
+ do_action ("ws_plugin__s2member_during_nocache_headers", get_defined_vars ());
101
+ }
102
  /**/
103
+ do_action ("ws_plugin__s2member_after_nocache_headers", get_defined_vars ());
 
104
  /**/
105
+ return;
106
  }
 
 
 
 
107
  }
108
  ?>
includes/functions/page-level-access.inc.php CHANGED
@@ -17,56 +17,59 @@ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
17
  Function for handling Page Level Access permissions.
18
  Attach to: add_action("template_redirect");
19
  */
20
- function ws_plugin__s2member_check_page_level_access ()
21
  {
22
- global $post; /* get_the_ID() not yet available here. */
23
- /**/
24
- do_action ("s2member_before_check_page_level_access", get_defined_vars ());
25
- /**/
26
- $excluded = apply_filters ("s2member_check_page_level_access_excluded", false, get_defined_vars ());
27
- /**/
28
- if (!$excluded && is_page () && is_object ($post) && ($page_ID = $post->ID))
29
  {
30
- $current_user = (is_user_logged_in ()) ? wp_get_current_user () : false;
31
  /**/
32
- 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")
33
- exit;
34
  /**/
35
- 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")
36
- exit;
37
  /**/
38
- 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")
39
- exit;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  /**/
41
- 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")
42
- exit;
43
  /**/
44
- 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")
45
- exit;
46
- /**/
47
- 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")
48
- exit;
49
- /**/
50
- 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")
51
- exit;
52
- /**/
53
- 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")
54
- exit;
55
- /**/
56
- 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")
57
- exit;
58
- /**/
59
- 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")
60
- exit;
61
- /**/
62
- 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")
63
- exit;
64
- /**/
65
- do_action ("s2member_during_check_page_level_access", get_defined_vars ());
66
  }
67
- /**/
68
- do_action ("s2member_after_check_page_level_access", get_defined_vars ());
69
- /**/
70
- return;
71
  }
72
  ?>
17
  Function for handling Page Level Access permissions.
18
  Attach to: add_action("template_redirect");
19
  */
20
+ if (!function_exists ("ws_plugin__s2member_check_page_level_access"))
21
  {
22
+ function ws_plugin__s2member_check_page_level_access ()
 
 
 
 
 
 
23
  {
24
+ global $post; /* get_the_ID() not yet available here. */
25
  /**/
26
+ do_action ("ws_plugin__s2member_before_check_page_level_access", get_defined_vars ());
 
27
  /**/
28
+ $excluded = apply_filters ("ws_plugin__s2member_check_page_level_access_excluded", false, get_defined_vars ());
 
29
  /**/
30
+ if (!$excluded && is_page () && is_object ($post) && ($page_ID = $post->ID))
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
+ }
69
  /**/
70
+ do_action ("ws_plugin__s2member_after_check_page_level_access", get_defined_vars ());
 
71
  /**/
72
+ return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  }
 
 
 
 
74
  }
75
  ?>
includes/functions/paypal-notify.inc.php CHANGED
@@ -17,223 +17,69 @@ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
17
  Handles PayPal® IPN URL processing.
18
  Attach to: add_action("init");
19
  */
20
- function ws_plugin__s2member_paypal_notify ()
21
  {
22
- do_action ("s2member_before_paypal_notify", get_defined_vars ());
23
- /**/
24
- include_once ABSPATH . "wp-admin/includes/admin.php"; /* Get Admin APIs. */
25
- /**/
26
- if ($_GET["s2member_paypal_notify"] && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"])
27
  {
28
- if (is_array ($paypal = ws_plugin__s2member_paypal_postvars ())) /* Verify PayPal® POST vars. */
 
 
 
 
29
  {
30
- $paypal["s2member_log"][] = "IPN received on: " . date ("D M j, Y g:i:s a T");
31
- $paypal["s2member_log"][] = "s2Member POST vars verified through a POST back to PayPal®.";
32
- /**/
33
- $paypal["custom"] = (!$paypal["custom"]) ? ws_plugin__s2member_paypal_custom ($paypal["recurring_payment_id"]) : $paypal["custom"];
34
- /* Notifications following the PayPal® Pro format for recurring payments, do NOT carry the "custom" value, so we do a lookup.
35
- This is only crucial for one IPN call in Standard Integration: `txn_type=recurring_payment_suspended_due_to_max_failed_payment`.
36
- In Pro Integrations, we just need to make sure the "custom" field is assigned for each account during on-site checkout.
37
- This way the "custom" value will always be available when it needs to be; for both Standard and Pro services. */
38
- if (preg_match ("/^" . preg_quote ($_SERVER["HTTP_HOST"], "/") . "/i", $paypal["custom"])) /* Matches originating host? */
39
- { /* The business address validation was removed from this routine, because PayPal® always fills that with the primary
40
- email address. In cases where an alternate PayPal® address is being paid, validation was not possible. */
41
- $paypal["s2member_log"][] = "s2Member originating domain ( _SERVER[HTTP_HOST] ) validated.";
42
- /*
43
- Specific Post/Page Access.
44
- */
45
- 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"]))
46
- {
47
- do_action ("s2member_during_paypal_notify_before_sp_access", get_defined_vars ());
48
- /**/
49
- $paypal["s2member_log"][] = "s2Member txn_type identified as (web_accept) for Specific Post/Page Access.";
50
- /**/
51
- list (, $paypal["sp_ids"], $paypal["hours"]) = preg_split ("/\:/", $paypal["item_number"], 3);
52
- /**/
53
- if (($sp_access_url = ws_plugin__s2member_sp_access_link_gen ($paypal["sp_ids"], $paypal["hours"])) && is_array ($cv = preg_split ("/\|/", $paypal["custom"])))
54
- {
55
- $processing = $during = true; /* Yes, we ARE processing this. */
56
- /**/
57
- $sbj = preg_replace ("/%%sp_access_url%%/i", $sp_access_url, $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_email_subject"]);
58
- $sbj = preg_replace ("/%%sp_access_exp%%/i", ws_plugin__s2member_approx_time_difference (time (), strtotime ("+" . $paypal["hours"] . " hours")), $sbj);
59
- /**/
60
- $msg = preg_replace ("/%%sp_access_url%%/i", $sp_access_url, $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_email_message"]);
61
- $msg = preg_replace ("/%%sp_access_exp%%/i", ws_plugin__s2member_approx_time_difference (time (), strtotime ("+" . $paypal["hours"] . " hours")), $msg);
62
- /**/
63
- if (($sbj = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $sbj)) && ($sbj = preg_replace ("/%%txn_id%%/i", $paypal["txn_id"], $sbj)))
64
- if (($sbj = preg_replace ("/%%amount%%/i", $paypal["mc_gross"], $sbj))) /* Full amount of the payment, before fee is subtracted. */
65
- if (($sbj = preg_replace ("/%%item_number%%/i", $paypal["item_number"], $sbj)) && ($sbj = preg_replace ("/%%item_name%%/i", $paypal["item_name"], $sbj)))
66
- if (($sbj = preg_replace ("/%%first_name%%/i", $paypal["first_name"], $sbj)) && ($sbj = preg_replace ("/%%last_name%%/i", $paypal["last_name"], $sbj)))
67
- if (($sbj = preg_replace ("/%%full_name%%/i", trim ($paypal["first_name"] . " " . $paypal["last_name"]), $sbj)))
68
- if (($sbj = preg_replace ("/%%payer_email%%/i", $paypal["payer_email"], $sbj)))
69
- /**/
70
- if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $msg)) && ($msg = preg_replace ("/%%txn_id%%/i", $paypal["txn_id"], $msg)))
71
- if (($msg = preg_replace ("/%%amount%%/i", $paypal["mc_gross"], $msg))) /* Full amount of the payment, before fee is subtracted. */
72
- if (($msg = preg_replace ("/%%item_number%%/i", $paypal["item_number"], $msg)) && ($msg = preg_replace ("/%%item_name%%/i", $paypal["item_name"], $msg)))
73
- if (($msg = preg_replace ("/%%first_name%%/i", $paypal["first_name"], $msg)) && ($msg = preg_replace ("/%%last_name%%/i", $paypal["last_name"], $msg)))
74
- if (($msg = preg_replace ("/%%full_name%%/i", trim ($paypal["first_name"] . " " . $paypal["last_name"]), $msg)))
75
- if (($msg = preg_replace ("/%%payer_email%%/i", $paypal["payer_email"], $msg)))
76
- /**/
77
- if (($sbj = trim ($sbj)) && ($msg = trim ($msg))) /* Make sure they are not empty. */
78
- {
79
- @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");
80
- /**/
81
- $paypal["s2member_log"][] = "Specific Post/Page Confirmation Email sent to Customer, with a URL that provides Specific Post/Page Access.";
82
- }
83
- /**/
84
- if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_notification_urls"])
85
- {
86
- foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_notification_urls"]) as $url)
87
- /**/
88
- 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)))
89
- if (($url = preg_replace ("/%%sp_access_exp%%/i", urlencode (ws_plugin__s2member_approx_time_difference (time (), strtotime ("+" . $paypal["hours"] . " hours"))), $url)))
90
- if (($url = preg_replace ("/%%amount%%/i", urlencode ($paypal["mc_gross"]), $url)) && ($url = preg_replace ("/%%txn_id%%/i", urlencode ($paypal["txn_id"]), $url)))
91
- if (($url = preg_replace ("/%%item_number%%/i", urlencode ($paypal["item_number"]), $url)) && ($url = preg_replace ("/%%item_name%%/i", urlencode ($paypal["item_name"]), $url)))
92
- if (($url = preg_replace ("/%%first_name%%/i", urlencode ($paypal["first_name"]), $url)) && ($url = preg_replace ("/%%last_name%%/i", urlencode ($paypal["last_name"]), $url)))
93
- if (($url = preg_replace ("/%%full_name%%/i", urlencode (trim ($paypal["first_name"] . " " . $paypal["last_name"])), $url)))
94
- if (($url = preg_replace ("/%%payer_email%%/i", urlencode ($paypal["payer_email"]), $url)))
95
- /**/
96
- if (($url = trim ($url))) /* Empty? */
97
- ws_plugin__s2member_remote ($url);
98
- /**/
99
- $paypal["s2member_log"][] = "Specific Post/Page Access Notification URLs have been processed.";
100
- }
101
- /**/
102
- if ($processing && ($code = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_tracking_codes"]))
103
- {
104
- 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)))
105
- if (($code = preg_replace ("/%%item_number%%/i", $paypal["item_number"], $code)) && ($code = preg_replace ("/%%item_name%%/i", $paypal["item_name"], $code)))
106
- if (($code = preg_replace ("/%%first_name%%/i", $paypal["first_name"], $code)) && ($code = preg_replace ("/%%last_name%%/i", $paypal["last_name"], $code)))
107
- if (($code = preg_replace ("/%%full_name%%/i", trim ($paypal["first_name"] . " " . $paypal["last_name"]), $code)))
108
- if (($code = preg_replace ("/%%payer_email%%/i", $paypal["payer_email"], $code)))
109
- /**/
110
- if (($code = trim ($code))) /* Make sure it is not empty. This gets stored into a Transient Queue. */
111
- {
112
- $paypal["s2member_log"][] = "Storing Specific Post/Page Tracking Codes into a Transient Queue for s2Member. These will be processed on-site.";
113
- set_transient (md5 ("s2member_transient_sp_tracking_codes_" . $paypal["txn_id"]), $code, 43200);
114
- }
115
- }
116
- /**/
117
- do_action ("s2member_during_paypal_notify_during_sp_access", get_defined_vars ());
118
- }
119
- else
120
- {
121
- $paypal["s2member_log"][] = "Unable to generate Access Link for Specific Post/Page Access. Does your Leading Post/Page still exist?";
122
- }
123
- /**/
124
- do_action ("s2member_during_paypal_notify_after_sp_access", get_defined_vars ());
125
- }
126
- /*
127
- New Subscriptions. Possibly containing advanced update vars ( option_name1, option_selection1 ); which allow account modifications.
128
- */
129
- 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"]))
130
- {
131
- do_action ("s2member_during_paypal_notify_before_subscr_signup", get_defined_vars ());
132
- /**/
133
- $paypal["s2member_log"][] = "s2Member txn_type identified as (web_accept|subscr_signup).";
134
- /**/
135
- list ($paypal["level"], $paypal["ccaps"], $paypal["eotper"]) = preg_split ("/\:/", $paypal["item_number"], 3);
136
- /**/
137
- if (preg_match ("/^web_accept$/i", $paypal["txn_type"])) /* Conversions for Lifetime & Fixed-Term sales. Transform into Subscription. */
138
- {
139
- $paypal["period3"] = ($paypal["eotper"]) ? $paypal["eotper"] : "1 L"; /* This defaults to exactly 1 Lifetime. */
140
- $paypal["mc_amount3"] = $paypal["mc_gross"]; /* The "Buy Now" amount. */
141
- }
142
- /**/
143
- $paypal["initial_term"] = $paypal["period1"] ? $paypal["period1"] : "0 D"; /* Do not allow the initial period to be empty. Defaults to 0 D. */
144
- $paypal["initial"] = (isset ($paypal["mc_amount1"]) && preg_match ("/^[1-9]/", $paypal["period1"])) ? $paypal["mc_amount1"] : $paypal["mc_amount3"];
145
- $paypal["regular"] = $paypal["mc_amount3"]; /* This is the regular payment amount that is charged to the customer. Always required by PayPal. */
146
- $paypal["regular_term"] = $paypal["period3"]; /* This is just set to keep a standard; this way both initial_term & regular_term are available. */
147
- $paypal["recurring"] = ($paypal["recurring"]) ? $paypal["mc_amount3"] : "0"; /* If non-recurring, this should be zero, otherwise regular. */
148
  /*
149
- New Subscription with advanced update vars ( option_name1, option_selection1 ).
150
  */
151
- if (preg_match ("/(updat|upgrad)/i", $paypal["option_name1"]) && $paypal["option_selection1"]) /* This is an advanced way to handle Subscription update modifications. */
152
- /* 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
153
- 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. */
154
  {
155
- do_action ("s2member_during_paypal_notify_before_subscr_signup_w_update_vars", get_defined_vars ());
156
- /**/
157
- $paypal["s2member_log"][] = "s2Member txn_type identified as (web_accept|subscr_signup) w/ update vars.";
158
- /**/
159
- /* Check for both the old & new subscr_id's, just in case the Return routine already changed it. */
160
- if (($user_id = ws_plugin__s2member_paypal_user_id ($paypal["subscr_id"], $paypal["option_selection1"])))
161
  {
162
- $user = new WP_User ($user_id); /* Acquire user object. */
 
 
 
 
 
 
163
  /**/
164
- if (!ws_plugin__s2member_user_has_wp_role ($user)) /* Non WP Roles. */
165
  {
166
  $processing = $during = true; /* Yes, we ARE processing this. */
167
  /**/
168
- $user->set_role ("s2member_level" . $paypal["level"]);
169
- update_usermeta ($user_id, "s2member_subscr_id", $paypal["subscr_id"]);
170
- update_usermeta ($user_id, "s2member_custom", $paypal["custom"]);
171
  /**/
172
- foreach ($user->allcaps as $cap => $cap_enabled)
173
- if (preg_match ("/^access_s2member_ccap_/", $cap))
174
- $user->remove_cap ($ccap = $cap);
175
  /**/
176
- foreach (preg_split ("/[\r\n\t\s;,]+/", $paypal["ccaps"]) as $ccap)
177
- if (strlen ($ccap)) /* Don't add empty capabilities. */
178
- $user->add_cap ("access_s2member_ccap_" . trim (strtolower ($ccap)));
179
- /**/
180
- delete_usermeta ($user_id, "s2member_file_download_access_arc");
181
- delete_usermeta ($user_id, "s2member_file_download_access_log");
182
- /**/
183
- if (preg_match ("/^web_accept$/i", $paypal["txn_type"]) && $paypal["eotper"])
184
- update_usermeta ($user_id, "s2member_auto_eot_time", ws_plugin__s2member_paypal_auto_eot_time (0, 0, 0, $paypal["eotper"]));
185
- else /* Otherwise, we need to clear the eot time. */
186
- delete_usermeta ($user_id, "s2member_auto_eot_time");
187
- /**/
188
- ws_plugin__s2member_clear_user_note_lines ($user_id, "/^Demoted by s2Member\:/");
189
- /**/
190
- $paypal["s2member_log"][] = "s2Member Level/Capabilities updated w/ advanced update routines.";
191
- /**/
192
- @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");
193
- /**/
194
- $paypal["s2member_log"][] = "Modification Confirmation Email sent to Customer, with a URL that provides them with a way to log back in.";
195
- /**/
196
- do_action ("s2member_during_paypal_notify_during_subscr_signup_w_update_vars", get_defined_vars ());
197
- }
198
- else
199
- {
200
- $paypal["s2member_log"][] = "Unable to modify Subscription. The existing User ID has a built-in WP Role. Stopping here. Otherwise, an Administrator/Editor/Author/Contributor could lose access.";
201
- }
202
- }
203
- else
204
- {
205
- $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.";
206
- }
207
- /**/
208
- do_action ("s2member_during_paypal_notify_after_subscr_signup_w_update_vars", get_defined_vars ());
209
- }
210
- /*
211
- New Subscription. Normal Subscription signup, we are not updating anything for a past Subscription.
212
- */
213
- else /* Else this is a normal Subscription signup, we are not updating anything. */
214
- {
215
- do_action ("s2member_during_paypal_notify_before_subscr_signup_wo_update_vars", get_defined_vars ());
216
- /**/
217
- $paypal["s2member_log"][] = "s2Member txn_type identified as (web_accept|subscr_signup) w/o update vars.";
218
- /**/
219
- if (($registration_url = ws_plugin__s2member_register_link_gen ($paypal["subscr_id"], $paypal["custom"], $paypal["item_number"])) && is_array ($cv = preg_split ("/\|/", $paypal["custom"])))
220
- {
221
- $processing = $during = true; /* Yes, we ARE processing this. */
222
- /**/
223
- $sbj = preg_replace ("/%%registration_url%%/i", $registration_url, $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["signup_email_subject"]);
224
- $msg = preg_replace ("/%%registration_url%%/i", $registration_url, $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["signup_email_message"]);
225
- /**/
226
- if (($sbj = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $sbj)) && ($sbj = preg_replace ("/%%subscr_id%%/i", $paypal["subscr_id"], $sbj)))
227
- 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)))
228
- if (($sbj = preg_replace ("/%%initial_term%%/i", $paypal["initial_term"], $sbj)) && ($sbj = preg_replace ("/%%regular_term%%/i", $paypal["regular_term"], $sbj)))
229
- if (($sbj = preg_replace ("/%%item_number%%/i", $paypal["item_number"], $sbj)) && ($sbj = preg_replace ("/%%item_name%%/i", $paypal["item_name"], $sbj)))
230
- if (($sbj = preg_replace ("/%%first_name%%/i", $paypal["first_name"], $sbj)) && ($sbj = preg_replace ("/%%last_name%%/i", $paypal["last_name"], $sbj)))
231
- if (($sbj = preg_replace ("/%%full_name%%/i", trim ($paypal["first_name"] . " " . $paypal["last_name"]), $sbj)))
232
- if (($sbj = preg_replace ("/%%payer_email%%/i", $paypal["payer_email"], $sbj)))
233
- /**/
234
- if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $msg)) && ($msg = preg_replace ("/%%subscr_id%%/i", $paypal["subscr_id"], $msg)))
235
- 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)))
236
- if (($msg = preg_replace ("/%%initial_term%%/i", $paypal["initial_term"], $msg)) && ($msg = preg_replace ("/%%regular_term%%/i", $paypal["regular_term"], $msg)))
237
  if (($msg = preg_replace ("/%%item_number%%/i", $paypal["item_number"], $msg)) && ($msg = preg_replace ("/%%item_name%%/i", $paypal["item_name"], $msg)))
238
  if (($msg = preg_replace ("/%%first_name%%/i", $paypal["first_name"], $msg)) && ($msg = preg_replace ("/%%last_name%%/i", $paypal["last_name"], $msg)))
239
  if (($msg = preg_replace ("/%%full_name%%/i", trim ($paypal["first_name"] . " " . $paypal["last_name"]), $msg)))
@@ -243,378 +89,603 @@ function ws_plugin__s2member_paypal_notify ()
243
  {
244
  @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");
245
  /**/
246
- $paypal["s2member_log"][] = "Signup Confirmation Email sent to Customer, with a URL to assist w/ registration.";
247
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
248
  /**/
249
- do_action ("s2member_during_paypal_notify_during_subscr_signup_wo_update_vars", get_defined_vars ());
 
 
250
  }
251
- /**/
252
- do_action ("s2member_during_paypal_notify_after_subscr_signup_wo_update_vars", get_defined_vars ());
253
- }
254
- /**/
255
- if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["signup_notification_urls"] && is_array ($cv = preg_split ("/\|/", $paypal["custom"])))
256
- {
257
- foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["signup_notification_urls"]) as $url)
258
- /**/
259
- if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)) && ($url = preg_replace ("/%%subscr_id%%/i", urlencode ($paypal["subscr_id"]), $url)))
260
- 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)))
261
- if (($url = preg_replace ("/%%initial_term%%/i", urlencode ($paypal["initial_term"]), $url)) && ($url = preg_replace ("/%%regular_term%%/i", urlencode ($paypal["regular_term"]), $url)))
262
- if (($url = preg_replace ("/%%item_number%%/i", urlencode ($paypal["item_number"]), $url)) && ($url = preg_replace ("/%%item_name%%/i", urlencode ($paypal["item_name"]), $url)))
263
- if (($url = preg_replace ("/%%first_name%%/i", urlencode ($paypal["first_name"]), $url)) && ($url = preg_replace ("/%%last_name%%/i", urlencode ($paypal["last_name"]), $url)))
264
- if (($url = preg_replace ("/%%full_name%%/i", urlencode (trim ($paypal["first_name"] . " " . $paypal["last_name"])), $url)))
265
- if (($url = preg_replace ("/%%payer_email%%/i", urlencode ($paypal["payer_email"]), $url)))
266
- /**/
267
- if (($url = trim ($url))) /* Empty? */
268
- ws_plugin__s2member_remote ($url);
269
- /**/
270
- $paypal["s2member_log"][] = "Signup Notification URLs have been processed.";
271
- }
272
- /**/
273
- if ($processing && ($code = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["signup_tracking_codes"]) && is_array ($cv = preg_split ("/\|/", $paypal["custom"])))
274
- {
275
- if (($code = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $code)) && ($code = preg_replace ("/%%subscr_id%%/i", $paypal["subscr_id"], $code)))
276
- 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)))
277
- if (($code = preg_replace ("/%%initial_term%%/i", $paypal["initial_term"], $code)) && ($code = preg_replace ("/%%regular_term%%/i", $paypal["regular_term"], $code)))
278
- if (($code = preg_replace ("/%%item_number%%/i", $paypal["item_number"], $code)) && ($code = preg_replace ("/%%item_name%%/i", $paypal["item_name"], $code)))
279
- if (($code = preg_replace ("/%%first_name%%/i", $paypal["first_name"], $code)) && ($code = preg_replace ("/%%last_name%%/i", $paypal["last_name"], $code)))
280
- if (($code = preg_replace ("/%%full_name%%/i", trim ($paypal["first_name"] . " " . $paypal["last_name"]), $code)))
281
- if (($code = preg_replace ("/%%payer_email%%/i", $paypal["payer_email"], $code)))
282
- /**/
283
- if (($code = trim ($code))) /* Make sure it is not empty. This gets stored into a Transient Queue. */
284
- {
285
- $paypal["s2member_log"][] = "Storing Signup Tracking Codes into a Transient Queue for s2Member. These will be processed on-site.";
286
- set_transient (md5 ("s2member_transient_signup_tracking_codes_" . $paypal["subscr_id"]), $code, 43200);
287
- }
288
- }
289
- /**/
290
- 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"])))
291
- {
292
- foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_urls"]) as $url)
293
- /**/
294
- if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)) && ($url = preg_replace ("/%%subscr_id%%/i", urlencode ($paypal["subscr_id"]), $url)))
295
- if (($url = preg_replace ("/%%amount%%/i", urlencode ($paypal["mc_gross"]), $url)) && ($url = preg_replace ("/%%txn_id%%/i", urlencode ($paypal["txn_id"]), $url)))
296
- if (($url = preg_replace ("/%%item_number%%/i", urlencode ($paypal["item_number"]), $url)) && ($url = preg_replace ("/%%item_name%%/i", urlencode ($paypal["item_name"]), $url)))
297
- if (($url = preg_replace ("/%%first_name%%/i", urlencode ($paypal["first_name"]), $url)) && ($url = preg_replace ("/%%last_name%%/i", urlencode ($paypal["last_name"]), $url)))
298
- if (($url = preg_replace ("/%%full_name%%/i", urlencode (trim ($paypal["first_name"] . " " . $paypal["last_name"])), $url)))
299
- if (($url = preg_replace ("/%%payer_email%%/i", urlencode ($paypal["payer_email"]), $url)))
300
- /**/
301
- if (($url = trim ($url))) /* Empty? */
302
- ws_plugin__s2member_remote ($url);
303
- /**/
304
- $paypal["s2member_log"][] = "Payment Notification URLs have been processed.";
305
- }
306
- /**/
307
- do_action ("s2member_during_paypal_notify_after_subscr_signup", get_defined_vars ());
308
- }
309
- /*
310
- Subscription modifications.
311
- */
312
- 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"]))
313
- {
314
- do_action ("s2member_during_paypal_notify_before_subscr_modify", get_defined_vars ());
315
- /**/
316
- $paypal["s2member_log"][] = "s2Member txn_type identified as subscr_modify.";
317
- /**/
318
- list ($paypal["level"], $paypal["ccaps"]) = preg_split ("/\:/", $paypal["item_number"], 2);
319
- /**/
320
- if (($user_id = ws_plugin__s2member_paypal_user_id ($paypal["subscr_id"])))
321
- {
322
- $user = new WP_User ($user_id); /* Acquire user object. */
323
- /**/
324
- if (!ws_plugin__s2member_user_has_wp_role ($user)) /* Non WP Roles. */
325
  {
326
- $processing = $during = true; /* Yes, we ARE processing this. */
 
 
327
  /**/
328
- $user->set_role ("s2member_level" . $paypal["level"]);
329
- update_usermeta ($user_id, "s2member_subscr_id", $paypal["subscr_id"]);
330
- update_usermeta ($user_id, "s2member_custom", $paypal["custom"]);
331
  /**/
332
- foreach ($user->allcaps as $cap => $cap_enabled)
333
- if (preg_match ("/^access_s2member_ccap_/", $cap))
334
- $user->remove_cap ($ccap = $cap);
335
  /**/
336
- foreach (preg_split ("/[\r\n\t\s;,]+/", $paypal["ccaps"]) as $ccap)
337
- if (strlen ($ccap)) /* Don't add empty capabilities. */
338
- $user->add_cap ("access_s2member_ccap_" . trim (strtolower ($ccap)));
339
- /**/
340
- delete_usermeta ($user_id, "s2member_file_download_access_arc");
341
- delete_usermeta ($user_id, "s2member_file_download_access_log");
342
- delete_usermeta ($user_id, "s2member_auto_eot_time");
343
  /**/
344
- ws_plugin__s2member_clear_user_note_lines ($user_id, "/^Demoted by s2Member\:/");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
345
  /**/
346
- $paypal["s2member_log"][] = "s2Member Level/Capabilities updated on Subscription modification.";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
347
  /**/
348
- @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");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
349
  /**/
350
- $paypal["s2member_log"][] = "Modification Confirmation Email sent to Customer, with a URL that provides them with a way to log back in.";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
351
  /**/
352
- do_action ("s2member_during_paypal_notify_during_subscr_modify", get_defined_vars ());
 
 
353
  }
354
- else
355
- {
356
- $paypal["s2member_log"][] = "Unable to modify Subscription. The existing User ID has a built-in WP Role. Stopping here. Otherwise, an Administrator/Editor/Author/Contributor could lose access.";
357
- }
358
- }
359
- else
360
- {
361
- $paypal["s2member_log"][] = "Unable to modify Subscription. Could not get the existing User ID from the DB.";
362
- }
363
- /**/
364
- do_action ("s2member_during_paypal_notify_after_subscr_modify", get_defined_vars ());
365
- }
366
- /*
367
- Subscription payments.
368
- */
369
- 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"])
370
- {
371
- do_action ("s2member_during_paypal_notify_before_subscr_payment", get_defined_vars ());
372
- /**/
373
- $paypal["s2member_log"][] = "s2Member txn_type identified as subscr_payment.";
374
- $paypal["s2member_log"][] = "Sleeping for 2 seconds. Waiting for a possible subscr_signup|subscr_modify.";
375
- sleep (2); /* Sleep here for a moment. PayPal® sometimes sends a subscr_payment before the subscr_signup, subscr_modify.
376
- 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. */
377
- $paypal["s2member_log"][] = "Awake. It's " . date ("D M j, Y g:i:s a T") . ". s2Member txn_type identified as subscr_payment.";
378
- /**/
379
- list ($paypal["level"], $paypal["ccaps"]) = preg_split ("/\:/", $paypal["item_number"], 2);
380
- /**/
381
- if (($user_id = ws_plugin__s2member_paypal_user_id ($paypal["subscr_id"], $paypal["option_selection1"])))
382
- {
383
- $processing = $during = true; /* Yes, we ARE processing this. */
384
- /**/
385
- update_usermeta ($user_id, "s2member_last_payment_time", time ());
386
- /**/
387
- $paypal["s2member_log"][] = "Updated Last Payment Time for this Member.";
388
- /**/
389
- if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_urls"] && is_array ($cv = preg_split ("/\|/", $paypal["custom"])))
390
  {
391
- foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_urls"]) as $url)
392
- /**/
393
- if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)) && ($url = preg_replace ("/%%subscr_id%%/i", urlencode ($paypal["subscr_id"]), $url)))
394
- if (($url = preg_replace ("/%%amount%%/i", urlencode ($paypal["mc_gross"]), $url)) && ($url = preg_replace ("/%%txn_id%%/i", urlencode ($paypal["txn_id"]), $url)))
395
- if (($url = preg_replace ("/%%item_number%%/i", urlencode ($paypal["item_number"]), $url)) && ($url = preg_replace ("/%%item_name%%/i", urlencode ($paypal["item_name"]), $url)))
396
- if (($url = preg_replace ("/%%first_name%%/i", urlencode ($paypal["first_name"]), $url)) && ($url = preg_replace ("/%%last_name%%/i", urlencode ($paypal["last_name"]), $url)))
397
- if (($url = preg_replace ("/%%full_name%%/i", urlencode (trim ($paypal["first_name"] . " " . $paypal["last_name"])), $url)))
398
- if (($url = preg_replace ("/%%payer_email%%/i", urlencode ($paypal["payer_email"]), $url)))
399
- /**/
400
- if (($url = trim ($url))) /* Empty? */
401
- ws_plugin__s2member_remote ($url);
402
  /**/
403
- $paypal["s2member_log"][] = "Payment Notification URLs have been processed.";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
404
  }
405
- /**/
406
- do_action ("s2member_during_paypal_notify_during_subscr_payment", get_defined_vars ());
407
- }
408
- else
409
- {
410
- $paypal["s2member_log"][] = "Skipping this IPN response, for now. The Subscr. ID is not associated with a registered Member.";
411
- $paypal["s2member_log"][] = "Storing this IPN response into a Transient Queue for s2Member. This will be re-processed when registration occurs.";
412
- set_transient (md5 ("s2member_transient_ipn_subscr_payment_" . $paypal["subscr_id"]), $_POST, 43200);
413
- }
414
- /**/
415
- do_action ("s2member_during_paypal_notify_after_subscr_payment", get_defined_vars ());
416
- }
417
- /*
418
- Subscription cancellations. s2Member can use this, to determine when/if it should Auto-EOT (demote|delete) a Member's account.
419
- The IPN for `subscr_cancel` is compatible with newer PayPal® accounts that do NOT send a subscr_eot when an account is cancelled.
420
- This works in conjunction with `s2member_last_payment_time`, and the s2Member Auto-EOT System.
421
- For further details & stupidity, see: https://www.x.com/thread/41155?start=15&tstart=0
422
- */
423
- 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"]))
424
- {
425
- do_action ("s2member_during_paypal_notify_before_subscr_cancel", get_defined_vars ());
426
- /**/
427
- $paypal["s2member_log"][] = "s2Member txn_type identified as subscr_cancel.";
428
- /**/
429
- list ($paypal["level"], $paypal["ccaps"]) = preg_split ("/\:/", $paypal["item_number"], 2);
430
- /**/
431
- if (($user_id = ws_plugin__s2member_paypal_user_id ($paypal["subscr_id"])))
432
- {
433
- if (!get_usermeta ($user_id, "s2member_auto_eot_time")) /* Respect existing. */
434
  {
435
- $processing = $during = true; /* Yes, we ARE processing this. */
 
 
436
  /**/
437
- $auto_eot_time = ws_plugin__s2member_paypal_auto_eot_time ($user_id, $paypal["period1"], $paypal["period3"]);
 
 
 
 
438
  /**/
439
- update_usermeta ($user_id, "s2member_auto_eot_time", $auto_eot_time); /* s2Member will follow-up on this later. */
440
  /**/
441
- $paypal["s2member_log"][] = "Auto-EOT Time for this account: " . date ("D M j, Y g:i a T", $auto_eot_time);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
442
  /**/
443
- do_action ("s2member_during_paypal_notify_during_subscr_cancel", get_defined_vars ());
 
 
444
  }
445
- else
 
 
 
 
 
 
446
  {
447
- $paypal["s2member_log"][] = "Ignoring Cancellation. An Auto-EOT Time is already set for this Member.";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
448
  }
449
- }
450
- else
451
- {
452
- $paypal["s2member_log"][] = "Unable to handle Cancellation. Could not get the existing User ID from the DB.";
453
- }
454
- /**/
455
- do_action ("s2member_during_paypal_notify_after_subscr_cancel", get_defined_vars ());
456
- }
457
- /*
458
- Subscription terminations, max failed payments, initial payment failed, chargebacks, refunds, and reversals. *** NOT processed for Specific Posts/Pages. */
459
- else if ( /* An immediate EOT is necessary under MANY different conditions. This consolidates them all, with a sub-classification for refunds/reversals. */
460
- (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"])))/**/
461
- && ($paypal["subscr_id"] || ($paypal["subscr_id"] = $paypal["recurring_payment_id"]) || ($paypal["subscr_id"] = $paypal["parent_txn_id"]))/**/
462
- && (preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?$/", $paypal["item_number"]) || $paypal["recurring_payment_id"])/**/)
463
- {
464
- do_action ("s2member_during_paypal_notify_before_subscr_eot", get_defined_vars ());
465
- /**/
466
- $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).";
467
- /**/
468
- if (($user_id = ws_plugin__s2member_paypal_user_id ($paypal["subscr_id"], $paypal["option_selection1"])))
469
- {
470
- if (!get_usermeta ($user_id, "s2member_auto_eot_time")) /* Respect Auto-EOT. */
471
  {
472
- $user = new WP_User ($user_id); /* Acquire user object. */
 
 
 
 
473
  /**/
474
- if (!ws_plugin__s2member_user_has_wp_role ($user)) /* Non WP Roles. */
475
  {
476
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["auto_eot_system_enabled"]) /* EOT enabled? */
477
  {
478
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_eot_behavior"] === "demote")
 
 
479
  {
480
- $processing = $during = true; /* Yes, we ARE processing this. */
481
- /**/
482
- $user->set_role ("subscriber");
483
- /**/
484
- delete_usermeta ($user_id, "s2member_custom");
485
- delete_usermeta ($user_id, "s2member_subscr_id");
486
- delete_usermeta ($user_id, "s2member_last_payment_time");
487
- delete_usermeta ($user_id, "s2member_auto_eot_time");
488
- /**/
489
- foreach ($user->allcaps as $cap => $cap_enabled)
490
- if (preg_match ("/^access_s2member_ccap_/", $cap))
491
- $user->remove_cap ($ccap = $cap);
492
- /**/
493
- delete_usermeta ($user_id, "s2member_file_download_access_arc");
494
- delete_usermeta ($user_id, "s2member_file_download_access_log");
495
- /**/
496
- ws_plugin__s2member_append_user_notes ($user_id, "Demoted by s2Member: " . date ("D M j, Y g:i a T"));
497
- /**/
498
- $paypal["s2member_log"][] = "Member Level/Capabilities demoted to a Free Subscriber.";
499
- /**/
500
- if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"] && is_array ($cv = preg_split ("/\|/", $paypal["custom"])))
501
  {
502
- foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"]) as $url) /* Handle eot notifications. */
503
- /**/
504
- if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)) && ($url = preg_replace ("/%%subscr_id%%/i", urlencode ($paypal["subscr_id"]), $url)))
505
- 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)))
506
- if (($url = preg_replace ("/%%user_full_name%%/i", urlencode (trim ($user->first_name . " " . $user->last_name)), $url)))
507
- if (($url = preg_replace ("/%%user_email%%/i", urlencode ($user->user_email), $url)))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
508
  /**/
509
- if (($url = trim ($url))) /* Empty? */
510
- ws_plugin__s2member_remote ($url);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
511
  /**/
512
- $paypal["s2member_log"][] = "EOT/Deletion Notification URLs have been processed.";
 
 
513
  }
514
  /**/
515
- do_action ("s2member_during_paypal_notify_during_subscr_eot_demote", get_defined_vars ());
 
 
 
 
 
 
 
 
 
 
 
 
516
  }
517
- else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_eot_behavior"] === "delete")
518
  {
519
- $processing = $during = true; /* Yes, we ARE processing this. */
520
- /**/
521
- wp_delete_user ($user_id); /* Triggers: `ws_plugin__s2member_handle_user_deletions()` */
522
- /* `ws_plugin__s2member_handle_user_deletions()` triggers `eot_del_notification_urls` */
523
- /**/
524
- $paypal["s2member_log"][] = "The Member's account has been deleted completely.";
525
- /**/
526
- $paypal["s2member_log"][] = "EOT/Deletion Notification URLs have been processed.";
527
- /**/
528
- do_action ("s2member_during_paypal_notify_during_subscr_eot_delete", get_defined_vars ());
529
  }
530
- /**/
531
- do_action ("s2member_during_paypal_notify_during_subscr_eot", get_defined_vars ());
532
  }
533
- /**/
534
- else /* Otherwise, treat this as if it were a cancellation. EOTs are currently disabled. */
535
  {
536
- $processing = $during = true; /* Yes, we ARE processing this. */
537
- /**/
538
- update_usermeta ($user_id, "s2member_auto_eot_time", ($auto_eot_time = strtotime ("now")));
539
- /**/
540
- $paypal["s2member_log"][] = "Auto-EOT is currently disabled. Skipping immediate EOT (demote|delete), for now.";
541
- $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);
542
- /**/
543
- do_action ("s2member_during_paypal_notify_during_subscr_eot_disabled", get_defined_vars ());
544
  }
545
  }
546
  else
547
  {
548
- $paypal["s2member_log"][] = "Unable to (demote|delete) Member. The existing User ID has a built-in WP Role. Stopping here. Otherwise, an Administrator/Editor/Author/Contributor could lose access.";
549
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
550
  }
551
  else
552
  {
553
- $paypal["s2member_log"][] = "Skipping (demote|delete) Member, for now. An Auto-EOT Time is already set. When an Auto-EOT Time has been recorded, s2Member will handle EOT (demote|delete) events using it's own Auto-EOT System.";
554
  }
555
  }
556
- else
557
- {
558
- $paypal["s2member_log"][] = "Unable to (demote|delete) Member. Could not get the existing User ID from the DB. It's possible that it was already removed manually by a Site Administrator, or by s2Member's Auto-EOT System.";
559
- }
560
- /*
561
- Refunds and chargeback reversals. This is excluded from the processing check, because a Member *could* have already been (demoted|deleted).
562
- In other words, s2Member sends `Refund/Reversal` Notifications ANYTIME a Refund/Reversal occurs; even if s2Member did not process it otherwise.
563
- Since this routine ignores the processing check, it is *possible* that Refund/Reversal Notification URLs will be contacted more than once.
564
- If you are writing scripts that depend on Refund/Reversal Notifications, please keep this in mind.
565
- */
566
- if (!$paypal["txn_type"] && preg_match ("/^(refunded|reversed)$/i", $paypal["payment_status"]) && $paypal["parent_txn_id"])
567
- {
568
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["ref_rev_notification_urls"] && is_array ($cv = preg_split ("/\|/", $paypal["custom"])))
569
- {
570
- foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["ref_rev_notification_urls"]) as $url)
571
- /**/
572
- if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)) && ($url = preg_replace ("/%%subscr_id%%/i", urlencode ($paypal["subscr_id"]), $url)))
573
- if (($url = preg_replace ("/%%-amount%%/i", urlencode ($paypal["mc_gross"]), $url)) && ($url = preg_replace ("/%%parent_txn_id%%/i", urlencode ($paypal["parent_txn_id"]), $url)))
574
- if (($url = preg_replace ("/%%item_number%%/i", urlencode ($paypal["item_number"]), $url)) && ($url = preg_replace ("/%%item_name%%/i", urlencode ($paypal["item_name"]), $url)))
575
- if (($url = preg_replace ("/%%first_name%%/i", urlencode ($paypal["first_name"]), $url)) && ($url = preg_replace ("/%%last_name%%/i", urlencode ($paypal["last_name"]), $url)))
576
- if (($url = preg_replace ("/%%full_name%%/i", urlencode (trim ($paypal["first_name"] . " " . $paypal["last_name"])), $url)))
577
- if (($url = preg_replace ("/%%payer_email%%/i", urlencode ($paypal["payer_email"]), $url)))
578
- /**/
579
- if (($url = trim ($url))) /* Empty? */
580
- ws_plugin__s2member_remote ($url);
581
- /**/
582
- $paypal["s2member_log"][] = "Refund/Reversal Notification URLs have been processed.";
583
- }
584
- /**/
585
- do_action ("s2member_during_paypal_notify_during_subscr_eot_refund_reversal", get_defined_vars ());
586
- }
587
- /**/
588
- do_action ("s2member_during_paypal_notify_after_subscr_eot", get_defined_vars ());
589
  }
590
  else
591
  {
592
- $paypal["s2member_log"][] = "Properly ignoring this IPN request. The txn_type does not require any action on the part of s2Member.";
593
  }
594
  }
595
  else
596
  {
597
- $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.";
598
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
599
  }
600
- else
601
- {
602
- $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.";
603
- }
604
- /**/
605
- if ($_GET["s2member_paypal_proxy"]) /* For proxy identification. */
606
- $paypal["s2member_paypal_proxy"] = $_GET["s2member_paypal_proxy"];
607
- /**/
608
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_debug"])
609
- if (is_dir ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"]))
610
- if (is_writable ($logs_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"]))
611
- file_put_contents ($logs_dir . "/paypal-ipn.log", var_export ($paypal, true) . "\n\n", FILE_APPEND);
612
- /**/
613
- do_action ("s2member_during_paypal_notify", get_defined_vars ());
614
  /**/
615
- exit;
 
 
616
  }
617
- /**/
618
- do_action ("s2member_after_paypal_notify", get_defined_vars ());
619
  }
620
  ?>
17
  Handles PayPal® IPN URL processing.
18
  Attach to: add_action("init");
19
  */
20
+ if (!function_exists ("ws_plugin__s2member_paypal_notify"))
21
  {
22
+ function ws_plugin__s2member_paypal_notify ()
 
 
 
 
23
  {
24
+ include_once ABSPATH . "wp-admin/includes/admin.php";
25
+ /**/
26
+ do_action ("ws_plugin__s2member_before_paypal_notify", get_defined_vars ());
27
+ /**/
28
+ if ($_GET["s2member_paypal_notify"] && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"])
29
  {
30
+ if (is_array ($paypal = ws_plugin__s2member_paypal_postvars ())) /* Verify PayPal® POST vars. */
31
+ {
32
+ $paypal["s2member_log"][] = "IPN received on: " . date ("D M j, Y g:i:s a T");
33
+ $paypal["s2member_log"][] = "s2Member POST vars verified through a POST back to PayPal®.";
34
+ /**/
35
+ $paypal["custom"] = (!$paypal["custom"]) ? ws_plugin__s2member_paypal_custom ($paypal["recurring_payment_id"]) : $paypal["custom"];
36
+ /* Notifications following the PayPal® Pro format for recurring payments, do NOT carry the "custom" value, so we do a lookup.
37
+ This is only crucial for one IPN call in Standard Integration: `txn_type=recurring_payment_suspended_due_to_max_failed_payment`.
38
+ In Pro Integrations, we just need to make sure the "custom" field is assigned for each account during on-site checkout.
39
+ This way the "custom" value will always be available when it needs to be; for both Standard and Pro services. */
40
+ if (preg_match ("/^" . preg_quote ($_SERVER["HTTP_HOST"], "/") . "/i", $paypal["custom"])) /* Matches originating host? */
41
+ { /* The business address validation was removed from this routine, because PayPal® always fills that with the primary
42
+ email address. In cases where an alternate PayPal® address is being paid, validation was not possible. */
43
+ $paypal["s2member_log"][] = "s2Member originating domain ( _SERVER[HTTP_HOST] ) validated.";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ /**/
60
+ $paypal["s2member_log"][] = "s2Member txn_type identified as (web_accept) for Specific Post/Page Access.";
61
+ /**/
62
+ list (, $paypal["sp_ids"], $paypal["hours"]) = preg_split ("/\:/", $paypal["item_number"], 3);
63
  /**/
64
+ if (($sp_access_url = ws_plugin__s2member_sp_access_link_gen ($paypal["sp_ids"], $paypal["hours"])) && is_array ($cv = preg_split ("/\|/", $paypal["custom"])))
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)))
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
+ {
123
+ $paypal["s2member_log"][] = "Storing Specific Post/Page Tracking Codes into a Transient Queue for s2Member. These will be processed on-site.";
124
+ set_transient (md5 ("s2member_transient_sp_tracking_codes_" . $paypal["txn_id"]), $code, 43200);
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
+ }
132
+ else
133
+ {
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
  /**/
150
+ $paypal["s2member_log"][] = "s2Member txn_type identified as (web_accept|subscr_signup).";
 
 
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. */
158
+ }
 
 
159
  /**/
160
+ $paypal["initial_term"] = $paypal["period1"] ? $paypal["period1"] : "0 D"; /* Do not allow the initial period to be empty. Defaults to 0 D. */
161
+ $paypal["initial"] = (isset ($paypal["mc_amount1"]) && preg_match ("/^[1-9]/", $paypal["period1"])) ? $paypal["mc_amount1"] : $paypal["mc_amount3"];
162
+ $paypal["regular"] = $paypal["mc_amount3"]; /* This is the regular payment amount that is charged to the customer. Always required by PayPal. */
163
+ $paypal["regular_term"] = $paypal["period3"]; /* This is just set to keep a standard; this way both initial_term & regular_term are available. */
164
+ $paypal["recurring"] = ($paypal["recurring"]) ? $paypal["mc_amount3"] : "0"; /* If non-recurring, this should be zero, otherwise regular. */
165
+ /*
166
+ New Subscription with advanced update vars ( option_name1, option_selection1 ).
167
+ */
168
+ if (preg_match ("/(updat|upgrad)/i", $paypal["option_name1"]) && $paypal["option_selection1"]) /* This is an advanced way to handle Subscription update modifications. */
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. */
186
+ /**/
187
+ $user->set_role ("s2member_level" . $paypal["level"]);
188
+ update_usermeta ($user_id, "s2member_subscr_id", $paypal["subscr_id"]);
189
+ update_usermeta ($user_id, "s2member_custom", $paypal["custom"]);
190
+ /**/
191
+ foreach ($user->allcaps as $cap => $cap_enabled)
192
+ if (preg_match ("/^access_s2member_ccap_/", $cap))
193
+ $user->remove_cap ($ccap = $cap);
194
+ /**/
195
+ foreach (preg_split ("/[\r\n\t\s;,]+/", $paypal["ccaps"]) as $ccap)
196
+ if (strlen ($ccap)) /* Don't add empty capabilities. */
197
+ $user->add_cap ("access_s2member_ccap_" . trim (strtolower ($ccap)));
198
+ /**/
199
+ delete_usermeta ($user_id, "s2member_file_download_access_arc");
200
+ delete_usermeta ($user_id, "s2member_file_download_access_log");
201
+ /**/
202
+ if (preg_match ("/^web_accept$/i", $paypal["txn_type"]) && $paypal["eotper"])
203
+ update_usermeta ($user_id, "s2member_auto_eot_time", ws_plugin__s2member_paypal_auto_eot_time (0, 0, 0, $paypal["eotper"]));
204
+ else /* Otherwise, we need to clear the eot time. */
205
+ delete_usermeta ($user_id, "s2member_auto_eot_time");
206
+ /**/
207
+ ws_plugin__s2member_clear_user_note_lines ($user_id, "/^Demoted by s2Member\:/");
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
+ }
219
+ else
220
+ {
221
+ $paypal["s2member_log"][] = "Unable to modify Subscription. The existing User ID has a built-in WP Role. Stopping here. Otherwise, an Administrator/Editor/Author/Contributor could lose access.";
222
+ }
223
+ }
224
+ else
225
+ {
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
+ }
233
+ /*
234
+ New Subscription. Normal Subscription signup, we are not updating anything for a past Subscription.
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
+ /**/
242
+ $paypal["s2member_log"][] = "s2Member txn_type identified as (web_accept|subscr_signup) w/o update vars.";
243
+ /**/
244
+ if (($registration_url = ws_plugin__s2member_register_link_gen ($paypal["subscr_id"], $paypal["custom"], $paypal["item_number"])) && is_array ($cv = preg_split ("/\|/", $paypal["custom"])))
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
  /**/
349
+ $paypal["s2member_log"][] = "s2Member txn_type identified as subscr_modify.";
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. */
360
+ /**/
361
+ $user->set_role ("s2member_level" . $paypal["level"]);
362
+ update_usermeta ($user_id, "s2member_subscr_id", $paypal["subscr_id"]);
363
+ update_usermeta ($user_id, "s2member_custom", $paypal["custom"]);
364
+ /**/
365
+ foreach ($user->allcaps as $cap => $cap_enabled)
366
+ if (preg_match ("/^access_s2member_ccap_/", $cap))
367
+ $user->remove_cap ($ccap = $cap);
368
+ /**/
369
+ foreach (preg_split ("/[\r\n\t\s;,]+/", $paypal["ccaps"]) as $ccap)
370
+ if (strlen ($ccap)) /* Don't add empty capabilities. */
371
+ $user->add_cap ("access_s2member_ccap_" . trim (strtolower ($ccap)));
372
+ /**/
373
+ delete_usermeta ($user_id, "s2member_file_download_access_arc");
374
+ delete_usermeta ($user_id, "s2member_file_download_access_log");
375
+ delete_usermeta ($user_id, "s2member_auto_eot_time");
376
+ /**/
377
+ ws_plugin__s2member_clear_user_note_lines ($user_id, "/^Demoted by s2Member\:/");
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
+ }
389
+ else
390
+ {
391
+ $paypal["s2member_log"][] = "Unable to modify Subscription. The existing User ID has a built-in WP Role. Stopping here. Otherwise, an Administrator/Editor/Author/Contributor could lose access.";
392
+ }
393
+ }
394
+ else
395
+ {
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
+ /**/
424
+ update_usermeta ($user_id, "s2member_last_payment_time", time ());
425
+ /**/
426
+ $paypal["s2member_log"][] = "Updated Last Payment Time for this Member.";
427
+ /**/
428
+ if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_urls"] && is_array ($cv = preg_split ("/\|/", $paypal["custom"])))
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
+ }
449
+ else
450
+ {
451
+ $paypal["s2member_log"][] = "Skipping this IPN response, for now. The Subscr. ID is not associated with a registered Member.";
452
+ $paypal["s2member_log"][] = "Storing this IPN response into a Transient Queue for s2Member. This will be re-processed when registration occurs.";
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
+ {
480
+ $processing = $during = true; /* Yes, we ARE processing this. */
481
+ /**/
482
+ $auto_eot_time = ws_plugin__s2member_paypal_auto_eot_time ($user_id, $paypal["period1"], $paypal["period3"]);
483
+ /**/
484
+ update_usermeta ($user_id, "s2member_auto_eot_time", $auto_eot_time); /* s2Member will follow-up on this later. */
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
+ }
492
+ else
493
+ {
494
+ $paypal["s2member_log"][] = "Ignoring Cancellation. An Auto-EOT Time is already set for this Member.";
495
+ }
496
+ }
497
+ else
498
+ {
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? */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
528
  {
529
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_eot_behavior"] === "demote")
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");
537
+ delete_usermeta ($user_id, "s2member_last_payment_time");
538
+ delete_usermeta ($user_id, "s2member_auto_eot_time");
539
+ /**/
540
+ foreach ($user->allcaps as $cap => $cap_enabled)
541
+ if (preg_match ("/^access_s2member_ccap_/", $cap))
542
+ $user->remove_cap ($ccap = $cap);
543
+ /**/
544
+ delete_usermeta ($user_id, "s2member_file_download_access_arc");
545
+ delete_usermeta ($user_id, "s2member_file_download_access_log");
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
+ }
570
+ else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_eot_behavior"] === "delete")
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
  }
590
  /**/
591
+ else /* Otherwise, treat this as if it were a cancellation. EOTs are currently disabled. */
592
+ {
593
+ $processing = $during = true; /* Yes, we ARE processing this. */
594
+ /**/
595
+ update_usermeta ($user_id, "s2member_auto_eot_time", ($auto_eot_time = strtotime ("now")));
596
+ /**/
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
+ }
604
  }
605
+ else
606
  {
607
+ $paypal["s2member_log"][] = "Unable to (demote|delete) Member. The existing User ID has a built-in WP Role. Stopping here. Otherwise, an Administrator/Editor/Author/Contributor could lose access.";
 
 
 
 
 
 
 
 
 
608
  }
 
 
609
  }
610
+ else
 
611
  {
612
+ $paypal["s2member_log"][] = "Skipping (demote|delete) Member, for now. An Auto-EOT Time is already set. When an Auto-EOT Time has been recorded, s2Member will handle EOT (demote|delete) events using it's own Auto-EOT System.";
 
 
 
 
 
 
 
613
  }
614
  }
615
  else
616
  {
617
+ $paypal["s2member_log"][] = "Unable to (demote|delete) Member. Could not get the existing User ID from the DB. It's possible that it was already removed manually by a Site Administrator, or by s2Member's Auto-EOT System.";
618
  }
619
+ /*
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
+ {
627
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["ref_rev_notification_urls"] && is_array ($cv = preg_split ("/\|/", $paypal["custom"])))
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
  }
 
 
690
  }
691
  ?>
includes/functions/paypal-return.inc.php CHANGED
@@ -17,338 +17,389 @@ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
17
  Handles PayPal® Return URL processing.
18
  Attach to: add_action("init");
19
  */
20
- function ws_plugin__s2member_paypal_return ()
21
  {
22
- do_action ("s2member_before_paypal_return", get_defined_vars ());
23
- /**/
24
- if ($_GET["s2member_paypal_return"] && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"])
25
  {
26
- if (is_array ($paypal = ws_plugin__s2member_paypal_postvars ())) /* Verify PayPal® POST vars. */
 
 
27
  {
28
- $paypal["s2member_log"][] = "Return-Data received on: " . date ("D M j, Y g:i:s a T");
29
- $paypal["s2member_log"][] = "s2Member POST vars verified through a POST back to PayPal®.";
30
- /**/
31
- if (preg_match ("/^" . preg_quote ($_SERVER["HTTP_HOST"], "/") . "/i", $paypal["custom"])) /* Matches originating host? */
32
- { /* The business address validation was removed from this routine, because PayPal® always fills that with the primary
33
- email address. In cases where an alternate PayPal® address is being paid, validation was not possible. */
34
- $paypal["s2member_log"][] = "s2Member originating domain ( _SERVER[HTTP_HOST] ) validated.";
35
- /*
36
- Specific Post/Page Access.
37
- */
38
- if (preg_match ("/^web_accept$/i", $paypal["txn_type"]) && $paypal["txn_id"] && preg_match ("/^sp\:[0-9,]+\:[0-9]+$/", $paypal["item_number"]))
39
- {
40
- do_action ("s2member_during_paypal_return_before_sp_access", get_defined_vars ());
41
- /**/
42
- $paypal["s2member_log"][] = "s2Member txn_type identified as (web_accept) for Specific Post/Page access.";
43
- /**/
44
- list (, $paypal["sp_ids"], $paypal["hours"]) = preg_split ("/\:/", $paypal["item_number"], 3);
45
- /**/
46
- if (($sp_access_url = ws_plugin__s2member_sp_access_link_gen ($paypal["sp_ids"], $paypal["hours"], false)))
47
- {
48
- $processing = $during = true; /* Yes, we ARE processing this. */
49
- /**/
50
- setcookie ("s2member_sp_tracking", ws_plugin__s2member_encrypt ($paypal["txn_id"]), time () + 31556926, "/");
51
- /**/
52
- $paypal["s2member_log"][] = "Transient Tracking Cookie set on (web_accept) for Specific Post/Page Access.";
53
- /**/
54
- if ($processing && ($code = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_tracking_codes"]) && is_array ($cv = preg_split ("/\|/", $paypal["custom"])))
55
- {
56
- 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)))
57
- if (($code = preg_replace ("/%%item_number%%/i", $paypal["item_number"], $code)) && ($code = preg_replace ("/%%item_name%%/i", $paypal["item_name"], $code)))
58
- if (($code = preg_replace ("/%%first_name%%/i", $paypal["first_name"], $code)) && ($code = preg_replace ("/%%last_name%%/i", $paypal["last_name"], $code)))
59
- if (($code = preg_replace ("/%%full_name%%/i", trim ($paypal["first_name"] . " " . $paypal["last_name"]), $code)))
60
- if (($code = preg_replace ("/%%payer_email%%/i", $paypal["payer_email"], $code)))
61
- /**/
62
- if (($code = trim ($code))) /* Make sure it is not empty. This gets stored into a Transient Queue. */
63
- {
64
- $paypal["s2member_log"][] = "Storing Specific Post/Page Tracking Codes into a Transient Queue for s2Member. These will be processed on-site.";
65
- set_transient (md5 ("s2member_transient_sp_tracking_codes_" . $paypal["txn_id"]), $code, 43200);
66
- }
67
- }
68
- /**/
69
- do_action ("s2member_during_paypal_return_during_sp_access", get_defined_vars ());
70
- /**/
71
- $paypal["s2member_log"][] = "Redirecting Customer to the Specific Post/Page.";
72
- /**/
73
- header ("Location: " . $sp_access_url);
74
- }
75
- else /* Otherwise, the ID must have been invalid. Or the Post/Page was deleted. */
76
- {
77
- $paypal["s2member_log"][] = "Unable to generate Specific Post/Page Access Link. Does your Leading Post/Page still exist?";
78
- /**/
79
- $paypal["s2member_log"][] = "Redirecting Customer to the Home Page, due to an error that occurred.";
80
- /**/
81
- echo '<script type="text/javascript">' . "\n";
82
- echo "alert('ERROR: Unable to generate Access Link. Please contact Support for assistance.');" . "\n";
83
- echo "window.location = '" . esc_js (get_bloginfo ("url")) . "';";
84
- echo '</script>' . "\n";
85
- }
86
- /**/
87
- do_action ("s2member_during_paypal_return_after_sp_access", get_defined_vars ());
88
- }
89
- /*
90
- New Subscriptions. Possibly containing advanced updated vars ( option_name1, option_selection1 ); which allow account modifications.
91
- */
92
- 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"]))
93
- { /* With Auto-Return/PDT, PayPal will send subscr_payment instead of subscr_signup to the return URL.
94
- So we need to look for (web_accept|subscr_signup|subscr_payment), and treat them as the same. */
95
- /**/
96
- do_action ("s2member_during_paypal_return_before_subscr_signup", get_defined_vars ());
97
- /**/
98
- $paypal["s2member_log"][] = "s2Member txn_type identified as (web_accept|subscr_signup|subscr_payment).";
99
- /**/
100
- list ($paypal["level"], $paypal["ccaps"], $paypal["eotper"]) = preg_split ("/\:/", $paypal["item_number"], 3);
101
  /*
102
- New Subscription with advanced update vars ( option_name1, option_selection1 ).
103
  */
104
- if (preg_match ("/(updat|upgrad)/i", $paypal["option_name1"]) && $paypal["option_selection1"]) /* Advanced Subscription update modifications. */
105
- /* 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
106
- 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. */
107
  {
108
- do_action ("s2member_during_paypal_return_before_subscr_signup_w_update_vars", get_defined_vars ());
109
- /**/
110
- $paypal["s2member_log"][] = "s2Member txn_type identified as (web_accept|subscr_signup|subscr_payment) w/ update vars.";
111
- /**/
112
- /* Check for both the old & new subscr_id's, just in case the IPN routine already changed it. */
113
- if (($user_id = ws_plugin__s2member_paypal_user_id ($paypal["subscr_id"], $paypal["option_selection1"])))
114
  {
115
- $user = new WP_User ($user_id); /* Acquire user object. */
 
 
 
 
 
 
116
  /**/
117
- if (!ws_plugin__s2member_user_has_wp_role ($user)) /* Non WP Roles. */
118
  {
119
  $processing = $during = true; /* Yes, we ARE processing this. */
120
  /**/
121
- $user->set_role ("s2member_level" . $paypal["level"]);
122
- update_usermeta ($user_id, "s2member_subscr_id", $paypal["subscr_id"]);
123
- update_usermeta ($user_id, "s2member_custom", $paypal["custom"]);
124
  /**/
125
- foreach ($user->allcaps as $cap => $cap_enabled)
126
- if (preg_match ("/^access_s2member_ccap_/", $cap))
127
- $user->remove_cap ($ccap = $cap);
128
  /**/
129
- foreach (preg_split ("/[\r\n\t\s;,]+/", $paypal["ccaps"]) as $ccap)
130
- if (strlen ($ccap)) /* Don't add empty capabilities. */
131
- $user->add_cap ("access_s2member_ccap_" . trim (strtolower ($ccap)));
 
 
 
 
 
 
 
 
 
 
 
132
  /**/
133
- delete_usermeta ($user_id, "s2member_file_download_access_arc");
134
- delete_usermeta ($user_id, "s2member_file_download_access_log");
 
135
  /**/
136
- if (preg_match ("/^web_accept$/i", $paypal["txn_type"]) && $paypal["eotper"])
137
- update_usermeta ($user_id, "s2member_auto_eot_time", ws_plugin__s2member_paypal_auto_eot_time (0, 0, 0, $paypal["eotper"]));
138
- else /* Otherwise, we need to clear the eot time. */
139
- delete_usermeta ($user_id, "s2member_auto_eot_time");
140
  /**/
141
- ws_plugin__s2member_clear_user_note_lines ($user_id, "/^Demoted by s2Member\:/");
142
- /**/
143
- $paypal["s2member_log"][] = "s2Member Level/Capabilities updated w/ advanced update routines.";
144
- /**/
145
- do_action ("s2member_during_paypal_return_during_subscr_signup_w_update_vars", get_defined_vars ());
146
  /**/
147
- $paypal["s2member_log"][] = "Redirecting Customer to the Login Page. They need to log back in after this modification.";
148
  /**/
149
  echo '<script type="text/javascript">' . "\n";
150
- echo "alert('Thank You! Your membership has been updated to:\\n\\n" . esc_js ($paypal["item_name"]) . "\\n\\nYou\\'ll need to log back in now.');" . "\n";
151
- echo "window.location = '" . wp_login_url () . "';" . "\n";
152
  echo '</script>' . "\n";
153
  }
154
- else
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
155
  {
156
- $paypal["s2member_log"][] = "Unable to modify Subscription. The existing User ID has a built-in WP Role. Stopping here. Otherwise, an Administrator/Editor/Author/Contributor could lose access.";
 
 
157
  /**/
158
- $paypal["s2member_log"][] = "Redirecting Customer to the Login Page, due to an error that occurred.";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
159
  /**/
160
  echo '<script type="text/javascript">' . "\n";
161
- echo "alert('ERROR: Unable to modify Subscription. Please contact Support for assistance.\\n\\nThe existing User ID has a built-in WP Role. Stopping here. Otherwise, an Administrator/Editor/Author/Contributor could lose access. Please make sure that you are NOT logged in as an Administrator/Editor/Author/Contributor while testing.');" . "\n";
162
- echo "window.location = '" . esc_js (wp_login_url ()) . "';";
163
  echo '</script>' . "\n";
 
 
 
 
164
  }
165
- }
166
- else
167
- {
168
- $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.";
169
  /**/
170
- $paypal["s2member_log"][] = "Redirecting Customer to the Login Page, due to an error that occurred.";
171
- /**/
172
- echo '<script type="text/javascript">' . "\n";
173
- echo "alert('ERROR: Unable to modify Subscription. Please contact Support for assistance.\\n\\nCould not get the existing User ID from the DB.');" . "\n";
174
- echo "window.location = '" . esc_js (wp_login_url ()) . "';";
175
- echo '</script>' . "\n";
176
  }
177
- /**/
178
- do_action ("s2member_during_paypal_return_after_subscr_signup_w_update_vars", get_defined_vars ());
179
- }
180
- /*
181
- New Subscription. Normal Subscription signup, we are not updating anything for a past Subscription.
182
- */
183
- else /* Else this is a normal Subscription signup, we are not updating an existing Subscription. */
184
- {
185
- do_action ("s2member_during_paypal_return_before_subscr_signup_wo_update_vars", get_defined_vars ());
186
- /**/
187
- $processing = $during = true; /* Yes, we ARE processing this new Subscription request. */
188
- /**/
189
- $paypal["s2member_log"][] = "s2Member txn_type identified as (web_accept|subscr_signup|subscr_payment) w/o update vars.";
190
- /**/
191
- setcookie ("s2member_subscr_id", ws_plugin__s2member_encrypt ($paypal["subscr_id"]), time () + 31556926, "/");
192
- setcookie ("s2member_custom", ws_plugin__s2member_encrypt ($paypal["custom"]), time () + 31556926, "/");
193
- setcookie ("s2member_level", ws_plugin__s2member_encrypt ($paypal["item_number"]), time () + 31556926, "/");
194
- /**/
195
- $paypal["s2member_log"][] = "Registration Cookies set on (web_accept|subscr_signup|subscr_payment) w/o update vars.";
196
- /**/
197
- do_action ("s2member_during_paypal_return_during_subscr_signup_wo_update_vars", get_defined_vars ());
198
- /**/
199
- $paypal["s2member_log"][] = "Redirecting Customer to Registration Page. They need to register a Username now.";
200
- /**/
201
- echo '<script type="text/javascript">' . "\n";
202
- echo "alert('Thank You! Your account has been approved.\\nThe next step is to Register a Username.\\n\\nPlease click OK to Register now.');" . "\n";/**/
203
- echo "window.location = '" . esc_js (add_query_arg ("action", "register", wp_login_url ())) . "';" . "\n";
204
- echo '</script>' . "\n";
205
- /**/
206
- do_action ("s2member_during_paypal_return_after_subscr_signup_wo_update_vars", get_defined_vars ());
207
- }
208
- /**/
209
- do_action ("s2member_during_paypal_return_after_subscr_signup", get_defined_vars ());
210
- }
211
- /*
212
- Subscription modifications.
213
- */
214
- 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"]))
215
- {
216
- do_action ("s2member_during_paypal_return_before_subscr_modify", get_defined_vars ());
217
- /**/
218
- $paypal["s2member_log"][] = "s2Member txn_type identified as subscr_modify.";
219
- /**/
220
- list ($paypal["level"], $paypal["ccaps"]) = preg_split ("/\:/", $paypal["item_number"], 2);
221
- /**/
222
- if (($user_id = ws_plugin__s2member_paypal_user_id ($paypal["subscr_id"])))
223
- {
224
- $user = new WP_User ($user_id); /* Acquire user object. */
225
- /**/
226
- if (!ws_plugin__s2member_user_has_wp_role ($user)) /* Non WP Roles. */
227
  {
228
- $processing = $during = true; /* Yes, we ARE processing this. */
229
- /**/
230
- $user->set_role ("s2member_level" . $paypal["level"]);
231
- update_usermeta ($user_id, "s2member_subscr_id", $paypal["subscr_id"]);
232
- update_usermeta ($user_id, "s2member_custom", $paypal["custom"]);
233
- /**/
234
- foreach ($user->allcaps as $cap => $cap_enabled)
235
- if (preg_match ("/^access_s2member_ccap_/", $cap))
236
- $user->remove_cap ($ccap = $cap);
237
- /**/
238
- foreach (preg_split ("/[\r\n\t\s;,]+/", $paypal["ccaps"]) as $ccap)
239
- if (strlen ($ccap)) /* Don't add empty capabilities. */
240
- $user->add_cap ("access_s2member_ccap_" . trim (strtolower ($ccap)));
241
  /**/
242
- delete_usermeta ($user_id, "s2member_file_download_access_arc");
243
- delete_usermeta ($user_id, "s2member_file_download_access_log");
244
- delete_usermeta ($user_id, "s2member_auto_eot_time");
245
  /**/
246
- ws_plugin__s2member_clear_user_note_lines ($user_id, "/^Demoted by s2Member\:/");
247
  /**/
248
- $paypal["s2member_log"][] = "s2Member Level/Capabilities updated on Subscription modification.";
249
- /**/
250
- do_action ("s2member_during_paypal_return_during_subscr_modify", get_defined_vars ());
251
- /**/
252
- $paypal["s2member_log"][] = "Redirecting Customer to the Login Page. They need to log back in after this modification.";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
253
  /**/
254
- echo '<script type="text/javascript">' . "\n";
255
- echo "alert('Thank You! Your membership has been updated to:\\n\\n" . esc_js ($paypal["item_name"]) . "\\n\\nYou\\'ll need to log back in now.');" . "\n";
256
- echo "window.location = '" . esc_js (wp_login_url ()) . "';";
257
- echo '</script>' . "\n";
258
  }
259
  else
260
  {
261
- $paypal["s2member_log"][] = "Unable to modify Subscription. The existing User ID has a built-in WP Role. Stopping here. Otherwise, an Administrator/Editor/Author/Contributor could lose access.";
262
  /**/
263
  $paypal["s2member_log"][] = "Redirecting Customer to the Login Page, due to an error that occurred.";
264
  /**/
265
  echo '<script type="text/javascript">' . "\n";
266
- echo "alert('ERROR: Unable to modify Subscription. Please contact Support for assistance.\\n\\nThe existing User ID has a built-in WP Role. Stopping here. Otherwise, an Administrator/Editor/Author/Contributor could lose access. Please make sure that you are NOT logged in as an Administrator/Editor/Author/Contributor while testing.');" . "\n";
267
  echo "window.location = '" . esc_js (wp_login_url ()) . "';";
268
  echo '</script>' . "\n";
269
  }
270
  }
271
- else
272
- {
273
- $paypal["s2member_log"][] = "Unable to modify Subscription. Could not get the existing User ID from the DB.";
274
- /**/
275
- $paypal["s2member_log"][] = "Redirecting Customer to the Login Page, due to an error that occurred.";
276
- /**/
277
- echo '<script type="text/javascript">' . "\n";
278
- echo "alert('ERROR: Unable to modify Subscription. Please contact Support for assistance.\\n\\nCould not get the existing User ID from the DB.');" . "\n";
279
- echo "window.location = '" . esc_js (wp_login_url ()) . "';";
280
- echo '</script>' . "\n";
281
- }
282
- /**/
283
- do_action ("s2member_during_paypal_return_after_subscr_modify", get_defined_vars ());
284
  }
285
  else
286
  {
287
- $paypal["s2member_log"][] = "Unexpected txn_type. The PayPal® txn_type did not match a required action.";
288
  /**/
289
  $paypal["s2member_log"][] = "Redirecting Customer to the Login Page, due to an error that occurred.";
290
  /**/
291
  echo '<script type="text/javascript">' . "\n";
292
- echo "alert('ERROR: Unexpected txn_type. Please contact Support for assistance.\\n\\nThe PayPal® txn_type did not match a required action.');" . "\n";
293
  echo "window.location = '" . esc_js (wp_login_url ()) . "';";
294
  echo '</script>' . "\n";
295
  }
296
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
297
  else
298
  {
299
- $paypal["s2member_log"][] = "Unable to verify _SERVER[HTTP_HOST]. Please check the `custom` value in your Button Code. It MUST start with your domain name.";
300
  /**/
301
  $paypal["s2member_log"][] = "Redirecting Customer to the Login Page, due to an error that occurred.";
302
  /**/
303
  echo '<script type="text/javascript">' . "\n";
304
- echo "alert('ERROR: Unable to verify _SERVER[HTTP_HOST]. Please contact Support for assistance.\\n\\nIf you are the site owner, please check the `custom` value in your Button Code. It MUST start with your domain name.');" . "\n";
305
  echo "window.location = '" . esc_js (wp_login_url ()) . "';";
306
  echo '</script>' . "\n";
307
  }
308
- }
309
- else if (!isset ($_GET["tx"]) && (empty ($_POST) || $_POST["auth"]))
310
- {
311
- do_action ("s2member_during_paypal_return_before_no_return_data", get_defined_vars ());
312
- /**/
313
- $paypal["s2member_log"][] = "No Return-Data from PayPal®. Customer must wait for Email Confirmation.";
314
  /**/
315
- do_action ("s2member_during_paypal_return_during_no_return_data", get_defined_vars ());
 
316
  /**/
317
- $paypal["s2member_log"][] = "Redirecting Customer to the Home Page.";
 
 
 
318
  /**/
319
- echo '<script type="text/javascript">' . "\n";
320
- echo "alert('Thank You! ( please check your email ).\\n\\n* Note: It can take ( up to 15 minutes ) for Email Confirmation. If you don\'t receive email confirmation in the next 15 minutes, please contact Support.');" . "\n";
321
- echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "alert('** Sandbox Mode ** You will probably NOT receive this Email Confirmation in Sandbox Mode. Sandbox addresses are usually bogus ( for testing ).');" . "\n" : "";
322
- echo "window.location = '" . esc_js (get_bloginfo ("url")) . "';";
323
- echo '</script>' . "\n";
324
  /**/
325
- do_action ("s2member_during_paypal_return_after_no_return_data", get_defined_vars ());
326
  }
327
- else
328
- {
329
- $paypal["s2member_log"][] = "Unable to verify POST vars. This is most likely related to an invalid PayPal® configuration. Please check: s2Member -> PayPal® Options.";
330
- /**/
331
- $paypal["s2member_log"][] = "Redirecting Customer to the Login Page, due to an error that occurred.";
332
- /**/
333
- echo '<script type="text/javascript">' . "\n";
334
- echo "alert('ERROR: Unable to verify POST vars. Please contact Support for assistance.\\n\\nThis is most likely related to an invalid PayPal® configuration. If you are the site owner, please check: s2Member -> PayPal® Options.');" . "\n";
335
- echo "window.location = '" . esc_js (wp_login_url ()) . "';";
336
- echo '</script>' . "\n";
337
- }
338
- /**/
339
- if ($_GET["s2member_paypal_proxy"]) /* For proxy identification. */
340
- $paypal["s2member_paypal_proxy"] = $_GET["s2member_paypal_proxy"];
341
- /**/
342
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_debug"])
343
- if (is_dir ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"]))
344
- if (is_writable ($logs_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"]))
345
- file_put_contents ($logs_dir . "/paypal-rtn.log", var_export ($paypal, true) . "\n\n", FILE_APPEND);
346
- /**/
347
- do_action ("s2member_during_paypal_return", get_defined_vars ());
348
  /**/
349
- exit;
 
 
350
  }
351
- /**/
352
- do_action ("s2member_after_paypal_return", get_defined_vars ());
353
  }
354
  ?>
17
  Handles PayPal® Return URL processing.
18
  Attach to: add_action("init");
19
  */
20
+ if (!function_exists ("ws_plugin__s2member_paypal_return"))
21
  {
22
+ function ws_plugin__s2member_paypal_return ()
 
 
23
  {
24
+ do_action ("ws_plugin__s2member_before_paypal_return", get_defined_vars ());
25
+ /**/
26
+ if ($_GET["s2member_paypal_return"] && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"])
27
  {
28
+ if (is_array ($paypal = ws_plugin__s2member_paypal_postvars ())) /* Verify PayPal® POST vars. */
29
+ {
30
+ $paypal["s2member_log"][] = "Return-Data received on: " . date ("D M j, Y g:i:s a T");
31
+ $paypal["s2member_log"][] = "s2Member POST vars verified through a POST back to PayPal®.";
32
+ /**/
33
+ if (preg_match ("/^" . preg_quote ($_SERVER["HTTP_HOST"], "/") . "/i", $paypal["custom"])) /* Matches originating host? */
34
+ { /* The business address validation was removed from this routine, because PayPal® always fills that with the primary
35
+ email address. In cases where an alternate PayPal® address is being paid, validation was not possible. */
36
+ $paypal["s2member_log"][] = "s2Member originating domain ( _SERVER[HTTP_HOST] ) validated.";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ /**/
53
+ $paypal["s2member_log"][] = "s2Member txn_type identified as (web_accept) for Specific Post/Page access.";
54
+ /**/
55
+ list (, $paypal["sp_ids"], $paypal["hours"]) = preg_split ("/\:/", $paypal["item_number"], 3);
56
  /**/
57
+ if (($sp_access_url = ws_plugin__s2member_sp_access_link_gen ($paypal["sp_ids"], $paypal["hours"], false)))
58
  {
59
  $processing = $during = true; /* Yes, we ARE processing this. */
60
  /**/
61
+ setcookie ("s2member_sp_tracking", ws_plugin__s2member_encrypt ($paypal["txn_id"]), time () + 31556926, "/");
 
 
62
  /**/
63
+ $paypal["s2member_log"][] = "Transient Tracking Cookie set on (web_accept) for Specific Post/Page Access.";
 
 
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
+ {
75
+ $paypal["s2member_log"][] = "Storing Specific Post/Page Tracking Codes into a Transient Queue for s2Member. These will be processed on-site.";
76
+ set_transient (md5 ("s2member_transient_sp_tracking_codes_" . $paypal["txn_id"]), $code, 43200);
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
+ {
90
+ $paypal["s2member_log"][] = "Unable to generate Specific Post/Page Access Link. Does your Leading Post/Page still exist?";
91
  /**/
92
+ $paypal["s2member_log"][] = "Redirecting Customer to the Home Page, due to an error that occurred.";
93
  /**/
94
  echo '<script type="text/javascript">' . "\n";
95
+ echo "alert('ERROR: Unable to generate Access Link. Please contact Support for assistance.');" . "\n";
96
+ echo "window.location = '" . esc_js (get_bloginfo ("url")) . "';";
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
+ /**/
115
+ $paypal["s2member_log"][] = "s2Member txn_type identified as (web_accept|subscr_signup|subscr_payment).";
116
+ /**/
117
+ list ($paypal["level"], $paypal["ccaps"], $paypal["eotper"]) = preg_split ("/\:/", $paypal["item_number"], 3);
118
+ /*
119
+ New Subscription with advanced update vars ( option_name1, option_selection1 ).
120
+ */
121
+ if (preg_match ("/(updat|upgrad)/i", $paypal["option_name1"]) && $paypal["option_selection1"]) /* Advanced Subscription update modifications. */
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. */
139
+ /**/
140
+ $user->set_role ("s2member_level" . $paypal["level"]);
141
+ update_usermeta ($user_id, "s2member_subscr_id", $paypal["subscr_id"]);
142
+ update_usermeta ($user_id, "s2member_custom", $paypal["custom"]);
143
+ /**/
144
+ foreach ($user->allcaps as $cap => $cap_enabled)
145
+ if (preg_match ("/^access_s2member_ccap_/", $cap))
146
+ $user->remove_cap ($ccap = $cap);
147
+ /**/
148
+ foreach (preg_split ("/[\r\n\t\s;,]+/", $paypal["ccaps"]) as $ccap)
149
+ if (strlen ($ccap)) /* Don't add empty capabilities. */
150
+ $user->add_cap ("access_s2member_ccap_" . trim (strtolower ($ccap)));
151
+ /**/
152
+ delete_usermeta ($user_id, "s2member_file_download_access_arc");
153
+ delete_usermeta ($user_id, "s2member_file_download_access_log");
154
+ /**/
155
+ if (preg_match ("/^web_accept$/i", $paypal["txn_type"]) && $paypal["eotper"])
156
+ update_usermeta ($user_id, "s2member_auto_eot_time", ws_plugin__s2member_paypal_auto_eot_time (0, 0, 0, $paypal["eotper"]));
157
+ else /* Otherwise, we need to clear the eot time. */
158
+ delete_usermeta ($user_id, "s2member_auto_eot_time");
159
+ /**/
160
+ ws_plugin__s2member_clear_user_note_lines ($user_id, "/^Demoted by s2Member\:/");
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
+ /**/
168
+ $paypal["s2member_log"][] = "Redirecting Customer to the Login Page. They need to log back in after this modification.";
169
+ /**/
170
+ echo '<script type="text/javascript">' . "\n";
171
+ echo "alert('Thank You! Your membership has been updated to:\\n\\n" . esc_js ($paypal["item_name"]) . "\\n\\nYou\\'ll need to log back in now.');" . "\n";
172
+ echo "window.location = '" . wp_login_url () . "';" . "\n";
173
+ echo '</script>' . "\n";
174
+ }
175
+ else
176
+ {
177
+ $paypal["s2member_log"][] = "Unable to modify Subscription. The existing User ID has a built-in WP Role. Stopping here. Otherwise, an Administrator/Editor/Author/Contributor could lose access.";
178
+ /**/
179
+ $paypal["s2member_log"][] = "Redirecting Customer to the Login Page, due to an error that occurred.";
180
+ /**/
181
+ echo '<script type="text/javascript">' . "\n";
182
+ echo "alert('ERROR: Unable to modify Subscription. Please contact Support for assistance.\\n\\nThe existing User ID has a built-in WP Role. Stopping here. Otherwise, an Administrator/Editor/Author/Contributor could lose access. Please make sure that you are NOT logged in as an Administrator/Editor/Author/Contributor while testing.');" . "\n";
183
+ echo "window.location = '" . esc_js (wp_login_url ()) . "';";
184
+ echo '</script>' . "\n";
185
+ }
186
+ }
187
+ else
188
+ {
189
+ $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.";
190
+ /**/
191
+ $paypal["s2member_log"][] = "Redirecting Customer to the Login Page, due to an error that occurred.";
192
+ /**/
193
+ echo '<script type="text/javascript">' . "\n";
194
+ echo "alert('ERROR: Unable to modify Subscription. Please contact Support for assistance.\\n\\nCould not get the existing User ID from the DB.');" . "\n";
195
+ echo "window.location = '" . esc_js (wp_login_url ()) . "';";
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
+ }
203
+ /*
204
+ New Subscription. Normal Subscription signup, we are not updating anything for a past Subscription.
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
+ /**/
212
+ $processing = $during = true; /* Yes, we ARE processing this new Subscription request. */
213
+ /**/
214
+ $paypal["s2member_log"][] = "s2Member txn_type identified as (web_accept|subscr_signup|subscr_payment) w/o update vars.";
215
+ /**/
216
+ setcookie ("s2member_subscr_id", ws_plugin__s2member_encrypt ($paypal["subscr_id"]), time () + 31556926, "/");
217
+ setcookie ("s2member_custom", ws_plugin__s2member_encrypt ($paypal["custom"]), time () + 31556926, "/");
218
+ setcookie ("s2member_level", ws_plugin__s2member_encrypt ($paypal["item_number"]), time () + 31556926, "/");
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
+ /**/
226
+ $paypal["s2member_log"][] = "Redirecting Customer to Registration Page. They need to register a Username now.";
227
  /**/
228
  echo '<script type="text/javascript">' . "\n";
229
+ echo "alert('Thank You! Your account has been approved.\\nThe next step is to Register a Username.\\n\\nPlease click OK to Register now.');" . "\n";/**/
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
  /**/
251
+ $paypal["s2member_log"][] = "s2Member txn_type identified as subscr_modify.";
 
 
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. */
262
+ /**/
263
+ $user->set_role ("s2member_level" . $paypal["level"]);
264
+ update_usermeta ($user_id, "s2member_subscr_id", $paypal["subscr_id"]);
265
+ update_usermeta ($user_id, "s2member_custom", $paypal["custom"]);
266
+ /**/
267
+ foreach ($user->allcaps as $cap => $cap_enabled)
268
+ if (preg_match ("/^access_s2member_ccap_/", $cap))
269
+ $user->remove_cap ($ccap = $cap);
270
+ /**/
271
+ foreach (preg_split ("/[\r\n\t\s;,]+/", $paypal["ccaps"]) as $ccap)
272
+ if (strlen ($ccap)) /* Don't add empty capabilities. */
273
+ $user->add_cap ("access_s2member_ccap_" . trim (strtolower ($ccap)));
274
+ /**/
275
+ delete_usermeta ($user_id, "s2member_file_download_access_arc");
276
+ delete_usermeta ($user_id, "s2member_file_download_access_log");
277
+ delete_usermeta ($user_id, "s2member_auto_eot_time");
278
+ /**/
279
+ ws_plugin__s2member_clear_user_note_lines ($user_id, "/^Demoted by s2Member\:/");
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
+ /**/
287
+ $paypal["s2member_log"][] = "Redirecting Customer to the Login Page. They need to log back in after this modification.";
288
+ /**/
289
+ echo '<script type="text/javascript">' . "\n";
290
+ echo "alert('Thank You! Your membership has been updated to:\\n\\n" . esc_js ($paypal["item_name"]) . "\\n\\nYou\\'ll need to log back in now.');" . "\n";
291
+ echo "window.location = '" . esc_js (wp_login_url ()) . "';";
292
+ echo '</script>' . "\n";
293
+ }
294
+ else
295
+ {
296
+ $paypal["s2member_log"][] = "Unable to modify Subscription. The existing User ID has a built-in WP Role. Stopping here. Otherwise, an Administrator/Editor/Author/Contributor could lose access.";
297
+ /**/
298
+ $paypal["s2member_log"][] = "Redirecting Customer to the Login Page, due to an error that occurred.";
299
+ /**/
300
+ echo '<script type="text/javascript">' . "\n";
301
+ echo "alert('ERROR: Unable to modify Subscription. Please contact Support for assistance.\\n\\nThe existing User ID has a built-in WP Role. Stopping here. Otherwise, an Administrator/Editor/Author/Contributor could lose access. Please make sure that you are NOT logged in as an Administrator/Editor/Author/Contributor while testing.');" . "\n";
302
+ echo "window.location = '" . esc_js (wp_login_url ()) . "';";
303
+ echo '</script>' . "\n";
304
+ }
305
+ }
306
+ else
307
+ {
308
+ $paypal["s2member_log"][] = "Unable to modify Subscription. Could not get the existing User ID from the DB.";
309
+ /**/
310
+ $paypal["s2member_log"][] = "Redirecting Customer to the Login Page, due to an error that occurred.";
311
+ /**/
312
+ echo '<script type="text/javascript">' . "\n";
313
+ echo "alert('ERROR: Unable to modify Subscription. Please contact Support for assistance.\\n\\nCould not get the existing User ID from the DB.');" . "\n";
314
+ echo "window.location = '" . esc_js (wp_login_url ()) . "';";
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
  }
322
  else
323
  {
324
+ $paypal["s2member_log"][] = "Unexpected txn_type. The PayPal® txn_type did not match a required action.";
325
  /**/
326
  $paypal["s2member_log"][] = "Redirecting Customer to the Login Page, due to an error that occurred.";
327
  /**/
328
  echo '<script type="text/javascript">' . "\n";
329
+ echo "alert('ERROR: Unexpected txn_type. Please contact Support for assistance.\\n\\nThe PayPal® txn_type did not match a required action.');" . "\n";
330
  echo "window.location = '" . esc_js (wp_login_url ()) . "';";
331
  echo '</script>' . "\n";
332
  }
333
  }
334
+ else /* Else a custom conditional has been applied by filters. */
335
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
 
 
 
 
 
 
 
 
 
 
 
336
  }
337
  else
338
  {
339
+ $paypal["s2member_log"][] = "Unable to verify _SERVER[HTTP_HOST]. Please check the `custom` value in your Button Code. It MUST start with your domain name.";
340
  /**/
341
  $paypal["s2member_log"][] = "Redirecting Customer to the Login Page, due to an error that occurred.";
342
  /**/
343
  echo '<script type="text/javascript">' . "\n";
344
+ echo "alert('ERROR: Unable to verify _SERVER[HTTP_HOST]. Please contact Support for assistance.\\n\\nIf you are the site owner, please check the `custom` value in your Button Code. It MUST start with your domain name.');" . "\n";
345
  echo "window.location = '" . esc_js (wp_login_url ()) . "';";
346
  echo '</script>' . "\n";
347
  }
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
+ /**/
361
+ $paypal["s2member_log"][] = "Redirecting Customer to the Home Page.";
362
+ /**/
363
+ echo '<script type="text/javascript">' . "\n";
364
+ echo "alert('Thank You! ( please check your email ).\\n\\n* Note: It can take ( up to 15 minutes ) for Email Confirmation. If you don\'t receive email confirmation in the next 15 minutes, please contact Support.');" . "\n";
365
+ echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "alert('** Sandbox Mode ** You will probably NOT receive this Email Confirmation in Sandbox Mode. Sandbox addresses are usually bogus ( for testing ).');" . "\n" : "";
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
  /**/
379
  echo '<script type="text/javascript">' . "\n";
380
+ echo "alert('ERROR: Unable to verify POST vars. Please contact Support for assistance.\\n\\nThis is most likely related to an invalid PayPal® configuration. If you are the site owner, please check: s2Member -> PayPal® Options.');" . "\n";
381
  echo "window.location = '" . esc_js (wp_login_url ()) . "';";
382
  echo '</script>' . "\n";
383
  }
 
 
 
 
 
 
384
  /**/
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
  }
 
 
404
  }
405
  ?>
includes/functions/paypal-utilities.inc.php CHANGED
@@ -16,185 +16,219 @@ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
16
  /*
17
  Get POST vars from PayPal®, verify and return array.
18
  */
19
- function ws_plugin__s2member_paypal_postvars ()
20
  {
21
- do_action ("s2member_before_paypal_postvars", get_defined_vars ());
22
- /**/
23
- if ($_GET["tx"]) /* PDT with Auto-Return. */
24
  {
25
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_identity_token"])
 
 
 
 
 
 
 
26
  {
27
- $postback["tx"] = $_GET["tx"];
28
- $postback["cmd"] = "_notify-synch";
29
- $postback["at"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_identity_token"];
30
  /**/
31
- $endpoint = ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "www.sandbox.paypal.com" : "www.paypal.com";
32
- /**/
33
- if (preg_match ("/^SUCCESS/i", ($response = trim (ws_plugin__s2member_remote ("https://" . $endpoint . "/cgi-bin/webscr", $postback)))))
34
  {
35
- foreach (preg_split ("/[\r\n]+/", preg_replace ("/^SUCCESS/i", "", $response)) as $varline)
36
  {
37
- list ($key, $value) = preg_split ("/\=/", $varline, 2);
38
- if (strlen ($key = trim ($key)) && strlen ($value = trim ($value)))
39
- $postvars[$key] = trim (stripslashes (urldecode ($value)));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  }
 
 
 
 
 
 
 
 
 
 
 
 
41
  /**/
42
- return apply_filters ("s2member_paypal_postvars", $postvars, get_defined_vars ());
 
 
 
 
 
43
  }
 
 
44
  }
45
- /**/
46
- return false;
47
- }
48
- else if (is_array ($postvars = stripslashes_deep ($_POST)))
49
- {
50
- $postback = $postvars;
51
- $postback["cmd"] = "_notify-validate";
52
- /**/
53
- foreach ($postvars as $key => $value)
54
- $postvars[$key] = trim ($value);
55
- /**/
56
- $endpoint = ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "www.sandbox.paypal.com" : "www.paypal.com";
57
- /**/
58
- if (strtolower (trim (ws_plugin__s2member_remote ("https://" . $endpoint . "/cgi-bin/webscr", $postback))) === "verified")
59
  {
60
- return apply_filters ("s2member_paypal_postvars", $postvars, get_defined_vars ());
 
 
61
  }
62
- /**/
63
- return false;
64
- }
65
- else /* Unable to obtain. */
66
- {
67
- return false;
68
  }
69
  }
70
  /*
71
  Get the custom value for an existing Member, referenced by a Subscr. ID.
72
  */
73
- function ws_plugin__s2member_paypal_custom ($subscr_id = FALSE, $os0 = FALSE)
74
  {
75
- global $wpdb; /* Need global DB obj. */
76
- /**/
77
- do_action ("s2member_before_paypal_custom", get_defined_vars ());
78
- /**/
79
- if ($subscr_id && $os0) /* This case includes some additional routines that can use the $os0 value. */
80
  {
81
- if (($q = $wpdb->get_row ("SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = 's2member_subscr_id' AND (`meta_value` = '" . $wpdb->escape ($subscr_id) . "' OR `meta_value` = '" . $wpdb->escape ($os0) . "') LIMIT 1"))/**/
82
- || ($q = $wpdb->get_row ("SELECT `ID` AS `user_id` FROM `" . $wpdb->users . "` WHERE `ID` = '" . $wpdb->escape ($os0) . "' LIMIT 1")))
83
- if (($custom = get_usermeta ($q->user_id, "s2member_custom")))
84
- return apply_filters ("s2member_paypal_custom", $custom, get_defined_vars ());
85
- }
86
- else if ($subscr_id) /* Otherwise, if all we have is a Subscr. ID value. */
87
- {
88
- if ($q = $wpdb->get_row ("SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = 's2member_subscr_id' AND `meta_value` = '" . $wpdb->escape ($subscr_id) . "' LIMIT 1"))
89
- if (($custom = get_usermeta ($q->user_id, "s2member_custom")))
90
- return apply_filters ("s2member_paypal_custom", $custom, get_defined_vars ());
 
 
 
 
 
 
 
 
 
 
 
91
  }
92
- /**/
93
- return apply_filters ("s2member_paypal_custom", false, get_defined_vars ());
94
  }
95
  /*
96
  Get the user ID for an existing Member, referenced by a Subscr. ID.
97
  A second lookup parameter can be provided, which will trigger some additional routines.
98
  The $os0 value comes from advanced update vars, pertaining to subscription modifications.
99
  */
100
- function ws_plugin__s2member_paypal_user_id ($subscr_id = FALSE, $os0 = FALSE)
101
  {
102
- global $wpdb; /* Need global DB obj. */
103
- /**/
104
- do_action ("s2member_before_paypal_user_id", get_defined_vars ());
105
- /**/
106
- if ($subscr_id && $os0) /* This case includes some additional routines that can use the $os0 value. */
107
  {
108
- if (($q = $wpdb->get_row ("SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = 's2member_subscr_id' AND (`meta_value` = '" . $wpdb->escape ($subscr_id) . "' OR `meta_value` = '" . $wpdb->escape ($os0) . "') LIMIT 1"))/**/
109
- || ($q = $wpdb->get_row ("SELECT `ID` AS `user_id` FROM `" . $wpdb->users . "` WHERE `ID` = '" . $wpdb->escape ($os0) . "' LIMIT 1")))
110
- return apply_filters ("s2member_paypal_user_id", $q->user_id, get_defined_vars ());
111
- }
112
- else if ($subscr_id) /* Otherwise, if all we have is a Subscr. ID value. */
113
- {
114
- if ($q = $wpdb->get_row ("SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = 's2member_subscr_id' AND `meta_value` = '" . $wpdb->escape ($subscr_id) . "' LIMIT 1"))
115
- return apply_filters ("s2member_paypal_user_id", $q->user_id, get_defined_vars ());
 
 
 
 
 
 
 
 
 
 
 
116
  }
117
- /**/
118
- return apply_filters ("s2member_paypal_user_id", false, get_defined_vars ());
119
  }
120
  /*
121
  Calculate Auto-EOT Time, based on last_payment_time, period1, and period3.
122
  This is used by s2Member's built-in Auto-EOT System, and by its IPN routines.
123
  */
124
- function ws_plugin__s2member_paypal_auto_eot_time ($user_id = FALSE, $period1 = FALSE, $period3 = FALSE, $eotper = FALSE)
125
  {
126
- do_action ("s2member_before_paypal_auto_eot_time", get_defined_vars ());
127
- /**/
128
- if ($user_id && ($user = new WP_User ($user_id))) /* Must have a valid user_id. */
129
  {
130
- $registration_time = strtotime ($user->user_registered);
131
- $last_payment_time = (int)get_usermeta ($user_id, "s2member_last_payment_time");
 
132
  /**/
133
- if (!($p1_time = 0) && ($period1 = trim (strtoupper ($period1))))
134
  {
135
- list ($num, $span) = preg_split ("/ /", $period1, 2);
136
- /**/
137
- $days = 0; /* Days start at 0. */
138
- $days = ($span === "D") ? 1 : $days;
139
- $days = ($span === "W") ? 7 : $days;
140
- $days = ($span === "M") ? 30 : $days;
141
- $days = ($span === "Y") ? 365 : $days;
142
  /**/
143
- $p1_days = (int)$num * (int)$days;
144
- $p1_time = $p1_days * 86400;
145
- }
146
- /**/
147
- if (!($p3_time = 0) && ($period3 = trim (strtoupper ($period3))))
148
- {
149
- list ($num, $span) = preg_split ("/ /", $period3, 2);
 
 
 
 
 
 
150
  /**/
151
- $days = 0; /* Days start at 0. */
152
- $days = ($span === "D") ? 1 : $days;
153
- $days = ($span === "W") ? 7 : $days;
154
- $days = ($span === "M") ? 30 : $days;
155
- $days = ($span === "Y") ? 365 : $days;
 
 
 
 
 
 
 
 
156
  /**/
157
- $p3_days = (int)$num * (int)$days;
158
- $p3_time = $p3_days * 86400;
 
 
 
 
 
 
 
 
 
 
 
 
159
  }
160
  /**/
161
- if (!$last_payment_time) /* If no payment yet.
162
- EOT after p1, if there was a p1. Otherwise, now + 1 day grace. */
163
- {
164
- $auto_eot_time = $registration_time + $p1_time + 86400;
165
- }
166
- /* Else if p1, and last payment was within p1, last + p1 + 1 day grace. */
167
- else if ($p1_time && $last_payment_time <= $registration_time + $p1_time)
168
- {
169
- $auto_eot_time = $last_payment_time + $p1_time + 86400;
170
- }
171
- else /* Otherwise, the EOT comes after last payment + p3 + 1 day grace. */
172
- {
173
- $auto_eot_time = $last_payment_time + $p3_time + 86400;
174
- }
175
- }
176
- /**/
177
- else if ($eotper) /* Otherwise, if we have a specific EOT period; calculate from today. */
178
- {
179
- if (!($eot_time = 0) && ($eotper = trim (strtoupper ($eotper))))
180
  {
181
- list ($num, $span) = preg_split ("/ /", $eotper, 2);
182
- /**/
183
- $days = 0; /* Days start at 0. */
184
- $days = ($span === "D") ? 1 : $days;
185
- $days = ($span === "W") ? 7 : $days;
186
- $days = ($span === "M") ? 30 : $days;
187
- $days = ($span === "Y") ? 365 : $days;
 
 
 
 
 
 
188
  /**/
189
- $eot_days = (int)$num * (int)$days;
190
- $eot_time = $eot_days * 86400;
191
  }
192
  /**/
193
- $auto_eot_time = strtotime ("now") + $eot_time + 86400;
 
 
194
  }
195
- /**/
196
- $auto_eot_time = ($auto_eot_time <= 0) ? strtotime ("now") : $auto_eot_time;
197
- /**/
198
- return apply_filters ("s2member_paypal_auto_eot_time", $auto_eot_time, get_defined_vars ());
199
  }
200
  ?>
16
  /*
17
  Get POST vars from PayPal®, verify and return array.
18
  */
19
+ if (!function_exists ("ws_plugin__s2member_paypal_postvars"))
20
  {
21
+ function ws_plugin__s2member_paypal_postvars ()
 
 
22
  {
23
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
24
+ do_action ("ws_plugin__s2member_before_paypal_postvars", get_defined_vars ());
25
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
26
+ /*
27
+ Custom conditionals can be applied by filters.
28
+ */
29
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
30
+ if (!($postvars = apply_filters ("ws_plugin__s2member_during_paypal_postvars_conditionals", array (), get_defined_vars ())))
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
  {
38
+ $postback["tx"] = $_GET["tx"];
39
+ $postback["cmd"] = "_notify-synch";
40
+ $postback["at"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_identity_token"];
41
+ /**/
42
+ $endpoint = ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "www.sandbox.paypal.com" : "www.paypal.com";
43
+ /**/
44
+ if (preg_match ("/^SUCCESS/i", ($response = trim (ws_plugin__s2member_remote ("https://" . $endpoint . "/cgi-bin/webscr", $postback)))))
45
+ {
46
+ foreach (preg_split ("/[\r\n]+/", preg_replace ("/^SUCCESS/i", "", $response)) as $varline)
47
+ {
48
+ list ($key, $value) = preg_split ("/\=/", $varline, 2);
49
+ if (strlen ($key = trim ($key)) && strlen ($value = trim ($value)))
50
+ $postvars[$key] = trim (stripslashes (urldecode ($value)));
51
+ }
52
+ /**/
53
+ return apply_filters ("ws_plugin__s2member_paypal_postvars", $postvars, get_defined_vars ());
54
+ }
55
+ else /* Nope. */
56
+ return false;
57
  }
58
+ else /* Nope. */
59
+ return false;
60
+ }
61
+ else if (is_array ($postvars = stripslashes_deep ($_POST)))
62
+ {
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
+ }
75
+ else /* Nope. */
76
+ return false;
77
  }
78
+ else /* Nope. */
79
+ return false;
80
  }
81
+ else /* Else a custom conditional has been applied by filters. */
 
 
 
 
 
 
 
 
 
 
 
 
 
82
  {
83
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
84
+ /**/
85
+ return apply_filters ("ws_plugin__s2member_paypal_postvars", $postvars, get_defined_vars ());
86
  }
 
 
 
 
 
 
87
  }
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
  {
94
+ function ws_plugin__s2member_paypal_custom ($subscr_id = FALSE, $os0 = FALSE)
 
 
 
 
95
  {
96
+ global $wpdb; /* Need global DB obj. */
97
+ /**/
98
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
99
+ do_action ("ws_plugin__s2member_before_paypal_custom", get_defined_vars ());
100
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
101
+ /**/
102
+ if ($subscr_id && $os0) /* This case includes some additional routines that can use the $os0 value. */
103
+ {
104
+ if (($q = $wpdb->get_row ("SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = 's2member_subscr_id' AND (`meta_value` = '" . $wpdb->escape ($subscr_id) . "' OR `meta_value` = '" . $wpdb->escape ($os0) . "') LIMIT 1"))/**/
105
+ || ($q = $wpdb->get_row ("SELECT `ID` AS `user_id` FROM `" . $wpdb->users . "` WHERE `ID` = '" . $wpdb->escape ($os0) . "' LIMIT 1")))
106
+ if (($custom = get_usermeta ($q->user_id, "s2member_custom")))
107
+ return apply_filters ("ws_plugin__s2member_paypal_custom", $custom, get_defined_vars ());
108
+ }
109
+ else if ($subscr_id) /* Otherwise, if all we have is a Subscr. ID value. */
110
+ {
111
+ if ($q = $wpdb->get_row ("SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = 's2member_subscr_id' AND `meta_value` = '" . $wpdb->escape ($subscr_id) . "' LIMIT 1"))
112
+ if (($custom = get_usermeta ($q->user_id, "s2member_custom")))
113
+ return apply_filters ("ws_plugin__s2member_paypal_custom", $custom, get_defined_vars ());
114
+ }
115
+ /**/
116
+ return apply_filters ("ws_plugin__s2member_paypal_custom", false, get_defined_vars ());
117
  }
 
 
118
  }
119
  /*
120
  Get the user ID for an existing Member, referenced by a Subscr. ID.
121
  A second lookup parameter can be provided, which will trigger some additional routines.
122
  The $os0 value comes from advanced update vars, pertaining to subscription modifications.
123
  */
124
+ if (!function_exists ("ws_plugin__s2member_paypal_user_id"))
125
  {
126
+ function ws_plugin__s2member_paypal_user_id ($subscr_id = FALSE, $os0 = FALSE)
 
 
 
 
127
  {
128
+ global $wpdb; /* Need global DB obj. */
129
+ /**/
130
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
131
+ do_action ("ws_plugin__s2member_before_paypal_user_id", get_defined_vars ());
132
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
133
+ /**/
134
+ if ($subscr_id && $os0) /* This case includes some additional routines that can use the $os0 value. */
135
+ {
136
+ if (($q = $wpdb->get_row ("SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = 's2member_subscr_id' AND (`meta_value` = '" . $wpdb->escape ($subscr_id) . "' OR `meta_value` = '" . $wpdb->escape ($os0) . "') LIMIT 1"))/**/
137
+ || ($q = $wpdb->get_row ("SELECT `ID` AS `user_id` FROM `" . $wpdb->users . "` WHERE `ID` = '" . $wpdb->escape ($os0) . "' LIMIT 1")))
138
+ return apply_filters ("ws_plugin__s2member_paypal_user_id", $q->user_id, get_defined_vars ());
139
+ }
140
+ else if ($subscr_id) /* Otherwise, if all we have is a Subscr. ID value. */
141
+ {
142
+ if ($q = $wpdb->get_row ("SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = 's2member_subscr_id' AND `meta_value` = '" . $wpdb->escape ($subscr_id) . "' LIMIT 1"))
143
+ return apply_filters ("ws_plugin__s2member_paypal_user_id", $q->user_id, get_defined_vars ());
144
+ }
145
+ /**/
146
+ return apply_filters ("ws_plugin__s2member_paypal_user_id", false, get_defined_vars ());
147
  }
 
 
148
  }
149
  /*
150
  Calculate Auto-EOT Time, based on last_payment_time, period1, and period3.
151
  This is used by s2Member's built-in Auto-EOT System, and by its IPN routines.
152
  */
153
+ if (!function_exists ("ws_plugin__s2member_paypal_auto_eot_time"))
154
  {
155
+ function ws_plugin__s2member_paypal_auto_eot_time ($user_id = FALSE, $period1 = FALSE, $period3 = FALSE, $eotper = FALSE)
 
 
156
  {
157
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
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");
 
 
 
 
 
165
  /**/
166
+ if (!($p1_time = 0) && ($period1 = trim (strtoupper ($period1))))
167
+ {
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;
178
+ }
179
  /**/
180
+ if (!($p3_time = 0) && ($period3 = trim (strtoupper ($period3))))
181
+ {
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;
192
+ }
193
  /**/
194
+ if (!$last_payment_time) /* If no payment yet.
195
+ EOT after p1, if there was a p1. Otherwise, now + 1 day grace. */
196
+ {
197
+ $auto_eot_time = $registration_time + $p1_time + 86400;
198
+ }
199
+ /* Else if p1, and last payment was within p1, last + p1 + 1 day grace. */
200
+ else if ($p1_time && $last_payment_time <= $registration_time + $p1_time)
201
+ {
202
+ $auto_eot_time = $last_payment_time + $p1_time + 86400;
203
+ }
204
+ else /* Otherwise, the EOT comes after last payment + p3 + 1 day grace. */
205
+ {
206
+ $auto_eot_time = $last_payment_time + $p3_time + 86400;
207
+ }
208
  }
209
  /**/
210
+ else if ($eotper) /* Otherwise, if we have a specific EOT period; calculate from today. */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
211
  {
212
+ if (!($eot_time = 0) && ($eotper = trim (strtoupper ($eotper))))
213
+ {
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;
224
+ }
225
  /**/
226
+ $auto_eot_time = strtotime ("now") + $eot_time + 86400;
 
227
  }
228
  /**/
229
+ $auto_eot_time = ($auto_eot_time <= 0) ? strtotime ("now") : $auto_eot_time;
230
+ /**/
231
+ return apply_filters ("ws_plugin__s2member_paypal_auto_eot_time", $auto_eot_time, get_defined_vars ());
232
  }
 
 
 
 
233
  }
234
  ?>
includes/functions/post-level-access.inc.php CHANGED
@@ -17,53 +17,56 @@ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
17
  Function for handling post level access permissions.
18
  Attach to: add_action("template_redirect");
19
  */
20
- function ws_plugin__s2member_check_post_level_access ()
21
  {
22
- global $post; /* get_the_ID() not yet available here. */
23
- /**/
24
- do_action ("s2member_before_check_post_level_access", get_defined_vars ());
25
- /**/
26
- $excluded = apply_filters ("s2member_check_post_level_access_excluded", false, get_defined_vars ());
27
- /**/
28
- if (!$excluded && is_single () && !is_page () && is_object ($post) && ($post_ID = $post->ID))
29
  {
30
- if (!ws_plugin__s2member_is_systematic_use_page ()) /* Never restrict systematic use pages. */
 
 
 
 
 
 
31
  {
32
- $current_user = (is_user_logged_in ()) ? wp_get_current_user () : false;
33
- /**/
34
- 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")
35
- exit;
36
- /**/
37
- 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")
38
- exit;
39
- /**/
40
- 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")
41
- exit;
42
- /**/
43
- 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")
44
- exit;
45
- /**/
46
- 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")
47
- exit;
48
- /**/
49
- 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")
50
- exit;
51
- /**/
52
- 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")
53
- exit;
54
- /**/
55
- 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")
56
- exit;
57
- /**/
58
- 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")
59
- exit;
60
- /**/
61
- do_action ("s2member_during_check_post_level_access", get_defined_vars ());
 
 
 
62
  }
 
 
 
 
63
  }
64
- /**/
65
- do_action ("s2member_after_check_post_level_access", get_defined_vars ());
66
- /**/
67
- return;
68
  }
69
  ?>
17
  Function for handling post level access permissions.
18
  Attach to: add_action("template_redirect");
19
  */
20
+ if (!function_exists ("ws_plugin__s2member_check_post_level_access"))
21
  {
22
+ function ws_plugin__s2member_check_post_level_access ()
 
 
 
 
 
 
23
  {
24
+ global $post; /* get_the_ID() not yet available here. */
25
+ /**/
26
+ do_action ("ws_plugin__s2member_before_check_post_level_access", get_defined_vars ());
27
+ /**/
28
+ $excluded = apply_filters ("ws_plugin__s2member_check_post_level_access_excluded", false, get_defined_vars ());
29
+ /**/
30
+ if (!$excluded && is_single () && !is_page () && is_object ($post) && ($post_ID = $post->ID))
31
  {
32
+ if (!ws_plugin__s2member_is_systematic_use_page ()) /* Never restrict systematic use pages. */
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
+ }
65
  }
66
+ /**/
67
+ do_action ("ws_plugin__s2member_after_check_post_level_access", get_defined_vars ());
68
+ /**/
69
+ return;
70
  }
 
 
 
 
71
  }
72
  ?>
includes/functions/profile-modifications.inc.php CHANGED
@@ -17,67 +17,77 @@ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
17
  Function for handling profile modifications.
18
  Attach to: add_action("init");
19
  */
20
- function ws_plugin__s2member_handle_profile_modifications ()
21
  {
22
- do_action ("s2member_before_handle_profile_modifications", get_defined_vars ());
23
- /**/
24
- if ($_GET["s2member_profile"] && ($current_user = (is_user_logged_in ()) ? wp_get_current_user () : false))
25
  {
26
- if (($nonce = $_POST["ws_plugin__s2member_profile_save"]) && wp_verify_nonce ($nonce, "ws-plugin--s2member-profile-save"))
 
 
27
  {
28
- $_POST = stripslashes_deep ($_POST); /* Clean POST vars. */
29
- /**/
30
- $userdata["ID"] = $user_id = $current_user->ID;
31
- /**/
32
- include_once (ABSPATH . WPINC . "/registration.php");
33
- /**/
34
- if (trim ($_POST["ws_plugin__s2member_profile_email"]))
35
- if (is_email (trim ($_POST["ws_plugin__s2member_profile_email"])))
36
- if (!email_exists (trim ($_POST["ws_plugin__s2member_profile_email"])))
37
- $userdata["user_email"] = trim ($_POST["ws_plugin__s2member_profile_email"]);
38
- /**/
39
- if (trim ($_POST["ws_plugin__s2member_profile_password"]))
40
- $userdata["user_pass"] = trim ($_POST["ws_plugin__s2member_profile_password"]);
41
- /**/
42
- $userdata["first_name"] = $userdata["display_name"] = trim ($_POST["ws_plugin__s2member_profile_first_name"]);
43
- /**/
44
- $userdata["last_name"] = trim ($_POST["ws_plugin__s2member_profile_last_name"]);
45
- /**/
46
- wp_update_user ($userdata); /* Send this array for an update. */
47
- /**/
48
- foreach (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) as $field)
49
  {
50
- if ($field = trim ($field, "* \t\n\r\0\x0B")) /* Don't process empty fields. */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  {
52
- $field = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field));
53
- $fields[$field] = trim ($_POST["ws_plugin__s2member_profile_" . $field]);
 
 
 
54
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  }
56
  /**/
57
- update_usermeta ($user_id, "s2member_custom_fields", $fields);
 
 
58
  /**/
59
- do_action ("s2member_during_handle_profile_modifications", get_defined_vars ());
60
  /**/
61
- echo '<script type="text/javascript">' . "\n";
62
- echo "if(window.parent && window.parent != window) { try{ window.parent.Shadowbox.close(); } catch(e){} try{ window.parent.tb_remove(); } catch(e){} window.parent.alert('Profile updated successfully!'); window.parent.location = '" . esc_js (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"])) . "'; }";
63
- echo "else if(window.opener) { window.close(); window.opener.alert('Profile updated successfully!'); window.opener.location = '" . esc_js (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"])) . "'; }";
64
- echo "else { alert('Profile updated successfully!'); window.location = '" . esc_js (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"])) . "'; }";
65
- echo '</script>' . "\n";
66
  /**/
67
  exit;
68
  }
69
  /**/
70
- do_action ("s2member_before_profile", get_defined_vars ());
71
- /**/
72
- include_once dirname (dirname (__FILE__)) . "/profile.inc.php";
73
- /**/
74
- do_action ("s2member_after_profile", get_defined_vars ());
75
  /**/
76
- exit;
77
  }
78
- /**/
79
- do_action ("s2member_after_handle_profile_modifications", get_defined_vars ());
80
- /**/
81
- return;
82
  }
83
  ?>
17
  Function for handling profile modifications.
18
  Attach to: add_action("init");
19
  */
20
+ if (!function_exists ("ws_plugin__s2member_handle_profile_modifications"))
21
  {
22
+ function ws_plugin__s2member_handle_profile_modifications ()
 
 
23
  {
24
+ do_action ("ws_plugin__s2member_before_handle_profile_modifications", get_defined_vars ());
25
+ /**/
26
+ if ($_GET["s2member_profile"] && ($current_user = (is_user_logged_in ()) ? wp_get_current_user () : false))
27
  {
28
+ if (($nonce = $_POST["ws_plugin__s2member_profile_save"]) && wp_verify_nonce ($nonce, "ws-plugin--s2member-profile-save"))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  {
30
+ $_POST = stripslashes_deep ($_POST); /* Clean POST vars. */
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"])))
38
+ if (!email_exists (trim ($_POST["ws_plugin__s2member_profile_email"])))
39
+ $userdata["user_email"] = trim ($_POST["ws_plugin__s2member_profile_email"]);
40
+ /**/
41
+ if (trim ($_POST["ws_plugin__s2member_profile_password"]))
42
+ if ($current_user->user_login !== "demo") /* No password change on demos. */
43
+ $userdata["user_pass"] = trim ($_POST["ws_plugin__s2member_profile_password"]);
44
+ /**/
45
+ $userdata["first_name"] = $userdata["display_name"] = trim ($_POST["ws_plugin__s2member_profile_first_name"]);
46
+ /**/
47
+ $userdata["last_name"] = trim ($_POST["ws_plugin__s2member_profile_last_name"]);
48
+ /**/
49
+ wp_update_user ($userdata); /* Send this array for an update. */
50
+ /**/
51
+ foreach (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) as $field)
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
+ /**/
60
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
61
+ do_action ("ws_plugin__s2member_during_handle_profile_modifications", get_defined_vars ());
62
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
63
+ /**/
64
+ update_usermeta ($user_id, "s2member_custom_fields", $fields);
65
+ /**/
66
+ echo '<script type="text/javascript">' . "\n";
67
+ echo "if(window.parent && window.parent != window) { try{ window.parent.Shadowbox.close(); } catch(e){} try{ window.parent.tb_remove(); } catch(e){} window.parent.alert('Profile updated successfully!'); window.parent.location = '" . esc_js (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"])) . "'; }";
68
+ echo "else if(window.opener) { window.close(); window.opener.alert('Profile updated successfully!'); window.opener.location = '" . esc_js (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"])) . "'; }";
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 ());
 
 
 
 
89
  /**/
90
+ return;
91
  }
 
 
 
 
92
  }
93
  ?>
includes/functions/ptag-level-access.inc.php CHANGED
@@ -17,79 +17,82 @@ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
17
  Function for handling ptag level access permissions.
18
  Attach to: add_action("template_redirect");
19
  */
20
- function ws_plugin__s2member_check_ptag_level_access ()
21
  {
22
- global $post; /* get_the_ID() not yet available here. */
23
- /**/
24
- do_action ("s2member_before_check_ptag_level_access", get_defined_vars ());
25
- /**/
26
- $excluded = apply_filters ("s2member_check_ptag_level_access_excluded", false, get_defined_vars ());
27
- /**/
28
- if (!$excluded && ((is_tag () && ($tag_ID = get_query_var ("tag"))) || (is_single () && has_tag () && is_object ($post) && ($post_ID = $post->ID))))
29
  {
30
- if (!ws_plugin__s2member_is_systematic_use_page ()) /* Never restrict systematic use pages. */
 
 
 
 
 
 
31
  {
32
- $current_user = (is_user_logged_in ()) ? wp_get_current_user () : false;
33
- /**/
34
- if (is_tag () && $tag_ID) /* We also check if this is a post or page with tags, having a restricted tag. */
35
  {
36
- 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")
37
- exit;
38
  /**/
39
- 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")
40
- exit;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  /**/
42
- 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")
43
- exit;
44
- /**/
45
- 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")
46
- exit;
47
- /**/
48
- 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")
49
- exit;
50
- /**/
51
- 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")
52
- exit;
53
- /**/
54
- 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")
55
- exit;
56
- /**/
57
- 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")
58
- exit;
59
- }
60
- else if (is_single () && has_tag () && $post_ID)
61
- {
62
- 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")
63
- exit;
64
- /**/
65
- 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")
66
- exit;
67
- /**/
68
- 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")
69
- exit;
70
- /**/
71
- 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")
72
- exit;
73
- /**/
74
- 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")
75
- exit;
76
- /**/
77
- 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")
78
- exit;
79
- /**/
80
- 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")
81
- exit;
82
- /**/
83
- 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")
84
- exit;
85
  }
86
- /**/
87
- do_action ("s2member_during_check_ptag_level_access", get_defined_vars ());
88
  }
 
 
 
 
89
  }
90
- /**/
91
- do_action ("s2member_after_check_ptag_level_access", get_defined_vars ());
92
- /**/
93
- return;
94
  }
95
  ?>
17
  Function for handling ptag level access permissions.
18
  Attach to: add_action("template_redirect");
19
  */
20
+ if (!function_exists ("ws_plugin__s2member_check_ptag_level_access"))
21
  {
22
+ function ws_plugin__s2member_check_ptag_level_access ()
 
 
 
 
 
 
23
  {
24
+ global $post; /* get_the_ID() not yet available here. */
25
+ /**/
26
+ do_action ("ws_plugin__s2member_before_check_ptag_level_access", get_defined_vars ());
27
+ /**/
28
+ $excluded = apply_filters ("ws_plugin__s2member_check_ptag_level_access_excluded", false, get_defined_vars ());
29
+ /**/
30
+ if (!$excluded && ((is_tag () && ($tag_ID = get_query_var ("tag"))) || (is_single () && has_tag () && is_object ($post) && ($post_ID = $post->ID))))
31
  {
32
+ if (!ws_plugin__s2member_is_systematic_use_page ()) /* Never restrict systematic use pages. */
 
 
33
  {
34
+ $current_user = (is_user_logged_in ()) ? wp_get_current_user () : false;
 
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 ());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  }
 
 
91
  }
92
+ /**/
93
+ do_action ("ws_plugin__s2member_after_check_ptag_level_access", get_defined_vars ());
94
+ /**/
95
+ return;
96
  }
 
 
 
 
97
  }
98
  ?>
includes/functions/readme-parsing.inc.php CHANGED
@@ -16,90 +16,109 @@ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
16
  /*
17
  Function that handles readme.txt parsing.
18
  */
19
- function ws_plugin__s2member_parse_readme ()
20
  {
21
- do_action ("s2member_before_parse_readme", get_defined_vars ());
22
- /**/
23
- if (file_exists (dirname (dirname (dirname (__FILE__))) . "/readme.txt"))
24
  {
25
- $o_pcre = ini_get ("pcre.backtrack_limit");
26
- ini_set ("pcre.backtrack_limit", 10000000);
 
27
  /**/
28
- if (!function_exists ("NC_Markdown"))
29
- include_once dirname (dirname (__FILE__)) . "/markdown/nc-markdown.inc.php";
 
30
  /**/
31
- $rm = file_get_contents (dirname (dirname (dirname (__FILE__))) . "/readme.txt"); /* Get readme.txt file contents. */
32
- $mb = function_exists ("mb_convert_encoding") ? @mb_convert_encoding ($rm, "UTF-8",@mb_detect_encoding ($rm, "WINDOWS-1252, UTF-8")) : $rm;
33
- $rm = ($mb) ? $mb : $rm; /* Double check this, just in case conversion fails on an unpredicted charset. */
34
- /**/
35
- $rm = preg_replace ("/(\=\=\=)( )(.+?)( )(\=\=\=)/", "<h2>Specifications</h2>", $rm);
36
- $rm = preg_replace ("/(\=\=)( )(.+?)( )(\=\=)/", "<h2>$3</h2>", $rm);
37
- $rm = preg_replace ("/(\=)( )(.+?)( )(\=)/", "<h3>$3</h3>", $rm);
38
- $rm = NC_Markdown ($rm); /* Parse out the Markdown syntax now. */
39
- /**/
40
- $r1 = "/(\<h2\>)(.+?)(\<\/h2\>)(.+?)(\<h2\>|$)/si";
41
- $r2 = "/(\<\/div\>)(\<h2\>)(.+?)(\<\/h2\>)(.+?)(\<div class\=\"section\"\>\<h2\>|$)/si";
42
- $r3 = "/(\<div class\=\"section\"\>)(\<h2\>)(Specifications)(\<\/h2\>)(\<div class\=\"content\"\>)(.+?)(\<\/div\>\<\/div\>)/sei";
43
- $r4 = "/(\<div class\=\"section\"\>)(\<h2\>)(Screenshots)(\<\/h2\>)(\<div class\=\"content\"\>)(.+?)(\<\/div\>\<\/div\>)/si";
44
- $r5 = "/(\<a)( href)/i"; /* Modify all links. Assume a nofollow relationship since destinations are unknown. */
45
- /**/
46
- $rm = preg_replace ($r1, '<div class="section">' . "$1$2$3" . '<div class="content">' . "$4" . '</div></div>' . "$5", $rm);
47
- $rm = preg_replace ($r2, "$1" . '<div class="section">' . "$2$3$4" . '<div class="content">' . "$5" . '</div></div>' . "$6", $rm);
48
- $rm = stripslashes (preg_replace ($r3, "'\\1\\2\\3\\4\\5'._ws_plugin__s2member_parse_readme_specs('\\6').'\\7'", $rm, 1));
49
- $rm = stripslashes (preg_replace ($r4, "", $rm, 1)); /* Here we just remove the screenshots completely. */
50
- $rm = preg_replace ($r5, "$1" . ' target="_blank" rel="nofollow external"' . "$2", $rm);
51
- /**/
52
- ini_set ("pcre.backtrack_limit", $o_pcre);
53
- /**/
54
- $readme = '<div class="readme">' . "\n";
55
- $readme .= $rm . "\n"; /* Content. */
56
- $readme .= '</div>' . "\n";
57
- /**/
58
- return apply_filters ("s2member_parse_readme", $readme, get_defined_vars ());
59
- }
60
- else /* Just in case readme.txt was deleted by the site owner. */
61
- {
62
- return "Unable to parse /readme.txt.";
 
 
 
 
 
 
 
 
 
63
  }
64
  }
65
  /*
66
  Callback function that helps readme file parsing with specs.
67
  */
68
- function _ws_plugin__s2member_parse_readme_specs ($str = FALSE)
69
  {
70
- do_action ("s2member_before_parse_readme_specs", get_defined_vars ());
71
- /**/
72
- $str = preg_replace ("/(\<p\>|^)(.+?)(\:)( )(.+?)($|\<\/p\>)/mi", "$1" . '<li><strong>' . "$2" . '</strong>' . "$3" . '&nbsp;&nbsp;&nbsp;&nbsp;<code>' . "$5" . '</code></li>' . "$6", $str);
73
- $str = preg_replace ("/\<p\>\<li\>/i", '<ul><li>', $str); /* Open the list items. */
74
- $str = preg_replace ("/\<\/li\>\<\/p\>/i", '</li></ul><br />', $str);
75
- /**/
76
- return apply_filters ("s2member_parse_readme_specs", $str, get_defined_vars ());
 
 
 
77
  }
78
  /*
79
  Function for parsing readme.txt files and returning a key value.
80
  */
81
- function ws_plugin__s2member_parse_readme_value ($key = FALSE)
82
  {
83
- static $readme; /* For repeated lookups. */
84
- /**/
85
- do_action ("s2member_before_parse_readme_value", get_defined_vars ());
86
- /**/
87
- $path = dirname (dirname (dirname (__FILE__))) . "/readme.txt";
88
- /**/
89
- if (isset ($readme) || file_exists ($path))
90
  {
91
- if (!isset ($readme)) /* If not already opened, we need open it up now. */
92
- {
93
- $readme = file_get_contents ($path); /* Get readme.txt file contents. */
94
- $mb = function_exists ("mb_convert_encoding") ? @mb_convert_encoding ($readme, "UTF-8",@mb_detect_encoding ($readme, "WINDOWS-1252, UTF-8")) : $readme;
95
- $readme = ($mb) ? $mb : $readme; /* Double check this, just in case conversion fails on an unpredicted charset. */
96
- }
97
  /**/
98
- preg_match ("/(^)(" . preg_quote ($key, "/") . ")(\:)( )(.+?)($)/m", $readme, $m);
 
 
99
  /**/
100
- return strlen ($m[5] = trim ($m[5])) ? apply_filters ("s2member_parse_readme_value", $m[5], get_defined_vars ()) : false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
  }
102
- else /* Nope. */
103
- return false;
104
  }
105
  ?>
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 ());
29
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
30
  /**/
31
+ if (file_exists ($path)) /* Give hooks a chance. */
32
+ {
33
+ $o_pcre = ini_get ("pcre.backtrack_limit");
34
+ ini_set ("pcre.backtrack_limit", 10000000);
35
+ /**/
36
+ if (!function_exists ("NC_Markdown"))
37
+ include_once dirname (dirname (__FILE__)) . "/markdown/nc-markdown.inc.php";
38
+ /**/
39
+ $rm = file_get_contents ($path); /* Get readme.txt file contents. */
40
+ $mb = function_exists ("mb_convert_encoding") ? @mb_convert_encoding ($rm, "UTF-8",@mb_detect_encoding ($rm, "WINDOWS-1252, UTF-8")) : $rm;
41
+ $rm = ($mb) ? $mb : $rm; /* Double check this, just in case conversion fails on an unpredicted charset. */
42
+ /**/
43
+ $rm = preg_replace ("/(\=\=\=)( )(.+?)( )(\=\=\=)/", "<h2>Specifications</h2>", $rm);
44
+ $rm = preg_replace ("/(\=\=)( )(.+?)( )(\=\=)/", "<h2>$3</h2>", $rm);
45
+ $rm = preg_replace ("/(\=)( )(.+?)( )(\=)/", "<h3>$3</h3>", $rm);
46
+ $rm = NC_Markdown ($rm); /* Parse out the Markdown syntax now. */
47
+ /**/
48
+ $r1 = "/(\<h2\>)(.+?)(\<\/h2\>)(.+?)(\<h2\>|$)/si";
49
+ $r2 = "/(\<\/div\>)(\<h2\>)(.+?)(\<\/h2\>)(.+?)(\<div class\=\"section\"\>\<h2\>|$)/si";
50
+ $r3 = "/(\<div class\=\"section\"\>)(\<h2\>)(Specifications)(\<\/h2\>)(\<div class\=\"content\"\>)(.+?)(\<\/div\>\<\/div\>)/sei";
51
+ $r4 = "/(\<div class\=\"section\"\>)(\<h2\>)(Screenshots)(\<\/h2\>)(\<div class\=\"content\"\>)(.+?)(\<\/div\>\<\/div\>)/si";
52
+ $r5 = "/(\<a)( href)/i"; /* Modify all links. Assume a nofollow relationship since destinations are unknown. */
53
+ /**/
54
+ $rm = preg_replace ($r1, '<div class="section">' . "$1$2$3" . '<div class="content">' . "$4" . '</div></div>' . "$5", $rm);
55
+ $rm = preg_replace ($r2, "$1" . '<div class="section">' . "$2$3$4" . '<div class="content">' . "$5" . '</div></div>' . "$6", $rm);
56
+ $rm = stripslashes (preg_replace ($r3, "'\\1\\2\\3\\4\\5'._ws_plugin__s2member_parse_readme_specs('\\6').'\\7'", $rm, 1));
57
+ $rm = stripslashes (preg_replace ($r4, "", $rm, 1)); /* Here we just remove the screenshots completely. */
58
+ $rm = preg_replace ($r5, "$1" . ' target="_blank" rel="nofollow external"' . "$2", $rm);
59
+ /**/
60
+ ini_set ("pcre.backtrack_limit", $o_pcre);
61
+ /**/
62
+ $readme = '<div class="readme">' . "\n";
63
+ $readme .= $rm . "\n"; /* Content. */
64
+ $readme .= '</div>' . "\n";
65
+ /**/
66
+ return apply_filters ("ws_plugin__s2member_parse_readme", $readme, get_defined_vars ());
67
+ }
68
+ else /* Just in case readme.txt was deleted by the site owner. */
69
+ {
70
+ return "Unable to parse /readme.txt.";
71
+ }
72
  }
73
  }
74
  /*
75
  Callback function that helps readme file parsing with specs.
76
  */
77
+ if (!function_exists ("_ws_plugin__s2member_parse_readme_specs"))
78
  {
79
+ function _ws_plugin__s2member_parse_readme_specs ($str = FALSE)
80
+ {
81
+ do_action ("_ws_plugin__s2member_before_parse_readme_specs", get_defined_vars ());
82
+ /**/
83
+ $str = preg_replace ("/(\<p\>|^)(.+?)(\:)( )(.+?)($|\<\/p\>)/mi", "$1" . '<li><strong>' . "$2" . '</strong>' . "$3" . '&nbsp;&nbsp;&nbsp;&nbsp;<code>' . "$5" . '</code></li>' . "$6", $str);
84
+ $str = preg_replace ("/\<p\>\<li\>/i", '<ul><li>', $str); /* Open the list items. */
85
+ $str = preg_replace ("/\<\/li\>\<\/p\>/i", '</li></ul><br />', $str);
86
+ /**/
87
+ return apply_filters ("_ws_plugin__s2member_parse_readme_specs", $str, get_defined_vars ());
88
+ }
89
  }
90
  /*
91
  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
+ }
120
+ else /* Nope. */
121
+ return false;
122
  }
 
 
123
  }
124
  ?>
includes/functions/register-access.inc.php CHANGED
@@ -17,382 +17,478 @@ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
17
  Function that forces a default Subscriber Role.
18
  Attach to: add_filter("pre_option_default_role");
19
  */
20
- function ws_plugin__s2member_force_default_role ($default_role = FALSE)
21
  {
22
- do_action ("s2member_before_force_default_role", get_defined_vars ());
23
- /**/
24
- return apply_filters ("s2member_force_default_role", ($default_role = "subscriber"), get_defined_vars ());
 
 
 
25
  }
26
  /*
27
  Function for allowing access to the register form.
28
  Attach to: add_filter("pre_option_users_can_register");
29
  */
30
- function ws_plugin__s2member_check_register_access ($users_can_register = FALSE)
31
  {
32
- global $pagenow; /* Check if we are on the General Options page. */
33
- /**/
34
- do_action ("s2member_before_check_register_access", get_defined_vars ());
35
- /**/
36
- if (current_user_can ("create_users") || $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["allow_subscribers_in"])
37
  {
38
- return apply_filters ("s2member_check_register_access", ($users_can_register = "1"), get_defined_vars ());
39
- }
40
- 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"]))))
41
- {
42
- global $wpdb; /* Global database object reference. */
43
  /**/
44
- if (!$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"))
45
  {
46
- return apply_filters ("s2member_check_register_access", ($users_can_register = "1"), get_defined_vars ());
47
  }
 
 
 
 
 
 
 
 
 
 
 
48
  }
49
- /**/
50
- return apply_filters ("s2member_check_register_access", ($users_can_register = "0"), get_defined_vars ());
51
  }
52
  /*
53
  Function that describes the General Option overrides for clarity.
54
  Attach to: add_action("admin_init");
55
  */
56
- function ws_plugin__s2member_general_ops_notice ()
57
  {
58
- global $pagenow; /* Need this. */
59
- /**/
60
- do_action ("s2member_before_general_ops_notice", get_defined_vars ());
61
- /**/
62
- if ($pagenow === "options-general.php" && !isset ($_GET["page"]))
63
  {
64
- $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>.";
65
  /**/
66
- do_action ("s2member_during_general_ops_notice", get_defined_vars ());
67
  /**/
68
- ws_plugin__s2member_enqueue_admin_notice ($notice, $pagenow);
 
 
 
 
 
 
 
 
 
 
 
69
  }
70
- /**/
71
- do_action ("s2member_after_general_ops_notice", get_defined_vars ());
72
- /**/
73
- return;
74
  }
75
  /*
76
  This adds custom fields to the registration form.
77
  Attach to: add_action("register_form");
78
  */
79
- function ws_plugin__s2member_custom_registration_fields ()
80
  {
81
- do_action ("s2member_before_custom_registration_fields", get_defined_vars ());
82
- /**/
83
- if (!defined ("BP_VERSION")) /* Not compatible with BuddyPress. */
84
  {
85
- echo '<input type="hidden" name="ws_plugin__s2member_registration" value="' . esc_attr (wp_create_nonce ("ws-plugin--s2member-registration")) . '" />' . "\n";
86
  /**/
87
- $tabindex = 20; /* Incremented tabindex starting with 20. */
88
- /**/
89
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_password"] && function_exists ("ws_plugin__s2member_generate_password"))
90
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
  echo '<p>' . "\n";
92
  echo '<label>' . "\n";
93
- echo 'Password *' . "\n";
94
- 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 + 1)) . '" value="' . format_to_edit (trim (stripslashes ($_POST["ws_plugin__s2member_custom_reg_field_user_pass"]))) . '" />' . "\n";
95
  echo '</label>' . "\n";
96
  echo '</p>';
97
- }
98
- /**/
99
- echo '<p>' . "\n";
100
- echo '<label>' . "\n";
101
- echo 'First Name *' . "\n";
102
- 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 + 1)) . '" value="' . format_to_edit (trim (stripslashes ($_POST["ws_plugin__s2member_custom_reg_field_first_name"]))) . '" />' . "\n";
103
- echo '</label>' . "\n";
104
- echo '</p>';
105
- /**/
106
- echo '<p>' . "\n";
107
- echo '<label>' . "\n";
108
- echo 'Last Name *' . "\n";
109
- 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 + 1)) . '" value="' . format_to_edit (trim (stripslashes ($_POST["ws_plugin__s2member_custom_reg_field_last_name"]))) . '" />' . "\n";
110
- echo '</label>' . "\n";
111
- echo '</p>';
112
- /**/
113
- foreach (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) as $field)
114
- {
115
- $req = preg_match ("/\*/", $field); /* Required fields should be wrapped inside asterisks. */
116
- $req = ($req) ? ' aria-required="true"' : ''; /* Has JavaScript validation applied. */
117
  /**/
118
- if ($field = trim ($field, "* \t\n\r\0\x0B")) /* Don't process empty fields. */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  {
 
 
 
 
120
  echo '<p>' . "\n";
121
  echo '<label>' . "\n";
122
- echo esc_html ($field) . (($req) ? " *" : "") . "\n";
123
- $field = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field));
124
- 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 + 1)) . '" value="' . format_to_edit (trim (stripslashes ($_POST["ws_plugin__s2member_custom_reg_field_" . $field]))) . '" />' . "\n";
125
  echo '</label>' . "\n";
126
  echo '</p>';
 
 
 
 
127
  }
 
 
 
 
128
  }
129
  /**/
130
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] && ws_plugin__s2member_list_servers_integrated ())
131
- {
132
- echo '<p>' . "\n";
133
- echo '<label>' . "\n";
134
- 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 + 1)) . '" 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";
135
- echo $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in_label"] . "\n";
136
- echo '</label>' . "\n";
137
- echo '</p>';
138
- }
139
  /**/
140
- do_action ("s2member_during_custom_registration_fields", get_defined_vars ());
141
  }
142
- /**/
143
- do_action ("s2member_after_custom_registration_fields", get_defined_vars ());
144
- /**/
145
- return;
146
  }
147
  /*
148
  This adds an opt-in checkbox to the BuddyPress signup form.
149
  Attach to: add_action("bp_before_registration_submit_buttons");
150
  */
151
- function ws_plugin__s2member_opt_in_4bp ()
152
  {
153
- do_action ("s2member_before_opt_in_4bp", get_defined_vars ());
154
- /**/
155
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] && ws_plugin__s2member_list_servers_integrated ())
156
  {
157
- echo '<div class="s2member-opt-in-4bp" style="' . apply_filters ("s2member_opt_in_4bp_styles", "clear:both; padding-top:10px; margin-left:-3px;", get_defined_vars ()) . '">' . "\n";
158
  /**/
159
- echo '<p>' . "\n";
160
- echo '<label>' . "\n";
161
- 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"' : '') . ' />' . "\n";
162
- echo $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in_label"] . "\n";
163
- echo '</label>' . "\n";
164
- echo '</p>';
 
 
 
 
 
 
 
 
 
 
 
165
  /**/
166
- echo '</div>' . "\n";
167
  /**/
168
- do_action ("s2member_during_opt_in_4bp", get_defined_vars ());
169
  }
170
- /**/
171
- do_action ("s2member_after_opt_in_4bp", get_defined_vars ());
172
- /**/
173
- return;
174
  }
175
  /*
176
  Generates registration links.
177
  */
178
- function ws_plugin__s2member_register_link_gen ($subscr_id = FALSE, $custom = FALSE, $item_number = FALSE, $shrink = TRUE)
179
  {
180
- do_action ("s2member_before_register_link_gen", get_defined_vars ());
181
- /**/
182
- if ($subscr_id && $custom && $item_number) /* Must have all of these. */
183
  {
184
- $register = ws_plugin__s2member_encrypt ("subscr_id_custom_item_number:.:|:.:" . $subscr_id . ":.:|:.:" . $custom . ":.:|:.:" . $item_number);
185
- $register_link = add_query_arg ("s2member_register", $register, get_bloginfo ("url") . "/");
 
 
 
 
 
 
 
 
 
 
 
 
186
  /**/
187
- if ($shrink && ($tinyurl = ws_plugin__s2member_remote ("http://tinyurl.com/api-create.php?url=" . rawurlencode ($register_link))))
188
- return apply_filters ("s2member_register_link_gen", $tinyurl, get_defined_vars ()); /* tinyURL is easier to work with. */
189
- else /* Else use the long one; tinyURL will fail when/if their server is down periodically. */
190
- return apply_filters ("s2member_register_link_gen", $register_link, get_defined_vars ());
191
  }
192
- /**/
193
- return false;
194
  }
195
  /*
196
  Handles registration links.
197
  Attach to: add_action("init");
198
  */
199
- function ws_plugin__s2member_register ()
200
  {
201
- do_action ("s2member_before_register", get_defined_vars ());
202
- /**/
203
- if ($_GET["s2member_register"]) /* If they're attempting to access the registration system. */
204
  {
205
- if (is_array ($register = preg_split ("/\:\.\:\|\:\.\:/", ws_plugin__s2member_decrypt ($_GET["s2member_register"]))))
 
 
206
  {
207
- if (count ($register) === 4 && $register[0] === "subscr_id_custom_item_number" && $register[1] && $register[2] && $register[3])
208
  {
209
- setcookie ("s2member_subscr_id", ws_plugin__s2member_encrypt ($register[1]), time () + 31556926, "/");
210
- setcookie ("s2member_custom", ws_plugin__s2member_encrypt ($register[2]), time () + 31556926, "/");
211
- setcookie ("s2member_level", ws_plugin__s2member_encrypt ($register[3]), time () + 31556926, "/");
212
- /**/
213
- do_action ("s2member_during_register", get_defined_vars ());
214
- /**/
215
- echo '<script type="text/javascript">' . "\n";
216
- echo "window.location = '" . esc_js (add_query_arg ("action", "register", wp_login_url ())) . "';";
217
- echo '</script>' . "\n";
 
 
 
 
 
 
218
  }
 
 
 
 
 
 
219
  }
220
- exit;
 
221
  }
222
- /**/
223
- do_action ("s2member_after_register", get_defined_vars ());
224
  }
225
  /*
226
  Function for configuring new users.
227
  Attach to: add_action("user_register");
228
  */
229
- function ws_plugin__s2member_configure_user_registration ($user_id = FALSE)
230
  {
231
- global $wpdb; /* Global database object may be required for this routine. */
232
- static $processed; /* Prevents duplicate processing. */
233
- /**/
234
- do_action ("s2member_before_configure_user_registration", get_defined_vars ());
235
- /**/
236
- if (!$processed && $user_id && is_array ($_POST = stripslashes_deep ($_POST)) && is_object ($user = new WP_User ($user_id)) && ($processed = true))
237
  {
238
- ws_plugin__s2member_email_config (); /* Configures From: header that will be used in new user notifications. */
 
239
  /**/
240
- if (!is_admin () /* Only run this particular routine whenever a Member [1-4] is registering themselves with cookies. */
241
- && ($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"])))/**/
242
- && (!$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")))
243
- /* ^ 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. */
 
244
  {
245
- $processed = "yes"; /* Mark this as yes, to indicate that a routine was successfully processed. */
246
- /**/
247
- list ($level, $ccaps, $eotper) = preg_split ("/\:/", $level, 3);
248
- $role = "s2member_level" . $level; /* Level 1-4. */
249
- /**/
250
- $email = $user->user_email;
251
- $login = $user->user_login;
252
- $ip = $_SERVER["REMOTE_ADDR"];
253
- $cv = preg_split ("/\|/", $custom);
254
- $fname = (!$user->first_name) ? trim ($_POST["ws_plugin__s2member_custom_reg_field_first_name"]) : $user->first_name;
255
- $lname = (!$user->last_name) ? trim ($_POST["ws_plugin__s2member_custom_reg_field_last_name"]) : $user->last_name;
256
- $name = trim ($fname . " " . $lname);
257
- /**/
258
- if (!$pass) /* s2Member password? */
259
- if ($GLOBALS["s2member_password"])
260
- $pass = $GLOBALS["s2member_password"];
261
- /**/
262
- if (!$pass) /* Also try to get the password from BuddyPress. */
263
- if ($_POST["signup_password"]) /* Field used by BuddyPress. */
264
- $pass = trim (stripslashes ($_POST["signup_password"]));
265
- /**/
266
- $opt_in = (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] || $_POST["ws_plugin__s2member_custom_reg_field_opt_in"]) ? true : false;
267
  /**/
268
- $user->set_role ($role); /* s2Member Role. */
269
- /**/
270
- update_usermeta ($user_id, "s2member_subscr_id", $subscr_id);
271
- update_usermeta ($user_id, "s2member_custom", $custom);
272
- /**/
273
- if ($ccaps) /* Add custom capabilities. */
274
- foreach (preg_split ("/[\r\n\t\s;,]+/", $ccaps) as $ccap)
275
- if (strlen ($ccap)) /* Don't add empty capabilities. */
276
- $user->add_cap ("access_s2member_ccap_" . trim (strtolower ($ccap)));
277
- /**/
278
- if ($eotper) /* If a specific EOT Period has been attached; we need to calculate that now. */
279
- update_usermeta ($user_id, "s2member_auto_eot_time", ws_plugin__s2member_paypal_auto_eot_time (0, 0, 0, $eotper));
280
- /**/
281
- if (($transient = md5 ("s2member_transient_ipn_subscr_payment_" . $subscr_id)) && is_array ($subscr_payment = get_transient ($transient)))
282
  {
283
- $proxy = array ("s2member_paypal_notify" => "1", "s2member_paypal_proxy" => "s2member_transient_ipn_subscr_payment");
284
- ws_plugin__s2member_remote (add_query_arg ($proxy, get_bloginfo ("url")), stripslashes_deep ($subscr_payment));
285
- delete_transient ($transient);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
286
  }
287
  /**/
288
- setcookie ("s2member_signup_tracking", ws_plugin__s2member_encrypt ($subscr_id), time () + 31556926, "/");
289
- /**/
290
- do_action ("s2member_during_configure_user_registration_front_side", get_defined_vars ());
291
- }
292
- /**/
293
- else if (!is_admin () && preg_match ("/^(subscriber|s2member_level[1-4])$/", ($role = $user->roles[0])))
294
- {
295
- $processed = "yes"; /* Mark this as yes, to indicate that a routine was successfully processed. */
296
- /**/
297
- $level = ($role === "subscriber") ? "0" : preg_replace ("/^s2member_level/", "", $role);
298
- $ccaps = ""; /* Custom Capabilities are not applicable here. */
299
- /**/
300
- $email = $user->user_email;
301
- $login = $user->user_login;
302
- $ip = $_SERVER["REMOTE_ADDR"];
303
- $cv = preg_split ("/\|/", ""); /* Not applicable here. */
304
- $fname = (!$user->first_name) ? trim ($_POST["ws_plugin__s2member_custom_reg_field_first_name"]) : $user->first_name;
305
- $lname = (!$user->last_name) ? trim ($_POST["ws_plugin__s2member_custom_reg_field_last_name"]) : $user->last_name;
306
- $name = trim ($fname . " " . $lname);
307
- /**/
308
- if (!$pass) /* s2Member password? */
309
- if ($GLOBALS["s2member_password"])
310
- $pass = $GLOBALS["s2member_password"];
311
- /**/
312
- if (!$pass) /* Also try to get the password from BuddyPress. */
313
- if ($_POST["signup_password"]) /* Field used by BuddyPress. */
314
- $pass = trim (stripslashes ($_POST["signup_password"]));
315
- /**/
316
- $opt_in = (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] || $_POST["ws_plugin__s2member_custom_reg_field_opt_in"]) ? true : false;
317
- /**/
318
- do_action ("s2member_during_configure_user_registration_front_side", get_defined_vars ());
319
- }
320
- /**/
321
- else if (is_admin () && preg_match ("/wp-admin\/user-new\.php/", $_POST["_wp_http_referer"]) && preg_match ("/^(subscriber|s2member_level[1-4])$/", ($role = $user->roles[0])))
322
- {
323
- $processed = "yes"; /* Mark this as yes, to indicate that a routine was successfully processed. */
324
- /**/
325
- $level = ($role === "subscriber") ? "0" : preg_replace ("/^s2member_level/", "", $role);
326
- $ccaps = ""; /* Custom Capabilities are not applicable here. */
327
- /**/
328
- $email = $user->user_email;
329
- $login = $user->user_login;
330
- $ip = ""; /* N/Applicable. */
331
- $cv = preg_split ("/\|/", "");
332
- $fname = (!$user->first_name) ? trim ($_POST["ws_plugin__s2member_custom_reg_field_first_name"]) : $user->first_name;
333
- $lname = (!$user->last_name) ? trim ($_POST["ws_plugin__s2member_custom_reg_field_last_name"]) : $user->last_name;
334
- $name = trim ($fname . " " . $lname);
335
- /**/
336
- if (!$pass) /* s2Member password? */
337
- if ($GLOBALS["s2member_password"])
338
- $pass = $GLOBALS["s2member_password"];
339
- /**/
340
- if (!$pass) /* Also try the `Users -> Add New` form. */
341
- if ($_POST["pass1"]) /* Field used by admin form. */
342
- $pass = trim (stripslashes ($_POST["pass1"]));
343
- /**/
344
- $opt_in = (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] || $_POST["ws_plugin__s2member_custom_reg_field_opt_in"]) ? true : false;
345
- /**/
346
- do_action ("s2member_during_configure_user_registration_admin_side", get_defined_vars ());
347
- }
348
- /**/
349
- if ($processed === "yes") /* If registration was processed by one of the routines above. */
350
- {
351
- if (!$user->first_name && ($first_name = trim ($_POST["ws_plugin__s2member_custom_reg_field_first_name"])))
352
- update_usermeta ($user_id, "first_name", $first_name) . /* And display name. */
353
- wp_update_user (array ("ID" => $user_id, "display_name" => $first_name));
354
  /**/
355
- if (!$user->last_name && ($last_name = trim ($_POST["ws_plugin__s2member_custom_reg_field_last_name"])))
356
- update_usermeta ($user_id, "last_name", $last_name);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
357
  /**/
358
- foreach (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) as $field)
359
  {
360
- if ($field = trim ($field, "* \t\n\r\0\x0B")) /* Don't process empty fields. */
 
 
 
 
 
 
 
361
  {
362
- $field = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field));
363
- if (strlen ($_POST["ws_plugin__s2member_custom_reg_field_" . $field]))
364
- $fields[$field] = trim ($_POST["ws_plugin__s2member_custom_reg_field_" . $field]);
 
 
 
365
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
366
  }
367
- /**/
368
- update_usermeta ($user_id, "s2member_custom_fields", $fields);
369
- /**/
370
- ws_plugin__s2member_process_list_servers ($level, $email, $fname, $lname, $ip, $opt_in);
371
- /**/
372
- if ($urls = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["registration_notification_urls"])
373
- foreach (preg_split ("/[\r\n\t]+/", $urls) as $url) /* Notify each of the urls. */
374
- if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)))
375
- if (($url = preg_replace ("/%%level%%/i", urlencode ($level), $url)))
376
- if (($url = preg_replace ("/%%user_first_name%%/i", urlencode ($fname), $url)))
377
- if (($url = preg_replace ("/%%user_last_name%%/i", urlencode ($lname), $url)))
378
- if (($url = preg_replace ("/%%user_full_name%%/i", urlencode ($name), $url)))
379
- if (($url = preg_replace ("/%%user_email%%/i", urlencode ($email), $url)))
380
- if (($url = preg_replace ("/%%user_login%%/i", urlencode ($login), $url)))
381
- if (($url = preg_replace ("/%%user_pass%%/i", urlencode ($pass), $url)))
382
- if (($url = trim ($url))) /* Empty? */
383
- ws_plugin__s2member_remote ($url);
384
- /**/
385
- setcookie ("s2member_subscr_id", "", time () + 31556926, "/");
386
- setcookie ("s2member_custom", "", time () + 31556926, "/");
387
- setcookie ("s2member_level", "", time () + 31556926, "/");
388
- /**/
389
- do_action ("s2member_during_configure_user_registration", get_defined_vars ());
390
  }
 
 
 
 
 
 
391
  }
392
- /**/
393
- do_action ("s2member_after_configure_user_registration", get_defined_vars ());
394
- /**/
395
- return;
396
  }
397
  /*
398
  Pluggable function that handles password generation.
@@ -400,23 +496,28 @@ Taken from: /wp-includes/pluggable.php
400
  */
401
  if (!function_exists ("wp_generate_password"))
402
  {
403
- function wp_generate_password ($length = 12, $special_chars = TRUE)
404
  {
405
- return ws_plugin__s2member_generate_password ($length, $special_chars);
406
- }
407
- /**/
408
- function ws_plugin__s2member_generate_password ($length = 12, $special_chars = TRUE)
409
- {
410
- do_action ("s2member_before_generate_password", get_defined_vars ());
411
- /**/
412
- $password = ws_plugin__s2member_random_str_gen ($length, $special_chars);
413
- /**/
414
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_password"])
415
- if (wp_verify_nonce (trim (stripslashes ($_POST["ws_plugin__s2member_registration"])), "ws-plugin--s2member-registration"))
416
- if ($custom = trim (stripslashes ($_POST["ws_plugin__s2member_custom_reg_field_user_pass"])))
417
- $password = $custom;
418
  /**/
419
- return ($GLOBALS["s2member_password"] = $password);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
420
  }
421
  }
422
  ?>
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"))
21
  {
22
+ function ws_plugin__s2member_force_default_role ($default_role = FALSE)
23
+ {
24
+ do_action ("ws_plugin__s2member_before_force_default_role", get_defined_vars ());
25
+ /**/
26
+ return apply_filters ("ws_plugin__s2member_force_default_role", ($default_role = "subscriber"), get_defined_vars ());
27
+ }
28
  }
29
  /*
30
  Function for allowing access to the register form.
31
  Attach to: add_filter("pre_option_users_can_register");
32
  */
33
+ if (!function_exists ("ws_plugin__s2member_check_register_access"))
34
  {
35
+ function ws_plugin__s2member_check_register_access ($users_can_register = FALSE)
 
 
 
 
36
  {
37
+ global $pagenow; /* Check if we are on the General Options page. */
38
+ /**/
39
+ do_action ("ws_plugin__s2member_before_check_register_access", get_defined_vars ());
 
 
40
  /**/
41
+ if (current_user_can ("create_users") || $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["allow_subscribers_in"])
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
+ /**/
49
+ if (!$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"))
50
+ {
51
+ return apply_filters ("ws_plugin__s2member_check_register_access", ($users_can_register = "1"), get_defined_vars ());
52
+ }
53
+ }
54
+ /**/
55
+ return apply_filters ("ws_plugin__s2member_check_register_access", ($users_can_register = "0"), get_defined_vars ());
56
  }
 
 
57
  }
58
  /*
59
  Function that describes the General Option overrides for clarity.
60
  Attach to: add_action("admin_init");
61
  */
62
+ if (!function_exists ("ws_plugin__s2member_general_ops_notice"))
63
  {
64
+ function ws_plugin__s2member_general_ops_notice ()
 
 
 
 
65
  {
66
+ global $pagenow; /* Need this. */
67
  /**/
68
+ do_action ("ws_plugin__s2member_before_general_ops_notice", get_defined_vars ());
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
+ /**/
76
+ ws_plugin__s2member_enqueue_admin_notice ($notice, $pagenow);
77
+ }
78
+ /**/
79
+ do_action ("ws_plugin__s2member_after_general_ops_notice", get_defined_vars ());
80
+ /**/
81
+ return;
82
  }
 
 
 
 
83
  }
84
  /*
85
  This adds custom fields to the registration form.
86
  Attach to: add_action("register_form");
87
  */
88
+ if (!function_exists ("ws_plugin__s2member_custom_registration_fields"))
89
  {
90
+ function 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
  /**/
204
+ return;
205
  }
 
 
 
 
206
  }
207
  /*
208
  This adds an opt-in checkbox to the BuddyPress signup form.
209
  Attach to: add_action("bp_before_registration_submit_buttons");
210
  */
211
+ if (!function_exists ("ws_plugin__s2member_opt_in_4bp"))
212
  {
213
+ function ws_plugin__s2member_opt_in_4bp ()
 
 
214
  {
215
+ do_action ("ws_plugin__s2member_before_opt_in_4bp", get_defined_vars ());
216
  /**/
217
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] && ws_plugin__s2member_list_servers_integrated ())
218
+ {
219
+ do_action ("ws_plugin__s2member_during_opt_in_4bp_before", get_defined_vars ());
220
+ /**/
221
+ echo '<div class="s2member-opt-in-4bp" style="' . apply_filters ("ws_plugin__s2member_opt_in_4bp_styles", "clear:both; padding-top:10px; margin-left:-3px;", get_defined_vars ()) . '">' . "\n";
222
+ /**/
223
+ echo '<p>' . "\n";
224
+ echo '<label>' . "\n";
225
+ 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"' : '') . ' />' . "\n";
226
+ echo $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in_label"] . "\n";
227
+ echo '</label>' . "\n";
228
+ echo '</p>';
229
+ /**/
230
+ echo '</div>' . "\n";
231
+ /**/
232
+ do_action ("ws_plugin__s2member_during_opt_in_4bp_after", get_defined_vars ());
233
+ }
234
  /**/
235
+ do_action ("ws_plugin__s2member_after_opt_in_4bp", get_defined_vars ());
236
  /**/
237
+ return;
238
  }
 
 
 
 
239
  }
240
  /*
241
  Generates registration links.
242
  */
243
+ 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
+ /**/
251
+ if ($subscr_id && $custom && $item_number) /* Must have all of these. */
252
+ {
253
+ $register = ws_plugin__s2member_encrypt ("subscr_id_custom_item_number_time:.:|:.:" . $subscr_id . ":.:|:.:" . $custom . ":.:|:.:" . $item_number . ":.:|:.:" . strtotime ("now"));
254
+ $register_link = add_query_arg ("s2member_register", $register, get_bloginfo ("url") . "/");
255
+ /**/
256
+ if ($shrink && ($tinyurl = ws_plugin__s2member_remote ("http://tinyurl.com/api-create.php?url=" . rawurlencode ($register_link))))
257
+ return apply_filters ("ws_plugin__s2member_register_link_gen", $tinyurl, get_defined_vars ()); /* tinyURL is easier to work with. */
258
+ else /* Else use the long one; tinyURL will fail when/if their server is down periodically. */
259
+ return apply_filters ("ws_plugin__s2member_register_link_gen", $register_link, get_defined_vars ());
260
+ }
261
  /**/
262
+ return false;
 
 
 
263
  }
 
 
264
  }
265
  /*
266
  Handles registration links.
267
  Attach to: add_action("init");
268
  */
269
+ if (!function_exists ("ws_plugin__s2member_register"))
270
  {
271
+ function ws_plugin__s2member_register ()
 
 
272
  {
273
+ do_action ("ws_plugin__s2member_before_register", get_defined_vars ());
274
+ /**/
275
+ if ($_GET["s2member_register"]) /* If they're attempting to access the registration system. */
276
  {
277
+ if (is_array ($register = preg_split ("/\:\.\:\|\:\.\:/", ws_plugin__s2member_decrypt ($_GET["s2member_register"]))))
278
  {
279
+ if (count ($register) === 5 && $register[0] === "subscr_id_custom_item_number_time" && $register[1] && $register[2] && $register[3] && $register[4])
280
+ {
281
+ if ($register[4] <= strtotime ("now") && $register[4] >= strtotime ("-2 days")) /* Customers have 2 days to register. */
282
+ {
283
+ setcookie ("s2member_subscr_id", ws_plugin__s2member_encrypt ($register[1]), time () + 31556926, "/");
284
+ setcookie ("s2member_custom", ws_plugin__s2member_encrypt ($register[2]), time () + 31556926, "/");
285
+ setcookie ("s2member_level", ws_plugin__s2member_encrypt ($register[3]), time () + 31556926, "/");
286
+ /**/
287
+ do_action ("ws_plugin__s2member_during_register", get_defined_vars ());
288
+ /**/
289
+ echo '<script type="text/javascript">' . "\n";
290
+ echo "window.location = '" . esc_js (add_query_arg ("action", "register", wp_login_url ())) . "';";
291
+ echo '</script>' . "\n";
292
+ }
293
+ }
294
  }
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 ());
304
  }
 
 
305
  }
306
  /*
307
  Function for configuring new users.
308
  Attach to: add_action("user_register");
309
  */
310
+ if (!function_exists ("ws_plugin__s2member_configure_user_registration"))
311
  {
312
+ function ws_plugin__s2member_configure_user_registration ($user_id = FALSE)
 
 
 
 
 
313
  {
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
  {
330
+ $processed = "yes"; /* Mark this as yes, to indicate that a routine was successfully processed. */
331
+ /**/
332
+ list ($level, $ccaps, $eotper) = preg_split ("/\:/", $level, 3);
333
+ $role = "s2member_level" . $level; /* Level 1-4. */
334
+ /**/
335
+ $email = $user->user_email;
336
+ $login = $user->user_login;
337
+ $ip = $_SERVER["REMOTE_ADDR"];
338
+ $cv = preg_split ("/\|/", $custom);
339
+ $fname = (!$user->first_name) ? trim ($_POST["ws_plugin__s2member_custom_reg_field_first_name"]) : $user->first_name;
340
+ $lname = (!$user->last_name) ? trim ($_POST["ws_plugin__s2member_custom_reg_field_last_name"]) : $user->last_name;
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. */
349
+ $pass = trim (stripslashes ($_POST["signup_password"]));
350
+ /**/
351
+ $opt_in = (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] || $_POST["ws_plugin__s2member_custom_reg_field_opt_in"]) ? true : false;
352
+ /**/
353
+ $user->set_role ($role); /* s2Member Role. */
354
+ /**/
355
+ update_usermeta ($user_id, "s2member_subscr_id", $subscr_id);
356
+ update_usermeta ($user_id, "s2member_custom", $custom);
357
+ /**/
358
+ if ($ccaps) /* Add custom capabilities. */
359
+ foreach (preg_split ("/[\r\n\t\s;,]+/", $ccaps) as $ccap)
360
+ if (strlen ($ccap)) /* Don't add empty capabilities. */
361
+ $user->add_cap ("access_s2member_ccap_" . trim (strtolower ($ccap)));
362
+ /**/
363
+ if ($eotper) /* If a specific EOT Period has been attached; we need to calculate that now. */
364
+ update_usermeta ($user_id, "s2member_auto_eot_time", ws_plugin__s2member_paypal_auto_eot_time (0, 0, 0, $eotper));
365
+ /**/
366
+ if (($transient = md5 ("s2member_transient_ipn_subscr_payment_" . $subscr_id)) && is_array ($subscr_payment = get_transient ($transient)))
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
  }
379
  /**/
380
+ else if (!is_admin () && preg_match ("/^(subscriber|s2member_level[1-4])$/", ($role = $user->roles[0])))
381
+ {
382
+ $processed = "yes"; /* Mark this as yes, to indicate that a routine was successfully processed. */
383
+ /**/
384
+ $level = ($role === "subscriber") ? "0" : preg_replace ("/^s2member_level/", "", $role);
385
+ $ccaps = ""; /* Custom Capabilities are not applicable here. */
386
+ /**/
387
+ $email = $user->user_email;
388
+ $login = $user->user_login;
389
+ $ip = $_SERVER["REMOTE_ADDR"];
390
+ $cv = preg_split ("/\|/", ""); /* Not applicable here. */
391
+ $fname = (!$user->first_name) ? trim ($_POST["ws_plugin__s2member_custom_reg_field_first_name"]) : $user->first_name;
392
+ $lname = (!$user->last_name) ? trim ($_POST["ws_plugin__s2member_custom_reg_field_last_name"]) : $user->last_name;
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. */
401
+ $pass = trim (stripslashes ($_POST["signup_password"]));
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
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
409
  /**/
410
+ else if (is_admin () && preg_match ("/wp-admin\/user-new\.php/", $_POST["_wp_http_referer"]) && preg_match ("/^(subscriber|s2member_level[1-4])$/", ($role = $user->roles[0])))
411
+ {
412
+ $processed = "yes"; /* Mark this as yes, to indicate that a routine was successfully processed. */
413
+ /**/
414
+ $level = ($role === "subscriber") ? "0" : preg_replace ("/^s2member_level/", "", $role);
415
+ $ccaps = ""; /* Custom Capabilities are not applicable here. */
416
+ /**/
417
+ $email = $user->user_email;
418
+ $login = $user->user_login;
419
+ $ip = ""; /* N/Applicable. */
420
+ $cv = preg_split ("/\|/", "");
421
+ $fname = (!$user->first_name) ? trim ($_POST["ws_plugin__s2member_custom_reg_field_first_name"]) : $user->first_name;
422
+ $lname = (!$user->last_name) ? trim ($_POST["ws_plugin__s2member_custom_reg_field_last_name"]) : $user->last_name;
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. */
431
+ $pass = trim (stripslashes ($_POST["pass1"]));
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
+ }
439
  /**/
440
+ if ($processed === "yes") /* If registration was processed by one of the routines above. */
441
  {
442
+ if (!$user->first_name && ($first_name = trim ($_POST["ws_plugin__s2member_custom_reg_field_first_name"])))
443
+ update_usermeta ($user_id, "first_name", $first_name) . /* And display name. */
444
+ wp_update_user (array ("ID" => $user_id, "display_name" => $first_name));
445
+ /**/
446
+ if (!$user->last_name && ($last_name = trim ($_POST["ws_plugin__s2member_custom_reg_field_last_name"])))
447
+ update_usermeta ($user_id, "last_name", $last_name);
448
+ /**/
449
+ foreach (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) as $field)
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
+ /**/
459
+ update_usermeta ($user_id, "s2member_custom_fields", $fields);
460
+ /**/
461
+ ws_plugin__s2member_process_list_servers ($level, $email, $fname, $lname, $ip, $opt_in);
462
+ /**/
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
+ /**/
490
+ return;
491
  }
 
 
 
 
492
  }
493
  /*
494
  Pluggable function that handles password generation.
496
  */
497
  if (!function_exists ("wp_generate_password"))
498
  {
499
+ if (!function_exists ("ws_plugin__s2member_generate_password"))
500
  {
501
+ function wp_generate_password ($length = 12, $special_chars = TRUE)
502
+ {
503
+ return ws_plugin__s2member_generate_password ($length, $special_chars);
504
+ }
 
 
 
 
 
 
 
 
 
505
  /**/
506
+ function ws_plugin__s2member_generate_password ($length = 12, $special_chars = TRUE)
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
  ?>
includes/functions/ruri-level-access.inc.php CHANGED
@@ -17,56 +17,64 @@ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
17
  Function for handling Request URI Level Access permissions.
18
  Attach to: add_action("template_redirect");
19
  */
20
- function ws_plugin__s2member_check_ruri_level_access ()
21
  {
22
- do_action ("s2member_before_check_ruri_level_access", get_defined_vars ());
23
- /**/
24
- $excluded = apply_filters ("s2member_check_ruri_level_access_excluded", false, get_defined_vars ());
25
- /**/
26
- if (!$excluded && !ws_plugin__s2member_is_systematic_use_page ()) /* Never restrict systematic use pages. */
27
  {
28
- $current_user = (is_user_logged_in ()) ? wp_get_current_user () : false; /* Is a user logged in? */
29
  /**/
30
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_ruris"])
31
- 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)
32
- 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")
33
- exit;
34
  /**/
35
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_ruris"])
36
- 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)
37
- 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")
38
- exit;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  /**/
40
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_ruris"])
41
- 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)
42
- 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")
43
- exit;
44
  /**/
45
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_ruris"])
46
- 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)
47
- 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")
48
- exit;
49
- /**/
50
- do_action ("s2member_during_check_ruri_level_access", get_defined_vars ());
51
  }
52
- /**/
53
- do_action ("s2member_after_check_ruri_level_access", get_defined_vars ());
54
- /**/
55
- return;
56
  }
57
  /*
58
  Function that fills replacement code variables in URIs; collectively.
59
  */
60
- function ws_plugin__s2member_fill_ruri_level_access_rc_vars ($uris = FALSE, $current_user = FALSE)
61
  {
62
- do_action ("s2member_before_fill_ruri_level_access_rc_vars", get_defined_vars ());
63
- /**/
64
- $current_user_login = (is_object ($current_user)) ? strtolower ($current_user->user_login) : "";
65
- $current_user_ID = (is_object ($current_user)) ? (string)$current_user->ID : "";
66
- /**/
67
- $uris = preg_replace ("/%%current_user_login%%/i", $current_user_login, $uris);
68
- $uris = preg_replace ("/%%current_user_ID%%/i", $current_user_ID, $uris);
69
- /**/
70
- return apply_filters ("s2member_fill_ruri_level_access_rc_vars", $uris, get_defined_vars ());
 
 
 
 
 
71
  }
72
  ?>
17
  Function for handling Request URI Level Access permissions.
18
  Attach to: add_action("template_redirect");
19
  */
20
+ if (!function_exists ("ws_plugin__s2member_check_ruri_level_access"))
21
  {
22
+ function ws_plugin__s2member_check_ruri_level_access ()
 
 
 
 
23
  {
24
+ do_action ("ws_plugin__s2member_before_check_ruri_level_access", get_defined_vars ());
25
  /**/
26
+ $excluded = apply_filters ("ws_plugin__s2member_check_ruri_level_access_excluded", false, get_defined_vars ());
 
 
 
27
  /**/
28
+ if (!$excluded && !ws_plugin__s2member_is_systematic_use_page ()) /* Never restrict systematic use pages. */
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
+ }
54
  /**/
55
+ do_action ("ws_plugin__s2member_after_check_ruri_level_access", get_defined_vars ());
 
 
 
56
  /**/
57
+ return;
 
 
 
 
 
58
  }
 
 
 
 
59
  }
60
  /*
61
  Function that fills replacement code variables in URIs; collectively.
62
  */
63
+ 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
+ }
79
  }
80
  ?>
includes/functions/shortcodes.inc.php CHANGED
@@ -30,103 +30,113 @@ PayPal® Cancellation Buttons are identified by cb="1".
30
 
31
  Attach to: add_shortcode("s2Member-PayPal-Button");
32
  */
33
- function ws_plugin__s2member_paypal_button ($attr = FALSE, $content = FALSE, $shortcode = FALSE)
34
  {
35
- do_action ("s2member_before_paypal_button", get_defined_vars ());
36
- /**/
37
- $attr["tt"] = strtoupper ($attr["tt"]); /* Term lengths absolutely must be provided in upper-case format. */
38
- $attr["rt"] = strtoupper ($attr["rt"]); /* Term lengths absolutely must be provided in upper-case format. */
39
- $attr["rr"] = strtoupper ($attr["rr"]); /* Must be provided in upper-case format. Numerical, or BN value. */
40
- $attr["ccaps"] = strtolower ($attr["ccaps"]); /* Custom Capabilities must be typed in lower-case format. */
41
- /**/
42
- $attr["rr"] = ($attr["rt"] === "L") ? "BN" : $attr["rr"]; /* Lifetime Subscriptions absolutely require Buy Now functionality in the (rr) attribute. */
43
- /**/
44
- $attr["ids"] = (!$attr["ids"] && $attr["page"]) ? $attr["page"] : $attr["ids"]; /* Backward compatibilty for "page", which was renamed to "ids" in s2Member v3.0. */
45
- /**/
46
- $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);
47
- /**/
48
- do_action ("s2member_before_paypal_button_after_shortcode_atts", get_defined_vars ());
49
- /**/
50
- if ($sc["cb"]) /* This is a special routine for Cancellation Buttons. Cancellation Buttons use a different template. */
51
  {
52
- $code = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/c-button.html"));
53
- $code = preg_replace ("/%%endpoint%%/", (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "www.sandbox.paypal.com" : "www.paypal.com"), $code);
54
- $code = preg_replace ("/%%paypal_business%%/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"], $code);
55
  /**/
56
- $code = ($sc["image"] && $sc["image"] !== "default") ? preg_replace ('/ src\="(.*?)"/', ' src="' . $sc["image"] . '"', $code) : $code;
 
 
 
57
  /**/
58
- do_action ("s2member_during_paypal_button_cb", get_defined_vars ());
59
- }
60
- /**/
61
- else if ($sc["sp"]) /* This is a special routine for Specific Post/Page Buttons. Specific Post/Page Buttons use a different template. */
62
- {
63
- $code = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/sp-button.html"));
64
- $code = preg_replace ("/%%endpoint%%/", (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "www.sandbox.paypal.com" : "www.paypal.com"), $code);
65
- $code = preg_replace ("/%%paypal_business%%/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"], $code);
66
- $code = preg_replace ("/%%cancel_return%%/", get_bloginfo ("url"), $code);
67
- $code = preg_replace ("/%%notify_url%%/", get_bloginfo ("url") . "/?s2member_paypal_notify=1", $code);
68
- $code = preg_replace ("/%%return%%/", get_bloginfo ("url") . "/?s2member_paypal_return=1", $code);
69
- $code = preg_replace ("/%%domain%%/", strtolower ($_SERVER["HTTP_HOST"]), $code);
70
- /**/
71
- $code = preg_replace ('/ name\="item_name" value\="(.*?)"/', ' name="item_name" value="' . $sc["desc"] . '"', $code);
72
- $code = preg_replace ('/ name\="item_number" value\="(.*?)"/', ' name="item_number" value="sp:' . $sc["ids"] . ':' . $sc["exp"] . '"', $code);
73
- $code = preg_replace ('/ name\="page_style" value\="(.*?)"/', ' name="page_style" value="' . $sc["ps"] . '"', $code);
74
- $code = preg_replace ('/ name\="currency_code" value\="(.*?)"/', ' name="currency_code" value="' . $sc["cc"] . '"', $code);
75
- $code = preg_replace ('/ name\="custom" value\="(.*?)"/', ' name="custom" value="' . $sc["custom"] . '"', $code);
76
- $code = preg_replace ('/ name\="amount" value\="(.*?)"/', ' name="amount" value="' . $sc["ra"] . '"', $code);
77
- /**/
78
- $code = ($sc["image"] && $sc["image"] !== "default") ? preg_replace ('/ src\="(.*?)"/', ' src="' . $sc["image"] . '"', $code) : $code;
79
- /**/
80
- do_action ("s2member_during_paypal_button_sp", get_defined_vars ());
81
- }
82
- else /* Otherwise, we'll process this Button normally, using the Membership routines. Also handles Modification Buttons. */
83
- {
84
- $sc["desc"] = (!$sc["desc"]) ? $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $sc["level"] . "_label"] : $sc["desc"];
85
  /**/
86
- $sc["level_ccaps_eotper"] = ($sc["rr"] === "BN" && $sc["rt"] !== "L") ? $sc["level"] . ":" . $sc["ccaps"] . ":" . $sc["rp"] . " " . $sc["rt"] : $sc["level"] . ":" . $sc["ccaps"];
87
- $sc["level_ccaps_eotper"] = rtrim ($sc["level_ccaps_eotper"], ":"); /* Clean any trailing separators from this string. */
88
  /**/
89
- $code = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/button.html"));
90
- $code = preg_replace ("/%%endpoint%%/", (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "www.sandbox.paypal.com" : "www.paypal.com"), $code);
91
- $code = preg_replace ("/%%paypal_business%%/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"], $code);
92
- $code = preg_replace ("/%%level_label%%/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $sc["level"] . "_label"], $code);
93
- $code = preg_replace ("/%%cancel_return%%/", get_bloginfo ("url"), $code); /* This brings them back to Front Page. */
94
- $code = preg_replace ("/%%notify_url%%/", get_bloginfo ("url") . "/?s2member_paypal_notify=1", $code);
95
- $code = preg_replace ("/%%return%%/", get_bloginfo ("url") . "/?s2member_paypal_return=1", $code);
96
- $code = preg_replace ("/%%domain%%/", strtolower ($_SERVER["HTTP_HOST"]), $code);
97
- $code = preg_replace ("/%%level%%/", $sc["level"], $code);
98
  /**/
99
- $code = preg_replace ('/ \<\!--(\<input type\="hidden" name\="(amount|src|sra|a1|p1|t1|a3|p3|t3)" value\="(.*?)" \/\>)--\>/', " $1", $code);
100
- $code = ($sc["tp"] <= 0) ? preg_replace ('/ (\<input type\="hidden" name\="(a1|p1|t1)" value\="(.*?)" \/\>)/', " <!--$1-->", $code) : $code;
101
- $code = ($sc["rr"] === "BN") ? preg_replace ('/ (\<input type\="hidden" name\="cmd" value\=")(.*?)(" \/\>)/', " $1_xclick$3", $code) : $code;
102
- $code = ($sc["rr"] === "BN") ? preg_replace ('/ (\<input type\="hidden" name\="(src|sra|a1|p1|t1|a3|p3|t3)" value\="(.*?)" \/\>)/', " <!--$1-->", $code) : $code;
103
- $code = ($sc["rr"] !== "BN") ? preg_replace ('/ (\<input type\="hidden" name\="cmd" value\=")(.*?)(" \/\>)/', " $1_xclick-subscriptions$3", $code) : $code;
104
- $code = ($sc["rr"] !== "BN") ? preg_replace ('/ (\<input type\="hidden" name\="amount" value\="(.*?)" \/\>)/', " <!--$1-->", $code) : $code;
105
  /**/
106
- $code = preg_replace ('/ name\="item_name" value\="(.*?)"/', ' name="item_name" value="' . $sc["desc"] . '"', $code);
107
- $code = preg_replace ('/ name\="item_number" value\="(.*?)"/', ' name="item_number" value="' . $sc["level_ccaps_eotper"] . '"', $code);
108
- $code = preg_replace ('/ name\="page_style" value\="(.*?)"/', ' name="page_style" value="' . $sc["ps"] . '"', $code);
109
- $code = preg_replace ('/ name\="currency_code" value\="(.*?)"/', ' name="currency_code" value="' . $sc["cc"] . '"', $code);
110
- $code = preg_replace ('/ name\="custom" value\="(.*?)"/', ' name="custom" value="' . $sc["custom"] . '"', $code);
111
- $code = preg_replace ('/ name\="on0" value\="(.*?)"/', ' name="on0" value="' . S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0 . '"', $code);
112
- $code = preg_replace ('/ name\="os0" value\="(.*?)"/', ' name="os0" value="' . S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0 . '"', $code);
113
- $code = preg_replace ('/ name\="modify" value\="(.*?)"/', ' name="modify" value="' . (($sc["mb"]) ? "1" : "0") . '"', $code);
114
- $code = preg_replace ('/ name\="amount" value\="(.*?)"/', ' name="amount" value="' . $sc["ra"] . '"', $code);
115
- $code = preg_replace ('/ name\="src" value\="(.*?)"/', ' name="src" value="' . $sc["rr"] . '"', $code);
116
- $code = preg_replace ('/ name\="p1" value\="(.*?)"/', ' name="p1" value="' . $sc["tp"] . '"', $code);
117
- $code = preg_replace ('/ name\="t1" value\="(.*?)"/', ' name="t1" value="' . $sc["tt"] . '"', $code);
118
- $code = preg_replace ('/ name\="a3" value\="(.*?)"/', ' name="a3" value="' . $sc["ra"] . '"', $code);
119
- $code = preg_replace ('/ name\="p3" value\="(.*?)"/', ' name="p3" value="' . $sc["rp"] . '"', $code);
120
- $code = preg_replace ('/ name\="t3" value\="(.*?)"/', ' name="t3" value="' . $sc["rt"] . '"', $code);
121
  /**/
122
- $code = ($sc["image"] && $sc["image"] !== "default") ? preg_replace ('/ src\="(.*?)"/', ' src="' . $sc["image"] . '"', $code) : $code;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
  /**/
124
- if ($sc["mb"])
125
- do_action ("s2member_during_paypal_button_mb", get_defined_vars ());
126
- else
127
- do_action ("s2member_during_paypal_button", get_defined_vars ());
128
  }
129
- /**/
130
- return apply_filters ("s2member_paypal_button", $code, get_defined_vars ()); /* The finished PayPal® Button. */
131
  }
132
  ?>
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
@@ -16,103 +16,124 @@ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
16
  /*
17
  Generates Specific Post/Page Access links.
18
  */
19
- function ws_plugin__s2member_sp_access_link_gen ($sp_IDs = FALSE, $hours = 72, $shrink = TRUE)
20
  {
21
- do_action ("s2member_before_sp_access_link_gen", get_defined_vars ());
22
- /**/
23
- if (($sp_IDs = preg_replace ("/[^0-9;,]/", "", $sp_IDs)) && ($leading_ID = preg_replace ("/^([0-9]+)(.*?)$/", "$1", $sp_IDs)) && $hours)
24
  {
25
- $sp_access = ws_plugin__s2member_encrypt ("sp_time_hours:.:|:.:" . $sp_IDs . ":.:|:.:" . strtotime ("now") . ":.:|:.:" . $hours);
26
- $sp_access_link = add_query_arg ("s2member_sp_access", $sp_access, get_permalink ($leading_ID));
 
27
  /**/
28
- if ($shrink && ($tinyurl = ws_plugin__s2member_remote ("http://tinyurl.com/api-create.php?url=" . rawurlencode ($sp_access_link))))
29
- return apply_filters ("s2member_sp_access_link_gen", $tinyurl, get_defined_vars ()); /* tinyURL is easier to work with. */
30
- else /* Else use the long one; tinyURL will fail when/if their server is down periodically. */
31
- return apply_filters ("s2member_sp_access_link_gen", $sp_access_link, get_defined_vars ());
 
 
 
 
 
 
 
 
32
  }
33
- /**/
34
- return false;
35
  }
36
  /*
37
  Generates Specific Post/Page Access links via ajax tools.
38
  Attach to: add_action("wp_ajax_s2member_sp_access_link");
39
  */
40
- function ws_plugin__s2member_sp_access_link ()
41
  {
42
- do_action ("s2member_before_sp_access_link", get_defined_vars ());
43
- /**/
44
- if (current_user_can ("edit_plugins")) /* Check priveledges as well. */
45
- if (($nonce = $_POST["s2member_sp_access_link"]) && wp_verify_nonce ($nonce, "ws-plugin--s2member-sp-access-link"))
46
- echo apply_filters ("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 ());
47
- /**/
48
- exit;
 
 
 
49
  }
50
  /*
51
  Handles Specific Post/Page Access authentication.
52
  */
53
- function ws_plugin__s2member_sp_access ($sp_ID = FALSE)
54
  {
55
- do_action ("s2member_before_sp_access", get_defined_vars ());
56
- /**/
57
- $excluded = apply_filters ("s2member_sp_access_excluded", false, get_defined_vars ());
58
- /**/
59
- if ($excluded || current_user_can ("edit_posts"))
60
- return true; /* Excluded? Or editing? */
61
- /**/
62
- else if ($sp_ID /* Looking for either a _GET request, or a non-empty session. */
63
- && (($_GET["s2member_sp_access"] && is_array ($sp_access_values = (array)$_GET["s2member_sp_access"]))/**/
64
- || (is_array ($sp_access_values = ws_plugin__s2member_sp_access_session ()) && !empty ($sp_access_values))))
65
  {
66
- foreach ($sp_access_values as $sp_access_value) /* Supports multiple access values in a session. */
 
 
 
 
 
 
 
 
 
67
  {
68
- if (is_array ($sp_access = preg_split ("/\:\.\:\|\:\.\:/", ws_plugin__s2member_decrypt ($sp_access_value))))
69
  {
70
- if (count ($sp_access) === 4 && $sp_access[0] === "sp_time_hours" && in_array ($sp_ID, preg_split ("/[\r\n\t\s;,]+/", $sp_access[1])))
71
  {
72
- if ($sp_access[2] <= strtotime ("now") && ($sp_access[2] + ($sp_access[3] * 3600)) >= strtotime ("now"))
73
  {
74
- if ($_GET["s2member_sp_access"]) /* Store request in a session. */
75
- ws_plugin__s2member_sp_access_session ($_GET["s2member_sp_access"]);
76
- /**/
77
- if (ws_plugin__s2member_ip_restrictions_ok ($_SERVER["REMOTE_ADDR"], $sp_access_value))
78
- return apply_filters ("s2member_sp_access", true, get_defined_vars ());
 
 
 
79
  }
80
  }
81
  }
82
- }
83
- /**/
84
- if ($_GET["s2member_sp_access"]) /* If this is a Specific Post/Page Link, fail with expiration. */
85
- {
86
- echo '<strong>Your Link Expired:</strong><br />Please contact Support if you need assistance.';
87
  /**/
88
- exit; /* $_GET["s2member_sp_access"] has expired. Or it is simply invalid. */
 
 
 
 
 
 
 
89
  }
90
  /**/
91
- return apply_filters ("s2member_sp_access", false, get_defined_vars ());
 
92
  }
93
- /**/
94
- else /* Access is not possible. */
95
- return apply_filters ("s2member_sp_access", false, get_defined_vars ());
96
  }
97
  /*
98
  Handles Specific Post/Page sessions, by writing access values into a cookie.
99
  This function can be used to add a new value into the session, and/or to return the current set of values in the session.
100
  */
101
- function ws_plugin__s2member_sp_access_session ($add_sp_access_value = FALSE)
102
  {
103
- do_action ("s2member_before_sp_access_session", get_defined_vars ());
104
- /**/
105
- $sp_access_values = ($_COOKIE["s2member_sp_access"]) ? preg_split ("/\:\.\:\|\:\.\:/", $_COOKIE["s2member_sp_access"]) : array ();
106
- /**/
107
- if ($add_sp_access_value && !in_array ($add_sp_access_value, $sp_access_values)) /* If it's not in the session already. */
108
  {
109
- $sp_access_values[] = $add_sp_access_value; /* Add an access value, and update the delimited session cookie. */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
  /**/
111
- $cookie = implode (":.:|:.:", $sp_access_values); /* Implode the access values into a delimited string. */
112
- $cookie = (strlen ($cookie) >= 4096) ? $add_sp_access_value : $cookie; /* Max cookie size is 4kbs. */
113
- setcookie ("s2member_sp_access", $cookie, time () + 31556926, "/");
114
  }
115
- /**/
116
- return apply_filters ("s2member_sp_access_session", $sp_access_values, get_defined_vars ());
117
  }
118
  ?>
16
  /*
17
  Generates Specific Post/Page Access links.
18
  */
19
+ if (!function_exists ("ws_plugin__s2member_sp_access_link_gen"))
20
  {
21
+ function ws_plugin__s2member_sp_access_link_gen ($sp_IDs = FALSE, $hours = 72, $shrink = TRUE)
 
 
22
  {
23
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
24
+ do_action ("ws_plugin__s2member_before_sp_access_link_gen", get_defined_vars ());
25
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
26
  /**/
27
+ if (($sp_IDs = preg_replace ("/[^0-9;,]/", "", $sp_IDs)) && ($leading_ID = preg_replace ("/^([0-9]+)(.*?)$/", "$1", $sp_IDs)) && $hours)
28
+ {
29
+ $sp_access = ws_plugin__s2member_encrypt ("sp_time_hours:.:|:.:" . $sp_IDs . ":.:|:.:" . strtotime ("now") . ":.:|:.:" . $hours);
30
+ $sp_access_link = add_query_arg ("s2member_sp_access", $sp_access, get_permalink ($leading_ID));
31
+ /**/
32
+ if ($shrink && ($tinyurl = ws_plugin__s2member_remote ("http://tinyurl.com/api-create.php?url=" . rawurlencode ($sp_access_link))))
33
+ return apply_filters ("ws_plugin__s2member_sp_access_link_gen", $tinyurl, get_defined_vars ()); /* tinyURL is easier to work with. */
34
+ else /* Else use the long one; tinyURL will fail when/if their server is down periodically. */
35
+ return apply_filters ("ws_plugin__s2member_sp_access_link_gen", $sp_access_link, get_defined_vars ());
36
+ }
37
+ /**/
38
+ return false;
39
  }
 
 
40
  }
41
  /*
42
  Generates Specific Post/Page Access links via ajax tools.
43
  Attach to: add_action("wp_ajax_s2member_sp_access_link");
44
  */
45
+ if (!function_exists ("ws_plugin__s2member_sp_access_link"))
46
  {
47
+ function ws_plugin__s2member_sp_access_link ()
48
+ {
49
+ do_action ("ws_plugin__s2member_before_sp_access_link", get_defined_vars ());
50
+ /**/
51
+ if (current_user_can ("edit_plugins")) /* Check priveledges as well. */
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
  /*
59
  Handles Specific Post/Page Access authentication.
60
  */
61
+ if (!function_exists ("ws_plugin__s2member_sp_access"))
62
  {
63
+ function ws_plugin__s2member_sp_access ($sp_ID = FALSE)
 
 
 
 
 
 
 
 
 
64
  {
65
+ do_action ("ws_plugin__s2member_before_sp_access", get_defined_vars ());
66
+ /**/
67
+ $excluded = apply_filters ("ws_plugin__s2member_sp_access_excluded", false, get_defined_vars ());
68
+ /**/
69
+ if ($excluded || current_user_can ("edit_posts"))
70
+ return true; /* Excluded? Or editing? */
71
+ /**/
72
+ else if ($sp_ID /* Looking for either a _GET request, or a non-empty session. */
73
+ && (($_GET["s2member_sp_access"] && is_array ($sp_access_values = (array)$_GET["s2member_sp_access"]))/**/
74
+ || (is_array ($sp_access_values = ws_plugin__s2member_sp_access_session ()) && !empty ($sp_access_values))))
75
  {
76
+ foreach ($sp_access_values as $sp_access_value) /* Supports multiple access values in a session. */
77
  {
78
+ if (is_array ($sp_access = preg_split ("/\:\.\:\|\:\.\:/", ws_plugin__s2member_decrypt ($sp_access_value))))
79
  {
80
+ if (count ($sp_access) === 4 && $sp_access[0] === "sp_time_hours" && in_array ($sp_ID, preg_split ("/[\r\n\t\s;,]+/", $sp_access[1])))
81
  {
82
+ if ($sp_access[2] <= strtotime ("now") && ($sp_access[2] + ($sp_access[3] * 3600)) >= strtotime ("now"))
83
+ {
84
+ if ($_GET["s2member_sp_access"]) /* Store request in a session. */
85
+ ws_plugin__s2member_sp_access_session($_GET["s2member_sp_access"]);
86
+ /**/
87
+ if (ws_plugin__s2member_ip_restrictions_ok ($_SERVER["REMOTE_ADDR"], $sp_access_value))
88
+ return apply_filters ("ws_plugin__s2member_sp_access", true, get_defined_vars ());
89
+ }
90
  }
91
  }
92
  }
 
 
 
 
 
93
  /**/
94
+ if ($_GET["s2member_sp_access"]) /* If this is a Specific Post/Page Link, fail with expiration. */
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 ());
102
  }
103
  /**/
104
+ else /* Access is not possible. */
105
+ return apply_filters ("ws_plugin__s2member_sp_access", false, get_defined_vars ());
106
  }
 
 
 
107
  }
108
  /*
109
  Handles Specific Post/Page sessions, by writing access values into a cookie.
110
  This function can be used to add a new value into the session, and/or to return the current set of values in the session.
111
  */
112
+ if (!function_exists ("ws_plugin__s2member_sp_access_session"))
113
  {
114
+ function ws_plugin__s2member_sp_access_session ($add_sp_access_value = FALSE)
 
 
 
 
115
  {
116
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
117
+ do_action ("ws_plugin__s2member_before_sp_access_session", get_defined_vars ());
118
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
119
+ /**/
120
+ $sp_access_values = ($_COOKIE["s2member_sp_access"]) ? preg_split ("/\:\.\:\|\:\.\:/", $_COOKIE["s2member_sp_access"]) : array ();
121
+ /**/
122
+ if ($add_sp_access_value && !in_array ($add_sp_access_value, $sp_access_values)) /* If it's not in the session already. */
123
+ {
124
+ $sp_access_values[] = $add_sp_access_value; /* Add an access value, and update the delimited session cookie. */
125
+ /**/
126
+ $cookie = implode (":.:|:.:", $sp_access_values); /* Implode the access values into a delimited string. */
127
+ $cookie = (strlen ($cookie) >= 4096) ? $add_sp_access_value : $cookie; /* Max cookie size is 4kbs. */
128
+ /**/
129
+ setcookie ("s2member_sp_access", $cookie, time () + 31556926, "/");
130
+ /**/
131
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
132
+ do_action ("ws_plugin__s2member_during_sp_access_session", get_defined_vars ());
133
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
134
+ }
135
  /**/
136
+ return apply_filters ("ws_plugin__s2member_sp_access_session", $sp_access_values, get_defined_vars ());
 
 
137
  }
 
 
138
  }
139
  ?>
includes/functions/tracking-codes.inc.php CHANGED
@@ -27,51 +27,59 @@ s2Member will display Tracking Codes in (1) of these 3 locations:
27
  2. Otherwise, if possible, on the Login Form after Registration is completed.
28
  3. Otherwise, in the footer of your theme, after both Registration and Login.
29
  */
30
- function ws_plugin__s2member_display_signup_tracking_codes ()
31
  {
32
- do_action ("s2member_before_display_signup_tracking_codes", get_defined_vars ());
33
- /**/
34
- if (($subscr_id = ws_plugin__s2member_decrypt ($_COOKIE["s2member_subscr_id"])) || ($subscr_id = ws_plugin__s2member_decrypt ($_COOKIE["s2member_signup_tracking"])))
35
  {
36
- if (($code = get_transient ($transient = md5 ("s2member_transient_signup_tracking_codes_" . $subscr_id))))
 
 
37
  {
38
- delete_transient ($transient); /* Only display this ONE time. Delete transient immediately. */
39
- /**/
40
- echo '<img src="' . add_query_arg ("s2member_delete_signup_tracking_cookie", "1", get_bloginfo ("url")) . '" alt="." style="width:1px; height:1px; border:0;" />' . "\n";
41
- /**/
42
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["is_multisite_farm"])
43
  {
44
- echo $code . "\n"; /* No PHP allowed here. */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  }
46
- else /* Otherwise, it's safe to allow PHP code. */
47
- {
48
- eval ("?>" . $code);
49
- }
50
- /**/
51
- do_action ("s2member_during_display_signup_tracking_codes", get_defined_vars ());
52
  }
 
 
53
  }
54
- /**/
55
- do_action ("s2member_after_display_signup_tracking_codes", get_defined_vars ());
56
  }
57
  /*
58
  Deletes s2Member's temporary tracking cookie.
59
  Attach to: add_action("init");
60
  */
61
- function ws_plugin__s2member_delete_signup_tracking_cookie ()
62
  {
63
- do_action ("s2member_before_delete_signup_tracking_cookie", get_defined_vars ());
64
- /**/
65
- if ($_GET["s2member_delete_signup_tracking_cookie"]) /* Deletes cookie. */
66
  {
67
- setcookie ("s2member_signup_tracking", "", time () + 31556926, "/");
68
  /**/
69
- do_action ("s2member_during_delete_signup_tracking_cookie", get_defined_vars ());
 
 
 
 
 
 
 
70
  /**/
71
- exit;
72
  }
73
- /**/
74
- do_action ("s2member_after_delete_signup_tracking_cookie", get_defined_vars ());
75
  }
76
  /*
77
  Function that displays Specific Post/Page Tracking Codes.
@@ -83,50 +91,58 @@ Attach to: add_action("wp_footer");
83
  Specific Post/Page Tracking Codes are only displayed/processed one time.
84
  s2Member will display Tracking Codes in the footer of your theme.
85
  */
86
- function ws_plugin__s2member_display_sp_tracking_codes ()
87
  {
88
- do_action ("s2member_before_display_sp_tracking_codes", get_defined_vars ());
89
- /**/
90
- if (($txn_id = ws_plugin__s2member_decrypt ($_COOKIE["s2member_sp_tracking"])))
91
  {
92
- if (($code = get_transient ($transient = md5 ("s2member_transient_sp_tracking_codes_" . $txn_id))))
 
 
93
  {
94
- delete_transient ($transient); /* Only display this ONE time. Delete transient immediately. */
95
- /**/
96
- echo '<img src="' . add_query_arg ("s2member_delete_sp_tracking_cookie", "1", get_bloginfo ("url")) . '" alt="." style="width:1px; height:1px; border:0;" />' . "\n";
97
- /**/
98
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["is_multisite_farm"])
99
  {
100
- echo $code . "\n"; /* No PHP allowed here. */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
  }
102
- else /* Otherwise, it's safe to allow PHP code. */
103
- {
104
- eval ("?>" . $code);
105
- }
106
- /**/
107
- do_action ("s2member_during_display_sp_tracking_codes", get_defined_vars ());
108
  }
 
 
109
  }
110
- /**/
111
- do_action ("s2member_after_display_sp_tracking_codes", get_defined_vars ());
112
  }
113
  /*
114
  Deletes s2Member's temporary tracking cookie.
115
  Attach to: add_action("init");
116
  */
117
- function ws_plugin__s2member_delete_sp_tracking_cookie ()
118
  {
119
- do_action ("s2member_before_delete_sp_tracking_cookie", get_defined_vars ());
120
- /**/
121
- if ($_GET["s2member_delete_sp_tracking_cookie"]) /* Deletes cookie. */
122
  {
123
- setcookie ("s2member_sp_tracking", "", time () + 31556926, "/");
124
  /**/
125
- do_action ("s2member_during_delete_sp_tracking_cookie", get_defined_vars ());
 
 
 
 
 
 
 
126
  /**/
127
- exit;
128
  }
129
- /**/
130
- do_action ("s2member_after_delete_sp_tracking_cookie", get_defined_vars ());
131
  }
132
  ?>
27
  2. Otherwise, if possible, on the Login Form after Registration is completed.
28
  3. Otherwise, in the footer of your theme, after both Registration and Login.
29
  */
30
+ if (!function_exists ("ws_plugin__s2member_display_signup_tracking_codes"))
31
  {
32
+ function ws_plugin__s2member_display_signup_tracking_codes ()
 
 
33
  {
34
+ do_action ("ws_plugin__s2member_before_display_signup_tracking_codes", get_defined_vars ());
35
+ /**/
36
+ if (($subscr_id = ws_plugin__s2member_decrypt ($_COOKIE["s2member_subscr_id"])) || ($subscr_id = ws_plugin__s2member_decrypt ($_COOKIE["s2member_signup_tracking"])))
37
  {
38
+ if (($code = get_transient ($transient = md5 ("s2member_transient_signup_tracking_codes_" . $subscr_id))))
 
 
 
 
39
  {
40
+ delete_transient ($transient); /* Only display this ONE time. Delete transient immediately. */
41
+ /**/
42
+ echo '<img src="' . add_query_arg ("s2member_delete_signup_tracking_cookie", "1", get_bloginfo ("url")) . '" alt="." style="width:1px; height:1px; border:0;" />' . "\n";
43
+ /**/
44
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
45
+ do_action ("ws_plugin__s2member_during_display_signup_tracking_codes", get_defined_vars ());
46
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
47
+ /**/
48
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["is_multisite_farm"])
49
+ {
50
+ echo $code . "\n"; /* No PHP allowed here. */
51
+ }
52
+ else /* Otherwise, it's safe to allow PHP code. */
53
+ {
54
+ eval ("?>" . $code);
55
+ }
56
  }
 
 
 
 
 
 
57
  }
58
+ /**/
59
+ do_action ("ws_plugin__s2member_after_display_signup_tracking_codes", get_defined_vars ());
60
  }
 
 
61
  }
62
  /*
63
  Deletes s2Member's temporary tracking cookie.
64
  Attach to: add_action("init");
65
  */
66
+ if (!function_exists ("ws_plugin__s2member_delete_signup_tracking_cookie"))
67
  {
68
+ function ws_plugin__s2member_delete_signup_tracking_cookie ()
 
 
69
  {
70
+ do_action ("ws_plugin__s2member_before_delete_signup_tracking_cookie", get_defined_vars ());
71
  /**/
72
+ if ($_GET["s2member_delete_signup_tracking_cookie"]) /* Deletes cookie. */
73
+ {
74
+ setcookie ("s2member_signup_tracking", "", time () + 31556926, "/");
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 ());
82
  }
 
 
83
  }
84
  /*
85
  Function that displays Specific Post/Page Tracking Codes.
91
  Specific Post/Page Tracking Codes are only displayed/processed one time.
92
  s2Member will display Tracking Codes in the footer of your theme.
93
  */
94
+ if (!function_exists ("ws_plugin__s2member_display_sp_tracking_codes"))
95
  {
96
+ function ws_plugin__s2member_display_sp_tracking_codes ()
 
 
97
  {
98
+ do_action ("ws_plugin__s2member_before_display_sp_tracking_codes", get_defined_vars ());
99
+ /**/
100
+ if (($txn_id = ws_plugin__s2member_decrypt ($_COOKIE["s2member_sp_tracking"])))
101
  {
102
+ if (($code = get_transient ($transient = md5 ("s2member_transient_sp_tracking_codes_" . $txn_id))))
 
 
 
 
103
  {
104
+ delete_transient ($transient); /* Only display this ONE time. Delete transient immediately. */
105
+ /**/
106
+ echo '<img src="' . add_query_arg ("s2member_delete_sp_tracking_cookie", "1", get_bloginfo ("url")) . '" alt="." style="width:1px; height:1px; border:0;" />' . "\n";
107
+ /**/
108
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
109
+ do_action ("ws_plugin__s2member_during_display_sp_tracking_codes", get_defined_vars ());
110
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
111
+ /**/
112
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["is_multisite_farm"])
113
+ {
114
+ echo $code . "\n"; /* No PHP allowed here. */
115
+ }
116
+ else /* Otherwise, it's safe to allow PHP code. */
117
+ {
118
+ eval ("?>" . $code);
119
+ }
120
  }
 
 
 
 
 
 
121
  }
122
+ /**/
123
+ do_action ("ws_plugin__s2member_after_display_sp_tracking_codes", get_defined_vars ());
124
  }
 
 
125
  }
126
  /*
127
  Deletes s2Member's temporary tracking cookie.
128
  Attach to: add_action("init");
129
  */
130
+ if (!function_exists ("ws_plugin__s2member_delete_sp_tracking_cookie"))
131
  {
132
+ function ws_plugin__s2member_delete_sp_tracking_cookie ()
 
 
133
  {
134
+ do_action ("ws_plugin__s2member_before_delete_sp_tracking_cookie", get_defined_vars ());
135
  /**/
136
+ if ($_GET["s2member_delete_sp_tracking_cookie"]) /* Deletes cookie. */
137
+ {
138
+ setcookie ("s2member_sp_tracking", "", time () + 31556926, "/");
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 ());
146
  }
 
 
147
  }
148
  ?>
includes/functions/translations.inc.php CHANGED
@@ -17,50 +17,47 @@ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
17
  Mangles internal translations.
18
  Attach to: add_filter("gettext");
19
  */
20
- function ws_plugin__s2member_translation_mangler ($translated = FALSE, $original = FALSE, $domain = FALSE)
21
  {
22
- static $is_admin_media_upload, $is_wp_login; /* Optimizes this routine. */
23
- /**/
24
- do_action ("s2member_before_translation_mangler", get_defined_vars ());
25
- /**/
26
- if (!isset ($is_admin_media_upload) || $is_admin_media_upload)
27
  {
28
- if ($is_admin_media_upload || (is_admin () && preg_match ("/\/(async-upload|media-upload)\.php/", $_SERVER["REQUEST_URI"])))
 
 
29
  {
30
- $is_admin_media_upload = true;
31
- /**/
32
- if ($translated === "Insert into Post")
33
  {
34
- $translated = "Insert";
 
 
 
 
 
35
  }
 
 
36
  }
37
- else
 
38
  {
39
- $is_admin_media_upload = false;
40
- }
41
- }
42
- /**/
43
- else if (!isset ($is_wp_login) || $is_wp_login)
44
- {
45
- if ($is_wp_login || preg_match ("/\/wp-login\.php/", $_SERVER["REQUEST_URI"]))
46
- {
47
- $is_wp_login = true;
48
- /**/
49
- if ($translated === "Username")
50
  {
51
- $translated = "Username *";
 
 
 
 
 
 
 
 
 
52
  }
53
- else if ($translated === "E-mail")
54
- {
55
- $translated = "Email Address *";
56
- }
57
- }
58
- else
59
- {
60
- $is_wp_login = false;
61
  }
 
 
62
  }
63
- /**/
64
- return apply_filters ("s2member_translation_mangler", $translated, get_defined_vars ());
65
  }
66
  ?>
17
  Mangles internal translations.
18
  Attach to: add_filter("gettext");
19
  */
20
+ if (!function_exists ("ws_plugin__s2member_translation_mangler"))
21
  {
22
+ function ws_plugin__s2member_translation_mangler ($translated = FALSE, $original = FALSE, $domain = FALSE)
 
 
 
 
23
  {
24
+ static $is_admin_media_upload, $is_wp_login; /* Optimizes this routine. */
25
+ /**/
26
+ if (!isset ($is_admin_media_upload) || $is_admin_media_upload)
27
  {
28
+ if ($is_admin_media_upload || (is_admin () && preg_match ("/\/(async-upload|media-upload)\.php/", $_SERVER["REQUEST_URI"])))
 
 
29
  {
30
+ $is_admin_media_upload = true; /* Yes, we are in this area. */
31
+ /**/
32
+ if ($translated === "Insert into Post") /* Give filters a chance here. */
33
+ {
34
+ $translated = apply_filters ("ws_plugin__s2member_translation_mangler", "Insert", get_defined_vars ());
35
+ }
36
  }
37
+ else /* Otherwise, false. */
38
+ $is_admin_media_upload = false;
39
  }
40
+ /**/
41
+ else if (!isset ($is_wp_login) || $is_wp_login)
42
  {
43
+ if ($is_wp_login || preg_match ("/\/wp-login\.php/", $_SERVER["REQUEST_URI"]))
 
 
 
 
 
 
 
 
 
 
44
  {
45
+ $is_wp_login = true; /* Yes, we are in this area. */
46
+ /**/
47
+ if ($translated === "Username") /* Give filters a chance here. */
48
+ {
49
+ $translated = apply_filters ("ws_plugin__s2member_translation_mangler", "Username *", get_defined_vars ());
50
+ }
51
+ else if ($translated === "E-mail") /* Give filters a chance here. */
52
+ {
53
+ $translated = apply_filters ("ws_plugin__s2member_translation_mangler", "Email Address *", get_defined_vars ());
54
+ }
55
  }
56
+ else /* Otherwise, false. */
57
+ $is_wp_login = false;
 
 
 
 
 
 
58
  }
59
+ /**/
60
+ return $translated;
61
  }
 
 
62
  }
63
  ?>
includes/functions/user-access-level.inc.php CHANGED
@@ -17,39 +17,40 @@ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
17
  Function for determing the Access Level of a User/Member.
18
  Returns 0-4 according to the current User/Member's Access Level.
19
  */
20
- function ws_plugin__s2member_user_access_level ()
21
  {
22
- do_action ("s2member_before_user_access_level", get_defined_vars ());
23
- /**/
24
- if (!($current_user = (is_user_logged_in ()) ? wp_get_current_user () : false))
25
  {
26
- return apply_filters ("s2member_user_access_level", -1, get_defined_vars ());
27
- /* Return of -1, means a User is not logged in. */
28
- }
29
- else if (current_user_can ("access_s2member_level4"))
30
- {
31
- return apply_filters ("s2member_user_access_level", 4, get_defined_vars ());
32
- /* Member logged in with Level 4 Access. */
33
- }
34
- else if (current_user_can ("access_s2member_level3"))
35
- {
36
- return apply_filters ("s2member_user_access_level", 3, get_defined_vars ());
37
- /* Member logged in with Level 3 Access. */
38
- }
39
- else if (current_user_can ("access_s2member_level2"))
40
- {
41
- return apply_filters ("s2member_user_access_level", 2, get_defined_vars ());
42
- /* Member logged in with Level 2 Access. */
43
- }
44
- else if (current_user_can ("access_s2member_level1"))
45
- {
46
- return apply_filters ("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 ("s2member_user_access_level", 0, get_defined_vars ());
52
- /* User is logged in without Access. A Free Subscriber. */
 
 
 
53
  }
54
  }
55
  ?>
17
  Function for determing the Access Level of a User/Member.
18
  Returns 0-4 according to the current User/Member's Access Level.
19
  */
20
+ if (!function_exists ("ws_plugin__s2member_user_access_level"))
21
  {
22
+ function ws_plugin__s2member_user_access_level ()
 
 
23
  {
24
+ if (!($current_user = (is_user_logged_in ()) ? wp_get_current_user () : false))
25
+ {
26
+ return apply_filters ("ws_plugin__s2member_user_access_level", -1, get_defined_vars ());
27
+ /* Return of -1, means a User is not logged in. */
28
+ }
29
+ else if (current_user_can ("access_s2member_level4"))
30
+ {
31
+ return apply_filters ("ws_plugin__s2member_user_access_level", 4, get_defined_vars ());
32
+ /* Member logged in with Level 4 Access. */
33
+ }
34
+ else if (current_user_can ("access_s2member_level3"))
35
+ {
36
+ return apply_filters ("ws_plugin__s2member_user_access_level", 3, get_defined_vars ());
37
+ /* Member logged in with Level 3 Access. */
38
+ }
39
+ else if (current_user_can ("access_s2member_level2"))
40
+ {
41
+ return apply_filters ("ws_plugin__s2member_user_access_level", 2, get_defined_vars ());
42
+ /* Member logged in with Level 2 Access. */
43
+ }
44
+ else if (current_user_can ("access_s2member_level1"))
45
+ {
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
  ?>
includes/functions/user-deletions.inc.php CHANGED
@@ -17,31 +17,40 @@ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
17
  Function for handling user deletions.
18
  Attach to: add_action("delete_user");
19
  */
20
- function ws_plugin__s2member_handle_user_deletions ($user_id = FALSE)
21
  {
22
- do_action ("s2member_before_handle_user_deletions", get_defined_vars ());
23
- /**/
24
- $user = new WP_User ($user_id); /* Acquire user obj. */
25
- /**/
26
- $custom = get_usermeta ($user_id, "s2member_custom");
27
- $subscr_id = get_usermeta ($user_id, "s2member_subscr_id");
28
- /**/
29
- if (is_object ($user) && $subscr_id && $custom && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"] && is_array ($cv = preg_split ("/\|/", $custom)))
30
  {
31
- foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"]) as $url) /* Handle eot notifications on user deletion. */
32
- if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)) && ($url = preg_replace ("/%%subscr_id%%/i", urlencode ($subscr_id), $url)))
33
- 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)))
34
- if (($url = preg_replace ("/%%user_full_name%%/i", urlencode (trim ($user->first_name . " " . $user->last_name)), $url)))
35
- if (($url = preg_replace ("/%%user_email%%/i", urlencode ($user->user_email), $url)))
36
- /**/
37
- if (($url = trim ($url))) /* Empty? */
38
- ws_plugin__s2member_remote ($url);
39
  /**/
40
- do_action ("s2member_during_handle_user_deletions", get_defined_vars ());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  }
42
- /**/
43
- do_action ("s2member_after_handle_user_deletions", get_defined_vars ());
44
- /**/
45
- return;
46
  }
47
  ?>
17
  Function for handling user deletions.
18
  Attach to: add_action("delete_user");
19
  */
20
+ if (!function_exists ("ws_plugin__s2member_handle_user_deletions"))
21
  {
22
+ function ws_plugin__s2member_handle_user_deletions ($user_id = FALSE)
 
 
 
 
 
 
 
23
  {
24
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
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);
43
+ /**/
44
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
45
+ do_action ("ws_plugin__s2member_during_handle_user_deletions", get_defined_vars ());
46
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
47
+ }
48
+ /**/
49
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
50
+ do_action ("ws_plugin__s2member_after_handle_user_deletions", get_defined_vars ());
51
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
52
+ /**/
53
+ return;
54
  }
 
 
 
 
55
  }
56
  ?>
includes/functions/user-has-wp-role.inc.php CHANGED
@@ -18,22 +18,27 @@ Function for determing whether $user has a built-in WP Role.
18
  One of: (administrator|editor|author|contributor).
19
  By default, this excludes the "subscriber" role.
20
  */
21
- function ws_plugin__s2member_user_has_wp_role ($user = FALSE, $exclude = array ("subscriber"))
22
  {
23
- do_action ("s2member_before_user_has_wp_role", get_defined_vars ());
24
- /**/
25
- if (!is_object ($user) || !is_array ($user->roles) || empty ($user->roles))
26
- return apply_filters ("s2member_user_has_wp_role", false, get_defined_vars ());
27
- /**/
28
- $exclude = (array)$exclude; /* Force array on the exclusions. */
29
- /**/
30
- if (in_array ("administrator", $exclude) || !in_array ("administrator", $user->roles))
31
- if (in_array ("editor", $exclude) || !in_array ("editor", $user->roles))
32
- if (in_array ("author", $exclude) || !in_array ("author", $user->roles))
33
- if (in_array ("contributor", $exclude) || !in_array ("contributor", $user->roles))
34
- if (in_array ("subscriber", $exclude) || !in_array ("subscriber", $user->roles))
35
- return apply_filters ("s2member_user_has_wp_role", false, get_defined_vars ());
36
- /**/
37
- return apply_filters ("s2member_user_has_wp_role", true, get_defined_vars ());
 
 
 
 
 
38
  }
39
  ?>
18
  One of: (administrator|editor|author|contributor).
19
  By default, this excludes the "subscriber" role.
20
  */
21
+ if (!function_exists ("ws_plugin__s2member_user_has_wp_role"))
22
  {
23
+ function ws_plugin__s2member_user_has_wp_role ($user = FALSE, $exclude = array ("subscriber"))
24
+ {
25
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
26
+ do_action ("ws_plugin__s2member_before_user_has_wp_role", get_defined_vars ());
27
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
28
+ /**/
29
+ if (!is_object ($user) || !is_array ($user->roles) || empty ($user->roles))
30
+ return apply_filters ("ws_plugin__s2member_user_has_wp_role", false, get_defined_vars ());
31
+ /**/
32
+ $exclude = (array)$exclude; /* Force array on the exclusions. */
33
+ /**/
34
+ if (in_array ("administrator", $exclude) || !in_array ("administrator", $user->roles))
35
+ if (in_array ("editor", $exclude) || !in_array ("editor", $user->roles))
36
+ if (in_array ("author", $exclude) || !in_array ("author", $user->roles))
37
+ if (in_array ("contributor", $exclude) || !in_array ("contributor", $user->roles))
38
+ if (in_array ("subscriber", $exclude) || !in_array ("subscriber", $user->roles))
39
+ return apply_filters ("ws_plugin__s2member_user_has_wp_role", false, get_defined_vars ());
40
+ /**/
41
+ return apply_filters ("ws_plugin__s2member_user_has_wp_role", true, get_defined_vars ());
42
+ }
43
  }
44
  ?>
includes/functions/user-notes.inc.php CHANGED
@@ -16,38 +16,57 @@ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
16
  /*
17
  Append a note onto a specific User/Member's account.
18
  */
19
- function ws_plugin__s2member_append_user_notes ($user_id = FALSE, $notes = FALSE)
20
  {
21
- do_action ("s2member_before_append_user_notes", get_defined_vars ());
22
- /**/
23
- if ($user_id && $notes && is_string ($notes)) /* Must have these. */
24
  {
25
- $notes = trim (get_usermeta ($user_id, "s2member_notes") . "\n" . $notes);
26
- $notes = apply_filters ("s2member_append_user_notes", $notes, get_defined_vars ());
27
- update_usermeta ($user_id, "s2member_notes", $notes);
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  }
29
- /**/
30
- return $notes; /* Return full set of notes. */
31
  }
32
  /*
33
  Clear specific notes from a User/Member's account; based on line-by-line regex.
34
  */
35
- function ws_plugin__s2member_clear_user_note_lines ($user_id = FALSE, $regex = FALSE)
36
  {
37
- do_action ("s2member_before_clear_user_note_lines", get_defined_vars ());
38
- /**/
39
- if ($user_id && $regex && is_string ($regex) && ($lines = array ()))
40
  {
41
- /* Careful here to preserve empty lines. */
42
- $notes = trim (get_usermeta ($user_id, "s2member_notes"));
43
- foreach (preg_split ("/\n/", $notes) as $line)
44
- if (!preg_match ($regex, $line))
45
- $lines[] = $line;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  /**/
47
- $notes = apply_filters ("s2member_clear_user_note_lines", trim (implode ("\n", $lines)), get_defined_vars ());
48
- update_usermeta ($user_id, "s2member_notes", $notes);
49
  }
50
- /**/
51
- return $notes; /* Return full set of notes. */
52
  }
53
  ?>
16
  /*
17
  Append a note onto a specific User/Member's account.
18
  */
19
+ if (!function_exists ("ws_plugin__s2member_append_user_notes"))
20
  {
21
+ function ws_plugin__s2member_append_user_notes ($user_id = FALSE, $notes = FALSE)
 
 
22
  {
23
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
24
+ do_action ("ws_plugin__s2member_before_append_user_notes", get_defined_vars ());
25
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
26
+ /**/
27
+ if ($user_id && $notes && is_string ($notes)) /* Must have these. */
28
+ {
29
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
30
+ do_action ("ws_plugin__s2member_during_append_user_notes", get_defined_vars ());
31
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
32
+ /**/
33
+ $notes = trim (get_usermeta ($user_id, "s2member_notes") . "\n" . $notes);
34
+ /**/
35
+ update_usermeta ($user_id, "s2member_notes", $notes);
36
+ }
37
+ /**/
38
+ return apply_filters ("ws_plugin__s2member_append_user_notes", $notes, get_defined_vars ());
39
  }
 
 
40
  }
41
  /*
42
  Clear specific notes from a User/Member's account; based on line-by-line regex.
43
  */
44
+ if (!function_exists ("ws_plugin__s2member_clear_user_note_lines"))
45
  {
46
+ function ws_plugin__s2member_clear_user_note_lines ($user_id = FALSE, $regex = FALSE)
 
 
47
  {
48
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
49
+ do_action ("ws_plugin__s2member_before_clear_user_note_lines", get_defined_vars ());
50
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
51
+ /**/
52
+ if ($user_id && $regex && is_string ($regex) && ($lines = array ()))
53
+ {
54
+ /* Careful here to preserve empty lines. */
55
+ $notes = trim (get_usermeta ($user_id, "s2member_notes"));
56
+ foreach (preg_split ("/\n/", $notes) as $line)
57
+ if (!preg_match ($regex, $line))
58
+ $lines[] = $line;
59
+ /**/
60
+ $notes = trim (implode ("\n", $lines));
61
+ /**/
62
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
63
+ do_action ("ws_plugin__s2member_during_clear_user_note_lines", get_defined_vars ());
64
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
65
+ /**/
66
+ update_usermeta ($user_id, "s2member_notes", $notes);
67
+ }
68
  /**/
69
+ return apply_filters ("ws_plugin__s2member_clear_user_note_lines", $notes, get_defined_vars ());
 
70
  }
 
 
71
  }
72
  ?>
includes/functions/users-list.inc.php CHANGED
@@ -17,205 +17,289 @@ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
17
  Function that adds columns to the list of Users.
18
  Attach to: add_filter ("manage_users_columns");
19
  */
20
- function ws_plugin__s2member_users_list_cols ($cols = FALSE)
21
  {
22
- do_action ("s2member_before_users_list_cols", get_defined_vars ());
23
- /**/
24
- $cols["s2member_registration_time"] = "Registered On"; /* Date they signed up. */
25
- $cols["s2member_subscr_id"] = "PayPal® Subscr. ID"; /* Special field that is always applied. */
26
- $cols["s2member_ccaps"] = "Custom Capabilities"; /* Special field that is always applied. */
27
- /**/
28
- if (!defined ("BP_VERSION")) /* Custom fields are not compatible when running together with BuddyPress. */
29
  {
30
- foreach (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) as $field)
 
 
 
 
 
 
 
 
31
  {
32
- if ($field = trim ($field, "* \t\n\r\0\x0B")) /* Don't process empty fields. */
33
  {
34
- $cols[preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field))] = $field;
 
 
 
35
  }
 
 
 
 
36
  }
 
 
37
  }
38
- /**/
39
- return apply_filters ("s2member_users_list_cols", $cols, get_defined_vars ());
40
  }
41
  /*
42
  Function that displays column data in the row of details.
43
  Attach to: add_filter ("manage_users_custom_column");
44
  */
45
- function ws_plugin__s2member_users_list_display_cols ($_ = FALSE, $col = FALSE, $user_id = FALSE)
46
  {
47
- global $user_object; /* Already in global scope inside users.php. */
48
- $user = $user_object; /* Shorter reference to the $user_object var. */
49
- static $fields, $fields_4_user_id; /* Used for optimization. */
50
- /**/
51
- do_action ("s2member_before_users_list_display_cols", get_defined_vars ());
52
- /**/
53
- if ((!isset ($fields) || $fields_4_user_id !== $user_id) && ($fields_4_user_id = $user_id))
54
- $fields = get_usermeta ($user_id, "s2member_custom_fields");
55
- /**/
56
- if ($col === "s2member_registration_time")
57
- $val = ($r = $user->user_registered) ? date ("D M j, Y", strtotime ($r)) . '<br />@exactly ' . date ("g:i a", strtotime ($r)) : "—";
58
- /**/
59
- else if ($col === "s2member_subscr_id")
60
- $val = ($r = get_usermeta ($user_id, "s2member_subscr_id")) ? esc_html ($r) : "—";
61
- /**/
62
- else if ($col === "s2member_ccaps") /* Custom Capabilities. */
63
  {
64
- foreach ($user->allcaps as $cap => $cap_enabled)
65
- if (preg_match ("/^access_s2member_ccap_/", $cap))
66
- $ccaps[] = preg_replace ("/^access_s2member_ccap_/", "", $cap);
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  /**/
68
- $val = (!empty ($ccaps)) ? implode ("<br />", $ccaps) : "—";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
  }
70
- /**/
71
- else if ($fields[$col] && preg_match ("/^http(s?)\:/i", $fields[$col]))
72
- $val = '<a href="' . esc_attr ($fields[$col]) . '" target="_blank">' . esc_html (substr ($fields[$col], strpos ($fields[$col], ":") + 3, 25) . "...") . '</a>';
73
- /**/
74
- else if ($fields[$col])
75
- $val = esc_html ($fields[$col]);
76
- /**/
77
- return apply_filters ("s2member_users_list_display_cols", (($val) ? $val : "—"), get_defined_vars ());
78
  }
79
  /*
80
  Function that adds custom fields to the admin profile editing page.
81
  Attach to: add_action("edit_user_profile");
82
  Attach to: add_action("show_user_profile");
83
  */
84
- function ws_plugin__s2member_users_list_edit_cols ($user = FALSE)
85
  {
86
- do_action ("s2member_before_users_list_edit_cols", get_defined_vars ());
87
- /**/
88
- if (current_user_can ("edit_users")) /* Security check. */
89
  {
90
- echo '<div style="margin:25px 0 25px 0; height:1px; line-height:1px; background:#CCCCCC;"></div>' . "\n";
91
- /**/
92
- echo '<h3>s2Member Configuration &amp; Profile Fields</h3>' . "\n";
93
  /**/
94
- echo '<table class="form-table">' . "\n";
95
- /**/
96
- if (!ws_plugin__s2member_user_has_wp_role ($user)) /* Not for WP Roles. */
97
- {
98
- echo '<tr>' . "\n";
99
- echo '<th><label>PayPal® Subscr. ID</label> <a href="#" onclick="alert(\'This will be filled automatically by s2Member.\\n\\nA PayPal® Subscr ID is only valid for paid Members. This field will always be empty for Free Subscribers, Administrators, Contributors, and Authors. This field is only editable for Customer Service purposes; just in case you ever need to update the PayPal® Subscr ID manually. You are not likely to need this, but s2Member makes it editable, just in case.\'); return false;">[?]</a></th>' . "\n";
100
- 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";
101
- echo '</tr>' . "\n";
102
- }
103
- /**/
104
- foreach ($user->allcaps as $cap => $cap_enabled)
105
- if (preg_match ("/^access_s2member_ccap_/", $cap))
106
- $ccaps[] = preg_replace ("/^access_s2member_ccap_/", "", $cap);
107
- /**/
108
- echo '<tr>' . "\n";
109
- echo '<th><label>Custom Capabilities</label> <a href="#" onclick="alert(\'Optional. This is VERY advanced. For full details, see:\\ns2Member -> API Scripting -> Custom Capabilities.\'); return false;">[?]</a></th>' . "\n";
110
- 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";
111
- echo '</tr>' . "\n";
112
- /**/
113
- if (!ws_plugin__s2member_user_has_wp_role ($user)) /* Not for WP Roles. */
114
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115
  echo '<tr>' . "\n";
116
- $auto_eot_time = get_usermeta ($user->ID, "s2member_auto_eot_time");
117
- $auto_eot_time = ($auto_eot_time) ? date ("D M j, Y g:i a T", $auto_eot_time) : "";
118
- echo '<th><label>Automatic EOT Time:</label> <a href="#" onclick="alert(\'EOT = End Of Term. ( i.e. Account Expiration / Termination. ).\\n\\nIf you leave this empty, s2Member will configure an EOT Time automatically, based on the PayPal® Subscription associated with this account. In other words, if a PayPal® Subscription expires, is cancelled, terminated, refunded, reversed, or charged back to you; s2Member will deal with the EOT automatically.\\n\\nThat being said, if you would rather take control over this, you can. If you type in a date manually, s2Member will obey the Auto-EOT Time that you\\\'ve given, no matter what. In other words, you can force certain Members to expire automatically, at a time that you specify. s2Member will obey.\\n\\nValid formats for Automatic EOT Time:\\n\\nmm/dd/yyyy\\nyyyy-mm-dd\\n+1 year\\n+2 weeks\\n+2 months\\n+10 minutes\\nnext thursday\\ntomorrow\\ntoday\\n\\n* anything compatible with PHP\\\'s strtotime() function.\'); return false;">[?]</a>' . (($auto_eot_time) ? '<br /><small>( based on server time )</small>' : '') . '</th>' . "\n";
119
- 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";
120
  echo '</tr>' . "\n";
121
- }
122
- /**/
123
- if (!defined ("BP_VERSION")) /* Custom fields are not compatible when running together with BuddyPress. */
124
- {
125
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) /* Only if configured. */
 
126
  {
 
 
 
 
127
  echo '<tr>' . "\n";
128
- echo '<td colspan="2">' . "\n";
129
- echo '<div style="height:1px; line-height:1px; background:#CCCCCC;"></div>' . "\n";
130
- echo '</td>' . "\n";
 
131
  echo '</tr>' . "\n";
132
  /**/
133
- $fields = get_usermeta ($user->ID, "s2member_custom_fields"); /* Get existing field values. */
134
- /**/
135
- foreach (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) as $field)
 
 
 
 
 
136
  {
137
- if ($field = trim ($field, "* \t\n\r\0\x0B")) /* Don't process empty fields. */
 
 
 
 
 
 
 
 
 
 
 
 
138
  {
139
- echo '<tr>' . "\n";
140
- echo '<th><label>' . esc_html ($field) . ' </label></th>' . "\n";
141
- $field = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field));
142
- echo '<td><input type="text" name="ws_plugin__s2member_profile_' . esc_attr ($field) . '" value="' . format_to_edit ($fields[$field]) . '" class="regular-text" /></td>' . "\n";
143
- echo '</tr>' . "\n";
 
 
 
 
 
 
 
 
 
 
 
144
  }
 
 
 
 
 
 
 
 
 
 
145
  }
146
- /**/
147
- echo '<tr>' . "\n";
148
- echo '<td colspan="2">' . "\n";
149
- echo '<div style="height:1px; line-height:1px; background:#CCCCCC;"></div>' . "\n";
150
- echo '</td>' . "\n";
151
- echo '</tr>' . "\n";
152
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
153
  }
154
  /**/
155
- echo '<tr>' . "\n";
156
- echo '<th><label>Administrative<br />Notations:</label> <a href="#" onclick="alert(\'This is for Administrative purposes. You can keep a list of Notations about this account. These Notations are private; Users/Members will never see these.\\n\\n*Note* The s2Member software may `append` Notes to this field occassionaly, under special circumstances. For example, when/if s2Member demotes a paid Member to a Free Subscriber, s2Member will leave a Note in this field.\'); return false;">[?]</a></th>' . "\n";
157
- 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";
158
- echo '</tr>' . "\n";
159
- /**/
160
- do_action ("s2member_during_users_list_edit_cols", get_defined_vars ());
161
- /**/
162
- echo '</table>' . "\n";
163
  /**/
164
- echo '<div style="margin:25px 0 25px 0; height:1px; line-height:1px; background:#CCCCCC;"></div>' . "\n";
165
  }
166
- /**/
167
- do_action ("s2member_after_users_list_edit_cols", get_defined_vars ());
168
- /**/
169
- return;
170
  }
171
  /*
172
  Function that saves custom fields after an admin updates profile.
173
  Attach to: add_action("edit_user_profile");
174
  Attach to: add_action("personal_options_update");
175
  */
176
- function ws_plugin__s2member_users_list_update_cols ($user_id = FALSE)
177
  {
178
- do_action ("s2member_before_users_list_update_cols", get_defined_vars ());
179
- /**/
180
- if (current_user_can ("edit_users")) /* Quick security check here. */
181
  {
182
- if (is_array ($_POST = stripslashes_deep ($_POST)) && !empty ($_POST))
 
 
 
 
183
  {
184
- $user = new WP_User ($user_id);
185
- /**/
186
- update_usermeta ($user_id, "s2member_subscr_id", $_POST["ws_plugin__s2member_profile_s2member_subscr_id"]);
187
- /**/
188
- foreach ($user->allcaps as $cap => $cap_enabled)
189
- if (preg_match ("/^access_s2member_ccap_/", $cap))
190
- $user->remove_cap ($ccap = $cap);
191
- /**/
192
- foreach (preg_split ("/[\r\n\t\s;,]+/", $_POST["ws_plugin__s2member_profile_s2member_ccaps"]) as $ccap)
193
- if (strlen ($ccap)) /* Don't add empty capabilities. */
194
- $user->add_cap ("access_s2member_ccap_" . trim (strtolower ($ccap)));
195
- /**/
196
- $auto_eot_time = ($eot = $_POST["ws_plugin__s2member_profile_s2member_auto_eot_time"]) ? strtotime ($eot) : "";
197
- update_usermeta ($user_id, "s2member_auto_eot_time", $auto_eot_time);
198
- /**/
199
- if (!defined ("BP_VERSION")) /* Custom fields are not compatible when running together with BuddyPress. */
200
  {
201
- foreach (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) as $field)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
  {
203
- if ($field = trim ($field, "* \t\n\r\0\x0B")) /* Don't process empty fields. */
204
  {
205
- $field = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field));
206
- $fields[$field] = trim ($_POST["ws_plugin__s2member_profile_" . $field]);
 
 
 
207
  }
 
 
208
  }
209
  /**/
210
- update_usermeta ($user_id, "s2member_custom_fields", $fields);
 
 
 
 
211
  }
212
- /**/
213
- update_usermeta ($user_id, "s2member_notes", $_POST["ws_plugin__s2member_profile_s2member_notes"]);
214
- /**/
215
- do_action ("s2member_during_users_list_update_cols", get_defined_vars ());
216
  }
 
 
 
 
217
  }
218
- /**/
219
- do_action ("s2member_after_users_list_update_cols", get_defined_vars ());
220
  }
221
  ?>
17
  Function that adds columns to the list of Users.
18
  Attach to: add_filter ("manage_users_columns");
19
  */
20
+ 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
+ /**/
28
+ $cols["s2member_registration_time"] = "Registered On"; /* Date they signed up. */
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
  }
50
  /*
51
  Function that displays column data in the row of details.
52
  Attach to: add_filter ("manage_users_custom_column");
53
  */
54
+ if (!function_exists ("ws_plugin__s2member_users_list_display_cols"))
55
  {
56
+ function ws_plugin__s2member_users_list_display_cols ($_ = FALSE, $col = FALSE, $user_id = FALSE)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  {
58
+ global $user_object; /* Already in global scope inside users.php. */
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
+ /**/
66
+ if ((!isset ($fields) || $fields_4_user_id !== $user_id) && ($fields_4_user_id = $user_id))
67
+ $fields = get_usermeta ($user_id, "s2member_custom_fields");
68
+ /**/
69
+ if ($col === "s2member_registration_time")
70
+ $val = ($r = $user->user_registered) ? date ("D M j, Y", strtotime ($r)) . '<br />@exactly ' . date ("g:i a", strtotime ($r)) : "—";
71
+ /**/
72
+ else if ($col === "s2member_subscr_id")
73
+ $val = ($r = get_usermeta ($user_id, "s2member_subscr_id")) ? esc_html ($r) : "—";
74
  /**/
75
+ else if ($col === "s2member_ccaps") /* Custom Capabilities. */
76
+ {
77
+ foreach ($user->allcaps as $cap => $cap_enabled)
78
+ if (preg_match ("/^access_s2member_ccap_/", $cap))
79
+ $ccaps[] = preg_replace ("/^access_s2member_ccap_/", "", $cap);
80
+ /**/
81
+ $val = (!empty ($ccaps)) ? implode ("<br />", $ccaps) : "—";
82
+ }
83
+ /**/
84
+ else if ($fields[$col] && preg_match ("/^http(s?)\:/i", $fields[$col]))
85
+ $val = '<a href="' . esc_attr ($fields[$col]) . '" target="_blank">' . esc_html (substr ($fields[$col], strpos ($fields[$col], ":") + 3, 25) . "...") . '</a>';
86
+ /**/
87
+ else if ($fields[$col])
88
+ $val = esc_html ($fields[$col]);
89
+ /**/
90
+ return apply_filters ("ws_plugin__s2member_users_list_display_cols", (($val) ? $val : "—"), get_defined_vars ());
91
  }
 
 
 
 
 
 
 
 
92
  }
93
  /*
94
  Function that adds custom fields to the admin profile editing page.
95
  Attach to: add_action("edit_user_profile");
96
  Attach to: add_action("show_user_profile");
97
  */
98
+ 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
  /**/
106
+ if (current_user_can ("edit_users")) /* Security check. */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  {
108
+ echo '<div style="margin:25px 0 25px 0; height:1px; line-height:1px; background:#CCCCCC;"></div>' . "\n";
109
+ /**/
110
+ echo '<h3>s2Member Configuration &amp; Profile Fields</h3>' . "\n";
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
+ /**/
124
+ echo '<tr>' . "\n";
125
+ echo '<th><label>PayPal® Subscr. ID</label> <a href="#" onclick="alert(\'This will be filled automatically by s2Member.\\n\\nA PayPal® Subscr ID is only valid for paid Members. This field will always be empty for Free Subscribers, Administrators, Contributors, and Authors. This field is only editable for Customer Service purposes; just in case you ever need to update the PayPal® Subscr ID manually. You are not likely to need this, but s2Member makes it editable, just in case.\'); return false;">[?]</a></th>' . "\n";
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
+ }
133
+ /**/
134
+ foreach ($user->allcaps as $cap => $cap_enabled)
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
+ /**/
142
  echo '<tr>' . "\n";
143
+ echo '<th><label>Custom Capabilities</label> <a href="#" onclick="alert(\'Optional. This is VERY advanced. For full details, see:\\ns2Member -> API Scripting -> Custom Capabilities.\'); return false;">[?]</a></th>' . "\n";
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
+ /**/
157
  echo '<tr>' . "\n";
158
+ $auto_eot_time = get_usermeta ($user->ID, "s2member_auto_eot_time");
159
+ $auto_eot_time = ($auto_eot_time) ? date ("D M j, Y g:i a T", $auto_eot_time) : "";
160
+ echo '<th><label>Automatic EOT Time:</label> <a href="#" onclick="alert(\'EOT = End Of Term. ( i.e. Account Expiration / Termination. ).\\n\\nIf you leave this empty, s2Member will configure an EOT Time automatically, based on the PayPal® Subscription associated with this account. In other words, if a PayPal® Subscription expires, is cancelled, terminated, refunded, reversed, or charged back to you; s2Member will deal with the EOT automatically.\\n\\nThat being said, if you would rather take control over this, you can. If you type in a date manually, s2Member will obey the Auto-EOT Time that you\\\'ve given, no matter what. In other words, you can force certain Members to expire automatically, at a time that you specify. s2Member will obey.\\n\\nValid formats for Automatic EOT Time:\\n\\nmm/dd/yyyy\\nyyyy-mm-dd\\n+1 year\\n+2 weeks\\n+2 months\\n+10 minutes\\nnext thursday\\ntomorrow\\ntoday\\n\\n* anything compatible with PHP\\\'s strtotime() function.\'); return false;">[?]</a>' . (($auto_eot_time) ? '<br /><small>( based on server time )</small>' : '') . '</th>' . "\n";
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
+ /**/
221
+ echo '<tr>' . "\n";
222
+ echo '<th><label>Administrative<br />Notations:</label> <a href="#" onclick="alert(\'This is for Administrative purposes. You can keep a list of Notations about this account. These Notations are private; Users/Members will never see these.\\n\\n*Note* The s2Member software may `append` Notes to this field occassionaly, under special circumstances. For example, when/if s2Member demotes a paid Member to a Free Subscriber, s2Member will leave a Note in this field.\'); return false;">[?]</a></th>' . "\n";
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
+ /**/
234
+ echo '</table>' . "\n";
235
+ /**/
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
  /**/
243
+ return;
244
  }
 
 
 
 
245
  }
246
  /*
247
  Function that saves custom fields after an admin updates profile.
248
  Attach to: add_action("edit_user_profile");
249
  Attach to: add_action("personal_options_update");
250
  */
251
+ 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)
268
+ if (preg_match ("/^access_s2member_ccap_/", $cap))
269
+ $user->remove_cap ($ccap = $cap);
270
+ /**/
271
+ foreach (preg_split ("/[\r\n\t\s;,]+/", $_POST["ws_plugin__s2member_profile_s2member_ccaps"]) as $ccap)
272
+ if (strlen ($ccap)) /* Don't add empty capabilities. */
273
+ $user->add_cap ("access_s2member_ccap_" . trim (strtolower ($ccap)));
274
+ /**/
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
  }
 
 
304
  }
305
  ?>
includes/functions/utilities.inc.php CHANGED
@@ -17,356 +17,407 @@ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
17
  Function that handles a remote request.
18
  This extends wp_remote_request() through the `WP_Http` class.
19
  */
20
- function ws_plugin__s2member_remote ($url = FALSE, $post_vars = FALSE, $args = array ())
21
  {
22
- static $http_response_filtered = false; /* Filter once. */
23
- /**/
24
- $args = (!is_array ($args)) ? array (): $args;
25
- /**/
26
- if (!$http_response_filtered && ($http_response_filtered = true))
27
- add_filter ("http_response", "_ws_plugin__s2member_remote_gz_variations");
28
- /**/
29
- if ($url) /* Obviously, we must have a URL to do anything. */
30
  {
31
- if ((is_array ($post_vars) || is_string ($post_vars)) && !empty ($post_vars))
 
 
 
 
 
 
 
32
  {
33
- $args["method"] = "POST";
34
- $args["body"] = $post_vars;
 
 
 
 
 
35
  }
36
  /**/
37
- return wp_remote_retrieve_body (wp_remote_request ($url, $args));
38
  }
39
- /**/
40
- return false;
41
  }
42
  /*
43
  A sort of callback function that filters the WP_Http response for additional gzinflate variations.
44
  Attach to: add_filter("http_response");
45
  */
46
- function _ws_plugin__s2member_remote_gz_variations ($response = array ())
47
  {
48
- if (!isset ($response["ws__gz_variations"]) && ($response["ws__gz_variations"] = 1))
49
  {
50
- if ($response["headers"]["content-encoding"])
51
- if (substr ($response["body"], 0, 2) === "\x78\x9c")
52
- if (($gz = @gzinflate (substr ($response["body"], 2))))
53
- $response["body"] = $gz;
 
 
 
 
 
54
  }
55
- /**/
56
- return $response;
57
  }
58
  /*
59
  Function that extends array_unique to
60
  support multi-dimensional arrays.
61
  */
62
- function ws_plugin__s2member_array_unique ($array = FALSE)
63
  {
64
- if (!is_array ($array))
65
- {
66
- return array ($array);
67
- }
68
- else /* Serialized array_unique. */
69
  {
70
- foreach ($array as &$value)
71
  {
72
- $value = serialize ($value);
73
  }
74
- /**/
75
- $array = array_unique ($array);
76
- /**/
77
- foreach ($array as &$value)
78
  {
79
- $value = unserialize ($value);
 
 
 
 
 
 
 
 
 
 
 
 
80
  }
81
- /**/
82
- return $array;
83
  }
84
  }
85
  /*
86
  Function that searches a multi-dimensional array
87
  using a regular expression match against array values.
88
  */
89
- function ws_plugin__s2member_regex_in_array ($regex = FALSE, $array = FALSE)
90
  {
91
- if ($regex && is_array ($array))
92
  {
93
- foreach ($array as $value)
94
  {
95
- if (is_array ($value)) /* Recursive function call. */
96
  {
97
- if (ws_plugin__s2member_regex_in_array ($regex, $value))
98
- return true;
 
 
 
 
 
 
 
 
 
99
  }
100
  /**/
101
- else if (is_string ($value)) /* Must be a string. */
102
- {
103
- if (@preg_match ($regex, $value))
104
- return true;
105
- }
106
  }
107
- /**/
108
- return false;
109
  }
110
- else /* False. */
111
- return false;
112
  }
113
  /*
114
  Function that buffers ( gets ) function output.
115
  */
116
- function ws_plugin__s2member_get ($function = FALSE)
117
  {
118
- $args = func_get_args ();
119
- $function = array_shift ($args);
120
- /**/
121
- if (is_string ($function) && $function)
122
  {
123
- ob_start ();
 
124
  /**/
125
- if (is_array ($args) && !empty ($args))
126
  {
127
- $return = call_user_func_array ($function, $args);
128
- }
129
- else /* There are no additional arguments to pass. */
130
- {
131
- $return = call_user_func ($function);
 
 
 
 
 
 
 
 
 
 
 
132
  }
133
- /**/
134
- $echo = ob_get_contents ();
135
- /**/
136
- ob_end_clean ();
137
- /**/
138
- return (!strlen ($echo) && strlen ($return)) ? $return : $echo;
139
  }
140
- else /* Else return null. */
141
- return;
142
  }
143
  /*
144
  Function escapes single quotes.
145
  */
146
- function ws_plugin__s2member_esc_sq ($string = FALSE)
147
  {
148
- return preg_replace ("/'/", "\'", $string);
 
 
 
149
  }
150
  /*
151
  Function checks if a post is in a child category.
152
  */
153
- function ws_plugin__s2member_in_descendant_category ($cats = FALSE, $post_ID = FALSE)
154
  {
155
- foreach ((array)$cats as $cat)
156
  {
157
- $descendants = get_term_children ((int)$cat, "category");
158
- if ($descendants && in_category ($descendants, $post_ID))
159
- return true;
 
 
 
 
 
160
  }
161
- /**/
162
- return false;
163
  }
164
  /*
165
  RIJNDAEL 256: two-way encryption/decryption, with a url-safe base64 wrapper.
166
  Includes a built-in fallback on XOR encryption when mcrypt is not available.
167
  */
168
- function ws_plugin__s2member_encrypt ($string = FALSE, $key = FALSE)
169
  {
170
- $string = (is_string ($string)) ? $string : "";
171
- /**/
172
- $key = (!is_string ($key) || !strlen ($key)) ? /* For security. */
173
- $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sec_encryption_key"] : $key;
174
- $key = (!is_string ($key) || !strlen ($key)) ? wp_salt () : $key;
175
- /**/
176
- if (function_exists ("mcrypt_encrypt") && in_array ("rijndael-256", mcrypt_list_algorithms ()) && in_array ("cbc", mcrypt_list_modes ()))
177
  {
178
- $string = (strlen ($string)) ? "~r2|" . $string : "";
179
- $key = substr ($key, 0, mcrypt_get_key_size (MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC));
180
- $iv = ws_plugin__s2member_random_str_gen (mcrypt_get_iv_size (MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC), false);
181
- $encrypted = mcrypt_encrypt (MCRYPT_RIJNDAEL_256, $key, $string, MCRYPT_MODE_CBC, $iv);
182
- $encrypted = (strlen ($encrypted)) ? "~r2:" . $iv . "|" . $encrypted : "";
183
  /**/
184
- return ($base64 = str_replace (array ("+", "/", "="), array ("-", "_", "."), base64_encode ($encrypted)));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
185
  }
186
- else /* Fallback on XOR encryption. */
187
- return ws_plugin__s2member_xencrypt ($string, $key);
188
  }
189
  /*
190
  Alias function for API Scripting usage.
191
  */
192
- function s2member_encrypt ($string = FALSE, $key = FALSE)
193
  {
194
- return ws_plugin__s2member_encrypt ($string, $key);
 
 
 
195
  }
196
  /*
197
  RIJNDAEL 256: two-way encryption/decryption, with a url-safe base64 wrapper.
198
  Includes a built-in fallback on XOR encryption when mcrypt is not available.
199
  */
200
- function ws_plugin__s2member_decrypt ($base64 = FALSE, $key = FALSE)
201
  {
202
- $base64 = (is_string ($base64)) ? $base64 : "";
203
- /**/
204
- $key = (!is_string ($key) || !strlen ($key)) ? /* For security. */
205
- $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sec_encryption_key"] : $key;
206
- $key = (!is_string ($key) || !strlen ($key)) ? wp_salt () : $key;
207
- /**/
208
- $encrypted = base64_decode (str_replace (array ("-", "_", "."), array ("+", "/", "="), $base64));
209
- /**/
210
- if (function_exists ("mcrypt_decrypt") && in_array ("rijndael-256", mcrypt_list_algorithms ()) && in_array ("cbc", mcrypt_list_modes ())/**/
211
- && preg_match ("/^~r2\:(.+?)\|/", $encrypted, $v1)) /* Check validity. */
212
  {
213
- $encrypted = preg_replace ("/^~r2\:(.+?)\|/", "", $encrypted);
214
- $key = substr ($key, 0, mcrypt_get_key_size (MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC));
215
- $decrypted = mcrypt_decrypt (MCRYPT_RIJNDAEL_256, $key, $encrypted, MCRYPT_MODE_CBC, $v1[1]);
216
- $decrypted = preg_replace ("/^~r2\|/", "", $decrypted, 1, $v2);
217
- $decrypted = ($v2) ? $decrypted : ""; /* Check validity. */
218
- $decrypted = rtrim ($decrypted, "\0\4"); /* Nulls/EOTs. */
219
  /**/
220
- return ($string = $decrypted);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
221
  }
222
- else /* Fallback on XOR decryption. */
223
- return ws_plugin__s2member_xdecrypt ($base64, $key);
224
  }
225
  /*
226
  Alias function for API Scripting usage.
227
  */
228
- function s2member_decrypt ($base64 = FALSE, $key = FALSE)
229
  {
230
- return ws_plugin__s2member_decrypt ($base64, $key);
 
 
 
231
  }
232
  /*
233
  XOR two-way encryption/decryption, with a base64 wrapper.
234
  */
235
- function ws_plugin__s2member_xencrypt ($string = FALSE, $key = FALSE)
236
  {
237
- $string = (is_string ($string)) ? $string : "";
238
- /**/
239
- $key = (!is_string ($key) || !strlen ($key)) ? /* For security. */
240
- $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sec_encryption_key"] : $key;
241
- $key = (!is_string ($key) || !strlen ($key)) ? wp_salt () : $key;
242
- /**/
243
- $string = (strlen ($string)) ? "~xe|" . $string : "";
244
- /**/
245
- for ($i = 1, $encrypted = ""; $i <= strlen ($string); $i++)
246
  {
247
- $char = substr ($string, $i - 1, 1);
248
- $keychar = substr ($key, ($i % strlen ($key)) - 1, 1);
249
- $encrypted .= chr (ord ($char) + ord ($keychar));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
250
  }
251
- /**/
252
- $encrypted = (strlen ($encrypted)) ? "~xe|" . $encrypted : "";
253
- /**/
254
- return ($base64 = str_replace (array ("+", "/", "="), array ("-", "_", "."), base64_encode ($encrypted)));
255
  }
256
  /*
257
  Alias function for API Scripting usage.
258
  */
259
- function s2member_xencrypt ($string = FALSE, $key = FALSE)
260
  {
261
- return ws_plugin__s2member_xencrypt ($string, $key);
 
 
 
262
  }
263
  /*
264
  XOR two-way encryption/decryption, with a base64 wrapper.
265
  */
266
- function ws_plugin__s2member_xdecrypt ($base64 = FALSE, $key = FALSE)
267
  {
268
- $base64 = (is_string ($base64)) ? $base64 : "";
269
- /**/
270
- $key = (!is_string ($key) || !strlen ($key)) ? /* For security. */
271
- $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sec_encryption_key"] : $key;
272
- $key = (!is_string ($key) || !strlen ($key)) ? wp_salt () : $key;
273
- /**/
274
- $encrypted = base64_decode (str_replace (array ("-", "_", "."), array ("+", "/", "="), $base64));
275
- /**/
276
- $encrypted = preg_replace ("/^~xe\|/", "", $encrypted, 1, $v1);
277
- $encrypted = ($v1) ? $encrypted : ""; /* Check validity. */
278
- /**/
279
- for ($i = 1, $decrypted = ""; $i <= strlen ($encrypted); $i++)
280
  {
281
- $char = substr ($encrypted, $i - 1, 1);
282
- $keychar = substr ($key, ($i % strlen ($key)) - 1, 1);
283
- $decrypted .= chr (ord ($char) - ord ($keychar));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
284
  }
285
- /**/
286
- $decrypted = preg_replace ("/^~xe\|/", "", $decrypted, 1, $v2);
287
- $decrypted = ($v2) ? $decrypted : ""; /* Check validity. */
288
- /**/
289
- return ($string = $decrypted);
290
  }
291
  /*
292
  Alias function for API Scripting usage.
293
  */
294
- function s2member_xdecrypt ($base64 = FALSE, $key = FALSE)
295
  {
296
- return ws_plugin__s2member_xdecrypt ($base64, $key);
 
 
 
297
  }
298
  /*
299
  Function generates a random string with letters/numbers/symbols.
300
  */
301
- function ws_plugin__s2member_random_str_gen ($length = 12, $special_chars = TRUE)
302
  {
303
- $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
304
- $chars .= ($special_chars) ? "!@#$%^&*()" : "";
305
- /**/
306
- for ($i = 0, $random_str = ""; $i < $length; $i++)
307
- $random_str .= substr ($chars, mt_rand (0, strlen ($chars) - 1), 1);
308
- /**/
309
- return $random_str;
 
 
 
310
  }
311
  /*
312
  Function that determines the difference between two timestamps. Returns the difference in a human readable format.
313
  Supports: minutes, hours, days, weeks, months, and years. This is an improvement on WordPress® human_time_diff().
314
  This returns an "approximate" time difference. Rounded to the nearest minute, hour, day, week, month, year.
315
  */
316
- function ws_plugin__s2member_approx_time_difference ($from = FALSE, $to = FALSE)
317
  {
318
- $from = (!$from) ? strtotime ("now") : (int)$from;
319
- $to = (!$to) ? strtotime ("now") : (int)$to;
320
- /**/
321
- if (($difference = abs ($to - $from)) < 3600)
322
- {
323
- $m = (int)round ($difference / 60);
324
- /**/
325
- $since = ($m < 1) ? "less than a minute" : $since;
326
- $since = ($m === 1) ? "1 minute" : $since;
327
- $since = ($m > 1) ? $m . " minutes" : $since;
328
- $since = ($m >= 60) ? "about 1 hour" : $since;
329
- }
330
- else if ($difference >= 3600 && $difference < 86400)
331
  {
332
- $h = (int)round ($difference / 3600);
 
333
  /**/
334
- $since = ($h === 1) ? "1 hour" : $since;
335
- $since = ($h > 1) ? $h . " hours" : $since;
336
- $since = ($h >= 24) ? "about 1 day" : $since;
337
- }
338
- else if ($difference >= 86400 && $difference < 604800)
339
- {
340
- $d = (int)round ($difference / 86400);
341
- /**/
342
- $since = ($d === 1) ? "1 day" : $since;
343
- $since = ($d > 1) ? $d . " days" : $since;
344
- $since = ($d >= 7) ? "about 1 week" : $since;
345
- }
346
- else if ($difference >= 604800 && $difference < 2592000)
347
- {
348
- $w = (int)round ($difference / 604800);
349
- /**/
350
- $since = ($w === 1) ? "1 week" : $since;
351
- $since = ($w > 1) ? $w . " weeks" : $since;
352
- $since = ($w >= 4) ? "about 1 month" : $since;
353
- }
354
- else if ($difference >= 2592000 && $difference < 31556926)
355
- {
356
- $m = (int)round ($difference / 2592000);
357
- /**/
358
- $since = ($m === 1) ? "1 month" : $since;
359
- $since = ($m > 1) ? $m . " months" : $since;
360
- $since = ($m >= 12) ? "about 1 year" : $since;
361
- }
362
- else if ($difference >= 31556926) /* Years. */
363
- {
364
- $y = (int)round ($difference / 31556926);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
365
  /**/
366
- $since = ($y === 1) ? "1 year" : $since;
367
- $since = ($y > 1) ? $y . " years" : $since;
368
  }
369
- /**/
370
- return $since;
371
  }
372
  ?>
17
  Function that handles a remote request.
18
  This extends wp_remote_request() through the `WP_Http` class.
19
  */
20
+ if (!function_exists ("ws_plugin__s2member_remote"))
21
  {
22
+ function ws_plugin__s2member_remote ($url = FALSE, $post_vars = FALSE, $args = array ())
 
 
 
 
 
 
 
23
  {
24
+ static $http_response_filtered = false; /* Filter once. */
25
+ /**/
26
+ $args = (!is_array ($args)) ? array (): $args;
27
+ /**/
28
+ if (!$http_response_filtered && ($http_response_filtered = true))
29
+ add_filter ("http_response", "_ws_plugin__s2member_remote_gz_variations");
30
+ /**/
31
+ if ($url) /* Obviously, we must have a URL to do anything. */
32
  {
33
+ if ((is_array ($post_vars) || is_string ($post_vars)) && !empty ($post_vars))
34
+ {
35
+ $args["method"] = "POST";
36
+ $args["body"] = $post_vars;
37
+ }
38
+ /**/
39
+ return wp_remote_retrieve_body (wp_remote_request ($url, $args));
40
  }
41
  /**/
42
+ return false;
43
  }
 
 
44
  }
45
  /*
46
  A sort of callback function that filters the WP_Http response for additional gzinflate variations.
47
  Attach to: add_filter("http_response");
48
  */
49
+ if (!function_exists ("_ws_plugin__s2member_remote_gz_variations"))
50
  {
51
+ function _ws_plugin__s2member_remote_gz_variations ($response = array ())
52
  {
53
+ if (!isset ($response["ws__gz_variations"]) && ($response["ws__gz_variations"] = 1))
54
+ {
55
+ if ($response["headers"]["content-encoding"])
56
+ if (substr ($response["body"], 0, 2) === "\x78\x9c")
57
+ if (($gz = @gzinflate (substr ($response["body"], 2))))
58
+ $response["body"] = $gz;
59
+ }
60
+ /**/
61
+ return $response;
62
  }
 
 
63
  }
64
  /*
65
  Function that extends array_unique to
66
  support multi-dimensional arrays.
67
  */
68
+ if (!function_exists ("ws_plugin__s2member_array_unique"))
69
  {
70
+ function ws_plugin__s2member_array_unique ($array = FALSE)
 
 
 
 
71
  {
72
+ if (!is_array ($array))
73
  {
74
+ return array ($array);
75
  }
76
+ else /* Serialized array_unique. */
 
 
 
77
  {
78
+ foreach ($array as &$value)
79
+ {
80
+ $value = serialize ($value);
81
+ }
82
+ /**/
83
+ $array = array_unique ($array);
84
+ /**/
85
+ foreach ($array as &$value)
86
+ {
87
+ $value = unserialize ($value);
88
+ }
89
+ /**/
90
+ return $array;
91
  }
 
 
92
  }
93
  }
94
  /*
95
  Function that searches a multi-dimensional array
96
  using a regular expression match against array values.
97
  */
98
+ if (!function_exists ("ws_plugin__s2member_regex_in_array"))
99
  {
100
+ function ws_plugin__s2member_regex_in_array ($regex = FALSE, $array = FALSE)
101
  {
102
+ if ($regex && is_array ($array))
103
  {
104
+ foreach ($array as $value)
105
  {
106
+ if (is_array ($value)) /* Recursive function call. */
107
+ {
108
+ if (ws_plugin__s2member_regex_in_array ($regex, $value))
109
+ return true;
110
+ }
111
+ /**/
112
+ else if (is_string ($value)) /* Must be a string. */
113
+ {
114
+ if (@preg_match ($regex, $value))
115
+ return true;
116
+ }
117
  }
118
  /**/
119
+ return false;
 
 
 
 
120
  }
121
+ else /* False. */
122
+ return false;
123
  }
 
 
124
  }
125
  /*
126
  Function that buffers ( gets ) function output.
127
  */
128
+ if (!function_exists ("ws_plugin__s2member_get"))
129
  {
130
+ function ws_plugin__s2member_get ($function = FALSE)
 
 
 
131
  {
132
+ $args = func_get_args ();
133
+ $function = array_shift ($args);
134
  /**/
135
+ if (is_string ($function) && $function)
136
  {
137
+ ob_start ();
138
+ /**/
139
+ if (is_array ($args) && !empty ($args))
140
+ {
141
+ $return = call_user_func_array ($function, $args);
142
+ }
143
+ else /* There are no additional arguments to pass. */
144
+ {
145
+ $return = call_user_func ($function);
146
+ }
147
+ /**/
148
+ $echo = ob_get_contents ();
149
+ /**/
150
+ ob_end_clean ();
151
+ /**/
152
+ return (!strlen ($echo) && strlen ($return)) ? $return : $echo;
153
  }
154
+ else /* Else return null. */
155
+ return;
 
 
 
 
156
  }
 
 
157
  }
158
  /*
159
  Function escapes single quotes.
160
  */
161
+ if (!function_exists ("ws_plugin__s2member_esc_sq"))
162
  {
163
+ function ws_plugin__s2member_esc_sq ($string = FALSE)
164
+ {
165
+ return preg_replace ("/'/", "\'", $string);
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"))
172
  {
173
+ function ws_plugin__s2member_in_descendant_category ($cats = FALSE, $post_ID = FALSE)
174
  {
175
+ foreach ((array)$cats as $cat)
176
+ {
177
+ $descendants = get_term_children ((int)$cat, "category");
178
+ if ($descendants && in_category ($descendants, $post_ID))
179
+ return true;
180
+ }
181
+ /**/
182
+ return false;
183
  }
 
 
184
  }
185
  /*
186
  RIJNDAEL 256: two-way encryption/decryption, with a url-safe base64 wrapper.
187
  Includes a built-in fallback on XOR encryption when mcrypt is not available.
188
  */
189
+ if (!function_exists ("ws_plugin__s2member_encrypt"))
190
  {
191
+ function ws_plugin__s2member_encrypt ($string = FALSE, $key = FALSE)
 
 
 
 
 
 
192
  {
193
+ $string = (is_string ($string)) ? $string : "";
 
 
 
 
194
  /**/
195
+ $key = (!is_string ($key) || !strlen ($key)) ? /* For security. */
196
+ $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sec_encryption_key"] : $key;
197
+ $key = (!is_string ($key) || !strlen ($key)) ? wp_salt () : $key;
198
+ /**/
199
+ if (function_exists ("mcrypt_encrypt") && in_array ("rijndael-256", mcrypt_list_algorithms ()) && in_array ("cbc", mcrypt_list_modes ()))
200
+ {
201
+ $string = (strlen ($string)) ? "~r2|" . $string : "";
202
+ $key = substr ($key, 0, mcrypt_get_key_size (MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC));
203
+ $iv = ws_plugin__s2member_random_str_gen (mcrypt_get_iv_size (MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC), false);
204
+ $encrypted = mcrypt_encrypt (MCRYPT_RIJNDAEL_256, $key, $string, MCRYPT_MODE_CBC, $iv);
205
+ $encrypted = (strlen ($encrypted)) ? "~r2:" . $iv . "|" . $encrypted : "";
206
+ /**/
207
+ return ($base64 = str_replace (array ("+", "/", "="), array ("-", "_", "."), base64_encode ($encrypted)));
208
+ }
209
+ else /* Fallback on XOR encryption. */
210
+ return ws_plugin__s2member_xencrypt ($string, $key);
211
  }
 
 
212
  }
213
  /*
214
  Alias function for API Scripting usage.
215
  */
216
+ if (!function_exists ("s2member_encrypt"))
217
  {
218
+ function s2member_encrypt ($string = FALSE, $key = FALSE)
219
+ {
220
+ return ws_plugin__s2member_encrypt ($string, $key);
221
+ }
222
  }
223
  /*
224
  RIJNDAEL 256: two-way encryption/decryption, with a url-safe base64 wrapper.
225
  Includes a built-in fallback on XOR encryption when mcrypt is not available.
226
  */
227
+ if (!function_exists ("ws_plugin__s2member_decrypt"))
228
  {
229
+ function ws_plugin__s2member_decrypt ($base64 = FALSE, $key = FALSE)
 
 
 
 
 
 
 
 
 
230
  {
231
+ $base64 = (is_string ($base64)) ? $base64 : "";
 
 
 
 
 
232
  /**/
233
+ $key = (!is_string ($key) || !strlen ($key)) ? /* For security. */
234
+ $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sec_encryption_key"] : $key;
235
+ $key = (!is_string ($key) || !strlen ($key)) ? wp_salt () : $key;
236
+ /**/
237
+ $encrypted = base64_decode (str_replace (array ("-", "_", "."), array ("+", "/", "="), $base64));
238
+ /**/
239
+ if (function_exists ("mcrypt_decrypt") && in_array ("rijndael-256", mcrypt_list_algorithms ()) && in_array ("cbc", mcrypt_list_modes ())/**/
240
+ && preg_match ("/^~r2\:(.+?)\|/", $encrypted, $v1)) /* Check validity. */
241
+ {
242
+ $encrypted = preg_replace ("/^~r2\:(.+?)\|/", "", $encrypted);
243
+ $key = substr ($key, 0, mcrypt_get_key_size (MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC));
244
+ $decrypted = mcrypt_decrypt (MCRYPT_RIJNDAEL_256, $key, $encrypted, MCRYPT_MODE_CBC, $v1[1]);
245
+ $decrypted = preg_replace ("/^~r2\|/", "", $decrypted, 1, $v2);
246
+ $decrypted = ($v2) ? $decrypted : ""; /* Check validity. */
247
+ $decrypted = rtrim ($decrypted, "\0\4"); /* Nulls/EOTs. */
248
+ /**/
249
+ return ($string = $decrypted);
250
+ }
251
+ else /* Fallback on XOR decryption. */
252
+ return ws_plugin__s2member_xdecrypt ($base64, $key);
253
  }
 
 
254
  }
255
  /*
256
  Alias function for API Scripting usage.
257
  */
258
+ if (!function_exists ("s2member_decrypt"))
259
  {
260
+ function s2member_decrypt ($base64 = FALSE, $key = FALSE)
261
+ {
262
+ return ws_plugin__s2member_decrypt ($base64, $key);
263
+ }
264
  }
265
  /*
266
  XOR two-way encryption/decryption, with a base64 wrapper.
267
  */
268
+ if (!function_exists ("ws_plugin__s2member_xencrypt"))
269
  {
270
+ function ws_plugin__s2member_xencrypt ($string = FALSE, $key = FALSE)
 
 
 
 
 
 
 
 
271
  {
272
+ $string = (is_string ($string)) ? $string : "";
273
+ /**/
274
+ $key = (!is_string ($key) || !strlen ($key)) ? /* For security. */
275
+ $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sec_encryption_key"] : $key;
276
+ $key = (!is_string ($key) || !strlen ($key)) ? wp_salt () : $key;
277
+ /**/
278
+ $string = (strlen ($string)) ? "~xe|" . $string : "";
279
+ /**/
280
+ for ($i = 1, $encrypted = ""; $i <= strlen ($string); $i++)
281
+ {
282
+ $char = substr ($string, $i - 1, 1);
283
+ $keychar = substr ($key, ($i % strlen ($key)) - 1, 1);
284
+ $encrypted .= chr (ord ($char) + ord ($keychar));
285
+ }
286
+ /**/
287
+ $encrypted = (strlen ($encrypted)) ? "~xe|" . $encrypted : "";
288
+ /**/
289
+ return ($base64 = str_replace (array ("+", "/", "="), array ("-", "_", "."), base64_encode ($encrypted)));
290
  }
 
 
 
 
291
  }
292
  /*
293
  Alias function for API Scripting usage.
294
  */
295
+ if (!function_exists ("s2member_xencrypt"))
296
  {
297
+ function s2member_xencrypt ($string = FALSE, $key = FALSE)
298
+ {
299
+ return ws_plugin__s2member_xencrypt ($string, $key);
300
+ }
301
  }
302
  /*
303
  XOR two-way encryption/decryption, with a base64 wrapper.
304
  */
305
+ if (!function_exists ("ws_plugin__s2member_xdecrypt"))
306
  {
307
+ function ws_plugin__s2member_xdecrypt ($base64 = FALSE, $key = FALSE)
 
 
 
 
 
 
 
 
 
 
 
308
  {
309
+ $base64 = (is_string ($base64)) ? $base64 : "";
310
+ /**/
311
+ $key = (!is_string ($key) || !strlen ($key)) ? /* For security. */
312
+ $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sec_encryption_key"] : $key;
313
+ $key = (!is_string ($key) || !strlen ($key)) ? wp_salt () : $key;
314
+ /**/
315
+ $encrypted = base64_decode (str_replace (array ("-", "_", "."), array ("+", "/", "="), $base64));
316
+ /**/
317
+ $encrypted = preg_replace ("/^~xe\|/", "", $encrypted, 1, $v1);
318
+ $encrypted = ($v1) ? $encrypted : ""; /* Check validity. */
319
+ /**/
320
+ for ($i = 1, $decrypted = ""; $i <= strlen ($encrypted); $i++)
321
+ {
322
+ $char = substr ($encrypted, $i - 1, 1);
323
+ $keychar = substr ($key, ($i % strlen ($key)) - 1, 1);
324
+ $decrypted .= chr (ord ($char) - ord ($keychar));
325
+ }
326
+ /**/
327
+ $decrypted = preg_replace ("/^~xe\|/", "", $decrypted, 1, $v2);
328
+ $decrypted = ($v2) ? $decrypted : ""; /* Check validity. */
329
+ /**/
330
+ return ($string = $decrypted);
331
  }
 
 
 
 
 
332
  }
333
  /*
334
  Alias function for API Scripting usage.
335
  */
336
+ if (!function_exists ("s2member_xdecrypt"))
337
  {
338
+ function s2member_xdecrypt ($base64 = FALSE, $key = FALSE)
339
+ {
340
+ return ws_plugin__s2member_xdecrypt ($base64, $key);
341
+ }
342
  }
343
  /*
344
  Function generates a random string with letters/numbers/symbols.
345
  */
346
+ if (!function_exists ("ws_plugin__s2member_random_str_gen"))
347
  {
348
+ function ws_plugin__s2member_random_str_gen ($length = 12, $special_chars = TRUE)
349
+ {
350
+ $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
351
+ $chars .= ($special_chars) ? "!@#$%^&*()" : "";
352
+ /**/
353
+ for ($i = 0, $random_str = ""; $i < $length; $i++)
354
+ $random_str .= substr ($chars, mt_rand (0, strlen ($chars) - 1), 1);
355
+ /**/
356
+ return $random_str;
357
+ }
358
  }
359
  /*
360
  Function that determines the difference between two timestamps. Returns the difference in a human readable format.
361
  Supports: minutes, hours, days, weeks, months, and years. This is an improvement on WordPress® human_time_diff().
362
  This returns an "approximate" time difference. Rounded to the nearest minute, hour, day, week, month, year.
363
  */
364
+ if (!function_exists ("ws_plugin__s2member_approx_time_difference"))
365
  {
366
+ function ws_plugin__s2member_approx_time_difference ($from = FALSE, $to = FALSE)
 
 
 
 
 
 
 
 
 
 
 
 
367
  {
368
+ $from = (!$from) ? strtotime ("now") : (int)$from;
369
+ $to = (!$to) ? strtotime ("now") : (int)$to;
370
  /**/
371
+ if (($difference = abs ($to - $from)) < 3600)
372
+ {
373
+ $m = (int)round ($difference / 60);
374
+ /**/
375
+ $since = ($m < 1) ? "less than a minute" : $since;
376
+ $since = ($m === 1) ? "1 minute" : $since;
377
+ $since = ($m > 1) ? $m . " minutes" : $since;
378
+ $since = ($m >= 60) ? "about 1 hour" : $since;
379
+ }
380
+ else if ($difference >= 3600 && $difference < 86400)
381
+ {
382
+ $h = (int)round ($difference / 3600);
383
+ /**/
384
+ $since = ($h === 1) ? "1 hour" : $since;
385
+ $since = ($h > 1) ? $h . " hours" : $since;
386
+ $since = ($h >= 24) ? "about 1 day" : $since;
387
+ }
388
+ else if ($difference >= 86400 && $difference < 604800)
389
+ {
390
+ $d = (int)round ($difference / 86400);
391
+ /**/
392
+ $since = ($d === 1) ? "1 day" : $since;
393
+ $since = ($d > 1) ? $d . " days" : $since;
394
+ $since = ($d >= 7) ? "about 1 week" : $since;
395
+ }
396
+ else if ($difference >= 604800 && $difference < 2592000)
397
+ {
398
+ $w = (int)round ($difference / 604800);
399
+ /**/
400
+ $since = ($w === 1) ? "1 week" : $since;
401
+ $since = ($w > 1) ? $w . " weeks" : $since;
402
+ $since = ($w >= 4) ? "about 1 month" : $since;
403
+ }
404
+ else if ($difference >= 2592000 && $difference < 31556926)
405
+ {
406
+ $m = (int)round ($difference / 2592000);
407
+ /**/
408
+ $since = ($m === 1) ? "1 month" : $since;
409
+ $since = ($m > 1) ? $m . " months" : $since;
410
+ $since = ($m >= 12) ? "about 1 year" : $since;
411
+ }
412
+ else if ($difference >= 31556926) /* Years. */
413
+ {
414
+ $y = (int)round ($difference / 31556926);
415
+ /**/
416
+ $since = ($y === 1) ? "1 year" : $since;
417
+ $since = ($y > 1) ? $y . " years" : $since;
418
+ }
419
  /**/
420
+ return $since;
 
421
  }
 
 
422
  }
423
  ?>
includes/hooks.inc.php CHANGED
@@ -71,10 +71,9 @@ add_action ("show_user_profile", "ws_plugin__s2member_users_list_edit_cols");
71
  add_action ("edit_user_profile_update", "ws_plugin__s2member_users_list_update_cols");
72
  add_action ("personal_options_update", "ws_plugin__s2member_users_list_update_cols");
73
  /**/
74
- add_shortcode ("s2Member-PayPal-Button", "ws_plugin__s2member_paypal_button");
75
- /**/
76
  add_filter ("cron_schedules", "ws_plugin__s2member_extend_cron_schedules");
77
- add_action ("s2member_auto_eot_system", "ws_plugin__s2member_auto_eot_system");
 
78
  /*
79
  Register the activation | de-activation routines.
80
  */
71
  add_action ("edit_user_profile_update", "ws_plugin__s2member_users_list_update_cols");
72
  add_action ("personal_options_update", "ws_plugin__s2member_users_list_update_cols");
73
  /**/
 
 
74
  add_filter ("cron_schedules", "ws_plugin__s2member_extend_cron_schedules");
75
+ /**/
76
+ add_action ("ws_plugin__s2member_auto_eot_system__schedule", "ws_plugin__s2member_auto_eot_system");
77
  /*
78
  Register the activation | de-activation routines.
79
  */
includes/menu-pages/api-ops.inc.php CHANGED
@@ -32,318 +32,368 @@ echo '<form method="post" name="ws_plugin__s2member_options_form" id="ws-plugin-
32
  echo '<input type="hidden" name="ws_plugin__s2member_options_save" id="ws-plugin--s2member-options-save" value="' . esc_attr (wp_create_nonce ("ws-plugin--s2member-options-save")) . '" />' . "\n";
33
  echo '<input type="hidden" name="ws_plugin__s2member_configured" id="ws-plugin--s2member-configured" value="1" />' . "\n";
34
  /**/
35
- echo '<div class="ws-menu-page-group" title="Signup Notifications">' . "\n";
36
- /**/
37
- echo '<div class="ws-menu-page-section ws-plugin--s2member-signup-notifications-section">' . "\n";
38
- echo '<h3>Signup Notification URLs ( optional )</h3>' . "\n";
39
- echo '<p>If you use affiliate software, or have back-office routines that need to be notified whenever a new Subscription is created, you\'ll want to read this section. This is marked `Signup`, because the URLs that you list below, will be notified each time a Member signs up. Depending on your fee structure, this may include a first initial payment that establishes their Subscription. This Notification will only be triggered once for each Member. Signup Notifications are sent right after a Member signs up successfully through PayPal®, regardless of whether any money has actually been received. In other words, this Notification is triggered anytime a Member signs up, even if you provided them with a free trial. Please note, this feature is not to be confused with the PayPal® IPN service. PayPal® IPN integration is already built into s2Member and remains active at all times. These Signup Notifications are an added layer of functionality, and they are completely optional; used primarily in affiliate program integration &amp; other back-office routines.</p>' . "\n";
40
- /**/
41
- echo '<table class="form-table">' . "\n";
42
- echo '<tbody>' . "\n";
43
- echo '<tr>' . "\n";
44
- /**/
45
- echo '<th>' . "\n";
46
- echo '<label for="ws-plugin--s2member-signup-notification-urls">' . "\n";
47
- echo 'Signup Notification URLs:' . "\n";
48
- echo '</label>' . "\n";
49
- echo '</th>' . "\n";
50
- /**/
51
- echo '</tr>' . "\n";
52
- echo '<tr>' . "\n";
53
- /**/
54
- echo '<td>' . "\n";
55
- echo 'You can input multiple Notification URLs by inserting one per line.<br />' . "\n";
56
- 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";
57
- 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";
58
- echo '<strong>You can also use these special replacement codes if you need them:</strong>' . "\n";
59
- echo '<ul>' . "\n";
60
- 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";
61
- 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";
62
- echo '<li><code>%%regular%% = The Regular Amount of the Subscription. This value is always > 0, no matter what.</code> [ <a href="#" onclick="alert(\'This is how much the Subscription costs after an initial period expires. The %%regular%% rate is always > 0. If you did not offer an initial period, %%initial%% and %%regular%% will be equal to the same thing.\'); return false;">?</a> ]</li>' . "\n";
63
- echo '<li><code>%%recurring%% = This is the amount that will be charged on a Recurring basis, or 0 if non-Recurring.</code> [ <a href="#" onclick="alert(\'If recurring payments have not been required, this will be equal to 0. That being said, %%regular%% &amp; %%recurring%% are usually the same value. This variable can be used in two different ways. You can use it to determine what the regular recurring rate is, or to determine whether the Subscription will recur or not. If it is going to recur, %%recurring%% will be > 0.\\n\\nThe only time this is NOT equal to the %%regular%% rate, is when recurring payments are not required; and only a one-time regular rate applies. If you have trouble, try using the %%regular%% amount, or use the `Payment` Notifications instead of the `Signup` Notifications.\'); return false;">?</a> ]</li>' . "\n";
64
- echo '<li><code>%%first_name%% = The First Name of the Customer who purchased the Membership Subscription through PayPal®.</code></li>' . "\n";
65
- echo '<li><code>%%last_name%% = The Last Name of the Customer who purchased the Membership Subscription through PayPal®.</code></li>' . "\n";
66
- echo '<li><code>%%full_name%% = The Full Name ( First & Last ) of the Customer who purchased the Membership Subscription.</code></li>' . "\n";
67
- echo '<li><code>%%payer_email%% = The Email Address of the Customer who purchased the Membership Subscription through PayPal®.</code></li>' . "\n";
68
- echo '<li><code>%%item_number%% = The Item Number ( colon separated <em>level:custom_capabilities:fixed term</em> ) for the Membership Subscription.</code></li>' . "\n";
69
- 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";
70
- 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";
71
- 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";
72
- echo '</ul>' . "\n";
73
- echo '<strong>Custom replacement codes can also be inserted using these instructions:</strong>' . "\n";
74
- echo '<ul>' . "\n";
75
- 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";
76
- 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";
77
- echo '</ul>' . "\n";
78
- echo '<strong>This example uses cv1 to track a User\'s IP address:</strong><br />' . "\n";
79
- echo '<em>( The IP address could be referenced in your Notification URL using %%cv1%% )</em><br />' . "\n";
80
- echo '<code>&lt;input type="hidden" name="custom" value="' . $_SERVER["HTTP_HOST"] . '|&lt;?php echo $_SERVER["REMOTE_ADDR"]; ?&gt;" /&gt;</code>' . "\n";
81
- echo '</td>' . "\n";
82
- /**/
83
- echo '</tr>' . "\n";
84
- echo '</tbody>' . "\n";
85
- echo '</table>' . "\n";
86
- echo '</div>' . "\n";
87
- /**/
88
- echo '</div>' . "\n";
89
- /**/
90
- echo '<div class="ws-menu-page-group" title="Registration Notifications">' . "\n";
91
- /**/
92
- echo '<div class="ws-menu-page-section ws-plugin--s2member-registration-notifications-section">' . "\n";
93
- echo '<h3>Registration Notification URLs ( optional )</h3>' . "\n";
94
- echo '<p>If you use affiliate software, or have back-office routines that need to be notified whenever a new Member is created, you\'ll want to read this section. This is marked `Registration`, because the URLs that you list below, will be notified each time a Member registers a Username. This is usually triggered right after a `Signup` Notification; at the point in which a new Member successfully completes the Registration form, and they are assigned a Username. However, this is ALSO triggered whenever you create a new User inside your WordPress® Dashboard with a Free Subscriber Role, or with one of the s2Member Roles. It will NOT be triggered for other Roles; such as Administrators, Editors, Authors, and Contributors. Please note, this feature is not to be confused with the PayPal® IPN service. PayPal® IPN integration is already built into s2Member and remains active at all times. These Registration Notifications are an added layer of functionality, and they are completely optional; used primarily in affiliate program integration &amp; other back-office routines.</p>' . "\n";
95
- /**/
96
- echo '<table class="form-table">' . "\n";
97
- echo '<tbody>' . "\n";
98
- echo '<tr>' . "\n";
99
- /**/
100
- echo '<th>' . "\n";
101
- echo '<label for="ws-plugin--s2member-registration-notification-urls">' . "\n";
102
- echo 'Registration Notification URLs:' . "\n";
103
- echo '</label>' . "\n";
104
- echo '</th>' . "\n";
105
- /**/
106
- echo '</tr>' . "\n";
107
- echo '<tr>' . "\n";
108
- /**/
109
- echo '<td>' . "\n";
110
- echo 'You can input multiple Notification URLs by inserting one per line.<br />' . "\n";
111
- 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";
112
- 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";
113
- echo '<strong>You can also use these special replacement codes if you need them:</strong>' . "\n";
114
- echo '<ul>' . "\n";
115
- echo '<li><code>%%level%% = The level number ( 0, 1, 2, 3, 4 ) 0 = Free Subscriber.</code></li>' . "\n";
116
- echo '<li><code>%%user_first_name%% = The First Name of the Member who registered their Username.</code></li>' . "\n";
117
- echo '<li><code>%%user_last_name%% = The Last Name of the Member who registered their Username.</code></li>' . "\n";
118
- echo '<li><code>%%user_full_name%% = The Full Name ( First & Last ) of the Member who registered their Username</code></li>' . "\n";
119
- echo '<li><code>%%user_email%% = The Email Address of the Member who registered their Username.</code></li>' . "\n";
120
- echo '<li><code>%%user_login%% = The Username the Member selected during registration.</code></li>' . "\n";
121
- echo '<li><code>%%user_pass%% = The Password selected or generated during registration.</code></li>' . "\n";
122
- echo '</ul>' . "\n";
123
- echo '<strong>Custom replacement codes can also be inserted using these instructions:</strong>' . "\n";
124
- echo '<ul>' . "\n";
125
- 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";
126
- 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";
127
- echo '</ul>' . "\n";
128
- echo '<strong>This example uses cv1 to track a User\'s IP address:</strong><br />' . "\n";
129
- echo '<em>( The IP address could be referenced in your Notification URL using %%cv1%% )</em><br />' . "\n";
130
- echo '<code>&lt;input type="hidden" name="custom" value="' . $_SERVER["HTTP_HOST"] . '|&lt;?php echo $_SERVER["REMOTE_ADDR"]; ?&gt;" /&gt;</code>' . "\n";
131
- echo '</td>' . "\n";
132
- /**/
133
- echo '</tr>' . "\n";
134
- echo '</tbody>' . "\n";
135
- echo '</table>' . "\n";
136
- echo '</div>' . "\n";
137
- /**/
138
- echo '</div>' . "\n";
139
- /**/
140
- echo '<div class="ws-menu-page-group" title="Payment Notifications">' . "\n";
141
- /**/
142
- echo '<div class="ws-menu-page-section ws-plugin--s2member-payment-notifications-section">' . "\n";
143
- echo '<h3>Payment Notification URLs ( optional )</h3>' . "\n";
144
- echo '<p>If you use affiliate software, or have back-office routines that need to be notified whenever payment transactions take place, and/or for recurring payments, you\'ll want to read this section. This is marked `Payment`, because the URLs that you list below, will be notified each time an actual payment occurs. Depending on your fee structure, this may include a first initial payment that establishes a Subscription. But more importantly, this will be triggered on all future payments that are received for the lifetime of the Subscription. So unlike the `Signup` Notification, `Payment` Notifications take place whenever actual payments are received, instead of just once after signup is completed. If a payment is required during signup ( e.g. no free trial is being offered ), a Signup Notification will be triggered, and a Payment Notification will ALSO be triggered. In other words, a Payment Notification occurs anytime funds are received, no matter what. Please note, this feature is not to be confused with the PayPal® IPN service. PayPal® IPN integration is already built into s2Member and remains active at all times. These Payment Notifications are an added layer of functionality, and they are completely optional; used primarily in affiliate program integration &amp; other back-office routines.</p>' . "\n";
145
- /**/
146
- echo '<table class="form-table">' . "\n";
147
- echo '<tbody>' . "\n";
148
- echo '<tr>' . "\n";
149
- /**/
150
- echo '<th>' . "\n";
151
- echo '<label for="ws-plugin--s2member-payment-notification-urls">' . "\n";
152
- echo 'Payment Notification URLs:' . "\n";
153
- echo '</label>' . "\n";
154
- echo '</th>' . "\n";
155
- /**/
156
- echo '</tr>' . "\n";
157
- echo '<tr>' . "\n";
158
- /**/
159
- echo '<td>' . "\n";
160
- echo 'You can input multiple Notification URLs by inserting one per line.<br />' . "\n";
161
- 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";
162
- 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";
163
- echo '<strong>You can also use these special replacement codes if you need them:</strong>' . "\n";
164
- echo '<ul>' . "\n";
165
- 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";
166
- echo '<li><code>%%txn_id%% = The PayPal® unique Transaction ID, which is always unique for each payment received.</code></li>' . "\n";
167
- echo '<li><code>%%amount%% = The Amount of the payment. Most affiliate programs calculate commissions from this.</code></li>' . "\n";
168
- echo '<li><code>%%first_name%% = The First Name of the Customer who purchased the Membership Subscription through PayPal®.</code></li>' . "\n";
169
- echo '<li><code>%%last_name%% = The Last Name of the Customer who purchased the Membership Subscription through PayPal®.</code></li>' . "\n";
170
- echo '<li><code>%%full_name%% = The Full Name ( First & Last ) of the Customer who purchased the Membership Subscription.</code></li>' . "\n";
171
- echo '<li><code>%%payer_email%% = The Email Address of the Customer who purchased the Membership Subscription through PayPal®.</code></li>' . "\n";
172
- 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";
173
- 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";
174
- echo '</ul>' . "\n";
175
- echo '<strong>Custom replacement codes can also be inserted using these instructions:</strong>' . "\n";
176
- echo '<ul>' . "\n";
177
- 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";
178
- 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";
179
- echo '</ul>' . "\n";
180
- echo '<strong>This example uses cv1 to track a User\'s IP address:</strong><br />' . "\n";
181
- echo '<em>( The IP address could be referenced in your Notification URL using %%cv1%% )</em><br />' . "\n";
182
- echo '<code>&lt;input type="hidden" name="custom" value="' . $_SERVER["HTTP_HOST"] . '|&lt;?php echo $_SERVER["REMOTE_ADDR"]; ?&gt;" /&gt;</code>' . "\n";
183
- echo '</td>' . "\n";
184
- /**/
185
- echo '</tr>' . "\n";
186
- echo '</tbody>' . "\n";
187
- echo '</table>' . "\n";
188
- echo '</div>' . "\n";
189
- /**/
190
- echo '</div>' . "\n";
191
- /**/
192
- echo '<div class="ws-menu-page-group" title="EOT/Deletion Notifications">' . "\n";
193
- /**/
194
- echo '<div class="ws-menu-page-section ws-plugin--s2member-eot-deletion-notifications-section">' . "\n";
195
- echo '<h3>EOT/Deletion Notification URLs ( optional )</h3>' . "\n";
196
- echo '<p>If you use affiliate software, or have back-office routines that need to be notified whenever Subscriptions have ended ( and a Member is demoted to a Free Subscriber ), or when an account is deleted from the system, you\'ll want to read this section. This is marked `EOT/Deletion`, because the URLs that you list below, will be notified in both cases. EOT = End Of Term. An EOT is triggered <em>immediately</em> when you refund a Customer, when a Customer forces a chargeback to occur, or when a PayPal® Subscription ends naturally ( i.e. expires ), and the PayPal® IPN service sends s2Member a <code>subscr_eot</code> response. Delayed EOTs occur after a cancellation, either as a result of you cancelling a Customer\'s Subscription, or a Customer cancelling their own Subscription through PayPal®. A cancellation usually results in a delayed EOT, because a cancellation does not always warrant an immediate EOT; there could still be time left on their Subscription.</p>' . "\n";
197
- echo '<p>Manual Deletions will trigger an immediate Notification. If you delete an account manually from within your WordPress® Dashboard, your URLs can be notified automatically through this system. So the two events are an EOT and/or a Manual Deletion. Please note, this feature is not to be confused with the PayPal® IPN service. PayPal® IPN integration is already built into s2Member and remains active at all times. These EOT/Deletion Notifications are an added layer of functionality, and they are completely optional; used primarily in affiliate program integration &amp; other back-office routines.</p>' . "\n";
198
- echo '<p><em><strong>*Some Hairy Details*</strong> There might be times whenever you notice that a Members\'s Subscription has been cancelled through PayPal®... but, s2Member continues allowing the User access to your site as a paid Member. Please don\'t be confused by this... in 99.9% of these cases, the reason for this is legitimate. s2Member will only remove the User\'s membership privileges when PayPal® sends a <code>subscr_eot</code> notification via the IPN service, a refund occurs, a chargeback occurs, or when a cancellation occurs - which would later result in a delayed Auto-EOT by s2Member. s2Member will not process an EOT until the User has completely used up the time they paid for. In other words, if a User signs up for a monthly Subscription on Jan 1st, and then cancels their Subscription on Jan 15th; technically, they should still be allowed to access the site for another 15 days, and then on Feb 1st, the time they paid for has completely elapsed. At that time, s2Member will remove their membership privileges; by either demoting them to a Free Subscriber, or deleting their account from the system ( based on your configuration ). s2Member also calculates one extra day ( 24 hours ) into its equation, just to make sure access is not removed sooner than a Customer might expect.</em></p>' . "\n";
199
- /**/
200
- echo '<table class="form-table">' . "\n";
201
- echo '<tbody>' . "\n";
202
- echo '<tr>' . "\n";
203
- /**/
204
- echo '<th>' . "\n";
205
- echo '<label for="ws-plugin--s2member-eot-del-notification-urls">' . "\n";
206
- echo 'EOT/Deletion Notification URLs:' . "\n";
207
- echo '</label>' . "\n";
208
- echo '</th>' . "\n";
209
- /**/
210
- echo '</tr>' . "\n";
211
- echo '<tr>' . "\n";
212
- /**/
213
- echo '<td>' . "\n";
214
- echo 'You can input multiple Notification URLs by inserting one per line.<br />' . "\n";
215
- 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";
216
- 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";
217
- echo '<strong>You can also use these special replacement codes if you need them:</strong>' . "\n";
218
- echo '<ul>' . "\n";
219
- 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";
220
- 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";
221
- echo '<li><code>%%user_last_name%% = The Last Name listed on their User account. This might be different than what is on file at PayPal®.</code></li>' . "\n";
222
- 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";
223
- 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";
224
- echo '</ul>' . "\n";
225
- echo '<strong>Custom replacement codes can also be inserted using these instructions:</strong>' . "\n";
226
- echo '<ul>' . "\n";
227
- 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";
228
- 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";
229
- echo '</ul>' . "\n";
230
- echo '<strong>This example uses cv1 to track a User\'s IP address:</strong><br />' . "\n";
231
- echo '<em>( The IP address could be referenced in your Notification URL using %%cv1%% )</em><br />' . "\n";
232
- echo '<code>&lt;input type="hidden" name="custom" value="' . $_SERVER["HTTP_HOST"] . '|&lt;?php echo $_SERVER["REMOTE_ADDR"]; ?&gt;" /&gt;</code>' . "\n";
233
- echo '</td>' . "\n";
234
- /**/
235
- echo '</tr>' . "\n";
236
- echo '</tbody>' . "\n";
237
- echo '</table>' . "\n";
238
- echo '</div>' . "\n";
239
- /**/
240
- echo '</div>' . "\n";
241
- /**/
242
- echo '<div class="ws-menu-page-group" title="Refund/Reversal Notifications">' . "\n";
243
- /**/
244
- echo '<div class="ws-menu-page-section ws-plugin--s2member-refund-reversal-notifications-section">' . "\n";
245
- echo '<h3>Refund/Reversal Notification URLs ( optional )</h3>' . "\n";
246
- echo '<p>If you use affiliate software, or have back-office routines that need to be notified whenever Subscriptions have been refunded or reversed ( i.e. charged back to you ), you\'ll want to read this section. This is marked `Refund/Reversal`, because the URLs that you list below, will ONLY be notified in those specific cases, as opposed to the EOT Notifications, which are all-inclusive. This is very similar to the EOT/Deletion described above. But, there is an important distinction. EOT includes cancellations, expirations, failed payments, refunds, chargebacks, etc, etc. In other words, ANY time a deletion or End Of Term action takes place.</p>' . "\n";
247
- echo '<p>So the distinction is that Refund/Reversal Notifications are ONLY sent under these specific circumstances: 1. You log into your PayPal® account and refund a payment that is associated with a Subscription. 2. The Customer complains to PayPal® and a chargeback occurs, forcing a Reversal. In both of these cases, an EOT/Deletion Notification will be sent ( as described above ), but since EOT is a more broad Notification, the Refund/Reversal Notification is here so you can nail down specific back-office operations in these two specific scenarios. Please note, this feature is not to be confused with the PayPal® IPN service. PayPal® IPN integration is already built into s2Member and remains active at all times. These Refund/Reversal Notifications are an added layer of functionality, and they are completely optional; used primarily in affiliate program integration &amp; other back-office routines.</p>' . "\n";
248
- /**/
249
- echo '<table class="form-table">' . "\n";
250
- echo '<tbody>' . "\n";
251
- echo '<tr>' . "\n";
252
- /**/
253
- echo '<th>' . "\n";
254
- echo '<label for="ws-plugin--s2member-ref-rev-notification-urls">' . "\n";
255
- echo 'Refund/Reversal Notification URLs:' . "\n";
256
- echo '</label>' . "\n";
257
- echo '</th>' . "\n";
258
- /**/
259
- echo '</tr>' . "\n";
260
- echo '<tr>' . "\n";
261
- /**/
262
- echo '<td>' . "\n";
263
- echo 'You can input multiple Notification URLs by inserting one per line.<br />' . "\n";
264
- 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";
265
- 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";
266
- echo '<strong>You can also use these special replacement codes if you need them:</strong>' . "\n";
267
- echo '<ul>' . "\n";
268
- 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";
269
- echo '<li><code>%%parent_txn_id%% = The PayPal® Transaction ID, associated with the original payment that is being refunded/reversed.</code></li>' . "\n";
270
- echo '<li><code>%%-amount%% = The Negative Amount of the payment, that was refunded or reversed back to the Customer.</code></li>' . "\n";
271
- echo '<li><code>%%first_name%% = The First Name of the Customer who purchased the Membership Subscription through PayPal®.</code></li>' . "\n";
272
- echo '<li><code>%%last_name%% = The Last Name of the Customer who purchased the Membership Subscription through PayPal®.</code></li>' . "\n";
273
- echo '<li><code>%%full_name%% = The Full Name ( First & Last ) of the Customer who purchased the Membership Subscription.</code></li>' . "\n";
274
- echo '<li><code>%%payer_email%% = The Email Address of the Customer who purchased the Membership Subscription through PayPal®.</code></li>' . "\n";
275
- 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";
276
- 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";
277
- echo '</ul>' . "\n";
278
- echo '<strong>Custom replacement codes can also be inserted using these instructions:</strong>' . "\n";
279
- echo '<ul>' . "\n";
280
- 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";
281
- 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";
282
- echo '</ul>' . "\n";
283
- echo '<strong>This example uses cv1 to track a User\'s IP address:</strong><br />' . "\n";
284
- echo '<em>( The IP address could be referenced in your Notification URL using %%cv1%% )</em><br />' . "\n";
285
- echo '<code>&lt;input type="hidden" name="custom" value="' . $_SERVER["HTTP_HOST"] . '|&lt;?php echo $_SERVER["REMOTE_ADDR"]; ?&gt;" /&gt;</code>' . "\n";
286
- echo '</td>' . "\n";
287
- /**/
288
- echo '</tr>' . "\n";
289
- echo '</tbody>' . "\n";
290
- echo '</table>' . "\n";
291
- echo '</div>' . "\n";
292
- /**/
293
- echo '</div>' . "\n";
294
- /**/
295
- echo '<div class="ws-menu-page-group" title="Specific Post/Page Access Notifications">' . "\n";
296
- /**/
297
- echo '<div class="ws-menu-page-section ws-plugin--s2member-sp-notifications-section">' . "\n";
298
- echo '<h3>Specific Post/Page Access Notification URLs ( optional )</h3>' . "\n";
299
- echo '<p>If you use affiliate software, or have back-office routines that need to be notified whenever Specific Post/Page transactions take place, you\'ll want to read this section. This is marked `Specific Post/Page`, because the URLs that you list below, will be notified each time a payment occurs, for access to a Specific Post/Page sale. This is the only Notification that is sent for Specific Post/Page Access. All of the other API Notifications are designed for Membership Level Access. Please note, this feature is not to be confused with the PayPal® IPN service. PayPal® IPN integration is already built into s2Member and remains active at all times. These Payment Notifications are an added layer of functionality, and they are completely optional; used primarily in affiliate program integration &amp; other back-office routines.</p>' . "\n";
300
- /**/
301
- echo '<table class="form-table">' . "\n";
302
- echo '<tbody>' . "\n";
303
- echo '<tr>' . "\n";
304
- /**/
305
- echo '<th>' . "\n";
306
- echo '<label for="ws-plugin--s2member-sp-notification-urls">' . "\n";
307
- echo 'Specific Post/Page Notification URLs:' . "\n";
308
- echo '</label>' . "\n";
309
- echo '</th>' . "\n";
310
- /**/
311
- echo '</tr>' . "\n";
312
- echo '<tr>' . "\n";
313
- /**/
314
- echo '<td>' . "\n";
315
- echo 'You can input multiple Notification URLs by inserting one per line.<br />' . "\n";
316
- 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";
317
- 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";
318
- echo '<strong>You can also use these special replacement codes if you need them:</strong>' . "\n";
319
- echo '<ul>' . "\n";
320
- echo '<li><code>%%sp_access_url%% = The full URL ( generated by s2Member ) where the Customer can gain access.</code></li>' . "\n";
321
- 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";
322
- echo '<li><code>%%txn_id%% = The PayPal® Transaction ID. PayPal® assigns a unique identifier for every purchase.</code></li>' . "\n";
323
- echo '<li><code>%%amount%% = The full Amount of the sale. Most affiliate programs calculate commissions from this.</code></li>' . "\n";
324
- echo '<li><code>%%first_name%% = The First Name of the Customer who purchased Specific Post/Page Access through PayPal®.</code></li>' . "\n";
325
- echo '<li><code>%%last_name%% = The Last Name of the Customer who purchased Specific Post/Page Access through PayPal®.</code></li>' . "\n";
326
- echo '<li><code>%%full_name%% = The Full Name ( First & Last ) of the Customer who purchased Specific Post/Page Access.</code></li>' . "\n";
327
- echo '<li><code>%%payer_email%% = The Email Address of the Customer who purchased Specific Post/Page Access through PayPal®.</code></li>' . "\n";
328
- 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";
329
- echo '<li><code>%%item_name%% = The Item Name. In other words, a brief description, detailing what this purchase was for.</code></li>' . "\n";
330
- echo '</ul>' . "\n";
331
- echo '<strong>Custom replacement codes can also be inserted using these instructions:</strong>' . "\n";
332
- echo '<ul>' . "\n";
333
- 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";
334
- 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";
335
- echo '</ul>' . "\n";
336
- echo '<strong>This example uses cv1 to track a User\'s IP address:</strong><br />' . "\n";
337
- echo '<em>( The IP address could be referenced in your Notification URL using %%cv1%% )</em><br />' . "\n";
338
- echo '<code>&lt;input type="hidden" name="custom" value="' . $_SERVER["HTTP_HOST"] . '|&lt;?php echo $_SERVER["REMOTE_ADDR"]; ?&gt;" /&gt;</code>' . "\n";
339
- echo '</td>' . "\n";
340
- /**/
341
- echo '</tr>' . "\n";
342
- echo '</tbody>' . "\n";
343
- echo '</table>' . "\n";
344
- echo '</div>' . "\n";
345
- /**/
346
- echo '</div>' . "\n";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
347
  /**/
348
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
349
  /**/
@@ -355,13 +405,16 @@ echo '</td>' . "\n";
355
  /**/
356
  echo '<td class="ws-menu-page-table-r">' . "\n";
357
  /**/
358
- echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu-r"]["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="." title="Contact PriMoThemes!" /></a></div>' . "\n" : '';
359
- /**/
360
- echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu-r"]["tools"]) ? '<div class="ws-menu-page-tools"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-tools.png" alt="." /></div>' . "\n" : '';
361
  /**/
362
- echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu-r"]["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" : '';
 
 
 
363
  /**/
364
- echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu-r"]["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" : '';
 
365
  /**/
366
  echo '</td>' . "\n";
367
  /**/
32
  echo '<input type="hidden" name="ws_plugin__s2member_options_save" id="ws-plugin--s2member-options-save" value="' . esc_attr (wp_create_nonce ("ws-plugin--s2member-options-save")) . '" />' . "\n";
33
  echo '<input type="hidden" name="ws_plugin__s2member_configured" id="ws-plugin--s2member-configured" value="1" />' . "\n";
34
  /**/
35
+ do_action ("ws_plugin__s2member_during_api_ops_page_before_left_sections", get_defined_vars ());
36
+ /**/
37
+ if (apply_filters ("ws_plugin__s2member_during_api_ops_page_during_left_sections_display_signup_notifications", true, get_defined_vars ()))
38
+ {
39
+ do_action ("ws_plugin__s2member_during_api_ops_page_during_left_sections_before_signup_notifications", get_defined_vars ());
40
+ /**/
41
+ echo '<div class="ws-menu-page-group" title="Signup Notifications">' . "\n";
42
+ /**/
43
+ echo '<div class="ws-menu-page-section ws-plugin--s2member-signup-notifications-section">' . "\n";
44
+ echo '<h3>Signup Notification URLs ( optional )</h3>' . "\n";
45
+ echo '<p>If you use affiliate software, or have back-office routines that need to be notified whenever a new Subscription is created, you\'ll want to read this section. This is marked `Signup`, because the URLs that you list below, will be notified each time a Member signs up. Depending on your fee structure, this may include a first initial payment that establishes their Subscription. This Notification will only be triggered once for each Member. Signup Notifications are sent right after a Member signs up successfully through PayPal®, regardless of whether any money has actually been received. In other words, this Notification is triggered anytime a Member signs up, even if you provided them with a free trial. Please note, this feature is not to be confused with the PayPal® IPN service. PayPal® IPN integration is already built into s2Member and remains active at all times. These Signup Notifications are an added layer of functionality, and they are completely optional; used primarily in affiliate program integration &amp; other back-office routines.</p>' . "\n";
46
+ do_action ("ws_plugin__s2member_during_api_ops_page_during_left_sections_during_signup_notifications", get_defined_vars ());
47
+ /**/
48
+ echo '<table class="form-table">' . "\n";
49
+ echo '<tbody>' . "\n";
50
+ echo '<tr>' . "\n";
51
+ /**/
52
+ echo '<th>' . "\n";
53
+ echo '<label for="ws-plugin--s2member-signup-notification-urls">' . "\n";
54
+ echo 'Signup Notification URLs:' . "\n";
55
+ echo '</label>' . "\n";
56
+ echo '</th>' . "\n";
57
+ /**/
58
+ echo '</tr>' . "\n";
59
+ echo '<tr>' . "\n";
60
+ /**/
61
+ echo '<td>' . "\n";
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";
69
+ echo '<li><code>%%regular%% = The Regular Amount of the Subscription. This value is always > 0, no matter what.</code> [ <a href="#" onclick="alert(\'This is how much the Subscription costs after an initial period expires. The %%regular%% rate is always > 0. If you did not offer an initial period, %%initial%% and %%regular%% will be equal to the same thing.\'); return false;">?</a> ]</li>' . "\n";
70
+ echo '<li><code>%%recurring%% = This is the amount that will be charged on a Recurring basis, or 0 if non-Recurring.</code> [ <a href="#" onclick="alert(\'If recurring payments have not been required, this will be equal to 0. That being said, %%regular%% &amp; %%recurring%% are usually the same value. This variable can be used in two different ways. You can use it to determine what the regular recurring rate is, or to determine whether the Subscription will recur or not. If it is going to recur, %%recurring%% will be > 0.\\n\\nThe only time this is NOT equal to the %%regular%% rate, is when recurring payments are not required; and only a one-time regular rate applies. If you have trouble, try using the %%regular%% amount, or use the `Payment` Notifications instead of the `Signup` Notifications.\'); return false;">?</a> ]</li>' . "\n";
71
+ echo '<li><code>%%first_name%% = The First Name of the Customer who purchased the Membership Subscription through PayPal®.</code></li>' . "\n";
72
+ echo '<li><code>%%last_name%% = The Last Name of the Customer who purchased the Membership Subscription through PayPal®.</code></li>' . "\n";
73
+ echo '<li><code>%%full_name%% = The Full Name ( First & Last ) of the Customer who purchased the Membership Subscription.</code></li>' . "\n";
74
+ echo '<li><code>%%payer_email%% = The Email Address of the Customer who purchased the Membership Subscription through PayPal®.</code></li>' . "\n";
75
+ echo '<li><code>%%item_number%% = The Item Number ( colon separated <em>level:custom_capabilities:fixed term</em> ) for the Membership Subscription.</code></li>' . "\n";
76
+ 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";
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";
91
+ echo '</tbody>' . "\n";
92
+ echo '</table>' . "\n";
93
+ echo '</div>' . "\n";
94
+ /**/
95
+ echo '</div>' . "\n";
96
+ }
97
+ /**/
98
+ if (apply_filters ("ws_plugin__s2member_during_api_ops_page_during_left_sections_display_registration_notifications", true, get_defined_vars ()))
99
+ {
100
+ do_action ("ws_plugin__s2member_during_api_ops_page_during_left_sections_before_registration_notifications", get_defined_vars ());
101
+ /**/
102
+ echo '<div class="ws-menu-page-group" title="Registration Notifications">' . "\n";
103
+ /**/
104
+ echo '<div class="ws-menu-page-section ws-plugin--s2member-registration-notifications-section">' . "\n";
105
+ echo '<h3>Registration Notification URLs ( optional )</h3>' . "\n";
106
+ echo '<p>If you use affiliate software, or have back-office routines that need to be notified whenever a new Member is created, you\'ll want to read this section. This is marked `Registration`, because the URLs that you list below, will be notified each time a Member registers a Username. This is usually triggered right after a `Signup` Notification; at the point in which a new Member successfully completes the Registration form, and they are assigned a Username. However, this is ALSO triggered whenever you create a new User inside your WordPress® Dashboard with a Free Subscriber Role, or with one of the s2Member Roles. It will NOT be triggered for other Roles; such as Administrators, Editors, Authors, and Contributors. Please note, this feature is not to be confused with the PayPal® IPN service. PayPal® IPN integration is already built into s2Member and remains active at all times. These Registration Notifications are an added layer of functionality, and they are completely optional; used primarily in affiliate program integration &amp; other back-office routines.</p>' . "\n";
107
+ do_action ("ws_plugin__s2member_during_api_ops_page_during_left_sections_during_registration_notifications", get_defined_vars ());
108
+ /**/
109
+ echo '<table class="form-table">' . "\n";
110
+ echo '<tbody>' . "\n";
111
+ echo '<tr>' . "\n";
112
+ /**/
113
+ echo '<th>' . "\n";
114
+ echo '<label for="ws-plugin--s2member-registration-notification-urls">' . "\n";
115
+ echo 'Registration Notification URLs:' . "\n";
116
+ echo '</label>' . "\n";
117
+ echo '</th>' . "\n";
118
+ /**/
119
+ echo '</tr>' . "\n";
120
+ echo '<tr>' . "\n";
121
+ /**/
122
+ echo '<td>' . "\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";
130
+ echo '<li><code>%%user_last_name%% = The Last Name of the Member who registered their Username.</code></li>' . "\n";
131
+ echo '<li><code>%%user_full_name%% = The Full Name ( First & Last ) of the Member who registered their Username</code></li>' . "\n";
132
+ echo '<li><code>%%user_email%% = The Email Address 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` 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";
147
+ echo '</tbody>' . "\n";
148
+ echo '</table>' . "\n";
149
+ echo '</div>' . "\n";
150
+ /**/
151
+ echo '</div>' . "\n";
152
+ /**/
153
+ do_action ("ws_plugin__s2member_during_api_ops_page_during_left_sections_after_registration_notifications", get_defined_vars ());
154
+ }
155
+ /**/
156
+ if (apply_filters ("ws_plugin__s2member_during_api_ops_page_during_left_sections_display_payment_notifications", true, get_defined_vars ()))
157
+ {
158
+ do_action ("ws_plugin__s2member_during_api_ops_page_during_left_sections_before_payment_notifications", get_defined_vars ());
159
+ /**/
160
+ echo '<div class="ws-menu-page-group" title="Payment Notifications">' . "\n";
161
+ /**/
162
+ echo '<div class="ws-menu-page-section ws-plugin--s2member-payment-notifications-section">' . "\n";
163
+ echo '<h3>Payment Notification URLs ( optional )</h3>' . "\n";
164
+ echo '<p>If you use affiliate software, or have back-office routines that need to be notified whenever payment transactions take place, and/or for recurring payments, you\'ll want to read this section. This is marked `Payment`, because the URLs that you list below, will be notified each time an actual payment occurs. Depending on your fee structure, this may include a first initial payment that establishes a Subscription. But more importantly, this will be triggered on all future payments that are received for the lifetime of the Subscription. So unlike the `Signup` Notification, `Payment` Notifications take place whenever actual payments are received, instead of just once after signup is completed. If a payment is required during signup ( e.g. no free trial is being offered ), a Signup Notification will be triggered, and a Payment Notification will ALSO be triggered. In other words, a Payment Notification occurs anytime funds are received, no matter what. Please note, this feature is not to be confused with the PayPal® IPN service. PayPal® IPN integration is already built into s2Member and remains active at all times. These Payment Notifications are an added layer of functionality, and they are completely optional; used primarily in affiliate program integration &amp; other back-office routines.</p>' . "\n";
165
+ do_action ("ws_plugin__s2member_during_api_ops_page_during_left_sections_during_payment_notifications", get_defined_vars ());
166
+ /**/
167
+ echo '<table class="form-table">' . "\n";
168
+ echo '<tbody>' . "\n";
169
+ echo '<tr>' . "\n";
170
+ /**/
171
+ echo '<th>' . "\n";
172
+ echo '<label for="ws-plugin--s2member-payment-notification-urls">' . "\n";
173
+ echo 'Payment Notification URLs:' . "\n";
174
+ echo '</label>' . "\n";
175
+ echo '</th>' . "\n";
176
+ /**/
177
+ echo '</tr>' . "\n";
178
+ echo '<tr>' . "\n";
179
+ /**/
180
+ echo '<td>' . "\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";
188
+ echo '<li><code>%%amount%% = The Amount of the payment. Most affiliate programs calculate commissions from this.</code></li>' . "\n";
189
+ echo '<li><code>%%first_name%% = The First Name of the Customer who purchased the Membership Subscription through PayPal®.</code></li>' . "\n";
190
+ echo '<li><code>%%last_name%% = The Last Name of the Customer who purchased the Membership Subscription through PayPal®.</code></li>' . "\n";
191
+ echo '<li><code>%%full_name%% = The Full Name ( First & Last ) of the Customer who purchased the Membership Subscription.</code></li>' . "\n";
192
+ echo '<li><code>%%payer_email%% = The Email Address of the Customer who purchased the Membership Subscription through PayPal®.</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` 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";
207
+ echo '</tbody>' . "\n";
208
+ echo '</table>' . "\n";
209
+ echo '</div>' . "\n";
210
+ /**/
211
+ echo '</div>' . "\n";
212
+ /**/
213
+ do_action ("ws_plugin__s2member_during_api_ops_page_during_left_sections_after_payment_notifications", get_defined_vars ());
214
+ }
215
+ /**/
216
+ if (apply_filters ("ws_plugin__s2member_during_api_ops_page_during_left_sections_display_eot_deletion_notifications", true, get_defined_vars ()))
217
+ {
218
+ do_action ("ws_plugin__s2member_during_api_ops_page_during_left_sections_before_eot_deletion_notifications", get_defined_vars ());
219
+ /**/
220
+ echo '<div class="ws-menu-page-group" title="EOT/Deletion Notifications">' . "\n";
221
+ /**/
222
+ echo '<div class="ws-menu-page-section ws-plugin--s2member-eot-deletion-notifications-section">' . "\n";
223
+ echo '<h3>EOT/Deletion Notification URLs ( optional )</h3>' . "\n";
224
+ echo '<p>If you use affiliate software, or have back-office routines that need to be notified whenever Subscriptions have ended ( and a Member is demoted to a Free Subscriber ), or when an account is deleted from the system, you\'ll want to read this section. This is marked `EOT/Deletion`, because the URLs that you list below, will be notified in both cases. EOT = End Of Term. An EOT is triggered <em>immediately</em> when you refund a Customer, when a Customer forces a chargeback to occur, or when a PayPal® Subscription ends naturally ( i.e. expires ), and the PayPal® IPN service sends s2Member a <code>subscr_eot</code> response. Delayed EOTs occur after a cancellation, either as a result of you cancelling a Customer\'s Subscription, or a Customer cancelling their own Subscription through PayPal®. A cancellation usually results in a delayed EOT, because a cancellation does not always warrant an immediate EOT; there could still be time left on their Subscription.</p>' . "\n";
225
+ echo '<p>Manual Deletions will trigger an immediate Notification. If you delete an account manually from within your WordPress® Dashboard, your URLs can be notified automatically through this system. So the two events are an EOT and/or a Manual Deletion. Please note, this feature is not to be confused with the PayPal® IPN service. PayPal® IPN integration is already built into s2Member and remains active at all times. These EOT/Deletion Notifications are an added layer of functionality, and they are completely optional; used primarily in affiliate program integration &amp; other back-office routines.</p>' . "\n";
226
+ echo '<p><em><strong>*Some Hairy Details*</strong> There might be times whenever you notice that a Members\'s Subscription has been cancelled through PayPal®... but, s2Member continues allowing the User access to your site as a paid Member. Please don\'t be confused by this... in 99.9% of these cases, the reason for this is legitimate. s2Member will only remove the User\'s membership privileges when PayPal® sends a <code>subscr_eot</code> notification via the IPN service, a refund occurs, a chargeback occurs, or when a cancellation occurs - which would later result in a delayed Auto-EOT by s2Member. s2Member will not process an EOT until the User has completely used up the time they paid for. In other words, if a User signs up for a monthly Subscription on Jan 1st, and then cancels their Subscription on Jan 15th; technically, they should still be allowed to access the site for another 15 days, and then on Feb 1st, the time they paid for has completely elapsed. At that time, s2Member will remove their membership privileges; by either demoting them to a Free Subscriber, or deleting their account from the system ( based on your configuration ). s2Member also calculates one extra day ( 24 hours ) into its equation, just to make sure access is not removed sooner than a Customer might expect.</em></p>' . "\n";
227
+ do_action ("ws_plugin__s2member_during_api_ops_page_during_left_sections_during_eot_deletion_notifications", get_defined_vars ());
228
+ /**/
229
+ echo '<table class="form-table">' . "\n";
230
+ echo '<tbody>' . "\n";
231
+ echo '<tr>' . "\n";
232
+ /**/
233
+ echo '<th>' . "\n";
234
+ echo '<label for="ws-plugin--s2member-eot-del-notification-urls">' . "\n";
235
+ echo 'EOT/Deletion Notification URLs:' . "\n";
236
+ echo '</label>' . "\n";
237
+ echo '</th>' . "\n";
238
+ /**/
239
+ echo '</tr>' . "\n";
240
+ echo '<tr>' . "\n";
241
+ /**/
242
+ echo '<td>' . "\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";
250
+ echo '<li><code>%%user_last_name%% = The Last 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` 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";
265
+ echo '</tbody>' . "\n";
266
+ echo '</table>' . "\n";
267
+ echo '</div>' . "\n";
268
+ /**/
269
+ echo '</div>' . "\n";
270
+ /**/
271
+ do_action ("ws_plugin__s2member_during_api_ops_page_during_left_sections_after_eot_deletion_notifications", get_defined_vars ());
272
+ }
273
+ /**/
274
+ if (apply_filters ("ws_plugin__s2member_during_api_ops_page_during_left_sections_display_refund_reversal_notifications", true, get_defined_vars ()))
275
+ {
276
+ do_action ("ws_plugin__s2member_during_api_ops_page_during_left_sections_before_refund_reversal_notifications", get_defined_vars ());
277
+ /**/
278
+ echo '<div class="ws-menu-page-group" title="Refund/Reversal Notifications">' . "\n";
279
+ /**/
280
+ echo '<div class="ws-menu-page-section ws-plugin--s2member-refund-reversal-notifications-section">' . "\n";
281
+ echo '<h3>Refund/Reversal Notification URLs ( optional )</h3>' . "\n";
282
+ echo '<p>If you use affiliate software, or have back-office routines that need to be notified whenever Subscriptions have been refunded or reversed ( i.e. charged back to you ), you\'ll want to read this section. This is marked `Refund/Reversal`, because the URLs that you list below, will ONLY be notified in those specific cases, as opposed to the EOT Notifications, which are all-inclusive. This is very similar to the EOT/Deletion described above. But, there is an important distinction. EOT includes cancellations, expirations, failed payments, refunds, chargebacks, etc, etc. In other words, ANY time a deletion or End Of Term action takes place.</p>' . "\n";
283
+ echo '<p>So the distinction is that Refund/Reversal Notifications are ONLY sent under these specific circumstances: 1. You log into your PayPal® account and refund a payment that is associated with a Subscription. 2. The Customer complains to PayPal® and a chargeback occurs, forcing a Reversal. In both of these cases, an EOT/Deletion Notification will be sent ( as described above ), but since EOT is a more broad Notification, the Refund/Reversal Notification is here so you can nail down specific back-office operations in these two specific scenarios. Please note, this feature is not to be confused with the PayPal® IPN service. PayPal® IPN integration is already built into s2Member and remains active at all times. These Refund/Reversal Notifications are an added layer of functionality, and they are completely optional; used primarily in affiliate program integration &amp; other back-office routines.</p>' . "\n";
284
+ do_action ("ws_plugin__s2member_during_api_ops_page_during_left_sections_during_refund_reversal_notifications", get_defined_vars ());
285
+ /**/
286
+ echo '<table class="form-table">' . "\n";
287
+ echo '<tbody>' . "\n";
288
+ echo '<tr>' . "\n";
289
+ /**/
290
+ echo '<th>' . "\n";
291
+ echo '<label for="ws-plugin--s2member-ref-rev-notification-urls">' . "\n";
292
+ echo 'Refund/Reversal Notification URLs:' . "\n";
293
+ echo '</label>' . "\n";
294
+ echo '</th>' . "\n";
295
+ /**/
296
+ echo '</tr>' . "\n";
297
+ echo '<tr>' . "\n";
298
+ /**/
299
+ echo '<td>' . "\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";
307
+ echo '<li><code>%%-amount%% = The Negative Amount of the payment, that was refunded or reversed back to the Customer.</code></li>' . "\n";
308
+ echo '<li><code>%%first_name%% = The First Name of the Customer who purchased the Membership Subscription through PayPal®.</code></li>' . "\n";
309
+ echo '<li><code>%%last_name%% = The Last Name of the Customer who purchased the Membership Subscription through PayPal®.</code></li>' . "\n";
310
+ echo '<li><code>%%full_name%% = The Full Name ( First & Last ) of the Customer who purchased the Membership Subscription.</code></li>' . "\n";
311
+ echo '<li><code>%%payer_email%% = The Email Address of the Customer who purchased the Membership Subscription through PayPal®.</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` 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";
326
+ echo '</tbody>' . "\n";
327
+ echo '</table>' . "\n";
328
+ echo '</div>' . "\n";
329
+ /**/
330
+ echo '</div>' . "\n";
331
+ /**/
332
+ do_action ("ws_plugin__s2member_during_api_ops_page_during_left_sections_after_refund_reversal_notifications", get_defined_vars ());
333
+ }
334
+ /**/
335
+ if (apply_filters ("ws_plugin__s2member_during_api_ops_page_during_left_sections_display_sp_notifications", true, get_defined_vars ()))
336
+ {
337
+ do_action ("ws_plugin__s2member_during_api_ops_page_during_left_sections_before_sp_notifications", get_defined_vars ());
338
+ /**/
339
+ echo '<div class="ws-menu-page-group" title="Specific Post/Page Access Notifications">' . "\n";
340
+ /**/
341
+ echo '<div class="ws-menu-page-section ws-plugin--s2member-sp-notifications-section">' . "\n";
342
+ echo '<h3>Specific Post/Page Access Notification URLs ( optional )</h3>' . "\n";
343
+ echo '<p>If you use affiliate software, or have back-office routines that need to be notified whenever Specific Post/Page transactions take place, you\'ll want to read this section. This is marked `Specific Post/Page`, because the URLs that you list below, will be notified each time a payment occurs, for access to a Specific Post/Page sale. This is the only Notification that is sent for Specific Post/Page Access. All of the other API Notifications are designed for Membership Level Access. Please note, this feature is not to be confused with the PayPal® IPN service. PayPal® IPN integration is already built into s2Member and remains active at all times. These Payment Notifications are an added layer of functionality, and they are completely optional; used primarily in affiliate program integration &amp; other back-office routines.</p>' . "\n";
344
+ do_action ("ws_plugin__s2member_during_api_ops_page_during_left_sections_during_sp_notifications", get_defined_vars ());
345
+ /**/
346
+ echo '<table class="form-table">' . "\n";
347
+ echo '<tbody>' . "\n";
348
+ echo '<tr>' . "\n";
349
+ /**/
350
+ echo '<th>' . "\n";
351
+ echo '<label for="ws-plugin--s2member-sp-notification-urls">' . "\n";
352
+ echo 'Specific Post/Page Notification URLs:' . "\n";
353
+ echo '</label>' . "\n";
354
+ echo '</th>' . "\n";
355
+ /**/
356
+ echo '</tr>' . "\n";
357
+ echo '<tr>' . "\n";
358
+ /**/
359
+ echo '<td>' . "\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";
367
+ echo '<li><code>%%txn_id%% = The PayPal® Transaction ID. PayPal® assigns a unique identifier for every purchase.</code></li>' . "\n";
368
+ echo '<li><code>%%amount%% = The full Amount of the sale. Most affiliate programs calculate commissions from this.</code></li>' . "\n";
369
+ echo '<li><code>%%first_name%% = The First Name of the Customer who purchased Specific Post/Page Access through PayPal®.</code></li>' . "\n";
370
+ echo '<li><code>%%last_name%% = The Last Name of the Customer who purchased Specific Post/Page Access through PayPal®.</code></li>' . "\n";
371
+ echo '<li><code>%%full_name%% = The Full Name ( First & Last ) of the Customer who purchased Specific Post/Page Access.</code></li>' . "\n";
372
+ echo '<li><code>%%payer_email%% = The Email Address of the Customer who purchased Specific Post/Page Access through PayPal®.</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` 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";
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_api_ops_page_during_left_sections_after_sp_notifications", get_defined_vars ());
394
+ }
395
+ /**/
396
+ do_action ("ws_plugin__s2member_during_api_ops_page_after_left_sections", get_defined_vars ());
397
  /**/
398
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
399
  /**/
405
  /**/
406
  echo '<td class="ws-menu-page-table-r">' . "\n";
407
  /**/
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" : '';
414
+ 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" : '';
415
  /**/
416
+ do_action ("ws_plugin__s2member_during_menu_pages_after_right_sections", get_defined_vars ());
417
+ do_action ("ws_plugin__s2member_during_api_ops_page_after_right_sections", get_defined_vars ());
418
  /**/
419
  echo '</td>' . "\n";
420
  /**/
includes/menu-pages/buttons.inc.php CHANGED
@@ -30,519 +30,594 @@ 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
- echo '<div class="ws-menu-page-group" title="PayPal® Buttons For Level #1 Access">' . "\n";
34
- /**/
35
- echo '<div class="ws-menu-page-section ws-plugin--s2member-button-code-1-section">' . "\n";
36
- echo '<h3>Button Code Generator For Level #1 Access</h3>' . "\n";
37
- 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";
38
- 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";
39
- /**/
40
- echo '<table class="form-table">' . "\n";
41
- echo '<tbody>' . "\n";
42
- echo '<tr>' . "\n";
43
- /**/
44
- echo '<th class="ws-menu-page-th-side">' . "\n";
45
- echo '<label for="ws-plugin--s2member-level1-shortcode">' . "\n";
46
- echo 'Button Code<br />For Level #1:<br /><br />' . "\n";
47
- echo '<div id="ws-plugin--s2member-level1-button-prev"></div>' . "\n";
48
- echo '</label>' . "\n";
49
- echo '</th>' . "\n";
50
- /**/
51
- echo '<td>' . "\n";
52
- echo '<form onsubmit="return false;">' . "\n";
53
- 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";
54
- 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";
55
- 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";
56
- 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";
57
- echo '</form>' . "\n";
58
- echo '</td>' . "\n";
59
- /**/
60
- echo '</tr>' . "\n";
61
- echo '<tr>' . "\n";
62
- /**/
63
- echo '<td colspan="2">' . "\n";
64
- echo '<form onsubmit="return false;">' . "\n";
65
- echo '<strong>WordPress® Shortcode:</strong> ( recommended for both the WordPress® Visual &amp; HTML Editors )<br />' . "\n";
66
- $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/shortcodes/shortcode.html"));
67
- $ws_plugin__s2member_temp_s = preg_replace ("/%%domain%%/", strtolower ($_SERVER["HTTP_HOST"]), $ws_plugin__s2member_temp_s);
68
- $ws_plugin__s2member_temp_s = preg_replace ("/%%level%%/", "1", $ws_plugin__s2member_temp_s);
69
- $ws_plugin__s2member_temp_s = preg_replace ("/%%level_label%%/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_label"], $ws_plugin__s2member_temp_s);
70
- 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";
71
- echo '<strong>Resulting PayPal® Button Code:</strong> ( ultimately, your Shortcode will produce this snippet )<br />' . "\n";
72
- echo '<textarea id="ws-plugin--s2member-level1-button" rows="8" wrap="off" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;">';
73
- $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/button.html"));
74
- $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);
75
- $ws_plugin__s2member_temp_s = preg_replace ("/%%paypal_business%%/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"], $ws_plugin__s2member_temp_s);
76
- $ws_plugin__s2member_temp_s = preg_replace ("/%%level_label%%/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_label"], $ws_plugin__s2member_temp_s);
77
- $ws_plugin__s2member_temp_s = preg_replace ("/%%cancel_return%%/", get_bloginfo ("url"), $ws_plugin__s2member_temp_s);
78
- $ws_plugin__s2member_temp_s = preg_replace ("/%%notify_url%%/", get_bloginfo ("url") . "/?s2member_paypal_notify=1", $ws_plugin__s2member_temp_s);
79
- $ws_plugin__s2member_temp_s = preg_replace ("/%%return%%/", get_bloginfo ("url") . "/?s2member_paypal_return=1", $ws_plugin__s2member_temp_s);
80
- $ws_plugin__s2member_temp_s = preg_replace ("/%%domain%%/", strtolower ($_SERVER["HTTP_HOST"]), $ws_plugin__s2member_temp_s);
81
- $ws_plugin__s2member_temp_s = preg_replace ("/%%level%%/", "1", $ws_plugin__s2member_temp_s);
82
- echo format_to_edit ($ws_plugin__s2member_temp_s);
83
- echo '</textarea><br />' . "\n";
84
- echo '&uarr; Use this more advanced Code if you\'re building a theme or plugin that integrates with s2Member.' . "\n";
85
- echo '</form>' . "\n";
86
- echo '</td>' . "\n";
87
- /**/
88
- echo '</tr>' . "\n";
89
- echo '</tbody>' . "\n";
90
- echo '</table>' . "\n";
91
- echo '</div>' . "\n";
92
- /**/
93
- echo '</div>' . "\n";
94
- /**/
95
- echo '<div class="ws-menu-page-group" title="PayPal® Buttons For Level #2 Access">' . "\n";
96
- /**/
97
- echo '<div class="ws-menu-page-section ws-plugin--s2member-button-code-2-section">' . "\n";
98
- echo '<h3>Button Code Generator For Level #2 Access</h3>' . "\n";
99
- 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";
100
- 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";
101
- /**/
102
- echo '<table class="form-table">' . "\n";
103
- echo '<tbody>' . "\n";
104
- echo '<tr>' . "\n";
105
- /**/
106
- echo '<th class="ws-menu-page-th-side">' . "\n";
107
- echo '<label for="ws-plugin--s2member-level2-shortcode">' . "\n";
108
- echo 'Button Code<br />For Level #2:<br /><br />' . "\n";
109
- echo '<div id="ws-plugin--s2member-level2-button-prev"></div>' . "\n";
110
- echo '</label>' . "\n";
111
- echo '</th>' . "\n";
112
- /**/
113
- echo '<td>' . "\n";
114
- echo '<form onsubmit="return false;">' . "\n";
115
- 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";
116
- 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";
117
- 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";
118
- 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";
119
- echo '</form>' . "\n";
120
- echo '</td>' . "\n";
121
- /**/
122
- echo '</tr>' . "\n";
123
- echo '<tr>' . "\n";
124
- /**/
125
- echo '<td colspan="2">' . "\n";
126
- echo '<form onsubmit="return false;">' . "\n";
127
- echo '<strong>WordPress® Shortcode:</strong> ( recommended for both the WordPress® Visual &amp; HTML Editors )<br />' . "\n";
128
- $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/shortcodes/shortcode.html"));
129
- $ws_plugin__s2member_temp_s = preg_replace ("/%%domain%%/", strtolower ($_SERVER["HTTP_HOST"]), $ws_plugin__s2member_temp_s);
130
- $ws_plugin__s2member_temp_s = preg_replace ("/%%level%%/", "2", $ws_plugin__s2member_temp_s);
131
- $ws_plugin__s2member_temp_s = preg_replace ("/%%level_label%%/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_label"], $ws_plugin__s2member_temp_s);
132
- 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";
133
- echo '<strong>Resulting PayPal® Button Code:</strong> ( ultimately, your Shortcode will produce this snippet )<br />' . "\n";
134
- echo '<textarea id="ws-plugin--s2member-level2-button" rows="8" wrap="off" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;">';
135
- $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/button.html"));
136
- $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);
137
- $ws_plugin__s2member_temp_s = preg_replace ("/%%paypal_business%%/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"], $ws_plugin__s2member_temp_s);
138
- $ws_plugin__s2member_temp_s = preg_replace ("/%%level_label%%/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_label"], $ws_plugin__s2member_temp_s);
139
- $ws_plugin__s2member_temp_s = preg_replace ("/%%cancel_return%%/", get_bloginfo ("url"), $ws_plugin__s2member_temp_s);
140
- $ws_plugin__s2member_temp_s = preg_replace ("/%%notify_url%%/", get_bloginfo ("url") . "/?s2member_paypal_notify=1", $ws_plugin__s2member_temp_s);
141
- $ws_plugin__s2member_temp_s = preg_replace ("/%%return%%/", get_bloginfo ("url") . "/?s2member_paypal_return=1", $ws_plugin__s2member_temp_s);
142
- $ws_plugin__s2member_temp_s = preg_replace ("/%%domain%%/", strtolower ($_SERVER["HTTP_HOST"]), $ws_plugin__s2member_temp_s);
143
- $ws_plugin__s2member_temp_s = preg_replace ("/%%level%%/", "2", $ws_plugin__s2member_temp_s);
144
- echo format_to_edit ($ws_plugin__s2member_temp_s);
145
- echo '</textarea><br />' . "\n";
146
- echo '&uarr; Use this more advanced Code if you\'re building a theme or plugin that integrates with s2Member.' . "\n";
147
- echo '</form>' . "\n";
148
- echo '</td>' . "\n";
149
- /**/
150
- echo '</tr>' . "\n";
151
- echo '</tbody>' . "\n";
152
- echo '</table>' . "\n";
153
- echo '</div>' . "\n";
154
- /**/
155
- echo '</div>' . "\n";
156
- /**/
157
- echo '<div class="ws-menu-page-group" title="PayPal® Buttons For Level #3 Access">' . "\n";
158
- /**/
159
- echo '<div class="ws-menu-page-section ws-plugin--s2member-button-code-3-section">' . "\n";
160
- echo '<h3>Button Code Generator For Level #3 Access</h3>' . "\n";
161
- 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";
162
- 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";
163
- /**/
164
- echo '<table class="form-table">' . "\n";
165
- echo '<tbody>' . "\n";
166
- echo '<tr>' . "\n";
167
- /**/
168
- echo '<th class="ws-menu-page-th-side">' . "\n";
169
- echo '<label for="ws-plugin--s2member-level3-shortcode">' . "\n";
170
- echo 'Button Code<br />For Level #3:<br /><br />' . "\n";
171
- echo '<div id="ws-plugin--s2member-level3-button-prev"></div>' . "\n";
172
- echo '</label>' . "\n";
173
- echo '</th>' . "\n";
174
- /**/
175
- echo '<td>' . "\n";
176
- echo '<form onsubmit="return false;">' . "\n";
177
- 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";
178
- 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";
179
- 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";
180
- 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";
181
- echo '</form>' . "\n";
182
- echo '</td>' . "\n";
183
- /**/
184
- echo '</tr>' . "\n";
185
- echo '<tr>' . "\n";
186
- /**/
187
- echo '<td colspan="2">' . "\n";
188
- echo '<form onsubmit="return false;">' . "\n";
189
- echo '<strong>WordPress® Shortcode:</strong> ( recommended for both the WordPress® Visual &amp; HTML Editors )<br />' . "\n";
190
- $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/shortcodes/shortcode.html"));
191
- $ws_plugin__s2member_temp_s = preg_replace ("/%%domain%%/", strtolower ($_SERVER["HTTP_HOST"]), $ws_plugin__s2member_temp_s);
192
- $ws_plugin__s2member_temp_s = preg_replace ("/%%level%%/", "3", $ws_plugin__s2member_temp_s);
193
- $ws_plugin__s2member_temp_s = preg_replace ("/%%level_label%%/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_label"], $ws_plugin__s2member_temp_s);
194
- 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";
195
- echo '<strong>Resulting PayPal® Button Code:</strong> ( ultimately, your Shortcode will produce this snippet )<br />' . "\n";
196
- echo '<textarea id="ws-plugin--s2member-level3-button" rows="8" wrap="off" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;">';
197
- $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/button.html"));
198
- $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);
199
- $ws_plugin__s2member_temp_s = preg_replace ("/%%paypal_business%%/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"], $ws_plugin__s2member_temp_s);
200
- $ws_plugin__s2member_temp_s = preg_replace ("/%%level_label%%/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_label"], $ws_plugin__s2member_temp_s);
201
- $ws_plugin__s2member_temp_s = preg_replace ("/%%cancel_return%%/", get_bloginfo ("url"), $ws_plugin__s2member_temp_s);
202
- $ws_plugin__s2member_temp_s = preg_replace ("/%%notify_url%%/", get_bloginfo ("url") . "/?s2member_paypal_notify=1", $ws_plugin__s2member_temp_s);
203
- $ws_plugin__s2member_temp_s = preg_replace ("/%%return%%/", get_bloginfo ("url") . "/?s2member_paypal_return=1", $ws_plugin__s2member_temp_s);
204
- $ws_plugin__s2member_temp_s = preg_replace ("/%%domain%%/", strtolower ($_SERVER["HTTP_HOST"]), $ws_plugin__s2member_temp_s);
205
- $ws_plugin__s2member_temp_s = preg_replace ("/%%level%%/", "3", $ws_plugin__s2member_temp_s);
206
- echo format_to_edit ($ws_plugin__s2member_temp_s);
207
- echo '</textarea><br />' . "\n";
208
- echo '&uarr; Use this more advanced Code if you\'re building a theme or plugin that integrates with s2Member.' . "\n";
209
- echo '</form>' . "\n";
210
- echo '</td>' . "\n";
211
- /**/
212
- echo '</tr>' . "\n";
213
- echo '</tbody>' . "\n";
214
- echo '</table>' . "\n";
215
- echo '</div>' . "\n";
216
- /**/
217
- echo '</div>' . "\n";
218
- /**/
219
- echo '<div class="ws-menu-page-group" title="PayPal® Buttons For Level #4 Access">' . "\n";
220
- /**/
221
- echo '<div class="ws-menu-page-section ws-plugin--s2member-button-code-4-section">' . "\n";
222
- echo '<h3>Button Code Generator For Level #4 Access</h3>' . "\n";
223
- 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";
224
- 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";
225
- /**/
226
- echo '<table class="form-table">' . "\n";
227
- echo '<tbody>' . "\n";
228
- echo '<tr>' . "\n";
229
- /**/
230
- echo '<th class="ws-menu-page-th-side">' . "\n";
231
- echo '<label for="ws-plugin--s2member-level4-shortcode">' . "\n";
232
- echo 'Button Code<br />For Level #4:<br /><br />' . "\n";
233
- echo '<div id="ws-plugin--s2member-level4-button-prev"></div>' . "\n";
234
- echo '</label>' . "\n";
235
- echo '</th>' . "\n";
236
- /**/
237
- echo '<td>' . "\n";
238
- echo '<form onsubmit="return false;">' . "\n";
239
- 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";
240
- 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";
241
- 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";
242
- 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";
243
- echo '</form>' . "\n";
244
- echo '</td>' . "\n";
245
- /**/
246
- echo '</tr>' . "\n";
247
- echo '<tr>' . "\n";
248
- /**/
249
- echo '<td colspan="2">' . "\n";
250
- echo '<form onsubmit="return false;">' . "\n";
251
- echo '<strong>WordPress® Shortcode:</strong> ( recommended for both the WordPress® Visual &amp; HTML Editors )<br />' . "\n";
252
- $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/shortcodes/shortcode.html"));
253
- $ws_plugin__s2member_temp_s = preg_replace ("/%%domain%%/", strtolower ($_SERVER["HTTP_HOST"]), $ws_plugin__s2member_temp_s);
254
- $ws_plugin__s2member_temp_s = preg_replace ("/%%level%%/", "4", $ws_plugin__s2member_temp_s);
255
- $ws_plugin__s2member_temp_s = preg_replace ("/%%level_label%%/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_label"], $ws_plugin__s2member_temp_s);
256
- 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";
257
- echo '<strong>Resulting PayPal® Button Code:</strong> ( ultimately, your Shortcode will produce this snippet )<br />' . "\n";
258
- echo '<textarea id="ws-plugin--s2member-level4-button" rows="8" wrap="off" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;">';
259
- $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/button.html"));
260
- $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);
261
- $ws_plugin__s2member_temp_s = preg_replace ("/%%paypal_business%%/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"], $ws_plugin__s2member_temp_s);
262
- $ws_plugin__s2member_temp_s = preg_replace ("/%%level_label%%/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_label"], $ws_plugin__s2member_temp_s);
263
- $ws_plugin__s2member_temp_s = preg_replace ("/%%cancel_return%%/", get_bloginfo ("url"), $ws_plugin__s2member_temp_s);
264
- $ws_plugin__s2member_temp_s = preg_replace ("/%%notify_url%%/", get_bloginfo ("url") . "/?s2member_paypal_notify=1", $ws_plugin__s2member_temp_s);
265
- $ws_plugin__s2member_temp_s = preg_replace ("/%%return%%/", get_bloginfo ("url") . "/?s2member_paypal_return=1", $ws_plugin__s2member_temp_s);
266
- $ws_plugin__s2member_temp_s = preg_replace ("/%%domain%%/", strtolower ($_SERVER["HTTP_HOST"]), $ws_plugin__s2member_temp_s);
267
- $ws_plugin__s2member_temp_s = preg_replace ("/%%level%%/", "4", $ws_plugin__s2member_temp_s);
268
- echo format_to_edit ($ws_plugin__s2member_temp_s);
269
- echo '</textarea><br />' . "\n";
270
- echo '&uarr; Use this more advanced Code if you\'re building a theme or plugin that integrates with s2Member.' . "\n";
271
- echo '</form>' . "\n";
272
- echo '</td>' . "\n";
273
- /**/
274
- echo '</tr>' . "\n";
275
- echo '</tbody>' . "\n";
276
- echo '</table>' . "\n";
277
- echo '</div>' . "\n";
278
- /**/
279
- echo '</div>' . "\n";
280
- /**/
281
- echo '<div class="ws-menu-page-group" title="PayPal® Subscr Modification Buttons">' . "\n";
282
- /**/
283
- echo '<div class="ws-menu-page-section ws-plugin--s2member-modification-section">' . "\n";
284
- echo '<h3>Button Code Generator For Subscription Modifications</h3>' . "\n";
285
- 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";
286
- 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";
287
- 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";
288
- 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";
289
- 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";
290
- /**/
291
- echo '<table class="form-table">' . "\n";
292
- echo '<tbody>' . "\n";
293
- echo '<tr>' . "\n";
294
- /**/
295
- echo '<th class="ws-menu-page-th-side">' . "\n";
296
- echo '<label for="ws-plugin--s2member-modification-shortcode">' . "\n";
297
- echo 'Button Code<br />For Modifications:<br /><br />' . "\n";
298
- echo '<div id="ws-plugin--s2member-modification-button-prev"></div>' . "\n";
299
- echo '</label>' . "\n";
300
- echo '</th>' . "\n";
301
- /**/
302
- echo '<td>' . "\n";
303
- echo '<form onsubmit="return false;">' . "\n";
304
- 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";
305
- 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";
306
- 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";
307
- 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";
308
- 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";
309
- echo '</form>' . "\n";
310
- echo '</td>' . "\n";
311
- /**/
312
- echo '</tr>' . "\n";
313
- echo '<tr>' . "\n";
314
- /**/
315
- echo '<td colspan="2">' . "\n";
316
- echo '<form onsubmit="return false;">' . "\n";
317
- echo '<strong>WordPress® Shortcode:</strong> ( recommended for both the WordPress® Visual &amp; HTML Editors )<br />' . "\n";
318
- $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/shortcodes/shortcode.html"));
319
- $ws_plugin__s2member_temp_s = preg_replace ("/\/]$/", 'mb="1" /]', $ws_plugin__s2member_temp_s);
320
- $ws_plugin__s2member_temp_s = preg_replace ("/%%domain%%/", strtolower ($_SERVER["HTTP_HOST"]), $ws_plugin__s2member_temp_s);
321
- $ws_plugin__s2member_temp_s = preg_replace ("/%%level%%/", "2", $ws_plugin__s2member_temp_s);
322
- $ws_plugin__s2member_temp_s = preg_replace ("/%%level_label%%/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_label"], $ws_plugin__s2member_temp_s);
323
- 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";
324
- echo '<strong>Resulting PayPal® Button Code:</strong> ( ultimately, your Shortcode will produce this snippet )<br />' . "\n";
325
- echo '<textarea id="ws-plugin--s2member-modification-button" rows="8" wrap="off" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;">';
326
- $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/button.html"));
327
- $ws_plugin__s2member_temp_s = preg_replace ('/name\="modify" value\="(.*?)"/', 'name="modify" value="1"', $ws_plugin__s2member_temp_s);
328
- $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);
329
- $ws_plugin__s2member_temp_s = preg_replace ("/%%paypal_business%%/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"], $ws_plugin__s2member_temp_s);
330
- $ws_plugin__s2member_temp_s = preg_replace ("/%%level_label%%/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_label"], $ws_plugin__s2member_temp_s);
331
- $ws_plugin__s2member_temp_s = preg_replace ("/%%cancel_return%%/", get_bloginfo ("url"), $ws_plugin__s2member_temp_s);
332
- $ws_plugin__s2member_temp_s = preg_replace ("/%%notify_url%%/", get_bloginfo ("url") . "/?s2member_paypal_notify=1", $ws_plugin__s2member_temp_s);
333
- $ws_plugin__s2member_temp_s = preg_replace ("/%%return%%/", get_bloginfo ("url") . "/?s2member_paypal_return=1", $ws_plugin__s2member_temp_s);
334
- $ws_plugin__s2member_temp_s = preg_replace ("/%%domain%%/", strtolower ($_SERVER["HTTP_HOST"]), $ws_plugin__s2member_temp_s);
335
- $ws_plugin__s2member_temp_s = preg_replace ("/%%level%%/", "2", $ws_plugin__s2member_temp_s);
336
- echo format_to_edit ($ws_plugin__s2member_temp_s);
337
- echo '</textarea><br />' . "\n";
338
- echo '&uarr; Use this more advanced Code if you\'re building a theme or plugin that integrates with s2Member.' . "\n";
339
- echo '</form>' . "\n";
340
- echo '</td>' . "\n";
341
- /**/
342
- echo '</tr>' . "\n";
343
- echo '</tbody>' . "\n";
344
- echo '</table>' . "\n";
345
- echo '</div>' . "\n";
346
- /**/
347
- echo '</div>' . "\n";
348
- /**/
349
- echo '<div class="ws-menu-page-group" title="PayPal® Subscr Cancellation Buttons">' . "\n";
350
- /**/
351
- echo '<div class="ws-menu-page-section ws-plugin--s2member-cancellation-section">' . "\n";
352
- echo '<h3>One Button Does It All For Cancellations ( copy/paste )</h3>' . "\n";
353
- 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";
354
- 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";
355
- /**/
356
- echo '<table class="form-table">' . "\n";
357
- echo '<tbody>' . "\n";
358
- echo '<tr>' . "\n";
359
- /**/
360
- echo '<th class="ws-menu-page-th-side">' . "\n";
361
- echo '<label for="ws-plugin--s2member-cancellation-shortcode">' . "\n";
362
- echo 'Button Code<br />For Cancellations:<br /><br />' . "\n";
363
- echo '<div id="ws-plugin--s2member-cancellation-button-prev">' . "\n";
364
- $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/c-button.html"));
365
- $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);
366
- $ws_plugin__s2member_temp_s = preg_replace ("/%%paypal_business%%/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"], $ws_plugin__s2member_temp_s);
367
- echo preg_replace ("/\<a/", '<a target="_blank"', $ws_plugin__s2member_temp_s);
368
- echo '</div>' . "\n";
369
- echo '</label>' . "\n";
370
- echo '</th>' . "\n";
371
- /**/
372
- echo '<td>' . "\n";
373
- echo '<form onsubmit="return false;">' . "\n";
374
- echo '<p>No configuration necessary.</p>' . "\n";
375
- echo '</form>' . "\n";
376
- echo '</td>' . "\n";
377
- /**/
378
- echo '</tr>' . "\n";
379
- echo '<tr>' . "\n";
380
- /**/
381
- echo '<td colspan="2">' . "\n";
382
- echo '<form onsubmit="return false;">' . "\n";
383
- echo '<strong>WordPress® Shortcode:</strong> ( recommended for both the WordPress® Visual &amp; HTML Editors )<br />' . "\n";
384
- $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/shortcodes/c-shortcode.html"));
385
- 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";
386
- echo '<strong>Resulting PayPal® Button Code:</strong> ( ultimately, your Shortcode will produce this snippet )<br />' . "\n";
387
- echo '<textarea id="ws-plugin--s2member-cancellation-button" rows="8" wrap="off" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;">';
388
- $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/c-button.html"));
389
- $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);
390
- $ws_plugin__s2member_temp_s = preg_replace ("/%%paypal_business%%/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"], $ws_plugin__s2member_temp_s);
391
- echo format_to_edit ($ws_plugin__s2member_temp_s);
392
- echo '</textarea><br />' . "\n";
393
- echo '&uarr; Use this more advanced Code if you\'re building a theme or plugin that integrates with s2Member.' . "\n";
394
- echo '</form>' . "\n";
395
- echo '</td>' . "\n";
396
- /**/
397
- echo '</tr>' . "\n";
398
- echo '</tbody>' . "\n";
399
- echo '</table>' . "\n";
400
- echo '</div>' . "\n";
401
- /**/
402
- echo '</div>' . "\n";
403
- /**/
404
- echo '<div class="ws-menu-page-group" title="PayPal® Specific Post/Page (Buy Now) Buttons">' . "\n";
405
- /**/
406
- echo '<div class="ws-menu-page-section ws-plugin--s2member-sp-buttons-section">' . "\n";
407
- echo '<h3>Button Code Generator For Specific Post/Page Buttons</h3>' . "\n";
408
- 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";
409
- 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";
410
- 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";
411
- 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";
412
- 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";
413
- /**/
414
- echo '<table class="form-table">' . "\n";
415
- echo '<tbody>' . "\n";
416
- echo '<tr>' . "\n";
417
- /**/
418
- echo '<th class="ws-menu-page-th-side">' . "\n";
419
- echo '<label for="ws-plugin--s2member-sp-shortcode">' . "\n";
420
- echo 'Button Code<br />Specific Posts/Pages:<br /><br />' . "\n";
421
- echo '<div id="ws-plugin--s2member-sp-button-prev"></div>' . "\n";
422
- echo '</label>' . "\n";
423
- echo '</th>' . "\n";
424
- /**/
425
- echo '<td>' . "\n";
426
- echo '<form onsubmit="return false;">' . "\n";
427
- echo '<p><select id="ws-plugin--s2member-sp-leading-id">' . "\n";
428
- echo '<option value="">&mdash; Select a Leading Post/Page that you\'ve protected &mdash;</option>' . "\n";
429
- $ws_plugin__s2member_temp_a_pp = ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"]) ?/**/
430
- array_merge ((array)get_posts ("include=" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"]),/**/
431
- (array)get_pages ("include=" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"])) : array ();
432
- foreach (($ws_plugin__s2member_temp_a = $ws_plugin__s2member_temp_a_pp) as $ws_plugin__s2member_temp_o)
433
- if ($ws_plugin__s2member_temp_o->ID != $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"])
434
- if ($ws_plugin__s2member_temp_o->ID != $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
435
- if ($ws_plugin__s2member_temp_o->ID != $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"])
436
- if (!in_array ($ws_plugin__s2member_temp_o->ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_pages"])))
437
- if (!in_array ($ws_plugin__s2member_temp_o->ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_pages"])))
438
- if (!in_array ($ws_plugin__s2member_temp_o->ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_pages"])))
439
- if (!in_array ($ws_plugin__s2member_temp_o->ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_pages"])))
440
- echo '<option value="' . esc_attr ($ws_plugin__s2member_temp_o->ID) . '">' . esc_html ($ws_plugin__s2member_temp_o->post_title) . '</option>' . "\n";
441
- /**/
442
- 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";
443
- /**/
444
- echo '<p><select id="ws-plugin--s2member-sp-additional-ids" multiple="multiple" style="height:100px;">' . "\n";
445
- echo '<optgroup label="&mdash; Package Additional Posts/Pages that you\'ve protected &mdash;">' . "\n";
446
- foreach (($ws_plugin__s2member_temp_a = $ws_plugin__s2member_temp_a_pp) as $ws_plugin__s2member_temp_o)
447
- if ($ws_plugin__s2member_temp_o->ID != $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"])
448
- if ($ws_plugin__s2member_temp_o->ID != $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
449
- if ($ws_plugin__s2member_temp_o->ID != $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"])
450
- if (!in_array ($ws_plugin__s2member_temp_o->ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_pages"])))
451
- if (!in_array ($ws_plugin__s2member_temp_o->ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_pages"])))
452
- if (!in_array ($ws_plugin__s2member_temp_o->ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_pages"])))
453
- if (!in_array ($ws_plugin__s2member_temp_o->ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_pages"])))
454
- echo '<option value="' . esc_attr ($ws_plugin__s2member_temp_o->ID) . '">' . esc_html ($ws_plugin__s2member_temp_o->post_title) . '</option>' . "\n";
455
- /**/
456
- 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";
457
- /**/
458
- echo '<p>Description: <input type="text" id="ws-plugin--s2member-sp-desc" value="" size="68" /></p>' . "\n";
459
- 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";
460
- 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";
461
- echo '</form>' . "\n";
462
- echo '</td>' . "\n";
463
- /**/
464
- echo '</tr>' . "\n";
465
- echo '<tr>' . "\n";
466
- /**/
467
- echo '<td colspan="2">' . "\n";
468
- echo '<form onsubmit="return false;">' . "\n";
469
- echo '<strong>WordPress® Shortcode:</strong> ( recommended for both the WordPress® Visual &amp; HTML Editors )<br />' . "\n";
470
- $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/shortcodes/sp-shortcode.html"));
471
- $ws_plugin__s2member_temp_s = preg_replace ("/%%domain%%/", strtolower ($_SERVER["HTTP_HOST"]), $ws_plugin__s2member_temp_s);
472
- 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";
473
- echo '<strong>Resulting PayPal® Button Code:</strong> ( ultimately, your Shortcode will produce this snippet )<br />' . "\n";
474
- echo '<textarea id="ws-plugin--s2member-sp-button" rows="8" wrap="off" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;">';
475
- $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/sp-button.html"));
476
- $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);
477
- $ws_plugin__s2member_temp_s = preg_replace ("/%%paypal_business%%/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"], $ws_plugin__s2member_temp_s);
478
- $ws_plugin__s2member_temp_s = preg_replace ("/%%cancel_return%%/", get_bloginfo ("url"), $ws_plugin__s2member_temp_s);
479
- $ws_plugin__s2member_temp_s = preg_replace ("/%%notify_url%%/", get_bloginfo ("url") . "/?s2member_paypal_notify=1", $ws_plugin__s2member_temp_s);
480
- $ws_plugin__s2member_temp_s = preg_replace ("/%%return%%/", get_bloginfo ("url") . "/?s2member_paypal_return=1", $ws_plugin__s2member_temp_s);
481
- $ws_plugin__s2member_temp_s = preg_replace ("/%%domain%%/", strtolower ($_SERVER["HTTP_HOST"]), $ws_plugin__s2member_temp_s);
482
- echo format_to_edit ($ws_plugin__s2member_temp_s);
483
- echo '</textarea><br />' . "\n";
484
- echo '&uarr; Use this more advanced Code if you\'re building a theme or plugin that integrates with s2Member.' . "\n";
485
- echo '</form>' . "\n";
486
- echo '</td>' . "\n";
487
- /**/
488
- echo '</tr>' . "\n";
489
- echo '</tbody>' . "\n";
490
- echo '</table>' . "\n";
491
- echo '</div>' . "\n";
492
- /**/
493
- echo '</div>' . "\n";
494
- /**/
495
- echo '<div class="ws-menu-page-group" title="PayPal® Specific Post/Page Access Links">' . "\n";
496
- /**/
497
- echo '<div class="ws-menu-page-section ws-plugin--s2member-sp-links-section">' . "\n";
498
- echo '<h3>Specific Post/Page Link Generator ( for Customer Service )</h3>' . "\n";
499
- 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";
500
- /**/
501
- echo '<table class="form-table">' . "\n";
502
- echo '<tbody>' . "\n";
503
- echo '<tr>' . "\n";
504
- /**/
505
- echo '<td>' . "\n";
506
- echo '<form onsubmit="return false;">' . "\n";
507
- echo '<p><select id="ws-plugin--s2member-sp-link-leading-id">' . "\n";
508
- echo '<option value="">&mdash; Select a Leading Post/Page that you\'ve protected &mdash;</option>' . "\n";
509
- foreach (($ws_plugin__s2member_temp_a = $ws_plugin__s2member_temp_a_pp) as $ws_plugin__s2member_temp_o)
510
- if ($ws_plugin__s2member_temp_o->ID != $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"])
511
- if ($ws_plugin__s2member_temp_o->ID != $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
512
- if ($ws_plugin__s2member_temp_o->ID != $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"])
513
- if (!in_array ($ws_plugin__s2member_temp_o->ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_pages"])))
514
- if (!in_array ($ws_plugin__s2member_temp_o->ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_pages"])))
515
- if (!in_array ($ws_plugin__s2member_temp_o->ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_pages"])))
516
- if (!in_array ($ws_plugin__s2member_temp_o->ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_pages"])))
517
- echo '<option value="' . esc_attr ($ws_plugin__s2member_temp_o->ID) . '">' . esc_html ($ws_plugin__s2member_temp_o->post_title) . '</option>' . "\n";
518
- /**/
519
- 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";
520
- /**/
521
- echo '<p><select id="ws-plugin--s2member-sp-link-additional-ids" multiple="multiple" style="height:100px;">' . "\n";
522
- echo '<optgroup label="&mdash; Package Additional Posts/Pages that you\'ve protected &mdash;">' . "\n";
523
- foreach (($ws_plugin__s2member_temp_a = $ws_plugin__s2member_temp_a_pp) as $ws_plugin__s2member_temp_o)
524
- if ($ws_plugin__s2member_temp_o->ID != $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"])
525
- if ($ws_plugin__s2member_temp_o->ID != $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
526
- if ($ws_plugin__s2member_temp_o->ID != $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"])
527
- if (!in_array ($ws_plugin__s2member_temp_o->ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_pages"])))
528
- if (!in_array ($ws_plugin__s2member_temp_o->ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_pages"])))
529
- if (!in_array ($ws_plugin__s2member_temp_o->ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_pages"])))
530
- if (!in_array ($ws_plugin__s2member_temp_o->ID, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_pages"])))
531
- echo '<option value="' . esc_attr ($ws_plugin__s2member_temp_o->ID) . '">' . esc_html ($ws_plugin__s2member_temp_o->post_title) . '</option>' . "\n";
532
- /**/
533
- 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";
534
- /**/
535
- 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";
536
- echo '<p id="ws-plugin--s2member-sp-link" style="font-family:Consolas, monospace; display:none;"></p>' . "\n";
537
- echo '</form>' . "\n";
538
- echo '</td>' . "\n";
539
- /**/
540
- echo '</tr>' . "\n";
541
- echo '</tbody>' . "\n";
542
- echo '</table>' . "\n";
543
- echo '</div>' . "\n";
544
- /**/
545
- echo '</div>' . "\n";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
546
  }
547
  else /* They need to first configure the options. */
548
  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";
@@ -551,13 +626,16 @@ echo '</td>' . "\n";
551
  /**/
552
  echo '<td class="ws-menu-page-table-r">' . "\n";
553
  /**/
554
- echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu-r"]["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="." title="Contact PriMoThemes!" /></a></div>' . "\n" : '';
555
- /**/
556
- echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu-r"]["tools"]) ? '<div class="ws-menu-page-tools"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-tools.png" alt="." /></div>' . "\n" : '';
557
  /**/
558
- echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu-r"]["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" : '';
 
 
 
559
  /**/
560
- echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu-r"]["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" : '';
 
561
  /**/
562
  echo '</td>' . "\n";
563
  /**/
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";
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
  /**/
includes/menu-pages/down-ops.inc.php CHANGED
@@ -32,168 +32,196 @@ echo '<form method="post" name="ws_plugin__s2member_options_form" id="ws-plugin-
32
  echo '<input type="hidden" name="ws_plugin__s2member_options_save" id="ws-plugin--s2member-options-save" value="' . esc_attr (wp_create_nonce ("ws-plugin--s2member-options-save")) . '" />' . "\n";
33
  echo '<input type="hidden" name="ws_plugin__s2member_configured" id="ws-plugin--s2member-configured" value="1" />' . "\n";
34
  /**/
35
- echo '<div class="ws-menu-page-group" title="Protected File Downloads">' . "\n";
36
- /**/
37
- echo '<div class="ws-menu-page-section ws-plugin--s2member-download-restrictions-section">' . "\n";
38
- echo '<h3>File Download Restrictions ( required, if providing access to protected files )</h3>' . "\n";
39
- echo '<p>If your membership offering allows access to restricted files, you\'ll need to configure these options.</p>' . "\n";
40
- /**/
41
- echo '<div class="ws-menu-page-hr"></div>' . "\n";
42
- /**/
43
- 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";
44
- 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";
45
- 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";
46
- /**/
47
- echo '<div class="ws-menu-page-hr"></div>' . "\n";
48
- /**/
49
- 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";
50
- 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";
51
- 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";
52
- /**/
53
- echo '<div class="ws-menu-page-hr"></div>' . "\n";
54
- /**/
55
- echo '<table class="form-table">' . "\n";
56
- echo '<tbody>' . "\n";
57
- echo '<tr>' . "\n";
58
- /**/
59
- echo '<th>' . "\n";
60
- echo '<label for="ws-plugin--s2member-level1-file-downloads-allowed">' . "\n";
61
- echo 'File Downloads ( Level #1 Or Higher ):' . "\n";
62
- echo '</label>' . "\n";
63
- echo '</th>' . "\n";
64
- /**/
65
- echo '</tr>' . "\n";
66
- echo '<tr>' . "\n";
67
- /**/
68
- echo '<td>' . "\n";
69
- echo '<input type="text" name="ws_plugin__s2member_level1_file_downloads_allowed" id="ws-plugin--s2member-level1-file-downloads-allowed" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_file_downloads_allowed"]) . '" style="width:200px;" maxlength="9" /> every <input type="text" name="ws_plugin__s2member_level1_file_downloads_allowed_days" id="ws-plugin--s2member-level1-file-downloads-allowed-days" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_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";
70
- echo 'Only this many unique downloads ( <code><em>999999999 = unlimited</em></code> ) will be permitted every X days.' . "\n";
71
- echo '</td>' . "\n";
72
- /**/
73
- echo '</tr>' . "\n";
74
- echo '<tr>' . "\n";
75
- /**/
76
- echo '<th>' . "\n";
77
- echo '<label for="ws-plugin--s2member-level2-file-downloads-allowed">' . "\n";
78
- echo 'File Downloads ( Level #2 Or Higher ):' . "\n";
79
- echo '</label>' . "\n";
80
- echo '</th>' . "\n";
81
- /**/
82
- echo '</tr>' . "\n";
83
- echo '<tr>' . "\n";
84
- /**/
85
- echo '<td>' . "\n";
86
- echo '<input type="text" name="ws_plugin__s2member_level2_file_downloads_allowed" id="ws-plugin--s2member-level2-file-downloads-allowed" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_file_downloads_allowed"]) . '" style="width:200px;" maxlength="9" /> every <input type="text" name="ws_plugin__s2member_level2_file_downloads_allowed_days" id="ws-plugin--s2member-level2-file-downloads-allowed-days" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_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";
87
- echo 'Only this many unique downloads ( <code><em>999999999 = unlimited</em></code> ) will be permitted every X days.' . "\n";
88
- echo '</td>' . "\n";
89
- /**/
90
- echo '</tr>' . "\n";
91
- echo '<tr>' . "\n";
92
- /**/
93
- echo '<th>' . "\n";
94
- echo '<label for="ws-plugin--s2member-level3-file-downloads-allowed">' . "\n";
95
- echo 'File Downloads ( Level #3 Or Higher ):' . "\n";
96
- echo '</label>' . "\n";
97
- echo '</th>' . "\n";
98
- /**/
99
- echo '</tr>' . "\n";
100
- echo '<tr>' . "\n";
101
- /**/
102
- echo '<td>' . "\n";
103
- echo '<input type="text" name="ws_plugin__s2member_level3_file_downloads_allowed" id="ws-plugin--s2member-level3-file-downloads-allowed" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_file_downloads_allowed"]) . '" style="width:200px;" maxlength="9" /> every <input type="text" name="ws_plugin__s2member_level3_file_downloads_allowed_days" id="ws-plugin--s2member-level3-file-downloads-allowed-days" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_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";
104
- echo 'Only this many unique downloads ( <code><em>999999999 = unlimited</em></code> ) will be permitted every X days.' . "\n";
105
- echo '</td>' . "\n";
106
- /**/
107
- echo '</tr>' . "\n";
108
- echo '<tr>' . "\n";
109
- /**/
110
- echo '<th>' . "\n";
111
- echo '<label for="ws-plugin--s2member-level4-file-downloads-allowed">' . "\n";
112
- echo 'File Downloads ( Highest Level #4 ):' . "\n";
113
- echo '</label>' . "\n";
114
- echo '</th>' . "\n";
115
- /**/
116
- echo '</tr>' . "\n";
117
- echo '<tr>' . "\n";
118
- /**/
119
- echo '<td>' . "\n";
120
- echo '<input type="text" name="ws_plugin__s2member_level4_file_downloads_allowed" id="ws-plugin--s2member-level4-file-downloads-allowed" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_file_downloads_allowed"]) . '" style="width:200px;" maxlength="9" /> every <input type="text" name="ws_plugin__s2member_level4_file_downloads_allowed_days" id="ws-plugin--s2member-level4-file-downloads-allowed-days" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_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";
121
- echo 'Only this many unique downloads ( <code><em>999999999 = unlimited</em></code> ) will be permitted every X days.' . "\n";
122
- echo '</td>' . "\n";
123
- /**/
124
- echo '</tr>' . "\n";
125
- echo '</tbody>' . "\n";
126
- echo '</table>' . "\n";
127
- echo '</div>' . "\n";
128
- /**/
129
- echo '</div>' . "\n";
130
- /**/
131
- echo '<div class="ws-menu-page-group" title="Download Limit Exceeded">' . "\n";
132
- /**/
133
- echo '<div class="ws-menu-page-section ws-plugin--s2member-limit-exceeded-section">' . "\n";
134
- echo '<h3>Download Limit Exceeded Page ( required, if providing access to protected files )</h3>' . "\n";
135
- echo '<p>This Page will be shown if a Member reaches their download limit, based on the configuration you\'ve specified in the fields above. This Page should be created by you, in WordPress®. This Page should provide an informative message to the Member, describing your file access restrictions. Just tell them a little bit about your policy on file downloads, and why they might have reached this Page.</p>' . "\n";
136
- /**/
137
- echo '<table class="form-table">' . "\n";
138
- echo '<tbody>' . "\n";
139
- echo '<tr>' . "\n";
140
- /**/
141
- echo '<th>' . "\n";
142
- echo '<label for="ws-plugin--s2member-file-download-limit-exceeded-page">' . "\n";
143
- echo 'Download Limit Exceeded Page:' . "\n";
144
- echo '</label>' . "\n";
145
- echo '</th>' . "\n";
146
- /**/
147
- echo '</tr>' . "\n";
148
- echo '<tr>' . "\n";
149
- /**/
150
- echo '<td>' . "\n";
151
- echo '<select name="ws_plugin__s2member_file_download_limit_exceeded_page" id="ws-plugin--s2member-file-download-limit-exceeded-page">' . "\n";
152
- echo '<option value="">&mdash; Select &mdash;</option>' . "\n";
153
- foreach (($ws_plugin__s2member_temp_a = array_merge ((array)get_pages ())) as $ws_plugin__s2member_temp_o)
154
- echo '<option value="' . esc_attr ($ws_plugin__s2member_temp_o->ID) . '"' . (($ws_plugin__s2member_temp_o->ID == $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"]) ? ' selected="selected"' : '') . '>' . esc_html ($ws_plugin__s2member_temp_o->post_title) . '</option>' . "\n";
155
- echo '</select><br />' . "\n";
156
- echo 'Please choose a Page that Members will see if they reach their file download limit. This Page should provide an informative message to the Member, describing your file access restrictions. Just tell them a little bit about your policy on file downloads. We recommend the following title: <code>Download Limit Exceeded</code>.' . "\n";
157
- echo '</td>' . "\n";
158
- /**/
159
- echo '</tr>' . "\n";
160
- echo '</tbody>' . "\n";
161
- echo '</table>' . "\n";
162
- echo '</div>' . "\n";
163
- /**/
164
- echo '</div>' . "\n";
165
- /**/
166
- echo '<div class="ws-menu-page-group" title="Inline File Extensions">' . "\n";
167
- /**/
168
- echo '<div class="ws-menu-page-section ws-plugin--s2member-extensions-section">' . "\n";
169
- echo '<h3>Inline File Extensions ( optional, for content-disposition )</h3>' . "\n";
170
- echo '<p>There are two ways to serve files. Inline, or as an Attachment. By default, s2Member will serve all of your protected Files, as downloadable attachments. Meaning, visitors will be given a File Download Prompt. Otherwise known as <code>Content-Disposition: attachment</code>. In some cases though, you may wish to serve files Inline. For example, PDF files and images should usually be served Inline. When you serve a file Inline, it is displayed in your browser immediately, rather than your browser prompting you to download the file as an attachment.</p>' . "\n";
171
- echo '<p>Using the field below, you can list all of the extensions that you want s2Member to serve Inline ( ex: <code>pdf,jpg,jpeg,jpe,gif,png</code> ). Please understand, some files just cannot be displayed inline. For instance, there is no way to display an <code>exe</code> file inline. So only specify extensions that can, and should be displayed inline by a web browser.</p>' . "\n";
172
- /**/
173
- echo '<table class="form-table">' . "\n";
174
- echo '<tbody>' . "\n";
175
- echo '<tr>' . "\n";
176
- /**/
177
- echo '<th>' . "\n";
178
- echo '<label for="ws-plugin--s2member-file-download-inline-extensions">' . "\n";
179
- echo 'Inline File Extensions ( comma delimited ):' . "\n";
180
- echo '</label>' . "\n";
181
- echo '</th>' . "\n";
182
- /**/
183
- echo '</tr>' . "\n";
184
- echo '<tr>' . "\n";
185
- /**/
186
- echo '<td>' . "\n";
187
- echo '<input type="text" name="ws_plugin__s2member_file_download_inline_extensions" id="ws-plugin--s2member-file-download-inline-extensions" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_inline_extensions"]) . '" /><br />' . "\n";
188
- echo 'Inline extensions in comma delimited format. Example: <code>pdf,jpg,jpeg,jpe,gif,png</code>.' . "\n";
189
- echo '</td>' . "\n";
190
- /**/
191
- echo '</tr>' . "\n";
192
- echo '</tbody>' . "\n";
193
- echo '</table>' . "\n";
194
- echo '</div>' . "\n";
195
- /**/
196
- echo '</div>' . "\n";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
197
  /**/
198
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
199
  /**/
@@ -205,13 +233,16 @@ echo '</td>' . "\n";
205
  /**/
206
  echo '<td class="ws-menu-page-table-r">' . "\n";
207
  /**/
208
- echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu-r"]["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="." title="Contact PriMoThemes!" /></a></div>' . "\n" : '';
209
- /**/
210
- echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu-r"]["tools"]) ? '<div class="ws-menu-page-tools"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-tools.png" alt="." /></div>' . "\n" : '';
211
  /**/
212
- echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu-r"]["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" : '';
 
 
 
213
  /**/
214
- echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu-r"]["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" : '';
 
215
  /**/
216
  echo '</td>' . "\n";
217
  /**/
32
  echo '<input type="hidden" name="ws_plugin__s2member_options_save" id="ws-plugin--s2member-options-save" value="' . esc_attr (wp_create_nonce ("ws-plugin--s2member-options-save")) . '" />' . "\n";
33
  echo '<input type="hidden" name="ws_plugin__s2member_configured" id="ws-plugin--s2member-configured" value="1" />' . "\n";
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
+ /**/
62
+ echo '<table class="form-table">' . "\n";
63
+ echo '<tbody>' . "\n";
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";
70
+ echo '</th>' . "\n";
71
+ /**/
72
+ echo '</tr>' . "\n";
73
+ echo '<tr>' . "\n";
74
+ /**/
75
+ echo '<td>' . "\n";
76
+ echo '<input type="text" name="ws_plugin__s2member_level1_file_downloads_allowed" id="ws-plugin--s2member-level1-file-downloads-allowed" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_file_downloads_allowed"]) . '" style="width:200px;" maxlength="9" /> every <input type="text" name="ws_plugin__s2member_level1_file_downloads_allowed_days" id="ws-plugin--s2member-level1-file-downloads-allowed-days" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_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";
77
+ echo 'Only this many unique downloads ( <code><em>999999999 = unlimited</em></code> ) will be permitted every X days.' . "\n";
78
+ echo '</td>' . "\n";
79
+ /**/
80
+ echo '</tr>' . "\n";
81
+ echo '<tr>' . "\n";
82
+ /**/
83
+ echo '<th>' . "\n";
84
+ echo '<label for="ws-plugin--s2member-level2-file-downloads-allowed">' . "\n";
85
+ echo 'File Downloads ( Level #2 Or Higher ):' . "\n";
86
+ echo '</label>' . "\n";
87
+ echo '</th>' . "\n";
88
+ /**/
89
+ echo '</tr>' . "\n";
90
+ echo '<tr>' . "\n";
91
+ /**/
92
+ echo '<td>' . "\n";
93
+ echo '<input type="text" name="ws_plugin__s2member_level2_file_downloads_allowed" id="ws-plugin--s2member-level2-file-downloads-allowed" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_file_downloads_allowed"]) . '" style="width:200px;" maxlength="9" /> every <input type="text" name="ws_plugin__s2member_level2_file_downloads_allowed_days" id="ws-plugin--s2member-level2-file-downloads-allowed-days" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_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";
94
+ echo 'Only this many unique downloads ( <code><em>999999999 = unlimited</em></code> ) will be permitted every X days.' . "\n";
95
+ echo '</td>' . "\n";
96
+ /**/
97
+ echo '</tr>' . "\n";
98
+ echo '<tr>' . "\n";
99
+ /**/
100
+ echo '<th>' . "\n";
101
+ echo '<label for="ws-plugin--s2member-level3-file-downloads-allowed">' . "\n";
102
+ echo 'File Downloads ( Level #3 Or Higher ):' . "\n";
103
+ echo '</label>' . "\n";
104
+ echo '</th>' . "\n";
105
+ /**/
106
+ echo '</tr>' . "\n";
107
+ echo '<tr>' . "\n";
108
+ /**/
109
+ echo '<td>' . "\n";
110
+ echo '<input type="text" name="ws_plugin__s2member_level3_file_downloads_allowed" id="ws-plugin--s2member-level3-file-downloads-allowed" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_file_downloads_allowed"]) . '" style="width:200px;" maxlength="9" /> every <input type="text" name="ws_plugin__s2member_level3_file_downloads_allowed_days" id="ws-plugin--s2member-level3-file-downloads-allowed-days" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_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";
111
+ echo 'Only this many unique downloads ( <code><em>999999999 = unlimited</em></code> ) will be permitted every X days.' . "\n";
112
+ echo '</td>' . "\n";
113
+ /**/
114
+ echo '</tr>' . "\n";
115
+ echo '<tr>' . "\n";
116
+ /**/
117
+ echo '<th>' . "\n";
118
+ echo '<label for="ws-plugin--s2member-level4-file-downloads-allowed">' . "\n";
119
+ echo 'File Downloads ( Highest Level #4 ):' . "\n";
120
+ echo '</label>' . "\n";
121
+ echo '</th>' . "\n";
122
+ /**/
123
+ echo '</tr>' . "\n";
124
+ echo '<tr>' . "\n";
125
+ /**/
126
+ echo '<td>' . "\n";
127
+ echo '<input type="text" name="ws_plugin__s2member_level4_file_downloads_allowed" id="ws-plugin--s2member-level4-file-downloads-allowed" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_file_downloads_allowed"]) . '" style="width:200px;" maxlength="9" /> every <input type="text" name="ws_plugin__s2member_level4_file_downloads_allowed_days" id="ws-plugin--s2member-level4-file-downloads-allowed-days" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_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";
128
+ echo 'Only this many unique downloads ( <code><em>999999999 = unlimited</em></code> ) will be permitted every X days.' . "\n";
129
+ echo '</td>' . "\n";
130
+ /**/
131
+ echo '</tr>' . "\n";
132
+ echo '</tbody>' . "\n";
133
+ echo '</table>' . "\n";
134
+ echo '</div>' . "\n";
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 ()))
142
+ {
143
+ do_action ("ws_plugin__s2member_during_down_ops_page_during_left_sections_before_limit_exceeded_page", get_defined_vars ());
144
+ /**/
145
+ echo '<div class="ws-menu-page-group" title="Download Limit Exceeded">' . "\n";
146
+ /**/
147
+ echo '<div class="ws-menu-page-section ws-plugin--s2member-limit-exceeded-page-section">' . "\n";
148
+ echo '<h3>Download Limit Exceeded Page ( required, if providing access to protected files )</h3>' . "\n";
149
+ echo '<p>This Page will be shown if a Member reaches their download limit, based on the configuration you\'ve specified in the fields above. This Page should be created by you, in WordPress®. This Page should provide an informative message to the Member, describing your file access restrictions. Just tell them a little bit about your policy on file downloads, and why they might have reached this Page.</p>' . "\n";
150
+ do_action ("ws_plugin__s2member_during_down_ops_page_during_left_sections_during_limit_exceeded_page", get_defined_vars ());
151
+ /**/
152
+ echo '<table class="form-table">' . "\n";
153
+ echo '<tbody>' . "\n";
154
+ echo '<tr>' . "\n";
155
+ /**/
156
+ echo '<th>' . "\n";
157
+ echo '<label for="ws-plugin--s2member-file-download-limit-exceeded-page">' . "\n";
158
+ echo 'Download Limit Exceeded Page:' . "\n";
159
+ echo '</label>' . "\n";
160
+ echo '</th>' . "\n";
161
+ /**/
162
+ echo '</tr>' . "\n";
163
+ echo '<tr>' . "\n";
164
+ /**/
165
+ echo '<td>' . "\n";
166
+ echo '<select name="ws_plugin__s2member_file_download_limit_exceeded_page" id="ws-plugin--s2member-file-download-limit-exceeded-page">' . "\n";
167
+ echo '<option value="">&mdash; Select &mdash;</option>' . "\n";
168
+ foreach (($ws_plugin__s2member_temp_a = array_merge ((array)get_pages ())) as $ws_plugin__s2member_temp_o)
169
+ echo '<option value="' . esc_attr ($ws_plugin__s2member_temp_o->ID) . '"' . (($ws_plugin__s2member_temp_o->ID == $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"]) ? ' selected="selected"' : '') . '>' . esc_html ($ws_plugin__s2member_temp_o->post_title) . '</option>' . "\n";
170
+ echo '</select><br />' . "\n";
171
+ echo 'Please choose a Page that Members will see if they reach their file download limit. This Page should provide an informative message to the Member, describing your file access restrictions. Just tell them a little bit about your policy on file downloads. We recommend the following title: <code>Download Limit Exceeded</code>.' . "\n";
172
+ echo '</td>' . "\n";
173
+ /**/
174
+ echo '</tr>' . "\n";
175
+ echo '</tbody>' . "\n";
176
+ echo '</table>' . "\n";
177
+ echo '</div>' . "\n";
178
+ /**/
179
+ echo '</div>' . "\n";
180
+ /**/
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 ());
187
+ /**/
188
+ echo '<div class="ws-menu-page-group" title="Inline File Extensions">' . "\n";
189
+ /**/
190
+ echo '<div class="ws-menu-page-section ws-plugin--s2member-inline-extensions-section">' . "\n";
191
+ echo '<h3>Inline File Extensions ( optional, for content-disposition )</h3>' . "\n";
192
+ echo '<p>There are two ways to serve files. Inline, or as an Attachment. By default, s2Member will serve all of your protected Files, as downloadable attachments. Meaning, visitors will be given a File Download Prompt. Otherwise known as <code>Content-Disposition: attachment</code>. In some cases though, you may wish to serve files Inline. For example, PDF files and images should usually be served Inline. When you serve a file Inline, it is displayed in your browser immediately, rather than your browser prompting you to download the file as an attachment.</p>' . "\n";
193
+ echo '<p>Using the field below, you can list all of the extensions that you want s2Member to serve Inline ( ex: <code>pdf,jpg,jpeg,jpe,gif,png</code> ). Please understand, some files just cannot be displayed inline. For instance, there is no way to display an <code>exe</code> file inline. So only specify extensions that can, and should be displayed inline by a web browser.</p>' . "\n";
194
+ do_action ("ws_plugin__s2member_during_down_ops_page_during_left_sections_during_inline_extensions", get_defined_vars ());
195
+ /**/
196
+ echo '<table class="form-table">' . "\n";
197
+ echo '<tbody>' . "\n";
198
+ echo '<tr>' . "\n";
199
+ /**/
200
+ echo '<th>' . "\n";
201
+ echo '<label for="ws-plugin--s2member-file-download-inline-extensions">' . "\n";
202
+ echo 'Inline File Extensions ( comma delimited ):' . "\n";
203
+ echo '</label>' . "\n";
204
+ echo '</th>' . "\n";
205
+ /**/
206
+ echo '</tr>' . "\n";
207
+ echo '<tr>' . "\n";
208
+ /**/
209
+ echo '<td>' . "\n";
210
+ echo '<input type="text" name="ws_plugin__s2member_file_download_inline_extensions" id="ws-plugin--s2member-file-download-inline-extensions" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_inline_extensions"]) . '" /><br />' . "\n";
211
+ echo 'Inline extensions in comma delimited format. Example: <code>pdf,jpg,jpeg,jpe,gif,png</code>.' . "\n";
212
+ echo '</td>' . "\n";
213
+ /**/
214
+ echo '</tr>' . "\n";
215
+ echo '</tbody>' . "\n";
216
+ echo '</table>' . "\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_inline_extensions", get_defined_vars ());
222
+ }
223
+ /**/
224
+ do_action ("ws_plugin__s2member_during_down_ops_page_after_left_sections", get_defined_vars ());
225
  /**/
226
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
227
  /**/
233
  /**/
234
  echo '<td class="ws-menu-page-table-r">' . "\n";
235
  /**/
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" : '';
242
+ 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" : '';
243
  /**/
244
+ do_action ("ws_plugin__s2member_during_menu_pages_after_right_sections", get_defined_vars ());
245
+ do_action ("ws_plugin__s2member_during_down_ops_page_after_right_sections", get_defined_vars ());
246
  /**/
247
  echo '</td>' . "\n";
248
  /**/
includes/menu-pages/els-ops.inc.php CHANGED
@@ -31,289 +31,325 @@ echo '<td class="ws-menu-page-table-l">' . "\n";
31
  echo '<form method="post" name="ws_plugin__s2member_options_form" id="ws-plugin--s2member-options-form">' . "\n";
32
  echo '<input type="hidden" name="ws_plugin__s2member_options_save" id="ws-plugin--s2member-options-save" value="' . esc_attr (wp_create_nonce ("ws-plugin--s2member-options-save")) . '" />' . "\n";
33
  /**/
34
- echo '<div class="ws-menu-page-group" title="MailChimp® List Server Integration">' . "\n";
35
- /**/
36
- echo '<div class="ws-menu-page-section ws-plugin--s2member-mailchimp-section">' . "\n";
37
- echo '<a href="http://www.mailchimp.com/signup/?aid=8f347da54d66b5298d13237d9&afl=1" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/mailchimp-stamp.png" class="ws-menu-page-right" style="width:125px; height:125px; border:0;" alt="." /></a>' . "\n";
38
- echo '<h3>MailChimp® List Server Integration ( optional )</h3>' . "\n";
39
- echo '<p>s2Member can be integrated with MailChimp®. MailChimp® is an email marketing service. MailChimp® makes it easy to send email newsletters to your Customers, manage your MailChimp® subscriber lists, and track campaign performance. Although s2Member can be integrated with almost ANY list server, we highly recommend MailChimp®; because of their <a href="http://www.mailchimp.com/api/?aid=8f347da54d66b5298d13237d9&afl=1" target="_blank" rel="external">powerful API for MailChimp® services</a>. In future versions of s2Member, we plan to build additional features into s2Member that work with, and extend, MailChimp® services.</p>' . "\n";
40
- echo '<p>For now, we\'ve covered the basics. You can have your Members automatically subscribed to your MailChimp® marketing lists ( e.g. newsletters / auto-responders ). You\'ll need a <a href="http://www.mailchimp.com/signup/?aid=8f347da54d66b5298d13237d9&afl=1" target="_blank" rel="external">MailChimp® account</a>, a <a href="http://admin.mailchimp.com/account/api-key-popup" target="_blank" rel="external">MailChimp® API Key</a>, and your <a href="#" onclick="alert(\'To obtain your MailChimp® List ID(s), log into your MailChimp® account, click on the Lists tab. Click the (View) button, for the list(s) you want to integrate with s2Member. Then, click the (settings) link at the top. On the main (settings) page, for each list, you\\\'ll find a Unique List ID.\'); return false;">MailChimp® List IDs</a>.</p>' . "\n";
41
- /**/
42
- echo '<table class="form-table">' . "\n";
43
- echo '<tbody>' . "\n";
44
- echo '<tr>' . "\n";
45
- /**/
46
- echo '<th>' . "\n";
47
- echo '<label for="ws-plugin--s2member-mailchimp-api-key">' . "\n";
48
- echo 'MailChimp® API Key:' . "\n";
49
- echo '</label>' . "\n";
50
- echo '</th>' . "\n";
51
- /**/
52
- echo '</tr>' . "\n";
53
- echo '<tr>' . "\n";
54
- /**/
55
- echo '<td>' . "\n";
56
- echo '<input type="text" name="ws_plugin__s2member_mailchimp_api_key" id="ws-plugin--s2member-mailchimp-api-key" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mailchimp_api_key"]) . '" /><br />' . "\n";
57
- echo 'Once you have a MailChimp® account, you\'ll need to <a href="http://admin.mailchimp.com/account/api-key-popup" target="_blank" rel="external">add an API Key</a>.' . "\n";
58
- echo '</td>' . "\n";
59
- /**/
60
- echo '</tr>' . "\n";
61
- echo '<tr>' . "\n";
62
- /**/
63
- echo '<th>' . "\n";
64
- echo '<label for="ws-plugin--s2member-level0-mailchimp-list-ids">' . "\n";
65
- echo 'List ID(s) for Free Subscribers ( comma delimited ):' . "\n";
66
- echo '</label>' . "\n";
67
- echo '</th>' . "\n";
68
- /**/
69
- echo '</tr>' . "\n";
70
- echo '<tr>' . "\n";
71
- /**/
72
- echo '<td>' . "\n";
73
- echo '<input type="text" name="ws_plugin__s2member_level0_mailchimp_list_ids" id="ws-plugin--s2member-level0-mailchimp-list-ids" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_mailchimp_list_ids"]) . '" /><br />' . "\n";
74
- echo 'New Free Subscribers will be subscribed to these List IDs.<br />' . "\n";
75
- echo 'Ex: <code>4654aad4s5d, 4323344ksdf, 23234j23k3</code>' . "\n";
76
- echo '</td>' . "\n";
77
- /**/
78
- echo '</tr>' . "\n";
79
- echo '<tr>' . "\n";
80
- /**/
81
- echo '<th>' . "\n";
82
- echo '<label for="ws-plugin--s2member-level1-mailchimp-list-ids">' . "\n";
83
- echo 'List ID(s) for Level #1 ( comma delimited ):' . "\n";
84
- echo '</label>' . "\n";
85
- echo '</th>' . "\n";
86
- /**/
87
- echo '</tr>' . "\n";
88
- echo '<tr>' . "\n";
89
- /**/
90
- echo '<td>' . "\n";
91
- echo '<input type="text" name="ws_plugin__s2member_level1_mailchimp_list_ids" id="ws-plugin--s2member-level1-mailchimp-list-ids" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_mailchimp_list_ids"]) . '" /><br />' . "\n";
92
- echo 'New Level 1 Members will be subscribed to these List IDs.<br />' . "\n";
93
- echo 'Ex: <code>4654aad4s5d, 4323344ksdf, 23234j23k3</code>' . "\n";
94
- echo '</td>' . "\n";
95
- /**/
96
- echo '</tr>' . "\n";
97
- echo '<tr>' . "\n";
98
- /**/
99
- echo '<th>' . "\n";
100
- echo '<label for="ws-plugin--s2member-level2-mailchimp-list-ids">' . "\n";
101
- echo 'List ID(s) for Level #2 ( comma delimited ):' . "\n";
102
- echo '</label>' . "\n";
103
- echo '</th>' . "\n";
104
- /**/
105
- echo '</tr>' . "\n";
106
- echo '<tr>' . "\n";
107
- /**/
108
- echo '<td>' . "\n";
109
- echo '<input type="text" name="ws_plugin__s2member_level2_mailchimp_list_ids" id="ws-plugin--s2member-level2-mailchimp-list-ids" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_mailchimp_list_ids"]) . '" /><br />' . "\n";
110
- echo 'New Level 2 Members will be subscribed to these List IDs.' . "\n";
111
- echo '</td>' . "\n";
112
- /**/
113
- echo '</tr>' . "\n";
114
- echo '<tr>' . "\n";
115
- /**/
116
- echo '<th>' . "\n";
117
- echo '<label for="ws-plugin--s2member-level3-mailchimp-list-ids">' . "\n";
118
- echo 'List ID(s) for Level #3 ( comma delimited ):' . "\n";
119
- echo '</label>' . "\n";
120
- echo '</th>' . "\n";
121
- /**/
122
- echo '</tr>' . "\n";
123
- echo '<tr>' . "\n";
124
- /**/
125
- echo '<td>' . "\n";
126
- echo '<input type="text" name="ws_plugin__s2member_level3_mailchimp_list_ids" id="ws-plugin--s2member-level3-mailchimp-list-ids" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_mailchimp_list_ids"]) . '" /><br />' . "\n";
127
- echo 'New Level 3 Members will be subscribed to these List IDs.' . "\n";
128
- echo '</td>' . "\n";
129
- /**/
130
- echo '</tr>' . "\n";
131
- echo '<tr>' . "\n";
132
- /**/
133
- echo '<th>' . "\n";
134
- echo '<label for="ws-plugin--s2member-level4-mailchimp-list-ids">' . "\n";
135
- echo 'List ID(s) for Level #4 ( comma delimited ):' . "\n";
136
- echo '</label>' . "\n";
137
- echo '</th>' . "\n";
138
- /**/
139
- echo '</tr>' . "\n";
140
- echo '<tr>' . "\n";
141
- /**/
142
- echo '<td>' . "\n";
143
- echo '<input type="text" name="ws_plugin__s2member_level4_mailchimp_list_ids" id="ws-plugin--s2member-level4-mailchimp-list-ids" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_mailchimp_list_ids"]) . '" /><br />' . "\n";
144
- echo 'New Level 4 Members will be subscribed to these List IDs.' . "\n";
145
- echo '</td>' . "\n";
146
- /**/
147
- echo '</tr>' . "\n";
148
- echo '</tbody>' . "\n";
149
- echo '</table>' . "\n";
150
- echo '</div>' . "\n";
151
- /**/
152
- echo '</div>' . "\n";
153
- /**/
154
- echo '<div class="ws-menu-page-group" title="AWeber® List Server Integration">' . "\n";
155
- /**/
156
- echo '<div class="ws-menu-page-section ws-plugin--s2member-aweber-section">' . "\n";
157
- echo '<a href="http://aweber.com/?348037" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/aweber-logo.png" class="ws-menu-page-right" style="width:125px; height:125px; border:0;" alt="." /></a>' . "\n";
158
- echo '<h3>AWeber® List Server Integration ( optional )</h3>' . "\n";
159
- echo '<p>s2Member can be integrated with AWeber®. AWeber® is an email marketing service. Whether you\'re looking to get your first email campaign off the ground, or you\'re a seasoned veteran who wants to dig into advanced tools like detailed email web analytics, activity based segmentation, geo-targeting and broadcast split-testing, AWeber\'s got just what you need to make email marketing work for you.</p>' . "\n";
160
- echo '<p>You can have your Members automatically subscribed to your AWeber® marketing lists ( e.g. newsletters / auto-responders ). You\'ll need an <a href="http://aweber.com/?348037" target="_blank" rel="external">AWeber® account</a> and your <a href="#" onclick="alert(\'To obtain your AWeber® List ID(s), log into your AWeber® account. Click on the Lists tab. On that page you\\\'ll find a Unique List ID associated with each of your lists. AWeber® sometimes refers to this as a List Name instead of a List ID.\'); return false;">AWeber® List IDs</a>. You will ALSO need to configure a Custom Email Parser inside your AWeber® account. Log into AWeber®, and go to <em>My Lists -> Email Parser</em>. Choose the PayPal® Parser. You can safely ignore the additional instructions they provide. s2Member just needs the PayPal® box checked, and that\'s all. At some point, we\'ll get in contact with AWeber® about integrating a Custom Parser that is specifically designed for s2Member. Until then, you can just use the PayPal® Parser that is already available in your AWeber® account.</p>' . "\n";
161
- /**/
162
- echo '<table class="form-table">' . "\n";
163
- echo '<tbody>' . "\n";
164
- echo '<tr>' . "\n";
165
- /**/
166
- echo '<th>' . "\n";
167
- echo '<label for="ws-plugin--s2member-level0-aweber-list-ids">' . "\n";
168
- echo 'List ID(s) for Free Subscribers ( comma delimited ):' . "\n";
169
- echo '</label>' . "\n";
170
- echo '</th>' . "\n";
171
- /**/
172
- echo '</tr>' . "\n";
173
- echo '<tr>' . "\n";
174
- /**/
175
- echo '<td>' . "\n";
176
- echo '<input type="text" name="ws_plugin__s2member_level0_aweber_list_ids" id="ws-plugin--s2member-level0-aweber-list-ids" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_aweber_list_ids"]) . '" /><br />' . "\n";
177
- echo 'New Free Subscribers will be subscribed to these List IDs.<br />' . "\n";
178
- echo 'Ex: <code>mylist, myotherlist, anotherlist</code>' . "\n";
179
- echo '</td>' . "\n";
180
- /**/
181
- echo '</tr>' . "\n";
182
- echo '<tr>' . "\n";
183
- /**/
184
- echo '<th>' . "\n";
185
- echo '<label for="ws-plugin--s2member-level1-aweber-list-ids">' . "\n";
186
- echo 'List ID(s) for Level #1 ( comma delimited ):' . "\n";
187
- echo '</label>' . "\n";
188
- echo '</th>' . "\n";
189
- /**/
190
- echo '</tr>' . "\n";
191
- echo '<tr>' . "\n";
192
- /**/
193
- echo '<td>' . "\n";
194
- echo '<input type="text" name="ws_plugin__s2member_level1_aweber_list_ids" id="ws-plugin--s2member-level1-aweber-list-ids" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_aweber_list_ids"]) . '" /><br />' . "\n";
195
- echo 'New Level 1 Members will be subscribed to these List IDs.<br />' . "\n";
196
- echo 'Ex: <code>mylist, myotherlist, anotherlist</code>' . "\n";
197
- echo '</td>' . "\n";
198
- /**/
199
- echo '</tr>' . "\n";
200
- echo '<tr>' . "\n";
201
- /**/
202
- echo '<th>' . "\n";
203
- echo '<label for="ws-plugin--s2member-level2-aweber-list-ids">' . "\n";
204
- echo 'List ID(s) for Level #2 ( comma delimited ):' . "\n";
205
- echo '</label>' . "\n";
206
- echo '</th>' . "\n";
207
- /**/
208
- echo '</tr>' . "\n";
209
- echo '<tr>' . "\n";
210
- /**/
211
- echo '<td>' . "\n";
212
- echo '<input type="text" name="ws_plugin__s2member_level2_aweber_list_ids" id="ws-plugin--s2member-level2-aweber-list-ids" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_aweber_list_ids"]) . '" /><br />' . "\n";
213
- echo 'New Level 2 Members will be subscribed to these List IDs.' . "\n";
214
- echo '</td>' . "\n";
215
- /**/
216
- echo '</tr>' . "\n";
217
- echo '<tr>' . "\n";
218
- /**/
219
- echo '<th>' . "\n";
220
- echo '<label for="ws-plugin--s2member-level3-aweber-list-ids">' . "\n";
221
- echo 'List ID(s) for Level #3 ( comma delimited ):' . "\n";
222
- echo '</label>' . "\n";
223
- echo '</th>' . "\n";
224
- /**/
225
- echo '</tr>' . "\n";
226
- echo '<tr>' . "\n";
227
- /**/
228
- echo '<td>' . "\n";
229
- echo '<input type="text" name="ws_plugin__s2member_level3_aweber_list_ids" id="ws-plugin--s2member-level3-aweber-list-ids" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_aweber_list_ids"]) . '" /><br />' . "\n";
230
- echo 'New Level 3 Members will be subscribed to these List IDs.' . "\n";
231
- echo '</td>' . "\n";
232
- /**/
233
- echo '</tr>' . "\n";
234
- echo '<tr>' . "\n";
235
- /**/
236
- echo '<th>' . "\n";
237
- echo '<label for="ws-plugin--s2member-level4-aweber-list-ids">' . "\n";
238
- echo 'List ID(s) for Level #4 ( comma delimited ):' . "\n";
239
- echo '</label>' . "\n";
240
- echo '</th>' . "\n";
241
- /**/
242
- echo '</tr>' . "\n";
243
- echo '<tr>' . "\n";
244
- /**/
245
- echo '<td>' . "\n";
246
- echo '<input type="text" name="ws_plugin__s2member_level4_aweber_list_ids" id="ws-plugin--s2member-level4-aweber-list-ids" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_aweber_list_ids"]) . '" /><br />' . "\n";
247
- echo 'New Level 4 Members will be subscribed to these List IDs.' . "\n";
248
- echo '</td>' . "\n";
249
- /**/
250
- echo '</tr>' . "\n";
251
- echo '</tbody>' . "\n";
252
- echo '</table>' . "\n";
253
- echo '</div>' . "\n";
254
- /**/
255
- echo '</div>' . "\n";
256
- /**/
257
- echo '<div class="ws-menu-page-group" title="Registration / Double Opt-In Box?">' . "\n";
258
- /**/
259
- echo '<div class="ws-menu-page-section ws-plugin--s2member-opt-in-section">' . "\n";
260
- echo '<h3>Double Opt-In Checkbox Field ( optional )</h3>' . "\n";
261
- echo '<p>A Double Opt-In Checkbox will ONLY be displayed, if you\'ve integrated one <em>or more</em> List Servers ( in the sections above ).' . ((defined ("BP_VERSION")) ? ' With BuddyPress installed, the Checkbox will only be displayed if your BuddyPress theme supports <code>do_action("bp_before_registration_submit_buttons")</code>. Almost all BuddyPress themes support this. If yours does not, you can add it in.' : '') . '</p>' . "\n";
262
- /**/
263
- echo '<table class="form-table">' . "\n";
264
- echo '<tbody>' . "\n";
265
- echo '<tr class="ws-plugin--s2member-custom-reg-opt-in-label-row"' . ((!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"]) ? ' style="display:none;"' : '') . '>' . "\n";
266
- /**/
267
- echo '<th>' . "\n";
268
- echo '<label for="ws-plugin--s2member-custom-reg-opt-in-label">' . "\n";
269
- echo 'Double Opt-In Checkbox Label:' . "\n";
270
- echo '</label>' . "\n";
271
- echo '</th>' . "\n";
272
- /**/
273
- echo '</tr>' . "\n";
274
- echo '<tr class="ws-plugin--s2member-custom-reg-opt-in-label-row"' . ((!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"]) ? ' style="display:none;"' : '') . '>' . "\n";
275
- /**/
276
- echo '<td>' . "\n";
277
- echo '<input type="text" name="ws_plugin__s2member_custom_reg_opt_in_label" id="ws-plugin--s2member-custom-reg-opt-in-label" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in_label"]) . '" /><br />' . "\n";
278
- echo 'Example: <code><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/' . (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] == 1) ? 'checked' : 'unchecked') . '.png" class="ws-plugin--s2member-custom-reg-opt-in-label-prev-img ws-menu-page-img-16" style="vertical-align:middle;" alt="" /> Your Label will appear next to a Checkbox.</code>' . "\n";
279
- echo '</td>' . "\n";
280
- /**/
281
- echo '</tr>' . "\n";
282
- echo '<tr>' . "\n";
283
- /**/
284
- echo '<th>' . "\n";
285
- echo '<label for="ws-plugin--s2member-custom-reg-opt-in">' . "\n";
286
- echo 'Require Double Opt-In Checkbox?' . "\n";
287
- echo '</label>' . "\n";
288
- echo '</th>' . "\n";
289
- /**/
290
- echo '</tr>' . "\n";
291
- echo '<tr>' . "\n";
292
- /**/
293
- echo '<td>' . "\n";
294
- echo '<select name="ws_plugin__s2member_custom_reg_opt_in" id="ws-plugin--s2member-custom-reg-opt-in">' . "\n";
295
- echo '<option value="1"' . (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] == 1) ? ' selected="selected"' : '') . '>Yes ( the Box MUST be checked — checked by default )</option>' . "\n";
296
- echo '<option value="2"' . (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] == 2) ? ' selected="selected"' : '') . '>Yes ( the Box MUST be checked — unchecked by default )</option>' . "\n";
297
- echo '<option value="0"' . ((!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"]) ? ' selected="selected"' : '') . '>No ( disable — do NOT display or require the Checkbox )</option>' . "\n";
298
- echo '</select><br />' . "\n";
299
- echo 'An email confirmation will NOT be sent to the User, unless the Box is checked, or you\'ve disabled the Box; by choosing <code>No</code>.' . "\n";
300
- echo '</td>' . "\n";
301
- /**/
302
- echo '</tr>' . "\n";
303
- echo '</tbody>' . "\n";
304
- echo '</table>' . "\n";
305
- echo '</div>' . "\n";
306
- /**/
307
- echo '</div>' . "\n";
308
- /**/
309
- echo '<div class="ws-menu-page-group" title="Other List Server Integration Methods">' . "\n";
310
- /**/
311
- echo '<div class="ws-menu-page-section ws-plugin--s2member-other-lists-section">' . "\n";
312
- echo '<h3>Other List Server Integrations ( there\'s always a way )</h3>' . "\n";
313
- echo '<p>Check the s2Member API Notifications panel. You\'ll find additional layers of automation available through the use of the `Signup`, `Registration`, `Payment`, `EOT/Deletion`, `Refund/Reversal`, and `Specific Post/Page` notifications that are available to you through the s2Member API. These make it possible to integrate with 3rd party applications; like list servers, affiliate programs, and other back-office routines; in more advanced ways. You will probably need to get help from a web developer though. s2Member API Notifications require some light PHP scripting by someone familiar with web service connections.</p>' . "\n";
314
- echo '</div>' . "\n";
315
- /**/
316
- echo '</div>' . "\n";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
317
  /**/
318
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
319
  /**/
@@ -325,13 +361,16 @@ echo '</td>' . "\n";
325
  /**/
326
  echo '<td class="ws-menu-page-table-r">' . "\n";
327
  /**/
328
- echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu-r"]["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="." title="Contact PriMoThemes!" /></a></div>' . "\n" : '';
329
- /**/
330
- echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu-r"]["tools"]) ? '<div class="ws-menu-page-tools"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-tools.png" alt="." /></div>' . "\n" : '';
331
  /**/
332
- echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu-r"]["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" : '';
 
 
 
333
  /**/
334
- echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu-r"]["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" : '';
 
335
  /**/
336
  echo '</td>' . "\n";
337
  /**/
31
  echo '<form method="post" name="ws_plugin__s2member_options_form" id="ws-plugin--s2member-options-form">' . "\n";
32
  echo '<input type="hidden" name="ws_plugin__s2member_options_save" id="ws-plugin--s2member-options-save" value="' . esc_attr (wp_create_nonce ("ws-plugin--s2member-options-save")) . '" />' . "\n";
33
  /**/
34
+ do_action ("ws_plugin__s2member_during_els_ops_page_before_left_sections", get_defined_vars ());
35
+ /**/
36
+ if (apply_filters ("ws_plugin__s2member_during_els_ops_page_during_left_sections_display_mailchimp", true, get_defined_vars ()))
37
+ {
38
+ do_action ("ws_plugin__s2member_during_els_ops_page_during_left_sections_before_mailchimp", get_defined_vars ());
39
+ /**/
40
+ echo '<div class="ws-menu-page-group" title="MailChimp® List Server Integration">' . "\n";
41
+ /**/
42
+ echo '<div class="ws-menu-page-section ws-plugin--s2member-mailchimp-section">' . "\n";
43
+ echo '<a href="http://www.mailchimp.com/signup/?aid=8f347da54d66b5298d13237d9&afl=1" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/mailchimp-stamp.png" class="ws-menu-page-right" style="width:125px; height:125px; border:0;" alt="." /></a>' . "\n";
44
+ echo '<h3>MailChimp® List Server Integration ( optional )</h3>' . "\n";
45
+ echo '<p>s2Member can be integrated with MailChimp®. MailChimp® is an email marketing service. MailChimp® makes it easy to send email newsletters to your Customers, manage your MailChimp® subscriber lists, and track campaign performance. Although s2Member can be integrated with almost ANY list server, we highly recommend MailChimp®; because of their <a href="http://www.mailchimp.com/api/?aid=8f347da54d66b5298d13237d9&afl=1" target="_blank" rel="external">powerful API for MailChimp® services</a>. In future versions of s2Member, we plan to build additional features into s2Member that work with, and extend, MailChimp® services.</p>' . "\n";
46
+ echo '<p>For now, we\'ve covered the basics. You can have your Members automatically subscribed to your MailChimp® marketing lists ( e.g. newsletters / auto-responders ). You\'ll need a <a href="http://www.mailchimp.com/signup/?aid=8f347da54d66b5298d13237d9&afl=1" target="_blank" rel="external">MailChimp® account</a>, a <a href="http://admin.mailchimp.com/account/api-key-popup" target="_blank" rel="external">MailChimp® API Key</a>, and your <a href="#" onclick="alert(\'To obtain your MailChimp® List ID(s), log into your MailChimp® account, click on the Lists tab. Click the (View) button, for the list(s) you want to integrate with s2Member. Then, click the (settings) link at the top. On the main (settings) page, for each list, you\\\'ll find a Unique List ID.\'); return false;">MailChimp® List IDs</a>.</p>' . "\n";
47
+ do_action ("ws_plugin__s2member_during_els_ops_page_during_left_sections_during_mailchimp", get_defined_vars ());
48
+ /**/
49
+ echo '<table class="form-table">' . "\n";
50
+ echo '<tbody>' . "\n";
51
+ echo '<tr>' . "\n";
52
+ /**/
53
+ echo '<th>' . "\n";
54
+ echo '<label for="ws-plugin--s2member-mailchimp-api-key">' . "\n";
55
+ echo 'MailChimp® API Key:' . "\n";
56
+ echo '</label>' . "\n";
57
+ echo '</th>' . "\n";
58
+ /**/
59
+ echo '</tr>' . "\n";
60
+ echo '<tr>' . "\n";
61
+ /**/
62
+ echo '<td>' . "\n";
63
+ echo '<input type="text" name="ws_plugin__s2member_mailchimp_api_key" id="ws-plugin--s2member-mailchimp-api-key" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mailchimp_api_key"]) . '" /><br />' . "\n";
64
+ echo 'Once you have a MailChimp® account, you\'ll need to <a href="http://admin.mailchimp.com/account/api-key-popup" target="_blank" rel="external">add an API Key</a>.' . "\n";
65
+ echo '</td>' . "\n";
66
+ /**/
67
+ echo '</tr>' . "\n";
68
+ echo '<tr>' . "\n";
69
+ /**/
70
+ echo '<th>' . "\n";
71
+ echo '<label for="ws-plugin--s2member-level0-mailchimp-list-ids">' . "\n";
72
+ echo 'List ID(s) for Free Subscribers ( comma delimited ):' . "\n";
73
+ echo '</label>' . "\n";
74
+ echo '</th>' . "\n";
75
+ /**/
76
+ echo '</tr>' . "\n";
77
+ echo '<tr>' . "\n";
78
+ /**/
79
+ echo '<td>' . "\n";
80
+ echo '<input type="text" name="ws_plugin__s2member_level0_mailchimp_list_ids" id="ws-plugin--s2member-level0-mailchimp-list-ids" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_mailchimp_list_ids"]) . '" /><br />' . "\n";
81
+ echo 'New Free Subscribers will be subscribed to these List IDs.<br />' . "\n";
82
+ echo 'Ex: <code>4654aad4s5d, 4323344ksdf, 23234j23k3</code>' . "\n";
83
+ echo '</td>' . "\n";
84
+ /**/
85
+ echo '</tr>' . "\n";
86
+ echo '<tr>' . "\n";
87
+ /**/
88
+ echo '<th>' . "\n";
89
+ echo '<label for="ws-plugin--s2member-level1-mailchimp-list-ids">' . "\n";
90
+ echo 'List ID(s) for Level #1 ( comma delimited ):' . "\n";
91
+ echo '</label>' . "\n";
92
+ echo '</th>' . "\n";
93
+ /**/
94
+ echo '</tr>' . "\n";
95
+ echo '<tr>' . "\n";
96
+ /**/
97
+ echo '<td>' . "\n";
98
+ echo '<input type="text" name="ws_plugin__s2member_level1_mailchimp_list_ids" id="ws-plugin--s2member-level1-mailchimp-list-ids" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_mailchimp_list_ids"]) . '" /><br />' . "\n";
99
+ echo 'New Level 1 Members will be subscribed to these List IDs.<br />' . "\n";
100
+ echo 'Ex: <code>4654aad4s5d, 4323344ksdf, 23234j23k3</code>' . "\n";
101
+ echo '</td>' . "\n";
102
+ /**/
103
+ echo '</tr>' . "\n";
104
+ echo '<tr>' . "\n";
105
+ /**/
106
+ echo '<th>' . "\n";
107
+ echo '<label for="ws-plugin--s2member-level2-mailchimp-list-ids">' . "\n";
108
+ echo 'List ID(s) for Level #2 ( comma delimited ):' . "\n";
109
+ echo '</label>' . "\n";
110
+ echo '</th>' . "\n";
111
+ /**/
112
+ echo '</tr>' . "\n";
113
+ echo '<tr>' . "\n";
114
+ /**/
115
+ echo '<td>' . "\n";
116
+ echo '<input type="text" name="ws_plugin__s2member_level2_mailchimp_list_ids" id="ws-plugin--s2member-level2-mailchimp-list-ids" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_mailchimp_list_ids"]) . '" /><br />' . "\n";
117
+ echo 'New Level 2 Members will be subscribed to these List IDs.' . "\n";
118
+ echo '</td>' . "\n";
119
+ /**/
120
+ echo '</tr>' . "\n";
121
+ echo '<tr>' . "\n";
122
+ /**/
123
+ echo '<th>' . "\n";
124
+ echo '<label for="ws-plugin--s2member-level3-mailchimp-list-ids">' . "\n";
125
+ echo 'List ID(s) for Level #3 ( comma delimited ):' . "\n";
126
+ echo '</label>' . "\n";
127
+ echo '</th>' . "\n";
128
+ /**/
129
+ echo '</tr>' . "\n";
130
+ echo '<tr>' . "\n";
131
+ /**/
132
+ echo '<td>' . "\n";
133
+ echo '<input type="text" name="ws_plugin__s2member_level3_mailchimp_list_ids" id="ws-plugin--s2member-level3-mailchimp-list-ids" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_mailchimp_list_ids"]) . '" /><br />' . "\n";
134
+ echo 'New Level 3 Members will be subscribed to these List IDs.' . "\n";
135
+ echo '</td>' . "\n";
136
+ /**/
137
+ echo '</tr>' . "\n";
138
+ echo '<tr>' . "\n";
139
+ /**/
140
+ echo '<th>' . "\n";
141
+ echo '<label for="ws-plugin--s2member-level4-mailchimp-list-ids">' . "\n";
142
+ echo 'List ID(s) for Level #4 ( comma delimited ):' . "\n";
143
+ echo '</label>' . "\n";
144
+ echo '</th>' . "\n";
145
+ /**/
146
+ echo '</tr>' . "\n";
147
+ echo '<tr>' . "\n";
148
+ /**/
149
+ echo '<td>' . "\n";
150
+ echo '<input type="text" name="ws_plugin__s2member_level4_mailchimp_list_ids" id="ws-plugin--s2member-level4-mailchimp-list-ids" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_mailchimp_list_ids"]) . '" /><br />' . "\n";
151
+ echo 'New Level 4 Members will be subscribed to these List IDs.' . "\n";
152
+ echo '</td>' . "\n";
153
+ /**/
154
+ echo '</tr>' . "\n";
155
+ echo '</tbody>' . "\n";
156
+ echo '</table>' . "\n";
157
+ echo '</div>' . "\n";
158
+ /**/
159
+ echo '</div>' . "\n";
160
+ /**/
161
+ do_action ("ws_plugin__s2member_during_els_ops_page_during_left_sections_after_mailchimp", get_defined_vars ());
162
+ }
163
+ /**/
164
+ if (apply_filters ("ws_plugin__s2member_during_els_ops_page_during_left_sections_display_aweber", true, get_defined_vars ()))
165
+ {
166
+ do_action ("ws_plugin__s2member_during_els_ops_page_during_left_sections_before_aweber", get_defined_vars ());
167
+ /**/
168
+ echo '<div class="ws-menu-page-group" title="AWeber® List Server Integration">' . "\n";
169
+ /**/
170
+ echo '<div class="ws-menu-page-section ws-plugin--s2member-aweber-section">' . "\n";
171
+ echo '<a href="http://aweber.com/?348037" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/aweber-logo.png" class="ws-menu-page-right" style="width:125px; height:125px; border:0;" alt="." /></a>' . "\n";
172
+ echo '<h3>AWeber® List Server Integration ( optional )</h3>' . "\n";
173
+ echo '<p>s2Member can be integrated with AWeber®. AWeber® is an email marketing service. Whether you\'re looking to get your first email campaign off the ground, or you\'re a seasoned veteran who wants to dig into advanced tools like detailed email web analytics, activity based segmentation, geo-targeting and broadcast split-testing, AWeber\'s got just what you need to make email marketing work for you.</p>' . "\n";
174
+ echo '<p>You can have your Members automatically subscribed to your AWeber® marketing lists ( e.g. newsletters / auto-responders ). You\'ll need an <a href="http://aweber.com/?348037" target="_blank" rel="external">AWeber® account</a> and your <a href="#" onclick="alert(\'To obtain your AWeber® List ID(s), log into your AWeber® account. Click on the Lists tab. On that page you\\\'ll find a Unique List ID associated with each of your lists. AWeber® sometimes refers to this as a List Name instead of a List ID.\'); return false;">AWeber® List IDs</a>. You will ALSO need to configure a Custom Email Parser inside your AWeber® account. Log into AWeber®, and go to <em>My Lists -> Email Parser</em>. Choose the PayPal® Parser. You can safely ignore the additional instructions they provide. s2Member just needs the PayPal® box checked, and that\'s all. At some point, we\'ll get in contact with AWeber® about integrating a Custom Parser that is specifically designed for s2Member. Until then, you can just use the PayPal® Parser that is already available in your AWeber® account.</p>' . "\n";
175
+ do_action ("ws_plugin__s2member_during_els_ops_page_during_left_sections_during_aweber", get_defined_vars ());
176
+ /**/
177
+ echo '<table class="form-table">' . "\n";
178
+ echo '<tbody>' . "\n";
179
+ echo '<tr>' . "\n";
180
+ /**/
181
+ echo '<th>' . "\n";
182
+ echo '<label for="ws-plugin--s2member-level0-aweber-list-ids">' . "\n";
183
+ echo 'List ID(s) for Free Subscribers ( comma delimited ):' . "\n";
184
+ echo '</label>' . "\n";
185
+ echo '</th>' . "\n";
186
+ /**/
187
+ echo '</tr>' . "\n";
188
+ echo '<tr>' . "\n";
189
+ /**/
190
+ echo '<td>' . "\n";
191
+ echo '<input type="text" name="ws_plugin__s2member_level0_aweber_list_ids" id="ws-plugin--s2member-level0-aweber-list-ids" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_aweber_list_ids"]) . '" /><br />' . "\n";
192
+ echo 'New Free Subscribers will be subscribed to these List IDs.<br />' . "\n";
193
+ echo 'Ex: <code>mylist, myotherlist, anotherlist</code>' . "\n";
194
+ echo '</td>' . "\n";
195
+ /**/
196
+ echo '</tr>' . "\n";
197
+ echo '<tr>' . "\n";
198
+ /**/
199
+ echo '<th>' . "\n";
200
+ echo '<label for="ws-plugin--s2member-level1-aweber-list-ids">' . "\n";
201
+ echo 'List ID(s) for Level #1 ( comma delimited ):' . "\n";
202
+ echo '</label>' . "\n";
203
+ echo '</th>' . "\n";
204
+ /**/
205
+ echo '</tr>' . "\n";
206
+ echo '<tr>' . "\n";
207
+ /**/
208
+ echo '<td>' . "\n";
209
+ echo '<input type="text" name="ws_plugin__s2member_level1_aweber_list_ids" id="ws-plugin--s2member-level1-aweber-list-ids" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_aweber_list_ids"]) . '" /><br />' . "\n";
210
+ echo 'New Level 1 Members will be subscribed to these List IDs.<br />' . "\n";
211
+ echo 'Ex: <code>mylist, myotherlist, anotherlist</code>' . "\n";
212
+ echo '</td>' . "\n";
213
+ /**/
214
+ echo '</tr>' . "\n";
215
+ echo '<tr>' . "\n";
216
+ /**/
217
+ echo '<th>' . "\n";
218
+ echo '<label for="ws-plugin--s2member-level2-aweber-list-ids">' . "\n";
219
+ echo 'List ID(s) for Level #2 ( comma delimited ):' . "\n";
220
+ echo '</label>' . "\n";
221
+ echo '</th>' . "\n";
222
+ /**/
223
+ echo '</tr>' . "\n";
224
+ echo '<tr>' . "\n";
225
+ /**/
226
+ echo '<td>' . "\n";
227
+ echo '<input type="text" name="ws_plugin__s2member_level2_aweber_list_ids" id="ws-plugin--s2member-level2-aweber-list-ids" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_aweber_list_ids"]) . '" /><br />' . "\n";
228
+ echo 'New Level 2 Members will be subscribed to these List IDs.' . "\n";
229
+ echo '</td>' . "\n";
230
+ /**/
231
+ echo '</tr>' . "\n";
232
+ echo '<tr>' . "\n";
233
+ /**/
234
+ echo '<th>' . "\n";
235
+ echo '<label for="ws-plugin--s2member-level3-aweber-list-ids">' . "\n";
236
+ echo 'List ID(s) for Level #3 ( comma delimited ):' . "\n";
237
+ echo '</label>' . "\n";
238
+ echo '</th>' . "\n";
239
+ /**/
240
+ echo '</tr>' . "\n";
241
+ echo '<tr>' . "\n";
242
+ /**/
243
+ echo '<td>' . "\n";
244
+ echo '<input type="text" name="ws_plugin__s2member_level3_aweber_list_ids" id="ws-plugin--s2member-level3-aweber-list-ids" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_aweber_list_ids"]) . '" /><br />' . "\n";
245
+ echo 'New Level 3 Members will be subscribed to these List IDs.' . "\n";
246
+ echo '</td>' . "\n";
247
+ /**/
248
+ echo '</tr>' . "\n";
249
+ echo '<tr>' . "\n";
250
+ /**/
251
+ echo '<th>' . "\n";
252
+ echo '<label for="ws-plugin--s2member-level4-aweber-list-ids">' . "\n";
253
+ echo 'List ID(s) for Level #4 ( comma delimited ):' . "\n";
254
+ echo '</label>' . "\n";
255
+ echo '</th>' . "\n";
256
+ /**/
257
+ echo '</tr>' . "\n";
258
+ echo '<tr>' . "\n";
259
+ /**/
260
+ echo '<td>' . "\n";
261
+ echo '<input type="text" name="ws_plugin__s2member_level4_aweber_list_ids" id="ws-plugin--s2member-level4-aweber-list-ids" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_aweber_list_ids"]) . '" /><br />' . "\n";
262
+ echo 'New Level 4 Members will be subscribed to these List IDs.' . "\n";
263
+ echo '</td>' . "\n";
264
+ /**/
265
+ echo '</tr>' . "\n";
266
+ echo '</tbody>' . "\n";
267
+ echo '</table>' . "\n";
268
+ echo '</div>' . "\n";
269
+ /**/
270
+ echo '</div>' . "\n";
271
+ /**/
272
+ do_action ("ws_plugin__s2member_during_els_ops_page_during_left_sections_after_aweber", get_defined_vars ());
273
+ }
274
+ /**/
275
+ if (apply_filters ("ws_plugin__s2member_during_els_ops_page_during_left_sections_display_opt_in", true, get_defined_vars ()))
276
+ {
277
+ do_action ("ws_plugin__s2member_during_els_ops_page_during_left_sections_before_opt_in", get_defined_vars ());
278
+ /**/
279
+ echo '<div class="ws-menu-page-group" title="Registration / Double Opt-In Box?">' . "\n";
280
+ /**/
281
+ echo '<div class="ws-menu-page-section ws-plugin--s2member-opt-in-section">' . "\n";
282
+ echo '<h3>Double Opt-In Checkbox Field ( optional )</h3>' . "\n";
283
+ echo '<p>A Double Opt-In Checkbox will ONLY be displayed, if you\'ve integrated one <em>or more</em> List Servers ( in the sections above ).' . ((defined ("BP_VERSION")) ? ' With BuddyPress installed, the Checkbox will only be displayed if your BuddyPress theme supports <code>do_action("bp_before_registration_submit_buttons")</code>. Almost all BuddyPress themes support this. If yours does not, you can add it in.' : '') . '</p>' . "\n";
284
+ do_action ("ws_plugin__s2member_during_els_ops_page_during_left_sections_during_opt_in", get_defined_vars ());
285
+ /**/
286
+ echo '<table class="form-table">' . "\n";
287
+ echo '<tbody>' . "\n";
288
+ echo '<tr class="ws-plugin--s2member-custom-reg-opt-in-label-row"' . ((!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"]) ? ' style="display:none;"' : '') . '>' . "\n";
289
+ /**/
290
+ echo '<th>' . "\n";
291
+ echo '<label for="ws-plugin--s2member-custom-reg-opt-in-label">' . "\n";
292
+ echo 'Double Opt-In Checkbox Label:' . "\n";
293
+ echo '</label>' . "\n";
294
+ echo '</th>' . "\n";
295
+ /**/
296
+ echo '</tr>' . "\n";
297
+ echo '<tr class="ws-plugin--s2member-custom-reg-opt-in-label-row"' . ((!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"]) ? ' style="display:none;"' : '') . '>' . "\n";
298
+ /**/
299
+ echo '<td>' . "\n";
300
+ echo '<input type="text" name="ws_plugin__s2member_custom_reg_opt_in_label" id="ws-plugin--s2member-custom-reg-opt-in-label" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in_label"]) . '" /><br />' . "\n";
301
+ echo 'Example: <code><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/' . (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] == 1) ? 'checked' : 'unchecked') . '.png" class="ws-plugin--s2member-custom-reg-opt-in-label-prev-img ws-menu-page-img-16" style="vertical-align:middle;" alt="" /> Your Label will appear next to a Checkbox.</code>' . "\n";
302
+ echo '</td>' . "\n";
303
+ /**/
304
+ echo '</tr>' . "\n";
305
+ echo '<tr>' . "\n";
306
+ /**/
307
+ echo '<th>' . "\n";
308
+ echo '<label for="ws-plugin--s2member-custom-reg-opt-in">' . "\n";
309
+ echo 'Require Double Opt-In Checkbox?' . "\n";
310
+ echo '</label>' . "\n";
311
+ echo '</th>' . "\n";
312
+ /**/
313
+ echo '</tr>' . "\n";
314
+ echo '<tr>' . "\n";
315
+ /**/
316
+ echo '<td>' . "\n";
317
+ echo '<select name="ws_plugin__s2member_custom_reg_opt_in" id="ws-plugin--s2member-custom-reg-opt-in">' . "\n";
318
+ echo '<option value="1"' . (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] == 1) ? ' selected="selected"' : '') . '>Yes ( the Box MUST be checked — checked by default )</option>' . "\n";
319
+ echo '<option value="2"' . (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] == 2) ? ' selected="selected"' : '') . '>Yes ( the Box MUST be checked — unchecked by default )</option>' . "\n";
320
+ echo '<option value="0"' . ((!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"]) ? ' selected="selected"' : '') . '>No ( disable — do NOT display or require the Checkbox )</option>' . "\n";
321
+ echo '</select><br />' . "\n";
322
+ echo 'An email confirmation will NOT be sent to the User, unless the Box is checked, or you\'ve disabled the Box; by choosing <code>No</code>.' . "\n";
323
+ echo '</td>' . "\n";
324
+ /**/
325
+ echo '</tr>' . "\n";
326
+ echo '</tbody>' . "\n";
327
+ echo '</table>' . "\n";
328
+ echo '</div>' . "\n";
329
+ /**/
330
+ echo '</div>' . "\n";
331
+ /**/
332
+ do_action ("ws_plugin__s2member_during_els_ops_page_during_left_sections_after_opt_in", get_defined_vars ());
333
+ }
334
+ /**/
335
+ if (apply_filters ("ws_plugin__s2member_during_els_ops_page_during_left_sections_display_other_methods", true, get_defined_vars ()))
336
+ {
337
+ do_action ("ws_plugin__s2member_during_els_ops_page_during_left_sections_before_other_methods", get_defined_vars ());
338
+ /**/
339
+ echo '<div class="ws-menu-page-group" title="Other List Server Integration Methods">' . "\n";
340
+ /**/
341
+ echo '<div class="ws-menu-page-section ws-plugin--s2member-other-methods-section">' . "\n";
342
+ echo '<h3>Other List Server Integrations ( there\'s always a way )</h3>' . "\n";
343
+ echo '<p>Check the s2Member API Notifications panel. You\'ll find additional layers of automation available through the use of the `Signup`, `Registration`, `Payment`, `EOT/Deletion`, `Refund/Reversal`, and `Specific Post/Page` notifications that are available to you through the s2Member API. These make it possible to integrate with 3rd party applications; like list servers, affiliate programs, and other back-office routines; in more advanced ways. You will probably need to get help from a web developer though. s2Member API Notifications require some light PHP scripting by someone familiar with web service connections.</p>' . "\n";
344
+ do_action ("ws_plugin__s2member_during_els_ops_page_during_left_sections_during_other_methods", get_defined_vars ());
345
+ echo '</div>' . "\n";
346
+ /**/
347
+ echo '</div>' . "\n";
348
+ /**/
349
+ do_action ("ws_plugin__s2member_during_els_ops_page_during_left_sections_after_other_methods", get_defined_vars ());
350
+ }
351
+ /**/
352
+ do_action ("ws_plugin__s2member_during_els_ops_page_after_left_sections", get_defined_vars ());
353
  /**/
354
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
355
  /**/
361
  /**/
362
  echo '<td class="ws-menu-page-table-r">' . "\n";
363
  /**/
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" : '';
370
+ 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" : '';
371
  /**/
372
+ do_action ("ws_plugin__s2member_during_menu_pages_after_right_sections", get_defined_vars ());
373
+ do_action ("ws_plugin__s2member_during_els_ops_page_after_right_sections", get_defined_vars ());
374
  /**/
375
  echo '</td>' . "\n";
376
  /**/
includes/menu-pages/info.inc.php CHANGED
@@ -11,7 +11,7 @@ If not, see: <http://www.gnu.org/licenses/>.
11
  /*
12
  Direct access denial.
13
  */
14
- if (realpath(__FILE__) === realpath($_SERVER["SCRIPT_FILENAME"]))
15
  exit;
16
  /*
17
  s2Member Info page.
@@ -19,7 +19,7 @@ s2Member Info page.
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 Information</h2>' . "\n";
23
  /**/
24
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
25
  /**/
@@ -30,23 +30,38 @@ echo '<td class="ws-menu-page-table-l">' . "\n";
30
  /**/
31
  echo '<img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-icon.png" class="ws-menu-page-brand-icon" alt="." />' . "\n";
32
  /**/
33
- echo '<a href="' . ws_plugin__s2member_parse_readme_value("Plugin URI") . '?check_ver=' . urlencode(ws_plugin__s2member_parse_readme_value("Version")) . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-updates.png" class="ws-menu-page-brand-updates" alt="." /></a>' . "\n";
34
  /**/
35
- echo '<div class="ws-menu-page-readme">' . "\n";
36
- echo ws_plugin__s2member_parse_readme() . "\n";
37
- echo '</div>' . "\n";
 
 
 
 
 
 
 
 
 
 
 
 
38
  /**/
39
  echo '</td>' . "\n";
40
  /**/
41
  echo '<td class="ws-menu-page-table-r">' . "\n";
42
  /**/
43
- echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu-r"]["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="." title="Contact PriMoThemes!" /></a></div>' . "\n" : '';
44
- /**/
45
- echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu-r"]["tools"]) ? '<div class="ws-menu-page-tools"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-tools.png" alt="." /></div>' . "\n" : '';
46
  /**/
47
- echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu-r"]["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" : '';
 
 
 
48
  /**/
49
- echo ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu-r"]["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" : '';
 
50
  /**/
51
  echo '</td>' . "\n";
52
  /**/
11
  /*
12
  Direct access denial.
13
  */
14
+ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
  exit;
16
  /*
17
  s2Member Info page.
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 Information</h2>' . "\n";
23
  /**/
24
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
25
  /**/
30
  /**/
31
  echo '<img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-icon.png" class="ws-menu-page-brand-icon" alt="." />' . "\n";
32
  /**/
33
+ echo '<a href="' . ws_plugin__s2member_parse_readme_value ("Plugin URI") . '?check_ver=' . urlencode (ws_plugin__s2member_parse_readme_value ("Version")) . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-updates.png" class="ws-menu-page-brand-updates" alt="." /></a>' . "\n";
34
  /**/
35
+ do_action ("ws_plugin__s2member_during_info_page_before_left_sections", get_defined_vars ());
36
+ /**/
37
+ if (apply_filters ("ws_plugin__s2member_during_info_page_during_left_sections_display_readme", true, get_defined_vars ()))
38
+ {
39
+ do_action ("ws_plugin__s2member_during_info_page_during_left_sections_before_readme", get_defined_vars ());
40
+ /**/
41
+ echo '<div class="ws-menu-page-readme">' . "\n";
42
+ do_action ("ws_plugin__s2member_during_info_page_during_left_sections_during_readme", get_defined_vars ());
43
+ echo ws_plugin__s2member_parse_readme () . "\n";
44
+ echo '</div>' . "\n";
45
+ /**/
46
+ do_action ("ws_plugin__s2member_during_info_page_during_left_sections_after_readme", get_defined_vars ());
47
+ }
48
+ /**/
49
+ do_action ("ws_plugin__s2member_during_info_page_after_left_sections", get_defined_vars ());
50
  /**/
51
  echo '</td>' . "\n";
52
  /**/
53
  echo '<td class="ws-menu-page-table-r">' . "\n";
54
  /**/
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" : '';
61
+ 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" : '';
62
  /**/
63
+ do_action ("ws_plugin__s2member_during_menu_pages_after_right_sections", get_defined_vars ());
64
+ do_action ("ws_plugin__s2member_during_info_page_after_right_sections", get_defined_vars ());
65
  /**/
66
  echo '</td>' . "\n";
67
  /**/
includes/menu-pages/menu-pages-s.js ADDED
@@ -0,0 +1,261 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ 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
+ {
17
+ ws_plugin__s2member_generateSecurityKey = function() /* Generates a unique Security Key. */
18
+ {
19
+ var mt_rand = function(min, max) /* The PHP equivalent to mt_rand(). */
20
+ {
21
+ min = (arguments.length < 1) ? 0 : min;
22
+ max = (arguments.length < 2) ? 2147483647 : max;
23
+ /**/
24
+ return Math.floor (Math.random () * (max - min + 1)) + min;
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
+ };
49
+ }
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 ()
60
+ else /* Hide instructions. */
61
+ $viaCron.hide ();
62
+ });
63
+ }
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'));
75
+ /**/
76
+ else if (val == 1) /* Enabled, checked by default. */
77
+ $rows.css ('display', ''), $prevImg.attr ('src', $prevImg.attr ('src').replace (/\/unchecked\.png$/, '/checked.png'));
78
+ /**/
79
+ else if (val == 2) /* Enabled, unchecked by default. */
80
+ $rows.css ('display', ''), $prevImg.attr ('src', $prevImg.attr ('src').replace (/\/checked\.png$/, '/unchecked.png'));
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
+ });
99
+ /**/
100
+ ws_plugin__s2member_paypalButtonGenerate = function(button) /* Handles PayPal® Button Generation. */
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;
142
+ (regRecur !== 'BN') ? code.val (code.val ().replace (/ (\<input type\="hidden" name\="amount" value\="(.*?)" \/\>)/g, " <!--$1-->")) : null;
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 + '"'));
150
+ code.val (code.val ().replace (/ name\="item_number" value\="(.*?)"/, ' name="item_number" value="' + levelCcapsPer + '"'));
151
+ code.val (code.val ().replace (/ name\="page_style" value\="(.*?)"/, ' name="page_style" value="' + pageStyle + '"'));
152
+ code.val (code.val ().replace (/ name\="currency_code" value\="(.*?)"/, ' name="currency_code" value="' + currencyCode + '"'));
153
+ code.val (code.val ().replace (/ name\="custom" value\="(.*?)"/, ' name="custom" value="<?php echo $_SERVER["HTTP_HOST"]; ?>"'));
154
+ code.val (code.val ().replace (/ name\="modify" value\="(.*?)"/, ' name="modify" value="' + ((button === 'modification') ? '1' : '0') + '"'));
155
+ code.val (code.val ().replace (/ name\="amount" value\="(.*?)"/, ' name="amount" value="' + regAmount + '"'));
156
+ code.val (code.val ().replace (/ name\="src" value\="(.*?)"/, ' name="src" value="' + regRecur + '"'));
157
+ code.val (code.val ().replace (/ name\="p1" value\="(.*?)"/, ' name="p1" value="' + trialPeriod + '"'));
158
+ code.val (code.val ().replace (/ name\="t1" value\="(.*?)"/, ' name="t1" value="' + trialTerm + '"'));
159
+ code.val (code.val ().replace (/ name\="a3" value\="(.*?)"/, ' name="a3" value="' + regAmount + '"'));
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
+ {
174
+ this.focus (), this.select ();
175
+ });
176
+ /**/
177
+ return false;
178
+ };
179
+ /**/
180
+ ws_plugin__s2member_paypalSpButtonGenerate = function() /* Handles PayPal® Button Generation for Specific Post/Page Access. */
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
+ /**/
203
+ for (var i = 0, ids = leading; i < additionals.length; i++)
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
+ {
230
+ this.focus (), this.select ();
231
+ });
232
+ /**/
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
+ /**/
249
+ for (var i = 0, ids = leading; i < additionals.length; i++)
250
+ if (additionals[i] && additionals[i] !== leading)
251
+ ids += ',' + additionals[i];
252
+ /**/
253
+ $link.hide (), $loading.show (), $.post (ajaxurl, {action: 's2member_sp_access_link', s2member_sp_access_link: '<?php echo ws_plugin__s2member_esc_sq (wp_create_nonce ("ws-plugin--s2member-sp-access-link")); ?>', s2member_sp_access_link_ids: ids, s2member_sp_access_link_hours: hours}, function(response)
254
+ {
255
+ $link.show ().html ('<a href="' + response + '" target="_blank" rel="external">' + response + '</a>'), $loading.hide ();
256
+ });
257
+ /**/
258
+ return false;
259
+ };
260
+ }
261
+ });
includes/menu-pages/menu-pages.css CHANGED
@@ -352,26 +352,26 @@ Specifically for the main content area on the left side.
352
  Specifically for info pages with readme files.
353
  These CSS selectors address common layout styles.
354
  */
355
- div.ws-menu-page > table.ws-menu-page-table > tbody > tr > td.ws-menu-page-table-l > div.ws-menu-page-readme > div.readme > div.section
356
  {
357
  margin: 0 0 20px 0;
358
  padding: 0 0 20px 0;
359
  border: 0 solid #DDDDDD;
360
  border-width: 0 0 1px 0;
361
  }
362
- div.ws-menu-page > table.ws-menu-page-table > tbody > tr > td.ws-menu-page-table-l > div.ws-menu-page-readme > div.readme > div.section > h2
363
  {
364
  margin-top: 0;
365
  padding-top: 0;
366
  font-size: 150%;
367
  }
368
- div.ws-menu-page > table.ws-menu-page-table > tbody > tr > td.ws-menu-page-table-l > div.ws-menu-page-readme > div.readme > div.section > div.content ul
369
  {
370
  padding: 0;
371
  margin: 10px 0 0 25px;
372
  list-style: disc outside;
373
  }
374
- div.ws-menu-page > table.ws-menu-page-table > tbody > tr > td.ws-menu-page-table-l > div.ws-menu-page-readme > div.readme > div.section > div.content ol
375
  {
376
  padding: 0;
377
  margin: 10px 0 0 25px;
@@ -382,36 +382,36 @@ Specifically for the main content area on the left side.
382
  Specifically for pages with a FeedBurner block.
383
  These CSS selectors address common layout styles.
384
  */
385
- div.ws-menu-page > table.ws-menu-page-table > tbody > tr > td.ws-menu-page-table-l > div.feedburnerFeedBlock
386
  {
387
  margin: 0 0 20px 0;
388
  }
389
- div.ws-menu-page > table.ws-menu-page-table > tbody > tr > td.ws-menu-page-table-l > div.feedburnerFeedBlock > ul > li
390
  {
391
  margin: 25px 0 0 0;
392
  padding: 0 0 20px 0;
393
  border: 0 solid #DDDDDD;
394
  border-width: 0 0 1px 0;
395
  }
396
- div.ws-menu-page > table.ws-menu-page-table > tbody > tr > td.ws-menu-page-table-l > div.feedburnerFeedBlock > ul > li:first-child
397
  {
398
  margin-top: 0;
399
  }
400
- div.ws-menu-page > table.ws-menu-page-table > tbody > tr > td.ws-menu-page-table-l > div.feedburnerFeedBlock > ul > li > span.headline
401
  {
402
  font-size: 150%;
403
  font-family: 'Georgia', serif;
404
  }
405
- div.ws-menu-page > table.ws-menu-page-table > tbody > tr > td.ws-menu-page-table-l > div.feedburnerFeedBlock > ul > li > p.date
406
  {
407
  font-size: 130%;
408
  font-family: 'Georgia', serif;
409
  }
410
- div.ws-menu-page > table.ws-menu-page-table > tbody > tr > td.ws-menu-page-table-l > div.feedburnerFeedBlock > ul > li > div > div.feedflare
411
  {
412
  margin: 10px 0 0 0;
413
  }
414
- div.ws-menu-page > table.ws-menu-page-table > tbody > tr > td.ws-menu-page-table-l > div.feedburnerFeedBlock > p.fbsubscribelink
415
  {
416
  margin: 25px 0 0 0;
417
  }
@@ -424,44 +424,26 @@ div.ws-menu-page > table.ws-menu-page-table > tbody > tr > td.ws-menu-page-table
424
  padding: 0;
425
  text-align: right;
426
  }
427
- div.ws-menu-page > table.ws-menu-page-table > tbody > tr > td.ws-menu-page-table-r > div.ws-menu-page-tools
428
  {
429
- margin: 0 0 25px 25px;
430
- }
431
- div.ws-menu-page > table.ws-menu-page-table > tbody > tr > td.ws-menu-page-table-r > div.ws-menu-page-tools > img
432
- {
433
- width: 200px;
434
- height: 200px;
435
- }
436
- div.ws-menu-page > table.ws-menu-page-table > tbody > tr > td.ws-menu-page-table-r > div.ws-menu-page-support
437
- {
438
- margin: 0 0 10px 25px;
439
- }
440
- div.ws-menu-page > table.ws-menu-page-table > tbody > tr > td.ws-menu-page-table-r > div.ws-menu-page-support > a > img
441
- {
442
- width: 200px;
443
- height: 150px;
444
- }
445
- div.ws-menu-page > table.ws-menu-page-table > tbody > tr > td.ws-menu-page-table-r > div.ws-menu-page-donations
446
- {
447
- margin: 0 0 10px 25px;
448
- }
449
- div.ws-menu-page > table.ws-menu-page-table > tbody > tr > td.ws-menu-page-table-r > div.ws-menu-page-donations > a > img
450
- {
451
- width: 200px;
452
- height: 400px;
453
- border: 1px solid #333333;
454
  }
455
- /*
456
- These CSS selectors are specific to this software.
457
- */
458
- div.ws-menu-page > table.ws-menu-page-table > tbody > tr > td.ws-menu-page-table-r > div.ws-menu-page-installation
 
459
  {
460
- margin: 0 0 10px 25px;
461
  }
462
- div.ws-menu-page > table.ws-menu-page-table > tbody > tr > td.ws-menu-page-table-r > div.ws-menu-page-installation > a > img
 
 
 
 
463
  {
 
464
  width: 200px;
465
- height: 150px;
466
- border: 1px solid transparent;
467
  }
352
  Specifically for info pages with readme files.
353
  These CSS selectors address common layout styles.
354
  */
355
+ div.ws-menu-page > table.ws-menu-page-table > tbody > tr > td.ws-menu-page-table-l div.ws-menu-page-readme > div.readme > div.section
356
  {
357
  margin: 0 0 20px 0;
358
  padding: 0 0 20px 0;
359
  border: 0 solid #DDDDDD;
360
  border-width: 0 0 1px 0;
361
  }
362
+ div.ws-menu-page > table.ws-menu-page-table > tbody > tr > td.ws-menu-page-table-l div.ws-menu-page-readme > div.readme > div.section > h2
363
  {
364
  margin-top: 0;
365
  padding-top: 0;
366
  font-size: 150%;
367
  }
368
+ div.ws-menu-page > table.ws-menu-page-table > tbody > tr > td.ws-menu-page-table-l div.ws-menu-page-readme > div.readme > div.section > div.content ul
369
  {
370
  padding: 0;
371
  margin: 10px 0 0 25px;
372
  list-style: disc outside;
373
  }
374
+ div.ws-menu-page > table.ws-menu-page-table > tbody > tr > td.ws-menu-page-table-l div.ws-menu-page-readme > div.readme > div.section > div.content ol
375
  {
376
  padding: 0;
377
  margin: 10px 0 0 25px;
382
  Specifically for pages with a FeedBurner block.
383
  These CSS selectors address common layout styles.
384
  */
385
+ div.ws-menu-page > table.ws-menu-page-table > tbody > tr > td.ws-menu-page-table-l div.feedburnerFeedBlock
386
  {
387
  margin: 0 0 20px 0;
388
  }
389
+ div.ws-menu-page > table.ws-menu-page-table > tbody > tr > td.ws-menu-page-table-l div.feedburnerFeedBlock > ul > li
390
  {
391
  margin: 25px 0 0 0;
392
  padding: 0 0 20px 0;
393
  border: 0 solid #DDDDDD;
394
  border-width: 0 0 1px 0;
395
  }
396
+ div.ws-menu-page > table.ws-menu-page-table > tbody > tr > td.ws-menu-page-table-l div.feedburnerFeedBlock > ul > li:first-child
397
  {
398
  margin-top: 0;
399
  }
400
+ div.ws-menu-page > table.ws-menu-page-table > tbody > tr > td.ws-menu-page-table-l div.feedburnerFeedBlock > ul > li > span.headline
401
  {
402
  font-size: 150%;
403
  font-family: 'Georgia', serif;
404
  }
405
+ div.ws-menu-page > table.ws-menu-page-table > tbody > tr > td.ws-menu-page-table-l div.feedburnerFeedBlock > ul > li > p.date
406
  {
407
  font-size: 130%;
408
  font-family: 'Georgia', serif;
409
  }
410
+ div.ws-menu-page > table.ws-menu-page-table > tbody > tr > td.ws-menu-page-table-l div.feedburnerFeedBlock > ul > li > div > div.feedflare
411
  {
412
  margin: 10px 0 0 0;
413
  }
414
+ div.ws-menu-page > table.ws-menu-page-table > tbody > tr > td.ws-menu-page-table-l div.feedburnerFeedBlock > p.fbsubscribelink
415
  {
416
  margin: 25px 0 0 0;
417
  }
424
  padding: 0;
425
  text-align: right;
426
  }
427
+ div.ws-menu-page > table.ws-menu-page-table > tbody > tr > td.ws-menu-page-table-r a[rel ~= "external"]
428
  {
429
+ padding-right: 18px;
430
+ background: url('<?php echo $i; ?>/brand-xlink.png') no-repeat center right;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
431
  }
432
+ div.ws-menu-page > table.ws-menu-page-table > tbody > tr > td.ws-menu-page-table-r div.ws-menu-page-installation,
433
+ div.ws-menu-page > table.ws-menu-page-table > tbody > tr > td.ws-menu-page-table-r div.ws-menu-page-tools,
434
+ div.ws-menu-page > table.ws-menu-page-table > tbody > tr > td.ws-menu-page-table-r div.ws-menu-page-support,
435
+ div.ws-menu-page > table.ws-menu-page-table > tbody > tr > td.ws-menu-page-table-r div.ws-menu-page-donations,
436
+ div.ws-menu-page > table.ws-menu-page-table > tbody > tr > td.ws-menu-page-table-r div.ws-menu-page-others
437
  {
438
+ margin: 0 0 25px 25px;
439
  }
440
+ div.ws-menu-page > table.ws-menu-page-table > tbody > tr > td.ws-menu-page-table-r div.ws-menu-page-installation img,
441
+ div.ws-menu-page > table.ws-menu-page-table > tbody > tr > td.ws-menu-page-table-r div.ws-menu-page-tools img,
442
+ div.ws-menu-page > table.ws-menu-page-table > tbody > tr > td.ws-menu-page-table-r div.ws-menu-page-support img,
443
+ div.ws-menu-page > table.ws-menu-page-table > tbody > tr > td.ws-menu-page-table-r div.ws-menu-page-donations img,
444
+ div.ws-menu-page > table.ws-menu-page-table > tbody > tr > td.ws-menu-page-table-r div.ws-menu-page-others img
445
  {
446
+ border: 0;
447
  width: 200px;
448
+ height: auto;
 
449
  }
includes/menu-pages/menu-pages.js CHANGED
@@ -7,11 +7,11 @@ 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
  jQuery(document).ready (function($)
11
  {
12
- /*
13
- These routines address common layout styles for menu pages.
14
- */
15
  $('div.ws-menu-page-group').each (function(index)
16
  {
17
  var ins = '<ins>+</ins>', group = $(this), title = group.attr ('title');
@@ -125,249 +125,4 @@ jQuery(document).ready (function($)
125
  /**/
126
  return false;
127
  });
128
- /*
129
- These routines are all specific to this software.
130
- */
131
- if (location.href.match (/page\=ws-plugin--s2member-options/))
132
- {
133
- ws_plugin__s2member_generateSecurityKey = function() /* Generates a unique Security Key. */
134
- {
135
- var mt_rand = function(min, max) /* The PHP equivalent to mt_rand(). */
136
- {
137
- min = (arguments.length < 1) ? 0 : min;
138
- max = (arguments.length < 2) ? 2147483647 : max;
139
- /**/
140
- return Math.floor (Math.random () * (max - min + 1)) + min;
141
- };
142
- /**/
143
- var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()';
144
- for (var i = 0, key = ''; i < 56; i++) key += chars.substr (mt_rand(0, chars.length - 1), 1);
145
- /**/
146
- $('input#ws-plugin--s2member-sec-encryption-key').val (key);
147
- /**/
148
- return false;
149
- };
150
- /**/
151
- ws_plugin__s2member_enableSecurityKey = function() /* Allow Security Key editing?? */
152
- {
153
- 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.'))
154
- $('input#ws-plugin--s2member-sec-encryption-key').attr ('disabled', false);
155
- /**/
156
- return false;
157
- };
158
- /**/
159
- ws_plugin__s2member_securityKeyHistory = function() /* Displays history of Keys. */
160
- {
161
- $('div#ws-plugin--s2member-sec-encryption-key-history').toggle ();
162
- /**/
163
- return false;
164
- };
165
- }
166
- /**/
167
- else if (location.href.match (/page\=ws-plugin--s2member-paypal-ops/))
168
- {
169
- $('select#ws-plugin--s2member-auto-eot-system-enabled').change (function()
170
- {
171
- var $this = $(this), val = $this.val ();
172
- var $viaCron = $('p#ws-plugin--s2member-auto-eot-system-enabled-via-cron');
173
- /**/
174
- if (val == 2) /* Display Cron instructions. */
175
- $viaCron.show ()
176
- else /* Hide instructions. */
177
- $viaCron.hide ();
178
- });
179
- }
180
- /**/
181
- else if (location.href.match (/page\=ws-plugin--s2member-els-ops/))
182
- {
183
- $('select#ws-plugin--s2member-custom-reg-opt-in').change (function()
184
- {
185
- var $this = $(this), val = $this.val ();
186
- var $rows = $('tr.ws-plugin--s2member-custom-reg-opt-in-label-row');
187
- var $prevImg = $('img.ws-plugin--s2member-custom-reg-opt-in-label-prev-img');
188
- /**/
189
- if (val <= 0) /* Checkbox disabled. */
190
- $rows.css ('display', 'none'), $prevImg.attr ('src', $prevImg.attr ('src').replace (/\/checked\.png$/, '/unchecked.png'));
191
- /**/
192
- else if (val == 1) /* Enabled, checked by default. */
193
- $rows.css ('display', ''), $prevImg.attr ('src', $prevImg.attr ('src').replace (/\/unchecked\.png$/, '/checked.png'));
194
- /**/
195
- else if (val == 2) /* Enabled, unchecked by default. */
196
- $rows.css ('display', ''), $prevImg.attr ('src', $prevImg.attr ('src').replace (/\/checked\.png$/, '/unchecked.png'));
197
- });
198
- }
199
- /**/
200
- else if (location.href.match (/page\=ws-plugin--s2member-buttons/))
201
- {
202
- $('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()
203
- {
204
- var button = this.id.replace (/^ws-plugin--s2member-(.+?)-term$/g, '$1');
205
- var trialDisabled = ($(this).val ().split ('-')[2].replace (/[^0-1BN]/g, '') === 'BN') ? 1 : 0;
206
- $('p#ws-plugin--s2member-' + button + '-trial-line').css ('display', (trialDisabled ? 'none' : ''));
207
- $('span#ws-plugin--s2member-' + button + '-trial-then').css ('display', (trialDisabled ? 'none' : ''));
208
- $('span#ws-plugin--s2member-' + button + '-20p-rule').css ('display', (trialDisabled ? 'none' : ''));
209
- });
210
- /**/
211
- $('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()
212
- {
213
- this.value = $.trim ($.trim (this.value).replace (/[ \-]/g, '_').replace (/[^A-Z_0-9,]/gi, '').toLowerCase ());
214
- });
215
- /**/
216
- ws_plugin__s2member_paypalButtonGenerate = function(button) /* Handles PayPal® Button Generation. */
217
- {
218
- var shortCodeTemplate = '[s2Member-PayPal-Button %%attrs%% image="default" /]', shortCodeTemplateAttrs = '', labels = {};
219
- /**/
220
- labels['level1'] = '<?php echo ws_plugin__s2member_esc_sq ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_label"]); ?>';
221
- labels['level2'] = '<?php echo ws_plugin__s2member_esc_sq ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_label"]); ?>';
222
- labels['level3'] = '<?php echo ws_plugin__s2member_esc_sq ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_label"]); ?>';
223
- labels['level4'] = '<?php echo ws_plugin__s2member_esc_sq ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_label"]); ?>';
224
- /**/
225
- var shortCode = $('input#ws-plugin--s2member-' + button + '-shortcode');
226
- var code = $('textarea#ws-plugin--s2member-' + button + '-button');
227
- var modLevel = $('select#ws-plugin--s2member-modification-level');
228
- /**/
229
- var level = (button === 'modification') ? modLevel.val ().split (':', 2)[1] : button.replace (/^level/, '');
230
- var label = labels['level' + level].replace (/"/g, "'"); /* Label cannot contain double-quotes. */
231
- var trialPeriod = $('input#ws-plugin--s2member-' + button + '-trial-period').val ().replace (/[^0-9]/g, '');
232
- var trialTerm = $('select#ws-plugin--s2member-' + button + '-trial-term').val ().replace (/[^A-Z]/g, '');
233
- var regAmount = $('input#ws-plugin--s2member-' + button + '-amount').val ().replace (/[^0-9\.]/g, '');
234
- var regPeriod = $('select#ws-plugin--s2member-' + button + '-term').val ().split ('-')[0].replace (/[^0-9]/g, '');
235
- var regTerm = $('select#ws-plugin--s2member-' + button + '-term').val ().split ('-')[1].replace (/[^A-Z]/g, '');
236
- var regRecur = $('select#ws-plugin--s2member-' + button + '-term').val ().split ('-')[2].replace (/[^0-1BN]/g, '');
237
- var pageStyle = $.trim ($('input#ws-plugin--s2member-' + button + '-page-style').val ().replace (/"/g, ''));
238
- var currencyCode = $('select#ws-plugin--s2member-' + button + '-currency').val ().replace (/[^A-Z]/g, '');
239
- var cCaps = $.trim ($.trim ($('input#ws-plugin--s2member-' + button + '-ccaps').val ()).replace (/[ \-]/g, '_').replace (/[^A-Z_0-9,]/gi, '').toLowerCase ());
240
- trialPeriod = (regRecur === 'BN') ? '0' : trialPeriod; /* Lifetime ( 1-L-BN ) and Buy Now ( BN ) access is NOT compatible w/ free trials. */
241
- var levelCcapsPer = (regRecur === 'BN' && regTerm !== 'L') ? level + ':' + cCaps + ':' + regPeriod + ' ' + regTerm : level + ':' + cCaps;
242
- levelCcapsPer = levelCcapsPer.replace (/\:+$/g, ''); /* Clean any trailing separators from this string. */
243
- /**/
244
- if (trialTerm === 'D' && trialPeriod > 90) /* Some validation on the trial period. Max days: 90. */
245
- 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;
246
- else if (trialTerm === 'W' && trialPeriod > 52) /* Some validation on the trial period. 52 max. */
247
- 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;
248
- else if (trialTerm === 'M' && trialPeriod > 24) /* Some validation on the trial period. 24 max. */
249
- 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;
250
- else if (trialTerm === 'Y' && trialPeriod > 5) /* 5 years max. */
251
- alert('* WARNING: Maximum Free Years is: 5.'), trialPeriod = 5;
252
- /**/
253
- code.val (code.val ().replace (/ \<\!--(\<input type\="hidden" name\="(amount|src|sra|a1|p1|t1|a3|p3|t3)" value\="(.*?)" \/\>)--\>/g, " $1"));
254
- (parseInt(trialPeriod) <= 0) ? code.val (code.val ().replace (/ (\<input type\="hidden" name\="(a1|p1|t1)" value\="(.*?)" \/\>)/g, " <!--$1-->")) : null;
255
- (regRecur === 'BN') ? code.val (code.val ().replace (/ (\<input type\="hidden" name\="cmd" value\=")(.*?)(" \/\>)/g, " $1_xclick$3")) : null;
256
- (regRecur === 'BN') ? code.val (code.val ().replace (/ (\<input type\="hidden" name\="(src|sra|a1|p1|t1|a3|p3|t3)" value\="(.*?)" \/\>)/g, " <!--$1-->")) : null;
257
- (regRecur !== 'BN') ? code.val (code.val ().replace (/ (\<input type\="hidden" name\="cmd" value\=")(.*?)(" \/\>)/g, " $1_xclick-subscriptions$3")) : null;
258
- (regRecur !== 'BN') ? code.val (code.val ().replace (/ (\<input type\="hidden" name\="amount" value\="(.*?)" \/\>)/g, " <!--$1-->")) : null;
259
- /**/
260
- shortCodeTemplateAttrs += 'level="' + level + '" ccaps="' + cCaps + '" desc="' + label + '" ps="' + pageStyle + '" cc="' + currencyCode + '" custom="<?php echo $_SERVER["HTTP_HOST"]; ?>"';
261
- shortCodeTemplateAttrs += ' tp="' + trialPeriod + '" tt="' + trialTerm + '" ra="' + regAmount + '" rp="' + regPeriod + '" rt="' + regTerm + '" rr="' + regRecur + '"';
262
- shortCodeTemplateAttrs += (button === 'modification') ? ' mb="1"' : ''; /* For modification buttons. */
263
- shortCode.val (shortCodeTemplate.replace (/%%attrs%%/, shortCodeTemplateAttrs));
264
- /**/
265
- code.val (code.val ().replace (/ name\="item_name" value\="(.*?)"/, ' name="item_name" value="' + label + '"'));
266
- code.val (code.val ().replace (/ name\="item_number" value\="(.*?)"/, ' name="item_number" value="' + levelCcapsPer + '"'));
267
- code.val (code.val ().replace (/ name\="page_style" value\="(.*?)"/, ' name="page_style" value="' + pageStyle + '"'));
268
- code.val (code.val ().replace (/ name\="currency_code" value\="(.*?)"/, ' name="currency_code" value="' + currencyCode + '"'));
269
- code.val (code.val ().replace (/ name\="custom" value\="(.*?)"/, ' name="custom" value="<?php echo $_SERVER["HTTP_HOST"]; ?>"'));
270
- code.val (code.val ().replace (/ name\="modify" value\="(.*?)"/, ' name="modify" value="' + ((button === 'modification') ? '1' : '0') + '"'));
271
- code.val (code.val ().replace (/ name\="amount" value\="(.*?)"/, ' name="amount" value="' + regAmount + '"'));
272
- code.val (code.val ().replace (/ name\="src" value\="(.*?)"/, ' name="src" value="' + regRecur + '"'));
273
- code.val (code.val ().replace (/ name\="p1" value\="(.*?)"/, ' name="p1" value="' + trialPeriod + '"'));
274
- code.val (code.val ().replace (/ name\="t1" value\="(.*?)"/, ' name="t1" value="' + trialTerm + '"'));
275
- code.val (code.val ().replace (/ name\="a3" value\="(.*?)"/, ' name="a3" value="' + regAmount + '"'));
276
- code.val (code.val ().replace (/ name\="p3" value\="(.*?)"/, ' name="p3" value="' + regPeriod + '"'));
277
- code.val (code.val ().replace (/ name\="t3" value\="(.*?)"/, ' name="t3" value="' + regTerm + '"'));
278
- /**/
279
- $('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, ''));
280
- /**/
281
- if (button === 'modification')
282
- 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.');
283
- else
284
- alert('Your Codes for Membership Level #' + level + ' have been generated. Please copy/paste the Shortcode Format into your Membership Options Page.');
285
- /**/
286
- shortCode.each (function() /* Focus and select the recommended Shortcode. */
287
- {
288
- this.focus (), this.select ();
289
- });
290
- /**/
291
- return false;
292
- };
293
- /**/
294
- ws_plugin__s2member_paypalSpButtonGenerate = function() /* Handles PayPal® Button Generation for Specific Post/Page Access. */
295
- {
296
- var shortCodeTemplate = '[s2Member-PayPal-Button %%attrs%% image="default" /]', shortCodeTemplateAttrs = '';
297
- /**/
298
- var shortCode = $('input#ws-plugin--s2member-sp-shortcode');
299
- var code = $('textarea#ws-plugin--s2member-sp-button');
300
- /**/
301
- var leading = $('select#ws-plugin--s2member-sp-leading-id').val ().replace (/[^0-9]/g, '');
302
- var additionals = $('select#ws-plugin--s2member-sp-additional-ids').val () || [];
303
- var hours = $('select#ws-plugin--s2member-sp-hours').val ().replace (/[^0-9]/g, '');
304
- var desc = $.trim ($('input#ws-plugin--s2member-sp-desc').val ().replace (/"/g, ''));
305
- /**/
306
- if (!leading) /* Must have a Leading Post/Page ID to work with. Otherwise, Link generation will fail. */
307
- {
308
- 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.');
309
- return false;
310
- }
311
- else if (!desc) /* Each Specific Post/Page purchase should have a description. */
312
- {
313
- alert('Please type a description for this purchase.');
314
- return false;
315
- }
316
- /**/
317
- for (var i = 0, ids = leading; i < additionals.length; i++)
318
- if (additionals[i] && additionals[i] !== leading)
319
- ids += ',' + additionals[i];
320
- /**/
321
- var regAmount = $('input#ws-plugin--s2member-sp-amount').val ().replace (/[^0-9\.]/g, '');
322
- var pageStyle = $.trim ($('input#ws-plugin--s2member-sp-page-style').val ().replace (/"/g, ''));
323
- var currencyCode = $('select#ws-plugin--s2member-sp-currency').val ().replace (/[^A-Z]/g, '');
324
- /**/
325
- shortCodeTemplateAttrs += 'ids="' + ids + '" exp="' + hours + '" desc="' + desc + '" ps="' + pageStyle + '" cc="' + currencyCode + '"';
326
- shortCodeTemplateAttrs += ' custom="<?php echo $_SERVER["HTTP_HOST"]; ?>" ra="' + regAmount + '" sp="1"';
327
- shortCode.val (shortCodeTemplate.replace (/%%attrs%%/, shortCodeTemplateAttrs));
328
- /**/
329
- code.val (code.val ().replace (/ name\="item_name" value\="(.*?)"/, ' name="item_name" value="' + desc + '"'));
330
- code.val (code.val ().replace (/ name\="item_number" value\="(.*?)"/, ' name="item_number" value="sp:' + ids + ':' + hours + '"'));
331
- code.val (code.val ().replace (/ name\="page_style" value\="(.*?)"/, ' name="page_style" value="' + pageStyle + '"'));
332
- code.val (code.val ().replace (/ name\="currency_code" value\="(.*?)"/, ' name="currency_code" value="' + currencyCode + '"'));
333
- code.val (code.val ().replace (/ name\="custom" value\="(.*?)"/, ' name="custom" value="<?php echo $_SERVER["HTTP_HOST"]; ?>"'));
334
- code.val (code.val ().replace (/ name\="amount" value\="(.*?)"/, ' name="amount" value="' + regAmount + '"'));
335
- /**/
336
- $('div#ws-plugin--s2member-sp-button-prev').html (code.val ().replace (/\<form/, '<form target="_blank"'));
337
- /**/
338
- alert('Your Codes have been generated.\nPlease copy/paste the Shortcode Format into your Membership Options Page.');
339
- /**/
340
- shortCode.each (function() /* Focus and select the recommended Shortcode. */
341
- {
342
- this.focus (), this.select ();
343
- });
344
- /**/
345
- return false;
346
- };
347
- /**/
348
- ws_plugin__s2member_paypalSpLinkGenerate = function() /* Handles PayPal® Link Generation for Specific Post/Page Access. */
349
- {
350
- var leading = $('select#ws-plugin--s2member-sp-link-leading-id').val ().replace (/[^0-9]/g, '');
351
- var additionals = $('select#ws-plugin--s2member-sp-link-additional-ids').val () || [];
352
- var hours = $('select#ws-plugin--s2member-sp-link-hours').val ().replace (/[^0-9]/g, '');
353
- var $link = $('p#ws-plugin--s2member-sp-link'), $loading = $('img#ws-plugin--s2member-sp-link-loading');
354
- /**/
355
- if (!leading) /* Must have a Leading Post/Page ID to work with. Otherwise, Link generation will fail. */
356
- {
357
- 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.');
358
- return false;
359
- }
360
- /**/
361
- for (var i = 0, ids = leading; i < additionals.length; i++)
362
- if (additionals[i] && additionals[i] !== leading)
363
- ids += ',' + additionals[i];
364
- /**/
365
- $link.hide (), $loading.show (), $.post (ajaxurl, {action: 's2member_sp_access_link', s2member_sp_access_link: '<?php echo ws_plugin__s2member_esc_sq (wp_create_nonce ("ws-plugin--s2member-sp-access-link")); ?>', s2member_sp_access_link_ids: ids, s2member_sp_access_link_hours: hours}, function(response)
366
- {
367
- $link.show ().html ('<a href="' + response + '" target="_blank" rel="external">' + response + '</a>'), $loading.hide ();
368
- });
369
- /**/
370
- return false;
371
- };
372
- }
373
  });
7
  along with this software. In the main directory, see: /licensing/
8
  If not, see: <http://www.gnu.org/licenses/>.
9
  */
10
+ /*
11
+ These routines address common layout styles for menu pages.
12
+ */
13
  jQuery(document).ready (function($)
14
  {
 
 
 
15
  $('div.ws-menu-page-group').each (function(index)
16
  {
17
  var ins = '<ins>+</ins>', group = $(this), title = group.attr ('title');
125
  /**/
126
  return false;
127
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
128
  });
includes/menu-pages/options.inc.php CHANGED
@@ -32,1120 +32,1255 @@ echo '<form method="post" name="ws_plugin__s2member_options_form" id="ws-plugin-
32
  echo '<input type="hidden" name="ws_plugin__s2member_options_save" id="ws-plugin--s2member-options-save" value="' . esc_attr (wp_create_nonce ("ws-plugin--s2member-options-save")) . '" />' . "\n";
33
  echo '<input type="hidden" name="ws_plugin__s2member_configured" id="ws-plugin--s2member-configured" value="1" />' . "\n";
34
  /**/
35
- echo '<div class="ws-menu-page-group" title="Security Encryption Key">' . "\n";
36
- /**/
37
- echo '<div class="ws-menu-page-section ws-plugin--s2member-security-section">' . "\n";
38
- echo '<h3>Security Encryption Key ( optional, for tighter security )</h3>' . "\n";
39
- echo '<p>Just like WordPress®, s2Member is open-source software. Which is wonderful. However, this also makes it possible for anyone to grab a copy of the software, and try to learn their way around its security measures. In order to keep your installation of s2Member unique/secure, you should configure a Security Encryption Key. s2Member will use your Security Encryption Key to protect itself against hackers. It does this by encrypting all sensitive information with your Key. A Security Encryption Key is unique to your installation.</p>' . "\n";
40
- echo '<p>Once you configure this, you do NOT want to change it; not ever. In fact, it is a VERY good idea to keep this backed up in a safe place, just in case you need to move your site, or re-install s2Member in the future. Some of the sensitive data that s2Member stores, will be encrypted with this Key. If you change it, that data can no longer be read, even by s2Member itself. In other words, don\'t use s2Member for six months, then decide to change your Key. That would break your installation. You configure this once, for each installation of s2Member; and you NEVER change it.</p>' . "\n";
41
- /**/
42
- echo '<table class="form-table">' . "\n";
43
- echo '<tbody>' . "\n";
44
- echo '<tr>' . "\n";
45
- /**/
46
- echo '<th>' . "\n";
47
- echo '<label for="ws-plugin--s2member-sec-encryption-key">' . "\n";
48
- echo 'Security Encryption Key:' . (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sec_encryption_key"]) ? ' ( <a href="#" onclick="ws_plugin__s2member_enableSecurityKey();" title="( not recommended )">edit key</a> )' : ' ( <a href="#" onclick="ws_plugin__s2member_generateSecurityKey();" title="Insert an auto-generated Key. ( recommended )">auto-generate</a> )') . "\n";
49
- echo '</label>' . "\n";
50
- echo '</th>' . "\n";
51
- /**/
52
- echo '</tr>' . "\n";
53
- echo '<tr>' . "\n";
54
- /**/
55
- echo '<td>' . "\n";
56
- echo '<input type="text" name="ws_plugin__s2member_sec_encryption_key" id="ws-plugin--s2member-sec-encryption-key" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sec_encryption_key"]) . '" maxlength="256" autocomplete="off"' . (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sec_encryption_key"]) ? ' disabled="disabled"' : '') . ' />' . "\n";
57
- echo (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sec_encryption_key"]) ? '<br />This may contain letters, numbers, spaces; even punctuation. Up to 256 characters.<br /><em>Ex: <code>' . esc_html (strtoupper (ws_plugin__s2member_random_str_gen (56))) . '</code></em>' . "\n" : '';
58
- echo (count ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sec_encryption_key_history"]) > 1) ? '<br /><a href="#" onclick="ws_plugin__s2member_securityKeyHistory();">Click here</a> for a history of your last 10 Encryption Keys.<div id="ws-plugin--s2member-sec-encryption-key-history" style="display:none;"><code>' . implode ('</code><br /><code>', $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sec_encryption_key_history"]) . '</code></div>' . "\n" : '';
59
- echo '</td>' . "\n";
60
- /**/
61
- echo '</tr>' . "\n";
62
- echo '</tbody>' . "\n";
63
- echo '</table>' . "\n";
64
- echo '</div>' . "\n";
65
- /**/
66
- echo '</div>' . "\n";
67
- /**/
68
- echo '<div class="ws-menu-page-group" title="Email Configuration">' . "\n";
69
- /**/
70
- echo '<div class="ws-menu-page-section ws-plugin--s2member-email-section">' . "\n";
71
- echo '<h3>EMail From: ' . esc_html ('"Name" <address>') . '</h3>' . "\n";
72
- echo '<p>This is the name/address that will appear in outgoing email notifications sent by the s2Member plugin.</p>' . "\n";
73
- /**/
74
- echo '<table class="form-table">' . "\n";
75
- echo '<tbody>' . "\n";
76
- echo '<tr>' . "\n";
77
- /**/
78
- echo '<th>' . "\n";
79
- echo '<label for="ws-plugin--s2member-reg-email-from-name">' . "\n";
80
- echo 'EMail From Name:' . "\n";
81
- echo '</label>' . "\n";
82
- echo '</th>' . "\n";
83
- /**/
84
- echo '</tr>' . "\n";
85
- echo '<tr>' . "\n";
86
- /**/
87
- echo '<td>' . "\n";
88
- echo '<input type="text" name="ws_plugin__s2member_reg_email_from_name" id="ws-plugin--s2member-reg-email-from-name" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . '" /><br />' . "\n";
89
- echo 'We recommend that you use the name of your site here.' . "\n";
90
- echo '</td>' . "\n";
91
- /**/
92
- echo '</tr>' . "\n";
93
- echo '<tr>' . "\n";
94
- /**/
95
- echo '<th>' . "\n";
96
- echo '<label for="ws-plugin--s2member-reg-email-from-email">' . "\n";
97
- echo 'EMail From Address:' . "\n";
98
- echo '</label>' . "\n";
99
- echo '</th>' . "\n";
100
- /**/
101
- echo '</tr>' . "\n";
102
- echo '<tr>' . "\n";
103
- /**/
104
- echo '<td>' . "\n";
105
- echo '<input type="text" name="ws_plugin__s2member_reg_email_from_email" id="ws-plugin--s2member-reg-email-from-email" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"]) . '" /><br />' . "\n";
106
- echo 'We recommend something like: support@your-domain.com.' . "\n";
107
- echo '</td>' . "\n";
108
- /**/
109
- echo '</tr>' . "\n";
110
- echo '</tbody>' . "\n";
111
- echo '</table>' . "\n";
112
- echo '</div>' . "\n";
113
- /**/
114
- echo '</div>' . "\n";
115
- /**/
116
- echo '<div class="ws-menu-page-group" title="Login/Registration Design">' . "\n";
117
- /**/
118
- echo '<div class="ws-menu-page-section ws-plugin--s2member-login-registration-section">' . "\n";
119
- echo '<h3>Login/Registration Page Customization ( required )</h3>' . "\n";
120
- echo '<p>These settings allow you to customize the user interface for your Login / Registration Pages:<br />( <a href="' . wp_login_url () . '" target="_blank" rel="external">' . esc_html (wp_login_url ()) . '</a> )</p>' . "\n";
121
- /**/
122
- echo '<table class="form-table">' . "\n";
123
- echo '<tbody>' . "\n";
124
- echo '<tr>' . "\n";
125
- /**/
126
- echo '<td>' . "\n";
127
- echo '<h3>Background Settings</h3>' . "\n";
128
- echo '<p>These settings are all focused on your Login/Registration Background.</p>' . "\n";
129
- echo '</td>' . "\n";
130
- /**/
131
- echo '</tr>' . "\n";
132
- echo '<tr>' . "\n";
133
- /**/
134
- echo '<th>' . "\n";
135
- echo '<label for="ws-plugin--s2member-login-reg-background-color">' . "\n";
136
- echo 'Background Color:' . "\n";
137
- echo '</label>' . "\n";
138
- echo '</th>' . "\n";
139
- /**/
140
- echo '</tr>' . "\n";
141
- echo '<tr>' . "\n";
142
- /**/
143
- echo '<td>' . "\n";
144
- echo '<input type="text" name="ws_plugin__s2member_login_reg_background_color" id="ws-plugin--s2member-login-reg-background-color" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_color"]) . '" /><br />' . "\n";
145
- echo 'Set this to a 6-digit hex color code.' . "\n";
146
- echo '</td>' . "\n";
147
- /**/
148
- echo '</tr>' . "\n";
149
- echo '<tr>' . "\n";
150
- /**/
151
- echo '<th>' . "\n";
152
- echo '<label for="ws-plugin--s2member-login-reg-background-image">' . "\n";
153
- echo 'Seamless Tile Background Image:' . "\n";
154
- echo '</label>' . "\n";
155
- echo '</th>' . "\n";
156
- /**/
157
- echo '</tr>' . "\n";
158
- echo '<tr>' . "\n";
159
- /**/
160
- echo '<td>' . "\n";
161
- echo '<input type="text" name="ws_plugin__s2member_login_reg_background_image" id="ws-plugin--s2member-login-reg-background-image" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_image"]) . '" /><br />' . "\n";
162
- echo '<input type="button" id="ws-plugin--s2member-login-reg-background-image-media-btn" value="Open Media Library" class="ws-menu-page-media-btn" rel="ws-plugin--s2member-login-reg-background-image" />' . "\n";
163
- echo 'Set this to the URL of your Background Image. ( this is optional )<br />';
164
- echo 'If supplied, your Background Image will be tiled.' . "\n";
165
- echo '</td>' . "\n";
166
- /**/
167
- echo '</tr>' . "\n";
168
- echo '<tr>' . "\n";
169
- /**/
170
- echo '<th>' . "\n";
171
- echo '<label for="ws-plugin--s2member-login-reg-background-text-color">' . "\n";
172
- echo 'Color of Text on top of your Background:' . "\n";
173
- echo '</label>' . "\n";
174
- echo '</th>' . "\n";
175
- /**/
176
- echo '</tr>' . "\n";
177
- echo '<tr>' . "\n";
178
- /**/
179
- echo '<td>' . "\n";
180
- echo '<input type="text" name="ws_plugin__s2member_login_reg_background_text_color" id="ws-plugin--s2member-login-reg-background-text-color" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_text_color"]) . '" /><br />' . "\n";
181
- echo 'Set this to a 6-digit hex color code.' . "\n";
182
- echo '</td>' . "\n";
183
- /**/
184
- echo '</tr>' . "\n";
185
- echo '<tr>' . "\n";
186
- /**/
187
- echo '<th>' . "\n";
188
- echo '<label for="ws-plugin--s2member-login-reg-background-text-shadow-color">' . "\n";
189
- echo 'Shadow Color for Text on top of your Background:' . "\n";
190
- echo '</label>' . "\n";
191
- echo '</th>' . "\n";
192
- /**/
193
- echo '</tr>' . "\n";
194
- echo '<tr>' . "\n";
195
- /**/
196
- echo '<td>' . "\n";
197
- echo '<input type="text" name="ws_plugin__s2member_login_reg_background_text_shadow_color" id="ws-plugin--s2member-login-reg-background-text-shadow-color" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_text_shadow_color"]) . '" /><br />' . "\n";
198
- echo 'Set this to a 6-digit hex color code.' . "\n";
199
- echo '</td>' . "\n";
200
- /**/
201
- echo '</tr>' . "\n";
202
- echo '<tr>' . "\n";
203
- /**/
204
- echo '<th>' . "\n";
205
- echo '<label for="ws-plugin--s2member-login-reg-background-box-shadow-color">' . "\n";
206
- echo 'Shadow Color for Boxes on top of your Background:' . "\n";
207
- echo '</label>' . "\n";
208
- echo '</th>' . "\n";
209
- /**/
210
- echo '</tr>' . "\n";
211
- echo '<tr>' . "\n";
212
- /**/
213
- echo '<td>' . "\n";
214
- echo '<input type="text" name="ws_plugin__s2member_login_reg_background_box_shadow_color" id="ws-plugin--s2member-login-reg-background-box-shadow-color" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"]) . '" /><br />' . "\n";
215
- echo 'Set this to a 6-digit hex color code.' . "\n";
216
- echo '</td>' . "\n";
217
- /**/
218
- echo '</tr>' . "\n";
219
- echo '<tr>' . "\n";
220
- /**/
221
- echo '<td>' . "\n";
222
- echo '<h3>Logo Image Settings</h3>' . "\n";
223
- echo '<p>These settings are all focused on your Login/Registration Logo.</p>' . "\n";
224
- echo '</td>' . "\n";
225
- /**/
226
- echo '</tr>' . "\n";
227
- echo '<tr>' . "\n";
228
- /**/
229
- echo '<th>' . "\n";
230
- echo '<label for="ws-plugin--s2member-login-reg-logo-src">' . "\n";
231
- echo 'Logo Image Location:' . "\n";
232
- echo '</label>' . "\n";
233
- echo '</th>' . "\n";
234
- /**/
235
- echo '</tr>' . "\n";
236
- echo '<tr>' . "\n";
237
- /**/
238
- echo '<td>' . "\n";
239
- echo '<input type="text" name="ws_plugin__s2member_login_reg_logo_src" id="ws-plugin--s2member-login-reg-logo-src" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_logo_src"]) . '" /><br />' . "\n";
240
- echo '<input type="button" id="ws-plugin--s2member-login-reg-logo-src-media-btn" value="Open Media Library" class="ws-menu-page-media-btn" rel="ws-plugin--s2member-login-reg-logo-src" />' . "\n";
241
- echo 'Set this to the URL of your Logo Image.<br />' . "\n";
242
- echo 'Suggested size is around 500 x 100.' . "\n";
243
- echo '</td>' . "\n";
244
- /**/
245
- echo '</tr>' . "\n";
246
- echo '<tr>' . "\n";
247
- /**/
248
- echo '<th>' . "\n";
249
- echo '<label for="ws-plugin--s2member-login-reg-logo-src-width">' . "\n";
250
- echo 'Logo Image Width:' . "\n";
251
- echo '</label>' . "\n";
252
- echo '</th>' . "\n";
253
- /**/
254
- echo '</tr>' . "\n";
255
- echo '<tr>' . "\n";
256
- /**/
257
- echo '<td>' . "\n";
258
- echo '<input type="text" name="ws_plugin__s2member_login_reg_logo_src_width" id="ws-plugin--s2member-login-reg-logo-src-width" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_logo_src_width"]) . '" /><br />' . "\n";
259
- echo 'The pixel Width of your Logo Image. <em>* This ALSO affects the overall width of your Login/Registration forms. If you want wider form fields, use a wider Logo.</em>' . "\n";
260
- echo '</td>' . "\n";
261
- /**/
262
- echo '</tr>' . "\n";
263
- echo '<tr>' . "\n";
264
- /**/
265
- echo '<th>' . "\n";
266
- echo '<label for="ws-plugin--s2member-login-reg-logo-src-height">' . "\n";
267
- echo 'Logo Image Height:' . "\n";
268
- echo '</label>' . "\n";
269
- echo '</th>' . "\n";
270
- /**/
271
- echo '</tr>' . "\n";
272
- echo '<tr>' . "\n";
273
- /**/
274
- echo '<td>' . "\n";
275
- echo '<input type="text" name="ws_plugin__s2member_login_reg_logo_src_height" id="ws-plugin--s2member-login-reg-logo-src-height" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_logo_src_height"]) . '" /><br />' . "\n";
276
- echo 'The pixel Height of your Logo Image.' . "\n";
277
- echo '</td>' . "\n";
278
- /**/
279
- echo '</tr>' . "\n";
280
- echo '<tr>' . "\n";
281
- /**/
282
- echo '<th>' . "\n";
283
- echo '<label for="ws-plugin--s2member-login-reg-logo-url">' . "\n";
284
- echo 'Logo Image Click URL:' . "\n";
285
- echo '</label>' . "\n";
286
- echo '</th>' . "\n";
287
- /**/
288
- echo '</tr>' . "\n";
289
- echo '<tr>' . "\n";
290
- /**/
291
- echo '<td>' . "\n";
292
- echo '<input type="text" name="ws_plugin__s2member_login_reg_logo_url" id="ws-plugin--s2member-login-reg-logo-url" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_logo_url"]) . '" /><br />' . "\n";
293
- echo 'Set this to the Click URL for your Logo Image.' . "\n";
294
- echo '</td>' . "\n";
295
- /**/
296
- echo '</tr>' . "\n";
297
- echo '<tr>' . "\n";
298
- /**/
299
- echo '<th>' . "\n";
300
- echo '<label for="ws-plugin--s2member-login-reg-logo-title">' . "\n";
301
- echo 'Logo Image Title Attribute:' . "\n";
302
- echo '</label>' . "\n";
303
- echo '</th>' . "\n";
304
- /**/
305
- echo '</tr>' . "\n";
306
- echo '<tr>' . "\n";
307
- /**/
308
- echo '<td>' . "\n";
309
- echo '<input type="text" name="ws_plugin__s2member_login_reg_logo_title" id="ws-plugin--s2member-login-reg-logo-title" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_logo_title"]) . '" /><br />' . "\n";
310
- echo 'Used as the <code>title=""</code> attribute for your Logo Image.' . "\n";
311
- echo '</td>' . "\n";
312
- /**/
313
- echo '</tr>' . "\n";
314
- echo '</tbody>' . "\n";
315
- echo '</table>' . "\n";
316
- echo '</div>' . "\n";
317
- /**/
318
- echo '</div>' . "\n";
319
- /**/
320
- echo '<div class="ws-menu-page-group" title="Custom Registration Fields">' . "\n";
321
- /**/
322
- echo '<div class="ws-menu-page-section ws-plugin--s2member-custom-reg-fields-section">' . "\n";
323
- echo '<h3>Custom Registration Fields ( optional, for further customization )</h3>' . "\n";
324
- 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";
325
- 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";
326
- if (defined ("BP_VERSION")) /* Notify the site owner about the conflict with Custom Fields and BuddyPress. */
327
- 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";
328
- if (!function_exists ("ws_plugin__s2member_generate_password"))
329
- 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";
330
- echo '<table class="form-table">' . "\n";
331
- echo '<tbody>' . "\n";
332
- echo '<tr>' . "\n";
333
- /**/
334
- echo '<th>' . "\n";
335
- echo '<label for="ws-plugin--s2member-custom-reg-fields">' . "\n";
336
- echo 'Custom Registration Fields:' . "\n";
337
- echo '</label>' . "\n";
338
- echo '</th>' . "\n";
339
- /**/
340
- echo '</tr>' . "\n";
341
- echo '<tr>' . "\n";
342
- /**/
343
- echo '<td>' . "\n";
344
- echo '<input type="text" name="ws_plugin__s2member_custom_reg_fields" id="ws-plugin--s2member-custom-reg-fields" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) . '" /><br />' . "\n";
345
- echo 'Comma delimited please. <em>Ex: <code>*Company*, *Website URL*, Street Address, City, State, Zip Code, Phone</code></em>' . "\n";
346
- echo '</td>' . "\n";
347
- /**/
348
- echo '</tr>' . "\n";
349
- echo '<tr>' . "\n";
350
- /**/
351
- echo '<th>' . "\n";
352
- echo '<label for="ws-plugin--s2member-custom-reg-password">' . "\n";
353
- echo 'Allow Custom Passwords during Registration?' . "\n";
354
- echo '</label>' . "\n";
355
- echo '</th>' . "\n";
356
- /**/
357
- echo '</tr>' . "\n";
358
- echo '<tr>' . "\n";
359
- /**/
360
- echo '<td>' . "\n";
361
- echo '<select name="ws_plugin__s2member_custom_reg_password" id="ws-plugin--s2member-custom-reg-password">' . "\n";
362
- echo '<option value="0"' . ((!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_password"]) ? ' selected="selected"' : '') . '>No ( send auto-generated passwords via email; after registration )</option>' . "\n";
363
- echo '<option value="1"' . (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_password"]) ? ' selected="selected"' : '') . '>Yes ( allow members to create their own password during registration )</option>' . "\n";
364
- echo '</select><br />' . "\n";
365
- echo 'Auto-generated Passwords are recommended for best security; because, this also serves as a form of email confirmation.' . "\n";
366
- echo '</td>' . "\n";
367
- /**/
368
- echo '</tr>' . "\n";
369
- echo '</tbody>' . "\n";
370
- echo '</table>' . "\n";
371
- echo '</div>' . "\n";
372
- /**/
373
- echo '</div>' . "\n";
374
- /**/
375
- echo '<div class="ws-menu-page-group" title="Login Welcome Page">' . "\n";
376
- /**/
377
- echo '<div class="ws-menu-page-section ws-plugin--s2member-login-welcome-page-section">' . "\n";
378
- echo '<h3>Login Welcome Page ( required, please customize this )</h3>' . "\n";
379
- echo '<p>Please create and/or choose an existing Page to use as the first page Members will see after logging in.</p>' . "\n";
380
- /**/
381
- echo '<table class="form-table">' . "\n";
382
- echo '<tbody>' . "\n";
383
- echo '<tr>' . "\n";
384
- /**/
385
- echo '<th>' . "\n";
386
- echo '<label for="ws-plugin--s2member-login-welcome-page">' . "\n";
387
- echo 'Login Welcome Page:' . "\n";
388
- echo '</label>' . "\n";
389
- echo '</th>' . "\n";
390
- /**/
391
- echo '</tr>' . "\n";
392
- echo '<tr>' . "\n";
393
- /**/
394
- echo '<td>' . "\n";
395
- echo '<select name="ws_plugin__s2member_login_welcome_page" id="ws-plugin--s2member-login-welcome-page">' . "\n";
396
- echo '<option value="">&mdash; Select &mdash;</option>' . "\n";
397
- foreach (($ws_plugin__s2member_temp_a = array_merge ((array)get_pages ())) as $ws_plugin__s2member_temp_o)
398
- echo '<option value="' . esc_attr ($ws_plugin__s2member_temp_o->ID) . '"' . ((!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"] && $ws_plugin__s2member_temp_o->ID == $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]) ? ' selected="selected"' : '') . '>' . esc_html ($ws_plugin__s2member_temp_o->post_title) . '</option>' . "\n";
399
- echo '</select><br />' . "\n";
400
- echo 'Please choose a Page to be used as the first page Members will see after logging in. This Page can contain anything you like. We recommend the following title: <code>Welcome To Our Members Area</code>.<br /><br />' . "\n";
401
- echo '&darr; Or, you may configure a Special Redirection URL, if you prefer. You\'ll need to type in the full URL, starting with: <code>http://</code>. <em>A couple of <a href="#" onclick="alert(\'Replacement Codes:\\n\\n%%current_user_login%% = The current User\\\'s login ( their Username, lowercase ).\\n%%current_user_ID%% = The current User\\\'s ID.\\n\\nFor example, if you\\\'re using BuddyPress, and you want to redirect Members to their BuddyPress Profile page after logging in, you would setup a Special Redirection URL, like this: ' . get_bloginfo ("url") . '/members/%%current_user_login%%/profile/\\n\\nAdditional Replacement Codes can be added through custom programming. Use: add_filter(\\\'s2member_fill_login_redirect_rc_vars\\\', \\\'my_filter\\\');\'); return false;">Replacement Codes</a> are also supported here.</em>' . "\n";
402
- echo '<input type="text" name="ws_plugin__s2member_login_redirection_override" id="ws-plugin--s2member-login-redirection-override" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"]) . '" /><br />' . "\n";
403
- echo '</td>' . "\n";
404
- /**/
405
- echo '</tr>' . "\n";
406
- echo '<tr>' . "\n";
407
- /**/
408
- echo '<th>' . "\n";
409
- echo '<label for="ws-plugin--s2member-allow-subscribers-in">' . "\n";
410
- echo 'Allow Free Subscribers Access To This Page?' . "\n";
411
- echo '</label>' . "\n";
412
- echo '</th>' . "\n";
413
- /**/
414
- echo '</tr>' . "\n";
415
- echo '<tr>' . "\n";
416
- /**/
417
- echo '<td>' . "\n";
418
- echo '<select name="ws_plugin__s2member_allow_subscribers_in" id="ws-plugin--s2member-allow-subscribers-in">' . "\n";
419
- 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";
420
- 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";
421
- echo '</select><br />' . "\n";
422
- 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";
423
- echo '</td>' . "\n";
424
- /**/
425
- echo '</tr>' . "\n";
426
- echo '</tbody>' . "\n";
427
- echo '</table>' . "\n";
428
- echo '</div>' . "\n";
429
- /**/
430
- echo '</div>' . "\n";
431
- /**/
432
- echo '<div class="ws-menu-page-group" title="Member Profile Modifications">' . "\n";
433
- /**/
434
- echo '<div class="ws-menu-page-section ws-plugin--s2member-profile-modifications-section">' . "\n";
435
- echo '<h3>Giving Members The Ability To Modify Their Profile</h3>' . "\n";
436
- 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";
437
- 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";
438
- /**/
439
- echo '<div class="ws-menu-page-hr"></div>' . "\n";
440
- /**/
441
- echo '<p>Stand-Alone page where Members can modify their Profile:<br />' . "\n";
442
- echo '<code><a href="' . get_bloginfo ("url") . '/?s2member_profile=1" target="_blank" rel="external">' . get_bloginfo ("url") . '/?s2member_profile=1</a></code></p>' . "\n";
443
- /**/
444
- echo '<div class="ws-menu-page-hr"></div>' . "\n";
445
- /**/
446
- echo '<p><strong>Code Sample #1</strong> ( standard link tag ):</p>' . "\n";
447
- 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";
448
- /**/
449
- echo '<p><strong>Code Sample #2</strong> ( open the link in a popup window ):</p>' . "\n";
450
- 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";
451
- /**/
452
- echo '<p><strong>Code Sample #3</strong> ( embed the form into a Post/Page using an IFRAME tag ):</p>' . "\n";
453
- 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";
454
- echo '<table class="form-table">' . "\n";
455
- echo '<tbody>' . "\n";
456
- echo '<tr>' . "\n";
457
- /**/
458
- echo '<th>' . "\n";
459
- echo '<label for="ws-plugin--s2member-force-admin-lockouts">' . "\n";
460
- echo 'Redirect Members away from the Default Profile Panel?' . "\n";
461
- echo '</label>' . "\n";
462
- echo '</th>' . "\n";
463
- /**/
464
- echo '</tr>' . "\n";
465
- echo '<tr>' . "\n";
466
- /**/
467
- echo '<td>' . "\n";
468
- echo '<select name="ws_plugin__s2member_force_admin_lockouts" id="ws-plugin--s2member-force-admin-lockouts">' . "\n";
469
- 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";
470
- echo '<option value="1"' . (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["force_admin_lockouts"]) ? ' selected="selected"' : '') . '>Yes ( redirect Members to their Login Welcome Page )</option>' . "\n";
471
- echo '</select><br />' . "\n";
472
- echo 'Recommended setting ( <code>Yes</code> ). The Stand-Alone version is better.<br />' . "\n";
473
- echo 'You\'ll want to embed the Stand-Alone version into your Login Welcome Page.<br />' . "\n";
474
- echo '</td>' . "\n";
475
- /**/
476
- echo '</tr>' . "\n";
477
- echo '</tbody>' . "\n";
478
- echo '</table>' . "\n";
479
- echo '</div>' . "\n";
480
- /**/
481
- echo '</div>' . "\n";
482
- /**/
483
- echo '<div class="ws-menu-page-group" title="Membership Options Page">' . "\n";
484
- /**/
485
- echo '<div class="ws-menu-page-section ws-plugin--s2member-membership-options-page-section">' . "\n";
486
- echo '<h3>Membership Options Page ( required, please customize this )</h3>' . "\n";
487
- 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";
488
- /**/
489
- echo '<table class="form-table">' . "\n";
490
- echo '<tbody>' . "\n";
491
- echo '<tr>' . "\n";
492
- /**/
493
- echo '<th>' . "\n";
494
- echo '<label for="ws-plugin--s2member-membership-options-page">' . "\n";
495
- echo 'Membership Options Page:' . "\n";
496
- echo '</label>' . "\n";
497
- echo '</th>' . "\n";
498
- /**/
499
- echo '</tr>' . "\n";
500
- echo '<tr>' . "\n";
501
- /**/
502
- echo '<td>' . "\n";
503
- echo '<select name="ws_plugin__s2member_membership_options_page" id="ws-plugin--s2member-membership-options-page">' . "\n";
504
- echo '<option value="">&mdash; Select &mdash;</option>' . "\n";
505
- foreach (($ws_plugin__s2member_temp_a = array_merge ((array)get_pages ())) as $ws_plugin__s2member_temp_o)
506
- 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";
507
- echo '</select><br />' . "\n";
508
- 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";
509
- echo '</td>' . "\n";
510
- /**/
511
- echo '</tr>' . "\n";
512
- echo '</tbody>' . "\n";
513
- echo '</table>' . "\n";
514
- echo '</div>' . "\n";
515
- /**/
516
- echo '</div>' . "\n";
517
- /**/
518
- echo '<div class="ws-menu-page-group" title="Membership Levels/Labels">' . "\n";
519
- /**/
520
- echo '<div class="ws-menu-page-section ws-plugin--s2member-membership-levels-section">' . "\n";
521
- echo '<h3>Membership Levels ( required, please customize these )</h3>' . "\n";
522
- 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";
523
- 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";
524
- /**/
525
- echo '<table class="form-table">' . "\n";
526
- echo '<tbody>' . "\n";
527
- echo '<tr>' . "\n";
528
- /**/
529
- echo '<th>' . "\n";
530
- echo '<label for="ws-plugin--s2member-level1-label">' . "\n";
531
- echo 'Membership Level #1 Label:' . "\n";
532
- echo '</label>' . "\n";
533
- echo '</th>' . "\n";
534
- /**/
535
- echo '</tr>' . "\n";
536
- echo '<tr>' . "\n";
537
- /**/
538
- echo '<td>' . "\n";
539
- echo '<input type="text" name="ws_plugin__s2member_level1_label" id="ws-plugin--s2member-level1-label" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_label"]) . '" /><br />' . "\n";
540
- echo 'This is the Label for Membership Level 1.<br />' . "\n";
541
- echo '</td>' . "\n";
542
- /**/
543
- echo '</tr>' . "\n";
544
- echo '<tr>' . "\n";
545
- /**/
546
- echo '<th>' . "\n";
547
- echo '<label for="ws-plugin--s2member-level2-label">' . "\n";
548
- echo 'Membership Level #2 Label:' . "\n";
549
- echo '</label>' . "\n";
550
- echo '</th>' . "\n";
551
- /**/
552
- echo '</tr>' . "\n";
553
- echo '<tr>' . "\n";
554
- /**/
555
- echo '<td>' . "\n";
556
- echo '<input type="text" name="ws_plugin__s2member_level2_label" id="ws-plugin--s2member-level2-label" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_label"]) . '" /><br />' . "\n";
557
- echo 'This is the Label for Membership Level 2.<br />' . "\n";
558
- echo '</td>' . "\n";
559
- /**/
560
- echo '</tr>' . "\n";
561
- echo '<tr>' . "\n";
562
- /**/
563
- echo '<th>' . "\n";
564
- echo '<label for="ws-plugin--s2member-level3-label">' . "\n";
565
- echo 'Membership Level #3 Label:' . "\n";
566
- echo '</label>' . "\n";
567
- echo '</th>' . "\n";
568
- /**/
569
- echo '</tr>' . "\n";
570
- echo '<tr>' . "\n";
571
- /**/
572
- echo '<td>' . "\n";
573
- echo '<input type="text" name="ws_plugin__s2member_level3_label" id="ws-plugin--s2member-level3-label" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_label"]) . '" /><br />' . "\n";
574
- echo 'This is the Label for Membership Level 3.<br />' . "\n";
575
- echo '</td>' . "\n";
576
- /**/
577
- echo '</tr>' . "\n";
578
- echo '<tr>' . "\n";
579
- /**/
580
- echo '<th>' . "\n";
581
- echo '<label for="ws-plugin--s2member-level4-label">' . "\n";
582
- echo 'Membership Level #4 Label:' . "\n";
583
- echo '</label>' . "\n";
584
- echo '</th>' . "\n";
585
- /**/
586
- echo '</tr>' . "\n";
587
- echo '<tr>' . "\n";
588
- /**/
589
- echo '<td>' . "\n";
590
- echo '<input type="text" name="ws_plugin__s2member_level4_label" id="ws-plugin--s2member-level4-label" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_label"]) . '" /><br />' . "\n";
591
- echo 'This is the Label for Membership Level 4.<br />' . "\n";
592
- echo '</td>' . "\n";
593
- /**/
594
- echo '</tr>' . "\n";
595
- echo '</tbody>' . "\n";
596
- echo '</table>' . "\n";
597
- echo '</div>' . "\n";
598
- /**/
599
- echo '</div>' . "\n";
600
- /**/
601
- echo '<div class="ws-menu-page-group" title="Post Access Restrictions">' . "\n";
602
- /**/
603
- echo '<div class="ws-menu-page-section ws-plugin--s2member-post-level-access-section">' . "\n";
604
- echo '<h3>Post Level Access Restrictions ( optional )</h3>' . "\n";
605
- echo '<p>Here you can specify Posts that are restricted to certain Membership Access Levels. These fields also support Custom Post Types, which were first introduced in WordPress® 3.0. If you have a theme/plugin installed that has enabled Custom Post Types ( i.e. Music/Videos/etc ), you can put the IDs for those Posts here.</p>' . "\n";
606
- /**/
607
- echo '<table class="form-table">' . "\n";
608
- echo '<tbody>' . "\n";
609
- echo '<tr>' . "\n";
610
- /**/
611
- echo '<th>' . "\n";
612
- echo '<label for="ws-plugin--s2member-level1-posts">' . "\n";
613
- echo 'Posts That Require Level #1 Or Higher:' . "\n";
614
- echo '</label>' . "\n";
615
- echo '</th>' . "\n";
616
- /**/
617
- echo '</tr>' . "\n";
618
- echo '<tr>' . "\n";
619
- /**/
620
- echo '<td>' . "\n";
621
- echo '<input type="text" name="ws_plugin__s2member_level1_posts" id="ws-plugin--s2member-level1-posts" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_posts"]) . '" /><br />' . "\n";
622
- echo 'Post IDs in comma delimited format. Example: <code>1,2,3,34,8,21</code> — or you can type: <code>all</code>.' . "\n";
623
- echo '</td>' . "\n";
624
- /**/
625
- echo '</tr>' . "\n";
626
- echo '<tr>' . "\n";
627
- /**/
628
- echo '<th>' . "\n";
629
- echo '<label for="ws-plugin--s2member-level2-posts">' . "\n";
630
- echo 'Posts That Require Level #2 Or Higher:' . "\n";
631
- echo '</label>' . "\n";
632
- echo '</th>' . "\n";
633
- /**/
634
- echo '</tr>' . "\n";
635
- echo '<tr>' . "\n";
636
- /**/
637
- echo '<td>' . "\n";
638
- echo '<input type="text" name="ws_plugin__s2member_level2_posts" id="ws-plugin--s2member-level2-posts" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_posts"]) . '" /><br />' . "\n";
639
- echo 'Post IDs in comma delimited format. Example: <code>1,2,3,34,8,21</code> — or you can type: <code>all</code>.' . "\n";
640
- echo '</td>' . "\n";
641
- /**/
642
- echo '</tr>' . "\n";
643
- echo '<tr>' . "\n";
644
- /**/
645
- echo '<th>' . "\n";
646
- echo '<label for="ws-plugin--s2member-level3-posts">' . "\n";
647
- echo 'Posts That Require Level #3 Or Higher:' . "\n";
648
- echo '</label>' . "\n";
649
- echo '</th>' . "\n";
650
- /**/
651
- echo '</tr>' . "\n";
652
- echo '<tr>' . "\n";
653
- /**/
654
- echo '<td>' . "\n";
655
- echo '<input type="text" name="ws_plugin__s2member_level3_posts" id="ws-plugin--s2member-level3-posts" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_posts"]) . '" /><br />' . "\n";
656
- echo 'Post IDs in comma delimited format. Example: <code>1,2,3,34,8,21</code> — or you can type: <code>all</code>.' . "\n";
657
- echo '</td>' . "\n";
658
- /**/
659
- echo '</tr>' . "\n";
660
- echo '<tr>' . "\n";
661
- /**/
662
- echo '<th>' . "\n";
663
- echo '<label for="ws-plugin--s2member-level4-posts">' . "\n";
664
- echo 'Posts That Require Highest Level #4:' . "\n";
665
- echo '</label>' . "\n";
666
- echo '</th>' . "\n";
667
- /**/
668
- echo '</tr>' . "\n";
669
- echo '<tr>' . "\n";
670
- /**/
671
- echo '<td>' . "\n";
672
- echo '<input type="text" name="ws_plugin__s2member_level4_posts" id="ws-plugin--s2member-level4-posts" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_posts"]) . '" /><br />' . "\n";
673
- echo 'Post IDs in comma delimited format. Example: <code>1,2,3,34,8,21</code> — or you can type: <code>all</code>.' . "\n";
674
- echo '</td>' . "\n";
675
- /**/
676
- echo '</tr>' . "\n";
677
- echo '</tbody>' . "\n";
678
- echo '</table>' . "\n";
679
- echo '</div>' . "\n";
680
- /**/
681
- echo '</div>' . "\n";
682
- /**/
683
- echo '<div class="ws-menu-page-group" title="Page Access Restrictions">' . "\n";
684
- /**/
685
- echo '<div class="ws-menu-page-section ws-plugin--s2member-page-level-access-section">' . "\n";
686
- echo '<h3>Page Level Access Restrictions ( optional )</h3>' . "\n";
687
- echo '<p>Here you can specify Pages that are restricted to certain Membership Access Levels.</p>' . "\n";
688
- /**/
689
- echo '<table class="form-table">' . "\n";
690
- echo '<tbody>' . "\n";
691
- echo '<tr>' . "\n";
692
- /**/
693
- echo '<th>' . "\n";
694
- echo '<label for="ws-plugin--s2member-level1-pages">' . "\n";
695
- echo 'Pages That Require Level #1 Or Higher:' . "\n";
696
- echo '</label>' . "\n";
697
- echo '</th>' . "\n";
698
- /**/
699
- echo '</tr>' . "\n";
700
- echo '<tr>' . "\n";
701
- /**/
702
- echo '<td>' . "\n";
703
- echo '<input type="text" name="ws_plugin__s2member_level1_pages" id="ws-plugin--s2member-level1-pages" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_pages"]) . '" /><br />' . "\n";
704
- echo 'Page IDs in comma delimited format. Example: <code>1,2,3,34,8,21</code> — or you can type: <code>all</code>.' . "\n";
705
- echo '</td>' . "\n";
706
- /**/
707
- echo '</tr>' . "\n";
708
- echo '<tr>' . "\n";
709
- /**/
710
- echo '<th>' . "\n";
711
- echo '<label for="ws-plugin--s2member-level2-pages">' . "\n";
712
- echo 'Pages That Require Level #2 Or Higher:' . "\n";
713
- echo '</label>' . "\n";
714
- echo '</th>' . "\n";
715
- /**/
716
- echo '</tr>' . "\n";
717
- echo '<tr>' . "\n";
718
- /**/
719
- echo '<td>' . "\n";
720
- echo '<input type="text" name="ws_plugin__s2member_level2_pages" id="ws-plugin--s2member-level2-pages" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_pages"]) . '" /><br />' . "\n";
721
- echo 'Page IDs in comma delimited format. Example: <code>1,2,3,34,8,21</code> — or you can type: <code>all</code>.' . "\n";
722
- echo '</td>' . "\n";
723
- /**/
724
- echo '</tr>' . "\n";
725
- echo '<tr>' . "\n";
726
- /**/
727
- echo '<th>' . "\n";
728
- echo '<label for="ws-plugin--s2member-level3-pages">' . "\n";
729
- echo 'Pages That Require Level #3 Or Higher:' . "\n";
730
- echo '</label>' . "\n";
731
- echo '</th>' . "\n";
732
- /**/
733
- echo '</tr>' . "\n";
734
- echo '<tr>' . "\n";
735
- /**/
736
- echo '<td>' . "\n";
737
- echo '<input type="text" name="ws_plugin__s2member_level3_pages" id="ws-plugin--s2member-level3-pages" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_pages"]) . '" /><br />' . "\n";
738
- echo 'Page IDs in comma delimited format. Example: <code>1,2,3,34,8,21</code> — or you can type: <code>all</code>.' . "\n";
739
- echo '</td>' . "\n";
740
- /**/
741
- echo '</tr>' . "\n";
742
- echo '<tr>' . "\n";
743
- /**/
744
- echo '<th>' . "\n";
745
- echo '<label for="ws-plugin--s2member-level4-pages">' . "\n";
746
- echo 'Pages That Require Highest Level #4:' . "\n";
747
- echo '</label>' . "\n";
748
- echo '</th>' . "\n";
749
- /**/
750
- echo '</tr>' . "\n";
751
- echo '<tr>' . "\n";
752
- /**/
753
- echo '<td>' . "\n";
754
- echo '<input type="text" name="ws_plugin__s2member_level4_pages" id="ws-plugin--s2member-level4-pages" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_pages"]) . '" /><br />' . "\n";
755
- echo 'Page IDs in comma delimited format. Example: <code>1,2,3,34,8,21</code> or you can type: <code>all</code>.' . "\n";
756
- echo '</td>' . "\n";
757
- /**/
758
- echo '</tr>' . "\n";
759
- echo '</tbody>' . "\n";
760
- echo '</table>' . "\n";
761
- echo '</div>' . "\n";
762
- /**/
763
- echo '</div>' . "\n";
764
- /**/
765
- echo '<div class="ws-menu-page-group" title="Tag Access Restrictions">' . "\n";
766
- /**/
767
- echo '<div class="ws-menu-page-section ws-plugin--s2member-tag-level-access-section">' . "\n";
768
- echo '<h3>Tag Level Access Restrictions ( optional )</h3>' . "\n";
769
- echo '<p>Here you can specify Tags that are restricted to certain Membership Access Levels. Tag restrictions are a bit more complex. When you restrict access to a Tag, it also restricts access to any Posts that may have the Tag. In other words, restricting a Tag protects that Tag Archive, and it also protects any Posts that have the Tag; even if they have other Tags.</p>' . "\n";
770
- /**/
771
- echo '<table class="form-table">' . "\n";
772
- echo '<tbody>' . "\n";
773
- echo '<tr>' . "\n";
774
- /**/
775
- echo '<th>' . "\n";
776
- echo '<label for="ws-plugin--s2member-level1-ptags">' . "\n";
777
- echo 'Tags That Require Level #1 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_level1_ptags" id="ws-plugin--s2member-level1-ptags" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_ptags"]) . '" /><br />' . "\n";
786
- echo 'Tags in comma delimited format. Example: <code>premium,restricted</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-level2-ptags">' . "\n";
794
- echo 'Tags That Require Level #2 Or Higher:' . "\n";
795
- echo '</label>' . "\n";
796
- echo '</th>' . "\n";
797
- /**/
798
- echo '</tr>' . "\n";
799
- echo '<tr>' . "\n";
800
- /**/
801
- echo '<td>' . "\n";
802
- echo '<input type="text" name="ws_plugin__s2member_level2_ptags" id="ws-plugin--s2member-level2-ptags" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_ptags"]) . '" /><br />' . "\n";
803
- echo 'Tags in comma delimited format. Example: <code>premium,restricted</code> — or you can type: <code>all</code>.' . "\n";
804
- echo '</td>' . "\n";
805
- /**/
806
- echo '</tr>' . "\n";
807
- echo '<tr>' . "\n";
808
- /**/
809
- echo '<th>' . "\n";
810
- echo '<label for="ws-plugin--s2member-level3-ptags">' . "\n";
811
- echo 'Tags That Require Level #3 Or Higher:' . "\n";
812
- echo '</label>' . "\n";
813
- echo '</th>' . "\n";
814
- /**/
815
- echo '</tr>' . "\n";
816
- echo '<tr>' . "\n";
817
- /**/
818
- echo '<td>' . "\n";
819
- echo '<input type="text" name="ws_plugin__s2member_level3_ptags" id="ws-plugin--s2member-level3-ptags" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_ptags"]) . '" /><br />' . "\n";
820
- echo 'Tags in comma delimited format. Example: <code>premium,restricted</code> — or you can type: <code>all</code>.' . "\n";
821
- echo '</td>' . "\n";
822
- /**/
823
- echo '</tr>' . "\n";
824
- echo '<tr>' . "\n";
825
- /**/
826
- echo '<th>' . "\n";
827
- echo '<label for="ws-plugin--s2member-level4-ptags">' . "\n";
828
- echo 'Tags That Require Highest Level #4:' . "\n";
829
- echo '</label>' . "\n";
830
- echo '</th>' . "\n";
831
- /**/
832
- echo '</tr>' . "\n";
833
- echo '<tr>' . "\n";
834
- /**/
835
- echo '<td>' . "\n";
836
- echo '<input type="text" name="ws_plugin__s2member_level4_ptags" id="ws-plugin--s2member-level4-ptags" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_ptags"]) . '" /><br />' . "\n";
837
- echo 'Tags in comma delimited format. Example: <code>premium,restricted</code> — or you can type: <code>all</code>.' . "\n";
838
- echo '</td>' . "\n";
839
- /**/
840
- echo '</tr>' . "\n";
841
- echo '</tbody>' . "\n";
842
- echo '</table>' . "\n";
843
- echo '</div>' . "\n";
844
- /**/
845
- echo '</div>' . "\n";
846
- /**/
847
- echo '<div class="ws-menu-page-group" title="Category Access Restrictions">' . "\n";
848
- /**/
849
- echo '<div class="ws-menu-page-section ws-plugin--s2member-category-level-access-section">' . "\n";
850
- echo '<h3>Category Level Access Restrictions ( optional )</h3>' . "\n";
851
- echo '<p>Here you can specify Categories that are restricted to certain Membership Access Levels. Category restrictions are a bit more complex. When you restrict access to a Category, it also restricts access to any child Categories it may have ( aka: sub-Categories ). In other words, restricting a Category protects that Category Archive, all of its child Category Archives, and any Posts contained within the Category, or its child Categories.</p>' . "\n";
852
- /**/
853
- echo '<table class="form-table">' . "\n";
854
- echo '<tbody>' . "\n";
855
- echo '<tr>' . "\n";
856
- /**/
857
- echo '<th>' . "\n";
858
- echo '<label for="ws-plugin--s2member-level1-catgs">' . "\n";
859
- echo 'Categories That Require Level #1 Or Higher:' . "\n";
860
- echo '</label>' . "\n";
861
- echo '</th>' . "\n";
862
- /**/
863
- echo '</tr>' . "\n";
864
- echo '<tr>' . "\n";
865
- /**/
866
- echo '<td>' . "\n";
867
- echo '<input type="text" name="ws_plugin__s2member_level1_catgs" id="ws-plugin--s2member-level1-catgs" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_catgs"]) . '" /><br />' . "\n";
868
- echo 'Category IDs in comma delimited format. Example: <code>1,2,3,34,8,21</code> — or you can type: <code>all</code>.' . "\n";
869
- echo '</td>' . "\n";
870
- /**/
871
- echo '</tr>' . "\n";
872
- echo '<tr>' . "\n";
873
- /**/
874
- echo '<th>' . "\n";
875
- echo '<label for="ws-plugin--s2member-level2-catgs">' . "\n";
876
- echo 'Categories That Require Level #2 Or Higher:' . "\n";
877
- echo '</label>' . "\n";
878
- echo '</th>' . "\n";
879
- /**/
880
- echo '</tr>' . "\n";
881
- echo '<tr>' . "\n";
882
- /**/
883
- echo '<td>' . "\n";
884
- echo '<input type="text" name="ws_plugin__s2member_level2_catgs" id="ws-plugin--s2member-level2-catgs" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_catgs"]) . '" /><br />' . "\n";
885
- echo 'Category IDs in comma delimited format. Example: <code>1,2,3,34,8,21</code> — or you can type: <code>all</code>.' . "\n";
886
- echo '</td>' . "\n";
887
- /**/
888
- echo '</tr>' . "\n";
889
- echo '<tr>' . "\n";
890
- /**/
891
- echo '<th>' . "\n";
892
- echo '<label for="ws-plugin--s2member-level3-catgs">' . "\n";
893
- echo 'Categories That Require Level #3 Or Higher:' . "\n";
894
- echo '</label>' . "\n";
895
- echo '</th>' . "\n";
896
- /**/
897
- echo '</tr>' . "\n";
898
- echo '<tr>' . "\n";
899
- /**/
900
- echo '<td>' . "\n";
901
- echo '<input type="text" name="ws_plugin__s2member_level3_catgs" id="ws-plugin--s2member-level3-catgs" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_catgs"]) . '" /><br />' . "\n";
902
- echo 'Category IDs in comma delimited format. Example: <code>1,2,3,34,8,21</code> — or you can type: <code>all</code>.' . "\n";
903
- echo '</td>' . "\n";
904
- /**/
905
- echo '</tr>' . "\n";
906
- echo '<tr>' . "\n";
907
- /**/
908
- echo '<th>' . "\n";
909
- echo '<label for="ws-plugin--s2member-level4-catgs">' . "\n";
910
- echo 'Categories That Require Highest Level #4:' . "\n";
911
- echo '</label>' . "\n";
912
- echo '</th>' . "\n";
913
- /**/
914
- echo '</tr>' . "\n";
915
- echo '<tr>' . "\n";
916
- /**/
917
- echo '<td>' . "\n";
918
- echo '<input type="text" name="ws_plugin__s2member_level4_catgs" id="ws-plugin--s2member-level4-catgs" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_catgs"]) . '" /><br />' . "\n";
919
- echo 'Category IDs in comma delimited format. Example: <code>1,2,3,34,8,21</code> — or you can type: <code>all</code>.' . "\n";
920
- echo '</td>' . "\n";
921
- /**/
922
- echo '</tr>' . "\n";
923
- echo '</tbody>' . "\n";
924
- echo '</table>' . "\n";
925
- echo '</div>' . "\n";
926
- /**/
927
- echo '</div>' . "\n";
928
- /**/
929
- echo '<div class="ws-menu-page-group" title="URI Access Restrictions">' . "\n";
930
- /**/
931
- echo '<div class="ws-menu-page-section ws-plugin--s2member-uri-level-access-section">' . "\n";
932
- echo '<h3>URI Level Access Restrictions ( optional )</h3>' . "\n";
933
- echo '<p>Here you can specify URIs ( or word fragments found in URIs ) that are restricted to certain Membership Access Levels. Control over URIs is a little more complex. This section is intended for advanced webmasters only. That being said, here are the basics... A REQUEST_URI, is the portion of the URL that comes after the domain. This is a URL <code>http://www.example.com/path/to/file.php</code>, and this is the URI: <code>/path/to/file.php</code>.</p>' . "\n";
934
- echo '<p>In the fields below, you can provide a list ( one per line ) of URIs on your site that should be off-limits based on Membership Level. You can also use word fragments instead of a full URI. If a word fragment is found anywhere in the URI, it will be protected. Wildcards and other regex patterns are not supported here, and therefore you don\'t need to escape special characters or anything. Please note, these ARE caSe sensitive. You must be specific with respect to case sensitivity. The word fragment <code>some-path/</code> would NOT match a URI that contains <code>some-Path/</code>. <em>A couple of <a href="#" onclick="alert(\'URI Replacement Codes:\\n\\n%%current_user_login%% = The current User\\\'s login ( their Username, lowercase ).\\n%%current_user_ID%% = The current User\\\'s ID.\\n\\nFor example, if you\\\'re using BuddyPress, and want to protect BuddyPress Groups, you could add URI protection, like this: /members/%%current_user_login%%/groups/\\n\\nAdditional Replacement Codes can be added through custom programming. Use: add_filter(\\\'s2member_fill_ruri_level_access_rc_vars\\\', \\\'my_filter\\\');\'); return false;">Replacement Codes</a> are also supported here.</em></p>' . "\n";
935
- /**/
936
- echo '<table class="form-table">' . "\n";
937
- echo '<tbody>' . "\n";
938
- echo '<tr>' . "\n";
939
- /**/
940
- echo '<th>' . "\n";
941
- echo '<label for="ws-plugin--s2member-level1-ruris">' . "\n";
942
- echo 'URIs That Require Level #1 Or Higher:' . "\n";
943
- echo '</label>' . "\n";
944
- echo '</th>' . "\n";
945
- /**/
946
- echo '</tr>' . "\n";
947
- echo '<tr>' . "\n";
948
- /**/
949
- echo '<td>' . "\n";
950
- echo '<textarea name="ws_plugin__s2member_level1_ruris" id="ws-plugin--s2member-level1-ruris" rows="3" wrap="off" spellcheck="false">' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_ruris"]) . '</textarea><br />' . "\n";
951
- echo 'URIs and/or word fragments found in URIs. One per line please.' . "\n";
952
- echo '</td>' . "\n";
953
- /**/
954
- echo '</tr>' . "\n";
955
- echo '<tr>' . "\n";
956
- /**/
957
- echo '<th>' . "\n";
958
- echo '<label for="ws-plugin--s2member-level2-ruris">' . "\n";
959
- echo 'URIs That Require Level #2 Or Higher:' . "\n";
960
- echo '</label>' . "\n";
961
- echo '</th>' . "\n";
962
- /**/
963
- echo '</tr>' . "\n";
964
- echo '<tr>' . "\n";
965
- /**/
966
- echo '<td>' . "\n";
967
- echo '<textarea name="ws_plugin__s2member_level2_ruris" id="ws-plugin--s2member-level2-ruris" rows="3" wrap="off" spellcheck="false">' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_ruris"]) . '</textarea><br />' . "\n";
968
- echo 'URIs and/or word fragments found in URIs. One per line please.' . "\n";
969
- echo '</td>' . "\n";
970
- /**/
971
- echo '</tr>' . "\n";
972
- echo '<tr>' . "\n";
973
- /**/
974
- echo '<th>' . "\n";
975
- echo '<label for="ws-plugin--s2member-level3-ruris">' . "\n";
976
- echo 'URIs That Require Level #3 Or Higher:' . "\n";
977
- echo '</label>' . "\n";
978
- echo '</th>' . "\n";
979
- /**/
980
- echo '</tr>' . "\n";
981
- echo '<tr>' . "\n";
982
- /**/
983
- echo '<td>' . "\n";
984
- echo '<textarea name="ws_plugin__s2member_level3_ruris" id="ws-plugin--s2member-level3-ruris" rows="3" wrap="off" spellcheck="false">' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_ruris"]) . '</textarea><br />' . "\n";
985
- echo 'URIs and/or word fragments found in URIs. One per line please.' . "\n";
986
- echo '</td>' . "\n";
987
- /**/
988
- echo '</tr>' . "\n";
989
- echo '<tr>' . "\n";
990
- /**/
991
- echo '<th>' . "\n";
992
- echo '<label for="ws-plugin--s2member-level4-ruris">' . "\n";
993
- echo 'URIs That Require Highest Level #4:' . "\n";
994
- echo '</label>' . "\n";
995
- echo '</th>' . "\n";
996
- /**/
997
- echo '</tr>' . "\n";
998
- echo '<tr>' . "\n";
999
- /**/
1000
- echo '<td>' . "\n";
1001
- echo '<textarea name="ws_plugin__s2member_level4_ruris" id="ws-plugin--s2member-level4-ruris" rows="3" wrap="off" spellcheck="false">' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_ruris"]) . '</textarea><br />' . "\n";
1002
- echo 'URIs and/or word fragments found in URIs. One per line please.' . "\n";
1003
- echo '</td>' . "\n";
1004
- /**/
1005
- echo '</tr>' . "\n";
1006
- echo '</tbody>' . "\n";
1007
- echo '</table>' . "\n";
1008
- echo '</div>' . "\n";
1009
- /**/
1010
- echo '</div>' . "\n";
1011
- /**/
1012
- echo '<div class="ws-menu-page-group" title="Specific Post/Page Access Restrictions">' . "\n";
1013
- /**/
1014
- echo '<div class="ws-menu-page-section ws-plugin--s2member-spage-access-section">' . "\n";
1015
- echo '<h3>Specific Post/Page Access Restrictions ( optional )</h3>' . "\n";
1016
- 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";
1017
- 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";
1018
- 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.</p>' . "\n";
1019
- echo '<p>Very simple. All you do is protect the Specific Post/Page IDs that are being sold on your site. Then, you can go to <code>s2Member -> PayPal® Buttons -> Specific Post/Page</code> to generate "Buy Now" Buttons that you can insert into your WordPress® Editor, and make available on your site. The Button Generator for s2Member, will even let you Package Additional Posts/Pages together into one transaction.</p>' . "\n";
1020
- /**/
1021
- echo '<table class="form-table">' . "\n";
1022
- echo '<tbody>' . "\n";
1023
- echo '<tr>' . "\n";
1024
- /**/
1025
- echo '<th>' . "\n";
1026
- echo '<label for="ws-plugin--s2member-specific-ids">' . "\n";
1027
- echo 'Specific Post/Page IDs Being Sold On Your Site:' . "\n";
1028
- echo '</label>' . "\n";
1029
- echo '</th>' . "\n";
1030
- /**/
1031
- echo '</tr>' . "\n";
1032
- echo '<tr>' . "\n";
1033
- /**/
1034
- echo '<td>' . "\n";
1035
- echo '<input type="text" name="ws_plugin__s2member_specific_ids" id="ws-plugin--s2member-specific-ids" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"]) . '" /><br />' . "\n";
1036
- echo 'Post/Page IDs in comma delimited format. Example: <code>1,2,3,34,8,21</code> * Note... the word <code>all</code> does NOT work here. Also, please be careful not to create a conflict with other Access Restrictions. If you are going to sell Specific Post/Page Access, you should enter specific Post/Page IDs here; and <strong>make SURE that you\'ve NOT already protected any of these Posts/Pages with Member Level Access Restrictions</strong>. In other words, if you configure s2Member, in such as a way, that a Post/Page requires Membership Level Access, you cannot sell that same Post/Page through Specific Post/Page Access. Doing so, would create a conflict. Customers that purchased Specific Post/Page Access, would be unable to access the Post/Page - without also having a Membership. Not good. So be careful with this.' . "\n";
1037
- echo '</td>' . "\n";
1038
- /**/
1039
- echo '</tr>' . "\n";
1040
- echo '</tbody>' . "\n";
1041
- echo '</table>' . "\n";
1042
- echo '</div>' . "\n";
1043
- /**/
1044
- echo '</div>' . "\n";
1045
- /**/
1046
- echo '<div class="ws-menu-page-group" title="Unique IP Access Restrictions">' . "\n";
1047
- /**/
1048
- echo '<div class="ws-menu-page-section ws-plugin--s2member-ip-restrictions-section">' . "\n";
1049
- echo '<h3>Unique IP Access Restrictions ( prevents username/link sharing )</h3>' . "\n";
1050
- echo '<p>As with any membership system, it is possible for one Member to signup, and then share their Username with someone else; or even post it online for the whole world to see. This is known as Link Sharing ( aka: Username Sharing ). It is not likely that you\'ll be attacked in this way, but it\'s still a good idea to protect your system; just in case somebody tries this. s2Member\'s IP Restrictions, work for both Membership Level Access ( account logins ), and also for Specific Post/Page Access. In both cases, the rules are simple. A single Username, and/or Access Link is only valid for a certain number of unique IP addresses. Once that limit is reached, s2Member assumes there has been a security breach. At that time, s2Member will place a temporary ban ( preventing access ) to a Specific Post/Page, or to an account associated with a particular Username. This temporary ban, will ONLY affect the offending Link and/or Username associated with the security breach.</p>' . "\n";
1051
- echo '<table class="form-table">' . "\n";
1052
- echo '<tbody>' . "\n";
1053
- echo '<tr>' . "\n";
1054
- /**/
1055
- echo '<th>' . "\n";
1056
- echo '<label for="ws-plugin--s2member-max-ip-restriction">' . "\n";
1057
- echo 'Maximum Unique IP Addresses Allowed:' . "\n";
1058
- echo '</label>' . "\n";
1059
- echo '</th>' . "\n";
1060
- /**/
1061
- echo '</tr>' . "\n";
1062
- echo '<tr>' . "\n";
1063
- /**/
1064
- echo '<td>' . "\n";
1065
- echo '<select name="ws_plugin__s2member_max_ip_restriction" id="ws-plugin--s2member-max-ip-restriction">' . "\n";
1066
- echo '<option value="2"' . (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction"] == 2) ? ' selected="selected"' : '') . '>Allow up to 2 different IPs per Customer</option>' . "\n";
1067
- echo '<option value="3"' . (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction"] == 3) ? ' selected="selected"' : '') . '>Allow up to 3 different IPs per Customer</option>' . "\n";
1068
- echo '<option value="4"' . (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction"] == 4) ? ' selected="selected"' : '') . '>Allow up to 4 different IPs per Customer</option>' . "\n";
1069
- echo '<option value="5"' . (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction"] == 5) ? ' selected="selected"' : '') . '>Allow up to 5 different IPs per Customer</option>' . "\n";
1070
- echo '<option value="10"' . ((!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction"] == 10) ? ' selected="selected"' : '') . '>Allow up to 10 different IPs per Customer</option>' . "\n";
1071
- echo '<option value="20"' . ((!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction"] == 20) ? ' selected="selected"' : '') . '>Allow up to 20 different IPs per Customer</option>' . "\n";
1072
- echo '<option value="30"' . ((!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction"] == 30) ? ' selected="selected"' : '') . '>Allow up to 30 different IPs per Customer</option>' . "\n";
1073
- echo '<option value="40"' . ((!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction"] == 40) ? ' selected="selected"' : '') . '>Allow up to 40 different IPs per Customer</option>' . "\n";
1074
- echo '<option value="50"' . ((!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction"] == 50) ? ' selected="selected"' : '') . '>Allow up to 50 different IPs per Customer</option>' . "\n";
1075
- echo '<option value="75"' . ((!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction"] == 75) ? ' selected="selected"' : '') . '>Allow up to 75 different IPs per Customer</option>' . "\n";
1076
- echo '<option value="100"' . ((!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction"] == 100) ? ' selected="selected"' : '') . '>Allow up to 100 different IPs per Customer</option>' . "\n";
1077
- echo '</select><br />' . "\n";
1078
- echo '</td>' . "\n";
1079
- /**/
1080
- echo '</tr>' . "\n";
1081
- echo '<tr>' . "\n";
1082
- /**/
1083
- echo '<th>' . "\n";
1084
- echo '<label for="ws-plugin--s2member-max-ip-restriction-time">' . "\n";
1085
- echo 'Security Breach Timeout Period:' . "\n";
1086
- echo '</label>' . "\n";
1087
- echo '</th>' . "\n";
1088
- /**/
1089
- echo '</tr>' . "\n";
1090
- echo '<tr>' . "\n";
1091
- /**/
1092
- echo '<td>' . "\n";
1093
- echo '<select name="ws_plugin__s2member_max_ip_restriction_time" id="ws-plugin--s2member-max-ip-restriction-time">' . "\n";
1094
- echo '<option value="900"' . (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction_time"] == 900) ? ' selected="selected"' : '') . '>If limit is exceeded ( punish for 15 mins )</option>' . "\n";
1095
- echo '<option value="1800"' . (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction_time"] == 1800) ? ' selected="selected"' : '') . '>If limit is exceeded ( punish for 30 mins )</option>' . "\n";
1096
- echo '<option value="3600"' . (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction_time"] == 3600) ? ' selected="selected"' : '') . '>If limit is exceeded ( punish for 1 hour )</option>' . "\n";
1097
- echo '<option value="7200"' . ((!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction_time"] == 7200) ? ' selected="selected"' : '') . '>If limit is exceeded ( punish for 2 hours )</option>' . "\n";
1098
- echo '<option value="14400"' . ((!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction_time"] == 14400) ? ' selected="selected"' : '') . '>If limit is exceeded ( punish for 4 hours )</option>' . "\n";
1099
- echo '<option value="21600"' . ((!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction_time"] == 21600) ? ' selected="selected"' : '') . '>If limit is exceeded ( punish for 6 hours )</option>' . "\n";
1100
- echo '<option value="28800"' . ((!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction_time"] == 28800) ? ' selected="selected"' : '') . '>If limit is exceeded ( punish for 8 hours )</option>' . "\n";
1101
- echo '<option value="43200"' . ((!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction_time"] == 43200) ? ' selected="selected"' : '') . '>If limit is exceeded ( punish for 12 hours )</option>' . "\n";
1102
- echo '<option value="86400"' . ((!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction_time"] == 86400) ? ' selected="selected"' : '') . '>If limit is exceeded ( punish for 24 hours )</option>' . "\n";
1103
- echo '<option value="172800"' . ((!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction_time"] == 172800) ? ' selected="selected"' : '') . '>If limit is exceeded ( punish for 2 days )</option>' . "\n";
1104
- echo '<option value="345600"' . ((!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction_time"] == 345600) ? ' selected="selected"' : '') . '>If limit is exceeded ( punish for 4 days )</option>' . "\n";
1105
- echo '<option value="604800"' . ((!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction_time"] == 604800) ? ' selected="selected"' : '') . '>If limit is exceeded ( punish for 1 week )</option>' . "\n";
1106
- echo '</select><br />' . "\n";
1107
- echo 'When/if you change this, it will take X amount of time to update; based on your previous configuration.' . "\n";
1108
- echo '</td>' . "\n";
1109
- /**/
1110
- echo '</tr>' . "\n";
1111
- echo '</tbody>' . "\n";
1112
- echo '</table>' . "\n";
1113
- echo '</div>' . "\n";
1114
- /**/
1115
- echo '</div>' . "\n";
1116
- /**/
1117
- echo '<div class="ws-menu-page-group" title="De-Activation Safeguards">' . "\n";
1118
- /**/
1119
- echo '<div class="ws-menu-page-section ws-plugin--s2member-deactivation-section">' . "\n";
1120
- echo '<h3>De-Activation Safeguards ( optional, for safeguarding s2Member data )</h3>' . "\n";
1121
- echo '<p>By default, s2Member will cleanup ( erase ) all of it\'s Roles, Capabilities, and your Configuration Options when/if you de-activate it from the Plugins Menu in WordPress®. If you would like to Safeguard all of this information, in case s2Member is de-activated inadvertently, you can disable the De-Activation Routines for s2Member.</p>' . "\n";
1122
- echo '<table class="form-table">' . "\n";
1123
- echo '<tbody>' . "\n";
1124
- echo '<tr>' . "\n";
1125
- /**/
1126
- echo '<th>' . "\n";
1127
- echo '<label for="ws-plugin--s2member-run-deactivation-routines">' . "\n";
1128
- echo 'Run De-Activation Routines for s2Member?' . "\n";
1129
- echo '</label>' . "\n";
1130
- echo '</th>' . "\n";
1131
- /**/
1132
- echo '</tr>' . "\n";
1133
- echo '<tr>' . "\n";
1134
- /**/
1135
- echo '<td>' . "\n";
1136
- echo '<select name="ws_plugin__s2member_run_deactivation_routines" id="ws-plugin--s2member-run-deactivation-routines">' . "\n";
1137
- echo '<option value="1"' . (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["run_deactivation_routines"]) ? ' selected="selected"' : '') . '>Yes ( erase all s2Member data/options on de-activation )</option>' . "\n";
1138
- echo '<option value="0"' . ((!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["run_deactivation_routines"]) ? ' selected="selected"' : '') . '>No ( safeguard all s2Member data/options )</option>' . "\n";
1139
- echo '</select><br />' . "\n";
1140
- echo 'It is recommended that you Safeguard all s2Member data/options on your system.' . "\n";
1141
- echo '</td>' . "\n";
1142
- /**/
1143
- echo '</tr>' . "\n";
1144
- echo '</tbody>' . "\n";
1145
- echo '</table>' . "\n";
1146
- echo '</div>' . "\n";
1147
- /**/
1148
- echo '</div>' . "\n";
32
  echo '<input type="hidden" name="ws_plugin__s2member_options_save" id="ws-plugin--s2member-options-save" value="' . esc_attr (wp_create_nonce ("ws-plugin--s2member-options-save")) . '" />' . "\n";
33
  echo '<input type="hidden" name="ws_plugin__s2member_configured" id="ws-plugin--s2member-configured" value="1" />' . "\n";
34
  /**/
35
+ do_action ("ws_plugin__s2member_during_options_page_before_left_sections", get_defined_vars ());
36
+ /**/
37
+ if (apply_filters ("ws_plugin__s2member_during_options_page_during_left_sections_display_security", true, get_defined_vars ()))
38
+ {
39
+ do_action ("ws_plugin__s2member_during_options_page_during_left_sections_before_security", get_defined_vars ());
40
+ /**/
41
+ echo '<div class="ws-menu-page-group" title="Security Encryption Key">' . "\n";
42
+ /**/
43
+ echo '<div class="ws-menu-page-section ws-plugin--s2member-security-section">' . "\n";
44
+ echo '<h3>Security Encryption Key ( optional, for tighter security )</h3>' . "\n";
45
+ echo '<p>Just like WordPress®, s2Member is open-source software. Which is wonderful. However, this also makes it possible for anyone to grab a copy of the software, and try to learn their way around its security measures. In order to keep your installation of s2Member unique/secure, you should configure a Security Encryption Key. s2Member will use your Security Encryption Key to protect itself against hackers. It does this by encrypting all sensitive information with your Key. A Security Encryption Key is unique to your installation.</p>' . "\n";
46
+ echo '<p>Once you configure this, you do NOT want to change it; not ever. In fact, it is a VERY good idea to keep this backed up in a safe place, just in case you need to move your site, or re-install s2Member in the future. Some of the sensitive data that s2Member stores, will be encrypted with this Key. If you change it, that data can no longer be read, even by s2Member itself. In other words, don\'t use s2Member for six months, then decide to change your Key. That would break your installation. You configure this once, for each installation of s2Member; and you NEVER change it.</p>' . "\n";
47
+ do_action ("ws_plugin__s2member_during_options_page_during_left_sections_during_security", get_defined_vars ());
48
+ /**/
49
+ echo '<table class="form-table">' . "\n";
50
+ echo '<tbody>' . "\n";
51
+ echo '<tr>' . "\n";
52
+ /**/
53
+ echo '<th>' . "\n";
54
+ echo '<label for="ws-plugin--s2member-sec-encryption-key">' . "\n";
55
+ echo 'Security Encryption Key:' . (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sec_encryption_key"]) ? ' ( <a href="#" onclick="ws_plugin__s2member_enableSecurityKey();" title="( not recommended )">edit key</a> )' : ' ( <a href="#" onclick="ws_plugin__s2member_generateSecurityKey();" title="Insert an auto-generated Key. ( recommended )">auto-generate</a> )') . "\n";
56
+ echo '</label>' . "\n";
57
+ echo '</th>' . "\n";
58
+ /**/
59
+ echo '</tr>' . "\n";
60
+ echo '<tr>' . "\n";
61
+ /**/
62
+ echo '<td>' . "\n";
63
+ echo '<input type="text" name="ws_plugin__s2member_sec_encryption_key" id="ws-plugin--s2member-sec-encryption-key" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sec_encryption_key"]) . '" maxlength="256" autocomplete="off"' . (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sec_encryption_key"]) ? ' disabled="disabled"' : '') . ' />' . "\n";
64
+ echo (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sec_encryption_key"]) ? '<br />This may contain letters, numbers, spaces; even punctuation. Up to 256 characters.<br /><em>Ex: <code>' . esc_html (strtoupper (ws_plugin__s2member_random_str_gen (56))) . '</code></em>' . "\n" : '';
65
+ echo (count ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sec_encryption_key_history"]) > 1) ? '<br /><a href="#" onclick="ws_plugin__s2member_securityKeyHistory();">Click here</a> for a history of your last 10 Encryption Keys.<div id="ws-plugin--s2member-sec-encryption-key-history" style="display:none;"><code>' . implode ('</code><br /><code>', $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sec_encryption_key_history"]) . '</code></div>' . "\n" : '';
66
+ echo '</td>' . "\n";
67
+ /**/
68
+ echo '</tr>' . "\n";
69
+ echo '</tbody>' . "\n";
70
+ echo '</table>' . "\n";
71
+ echo '</div>' . "\n";
72
+ /**/
73
+ echo '</div>' . "\n";
74
+ /**/
75
+ do_action ("ws_plugin__s2member_during_options_page_during_left_sections_after_security", get_defined_vars ());
76
+ }
77
+ /**/
78
+ if (apply_filters ("ws_plugin__s2member_during_options_page_during_left_sections_display_email_config", true, get_defined_vars ()))
79
+ {
80
+ do_action ("ws_plugin__s2member_during_options_page_during_left_sections_before_email_config", get_defined_vars ());
81
+ /**/
82
+ echo '<div class="ws-menu-page-group" title="Email Configuration">' . "\n";
83
+ /**/
84
+ echo '<div class="ws-menu-page-section ws-plugin--s2member-email-section">' . "\n";
85
+ echo '<h3>EMail From: ' . esc_html ('"Name" <address>') . '</h3>' . "\n";
86
+ echo '<p>This is the name/address that will appear in outgoing email notifications sent by the s2Member plugin.</p>' . "\n";
87
+ do_action ("ws_plugin__s2member_during_options_page_during_left_sections_during_email_config", get_defined_vars ());
88
+ /**/
89
+ echo '<table class="form-table">' . "\n";
90
+ echo '<tbody>' . "\n";
91
+ echo '<tr>' . "\n";
92
+ /**/
93
+ echo '<th>' . "\n";
94
+ echo '<label for="ws-plugin--s2member-reg-email-from-name">' . "\n";
95
+ echo 'EMail From Name:' . "\n";
96
+ echo '</label>' . "\n";
97
+ echo '</th>' . "\n";
98
+ /**/
99
+ echo '</tr>' . "\n";
100
+ echo '<tr>' . "\n";
101
+ /**/
102
+ echo '<td>' . "\n";
103
+ echo '<input type="text" name="ws_plugin__s2member_reg_email_from_name" id="ws-plugin--s2member-reg-email-from-name" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . '" /><br />' . "\n";
104
+ echo 'We recommend that you use the name of your site here.' . "\n";
105
+ echo '</td>' . "\n";
106
+ /**/
107
+ echo '</tr>' . "\n";
108
+ echo '<tr>' . "\n";
109
+ /**/
110
+ echo '<th>' . "\n";
111
+ echo '<label for="ws-plugin--s2member-reg-email-from-email">' . "\n";
112
+ echo 'EMail From Address:' . "\n";
113
+ echo '</label>' . "\n";
114
+ echo '</th>' . "\n";
115
+ /**/
116
+ echo '</tr>' . "\n";
117
+ echo '<tr>' . "\n";
118
+ /**/
119
+ echo '<td>' . "\n";
120
+ echo '<input type="text" name="ws_plugin__s2member_reg_email_from_email" id="ws-plugin--s2member-reg-email-from-email" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"]) . '" /><br />' . "\n";
121
+ echo 'We recommend something like: support@your-domain.com.' . "\n";
122
+ echo '</td>' . "\n";
123
+ /**/
124
+ echo '</tr>' . "\n";
125
+ echo '</tbody>' . "\n";
126
+ echo '</table>' . "\n";
127
+ echo '</div>' . "\n";
128
+ /**/
129
+ echo '</div>' . "\n";
130
+ /**/
131
+ do_action ("ws_plugin__s2member_during_options_page_during_left_sections_after_email_config", get_defined_vars ());
132
+ }
133
+ /**/
134
+ if (apply_filters ("ws_plugin__s2member_during_options_page_during_left_sections_display_login_registration", true, get_defined_vars ()))
135
+ {
136
+ do_action ("ws_plugin__s2member_during_options_page_during_left_sections_before_login_registration", get_defined_vars ());
137
+ /**/
138
+ echo '<div class="ws-menu-page-group" title="Login/Registration Design">' . "\n";
139
+ /**/
140
+ echo '<div class="ws-menu-page-section ws-plugin--s2member-login-registration-section">' . "\n";
141
+ echo '<h3>Login/Registration Page Customization ( required )</h3>' . "\n";
142
+ echo '<p>These settings allow you to customize the user interface for your Login / Registration Pages:<br />( <a href="' . wp_login_url () . '" target="_blank" rel="external">' . esc_html (wp_login_url ()) . '</a> )</p>' . "\n";
143
+ do_action ("ws_plugin__s2member_during_options_page_during_left_sections_during_login_registration", get_defined_vars ());
144
+ /**/
145
+ echo '<table class="form-table">' . "\n";
146
+ echo '<tbody>' . "\n";
147
+ echo '<tr>' . "\n";
148
+ /**/
149
+ echo '<td>' . "\n";
150
+ echo '<h3>Background Settings</h3>' . "\n";
151
+ echo '<p>These settings are all focused on your Login/Registration Background.</p>' . "\n";
152
+ echo '</td>' . "\n";
153
+ /**/
154
+ echo '</tr>' . "\n";
155
+ echo '<tr>' . "\n";
156
+ /**/
157
+ echo '<th>' . "\n";
158
+ echo '<label for="ws-plugin--s2member-login-reg-background-color">' . "\n";
159
+ echo 'Background Color:' . "\n";
160
+ echo '</label>' . "\n";
161
+ echo '</th>' . "\n";
162
+ /**/
163
+ echo '</tr>' . "\n";
164
+ echo '<tr>' . "\n";
165
+ /**/
166
+ echo '<td>' . "\n";
167
+ echo '<input type="text" name="ws_plugin__s2member_login_reg_background_color" id="ws-plugin--s2member-login-reg-background-color" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_color"]) . '" /><br />' . "\n";
168
+ echo 'Set this to a 6-digit hex color code.' . "\n";
169
+ echo '</td>' . "\n";
170
+ /**/
171
+ echo '</tr>' . "\n";
172
+ echo '<tr>' . "\n";
173
+ /**/
174
+ echo '<th>' . "\n";
175
+ echo '<label for="ws-plugin--s2member-login-reg-background-image">' . "\n";
176
+ echo 'Seamless Tile Background Image:' . "\n";
177
+ echo '</label>' . "\n";
178
+ echo '</th>' . "\n";
179
+ /**/
180
+ echo '</tr>' . "\n";
181
+ echo '<tr>' . "\n";
182
+ /**/
183
+ echo '<td>' . "\n";
184
+ echo '<input type="text" name="ws_plugin__s2member_login_reg_background_image" id="ws-plugin--s2member-login-reg-background-image" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_image"]) . '" /><br />' . "\n";
185
+ echo '<input type="button" id="ws-plugin--s2member-login-reg-background-image-media-btn" value="Open Media Library" class="ws-menu-page-media-btn" rel="ws-plugin--s2member-login-reg-background-image" />' . "\n";
186
+ echo 'Set this to the URL of your Background Image. ( this is optional )<br />';
187
+ echo 'If supplied, your Background Image will be tiled.' . "\n";
188
+ echo '</td>' . "\n";
189
+ /**/
190
+ echo '</tr>' . "\n";
191
+ echo '<tr>' . "\n";
192
+ /**/
193
+ echo '<th>' . "\n";
194
+ echo '<label for="ws-plugin--s2member-login-reg-background-text-color">' . "\n";
195
+ echo 'Color of Text on top of your Background:' . "\n";
196
+ echo '</label>' . "\n";
197
+ echo '</th>' . "\n";
198
+ /**/
199
+ echo '</tr>' . "\n";
200
+ echo '<tr>' . "\n";
201
+ /**/
202
+ echo '<td>' . "\n";
203
+ echo '<input type="text" name="ws_plugin__s2member_login_reg_background_text_color" id="ws-plugin--s2member-login-reg-background-text-color" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_text_color"]) . '" /><br />' . "\n";
204
+ echo 'Set this to a 6-digit hex color code.' . "\n";
205
+ echo '</td>' . "\n";
206
+ /**/
207
+ echo '</tr>' . "\n";
208
+ echo '<tr>' . "\n";
209
+ /**/
210
+ echo '<th>' . "\n";
211
+ echo '<label for="ws-plugin--s2member-login-reg-background-text-shadow-color">' . "\n";
212
+ echo 'Shadow Color for Text on top of your Background:' . "\n";
213
+ echo '</label>' . "\n";
214
+ echo '</th>' . "\n";
215
+ /**/
216
+ echo '</tr>' . "\n";
217
+ echo '<tr>' . "\n";
218
+ /**/
219
+ echo '<td>' . "\n";
220
+ echo '<input type="text" name="ws_plugin__s2member_login_reg_background_text_shadow_color" id="ws-plugin--s2member-login-reg-background-text-shadow-color" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_text_shadow_color"]) . '" /><br />' . "\n";
221
+ echo 'Set this to a 6-digit hex color code.' . "\n";
222
+ echo '</td>' . "\n";
223
+ /**/
224
+ echo '</tr>' . "\n";
225
+ echo '<tr>' . "\n";
226
+ /**/
227
+ echo '<th>' . "\n";
228
+ echo '<label for="ws-plugin--s2member-login-reg-background-box-shadow-color">' . "\n";
229
+ echo 'Shadow Color for Boxes on top of your Background:' . "\n";
230
+ echo '</label>' . "\n";
231
+ echo '</th>' . "\n";
232
+ /**/
233
+ echo '</tr>' . "\n";
234
+ echo '<tr>' . "\n";
235
+ /**/
236
+ echo '<td>' . "\n";
237
+ echo '<input type="text" name="ws_plugin__s2member_login_reg_background_box_shadow_color" id="ws-plugin--s2member-login-reg-background-box-shadow-color" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"]) . '" /><br />' . "\n";
238
+ echo 'Set this to a 6-digit hex color code.' . "\n";
239
+ echo '</td>' . "\n";
240
+ /**/
241
+ echo '</tr>' . "\n";
242
+ echo '<tr>' . "\n";
243
+ /**/
244
+ echo '<td>' . "\n";
245
+ echo '<h3>Logo Image Settings</h3>' . "\n";
246
+ echo '<p>These settings are all focused on your Login/Registration Logo.</p>' . "\n";
247
+ echo '</td>' . "\n";
248
+ /**/
249
+ echo '</tr>' . "\n";
250
+ echo '<tr>' . "\n";
251
+ /**/
252
+ echo '<th>' . "\n";
253
+ echo '<label for="ws-plugin--s2member-login-reg-logo-src">' . "\n";
254
+ echo 'Logo Image Location:' . "\n";
255
+ echo '</label>' . "\n";
256
+ echo '</th>' . "\n";
257
+ /**/
258
+ echo '</tr>' . "\n";
259
+ echo '<tr>' . "\n";
260
+ /**/
261
+ echo '<td>' . "\n";
262
+ echo '<input type="text" name="ws_plugin__s2member_login_reg_logo_src" id="ws-plugin--s2member-login-reg-logo-src" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_logo_src"]) . '" /><br />' . "\n";
263
+ echo '<input type="button" id="ws-plugin--s2member-login-reg-logo-src-media-btn" value="Open Media Library" class="ws-menu-page-media-btn" rel="ws-plugin--s2member-login-reg-logo-src" />' . "\n";
264
+ echo 'Set this to the URL of your Logo Image.<br />' . "\n";
265
+ echo 'Suggested size is around 500 x 100.' . "\n";
266
+ echo '</td>' . "\n";
267
+ /**/
268
+ echo '</tr>' . "\n";
269
+ echo '<tr>' . "\n";
270
+ /**/
271
+ echo '<th>' . "\n";
272
+ echo '<label for="ws-plugin--s2member-login-reg-logo-src-width">' . "\n";
273
+ echo 'Logo Image Width:' . "\n";
274
+ echo '</label>' . "\n";
275
+ echo '</th>' . "\n";
276
+ /**/
277
+ echo '</tr>' . "\n";
278
+ echo '<tr>' . "\n";
279
+ /**/
280
+ echo '<td>' . "\n";
281
+ echo '<input type="text" name="ws_plugin__s2member_login_reg_logo_src_width" id="ws-plugin--s2member-login-reg-logo-src-width" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_logo_src_width"]) . '" /><br />' . "\n";
282
+ echo 'The pixel Width of your Logo Image. <em>* This ALSO affects the overall width of your Login/Registration forms. If you want wider form fields, use a wider Logo.</em>' . "\n";
283
+ echo '</td>' . "\n";
284
+ /**/
285
+ echo '</tr>' . "\n";
286
+ echo '<tr>' . "\n";
287
+ /**/
288
+ echo '<th>' . "\n";
289
+ echo '<label for="ws-plugin--s2member-login-reg-logo-src-height">' . "\n";
290
+ echo 'Logo Image Height:' . "\n";
291
+ echo '</label>' . "\n";
292
+ echo '</th>' . "\n";
293
+ /**/
294
+ echo '</tr>' . "\n";
295
+ echo '<tr>' . "\n";
296
+ /**/
297
+ echo '<td>' . "\n";
298
+ echo '<input type="text" name="ws_plugin__s2member_login_reg_logo_src_height" id="ws-plugin--s2member-login-reg-logo-src-height" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_logo_src_height"]) . '" /><br />' . "\n";
299
+ echo 'The pixel Height of your Logo Image.' . "\n";
300
+ echo '</td>' . "\n";
301
+ /**/
302
+ echo '</tr>' . "\n";
303
+ echo '<tr>' . "\n";
304
+ /**/
305
+ echo '<th>' . "\n";
306
+ echo '<label for="ws-plugin--s2member-login-reg-logo-url">' . "\n";
307
+ echo 'Logo Image Click URL:' . "\n";
308
+ echo '</label>' . "\n";
309
+ echo '</th>' . "\n";
310
+ /**/
311
+ echo '</tr>' . "\n";
312
+ echo '<tr>' . "\n";
313
+ /**/
314
+ echo '<td>' . "\n";
315
+ echo '<input type="text" name="ws_plugin__s2member_login_reg_logo_url" id="ws-plugin--s2member-login-reg-logo-url" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_logo_url"]) . '" /><br />' . "\n";
316
+ echo 'Set this to the Click URL for your Logo Image.' . "\n";
317
+ echo '</td>' . "\n";
318
+ /**/
319
+ echo '</tr>' . "\n";
320
+ echo '<tr>' . "\n";
321
+ /**/
322
+ echo '<th>' . "\n";
323
+ echo '<label for="ws-plugin--s2member-login-reg-logo-title">' . "\n";
324
+ echo 'Logo Image Title Attribute:' . "\n";
325
+ echo '</label>' . "\n";
326
+ echo '</th>' . "\n";
327
+ /**/
328
+ echo '</tr>' . "\n";
329
+ echo '<tr>' . "\n";
330
+ /**/
331
+ echo '<td>' . "\n";
332
+ echo '<input type="text" name="ws_plugin__s2member_login_reg_logo_title" id="ws-plugin--s2member-login-reg-logo-title" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_logo_title"]) . '" /><br />' . "\n";
333
+ echo 'Used as the <code>title=""</code> attribute for your Logo Image.' . "\n";
334
+ echo '</td>' . "\n";
335
+ /**/
336
+ echo '</tr>' . "\n";
337
+ echo '</tbody>' . "\n";
338
+ echo '</table>' . "\n";
339
+ echo '</div>' . "\n";
340
+ /**/
341
+ echo '</div>' . "\n";
342
+ /**/
343
+ do_action ("ws_plugin__s2member_during_options_page_during_left_sections_after_login_registration", get_defined_vars ());
344
+ }
345
+ /**/
346
+ if (apply_filters ("ws_plugin__s2member_during_options_page_during_left_sections_display_custom_reg_fields", true, get_defined_vars ()))
347
+ {
348
+ do_action ("ws_plugin__s2member_during_options_page_during_left_sections_before_custom_reg_fields", get_defined_vars ());
349
+ /**/
350
+ echo '<div class="ws-menu-page-group" title="Custom Registration Fields">' . "\n";
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";
363
+ echo '<tbody>' . "\n";
364
+ echo '<tr>' . "\n";
365
+ /**/
366
+ echo '<th>' . "\n";
367
+ echo '<label for="ws-plugin--s2member-custom-reg-fields">' . "\n";
368
+ echo 'Custom Registration Fields:' . "\n";
369
+ echo '</label>' . "\n";
370
+ echo '</th>' . "\n";
371
+ /**/
372
+ echo '</tr>' . "\n";
373
+ echo '<tr>' . "\n";
374
+ /**/
375
+ echo '<td>' . "\n";
376
+ echo '<input type="text" name="ws_plugin__s2member_custom_reg_fields" id="ws-plugin--s2member-custom-reg-fields" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) . '" /><br />' . "\n";
377
+ echo 'Comma delimited please. <em>Ex: <code>*Company*, *Website URL*, Street Address, City, State, Zip Code, Phone</code></em>' . "\n";
378
+ echo '</td>' . "\n";
379
+ /**/
380
+ echo '</tr>' . "\n";
381
+ echo '<tr>' . "\n";
382
+ /**/
383
+ echo '<th>' . "\n";
384
+ echo '<label for="ws-plugin--s2member-custom-reg-password">' . "\n";
385
+ echo 'Allow Custom Passwords during Registration?' . "\n";
386
+ echo '</label>' . "\n";
387
+ echo '</th>' . "\n";
388
+ /**/
389
+ echo '</tr>' . "\n";
390
+ echo '<tr>' . "\n";
391
+ /**/
392
+ echo '<td>' . "\n";
393
+ echo '<select name="ws_plugin__s2member_custom_reg_password" id="ws-plugin--s2member-custom-reg-password">' . "\n";
394
+ echo '<option value="0"' . ((!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_password"]) ? ' selected="selected"' : '') . '>No ( send auto-generated passwords via email; after registration )</option>' . "\n";
395
+ echo '<option value="1"' . (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_password"]) ? ' selected="selected"' : '') . '>Yes ( allow members to create their own password during registration )</option>' . "\n";
396
+ echo '</select><br />' . "\n";
397
+ echo 'Auto-generated Passwords are recommended for best security; because, this also serves as a form of email confirmation.' . "\n";
398
+ echo '</td>' . "\n";
399
+ /**/
400
+ echo '</tr>' . "\n";
401
+ echo '</tbody>' . "\n";
402
+ echo '</table>' . "\n";
403
+ echo '</div>' . "\n";
404
+ /**/
405
+ echo '</div>' . "\n";
406
+ /**/
407
+ do_action ("ws_plugin__s2member_during_options_page_during_left_sections_after_custom_reg_fields", get_defined_vars ());
408
+ }
409
+ /**/
410
+ if (apply_filters ("ws_plugin__s2member_during_options_page_during_left_sections_display_login_welcome_page", true, get_defined_vars ()))
411
+ {
412
+ do_action ("ws_plugin__s2member_during_options_page_during_left_sections_before_login_welcome_page", get_defined_vars ());
413
+ /**/
414
+ echo '<div class="ws-menu-page-group" title="Login Welcome Page">' . "\n";
415
+ /**/
416
+ echo '<div class="ws-menu-page-section ws-plugin--s2member-login-welcome-page-section">' . "\n";
417
+ echo '<h3>Login Welcome Page ( required, please customize this )</h3>' . "\n";
418
+ echo '<p>Please create and/or choose an existing Page to use as the first page Members will see after logging in.</p>' . "\n";
419
+ do_action ("ws_plugin__s2member_during_options_page_during_left_sections_during_login_welcome_page", get_defined_vars ());
420
+ /**/
421
+ echo '<table class="form-table">' . "\n";
422
+ echo '<tbody>' . "\n";
423
+ echo '<tr>' . "\n";
424
+ /**/
425
+ echo '<th>' . "\n";
426
+ echo '<label for="ws-plugin--s2member-login-welcome-page">' . "\n";
427
+ echo 'Login Welcome Page:' . "\n";
428
+ echo '</label>' . "\n";
429
+ echo '</th>' . "\n";
430
+ /**/
431
+ echo '</tr>' . "\n";
432
+ echo '<tr>' . "\n";
433
+ /**/
434
+ echo '<td>' . "\n";
435
+ echo '<select name="ws_plugin__s2member_login_welcome_page" id="ws-plugin--s2member-login-welcome-page">' . "\n";
436
+ echo '<option value="">&mdash; Select &mdash;</option>' . "\n";
437
+ foreach (($ws_plugin__s2member_temp_a = array_merge ((array)get_pages ())) as $ws_plugin__s2member_temp_o)
438
+ echo '<option value="' . esc_attr ($ws_plugin__s2member_temp_o->ID) . '"' . ((!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"] && $ws_plugin__s2member_temp_o->ID == $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]) ? ' selected="selected"' : '') . '>' . esc_html ($ws_plugin__s2member_temp_o->post_title) . '</option>' . "\n";
439
+ echo '</select><br />' . "\n";
440
+ echo 'Please choose a Page to be used as the first page Members will see after logging in. This Page can contain anything you like. We recommend the following title: <code>Welcome To Our Members Area</code>.<br /><br />' . "\n";
441
+ echo '&darr; Or, you may configure a Special Redirection URL, if you prefer. You\'ll need to type in the full URL, starting with: <code>http://</code>. <em>A couple of <a href="#" onclick="alert(\'Replacement Codes:\\n\\n%%current_user_login%% = The current User\\\'s login ( their Username, lowercase ).\\n%%current_user_ID%% = The current User\\\'s ID.\\n\\nFor example, if you\\\'re using BuddyPress, and you want to redirect Members to their BuddyPress Profile page after logging in, you would setup a Special Redirection URL, like this: ' . get_bloginfo ("url") . '/members/%%current_user_login%%/profile/\\n\\nAdditional Replacement Codes can be added through custom programming. Use: add_filter(\\\'s2member_fill_login_redirect_rc_vars\\\', \\\'my_filter\\\');\'); return false;">Replacement Codes</a> are also supported here.</em>' . "\n";
442
+ echo '<input type="text" name="ws_plugin__s2member_login_redirection_override" id="ws-plugin--s2member-login-redirection-override" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"]) . '" /><br />' . "\n";
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";
469
+ /**/
470
+ echo '</div>' . "\n";
471
+ /**/
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
+ /**/
512
+ echo '</tr>' . "\n";
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";
525
+ echo '</tbody>' . "\n";
526
+ echo '</table>' . "\n";
527
+ echo '</div>' . "\n";
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
+ /**/
555
+ echo '</tr>' . "\n";
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";
568
+ echo '</tbody>' . "\n";
569
+ echo '</table>' . "\n";
570
+ echo '</div>' . "\n";
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 ()))
578
+ {
579
+ do_action ("ws_plugin__s2member_during_options_page_during_left_sections_before_membership_levels", get_defined_vars ());
580
+ /**/
581
+ echo '<div class="ws-menu-page-group" title="Membership Levels/Labels">' . "\n";
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
+ /**/
589
+ echo '<table class="form-table">' . "\n";
590
+ echo '<tbody>' . "\n";
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";
597
+ echo '</th>' . "\n";
598
+ /**/
599
+ echo '</tr>' . "\n";
600
+ echo '<tr>' . "\n";
601
+ /**/
602
+ echo '<td>' . "\n";
603
+ echo '<input type="text" name="ws_plugin__s2member_level1_label" id="ws-plugin--s2member-level1-label" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_label"]) . '" /><br />' . "\n";
604
+ echo 'This is the Label for Membership Level 1.<br />' . "\n";
605
+ echo '</td>' . "\n";
606
+ /**/
607
+ echo '</tr>' . "\n";
608
+ echo '<tr>' . "\n";
609
+ /**/
610
+ echo '<th>' . "\n";
611
+ echo '<label for="ws-plugin--s2member-level2-label">' . "\n";
612
+ echo 'Membership Level #2 Label:' . "\n";
613
+ echo '</label>' . "\n";
614
+ echo '</th>' . "\n";
615
+ /**/
616
+ echo '</tr>' . "\n";
617
+ echo '<tr>' . "\n";
618
+ /**/
619
+ echo '<td>' . "\n";
620
+ echo '<input type="text" name="ws_plugin__s2member_level2_label" id="ws-plugin--s2member-level2-label" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_label"]) . '" /><br />' . "\n";
621
+ echo 'This is the Label for Membership Level 2.<br />' . "\n";
622
+ echo '</td>' . "\n";
623
+ /**/
624
+ echo '</tr>' . "\n";
625
+ echo '<tr>' . "\n";
626
+ /**/
627
+ echo '<th>' . "\n";
628
+ echo '<label for="ws-plugin--s2member-level3-label">' . "\n";
629
+ echo 'Membership Level #3 Label:' . "\n";
630
+ echo '</label>' . "\n";
631
+ echo '</th>' . "\n";
632
+ /**/
633
+ echo '</tr>' . "\n";
634
+ echo '<tr>' . "\n";
635
+ /**/
636
+ echo '<td>' . "\n";
637
+ echo '<input type="text" name="ws_plugin__s2member_level3_label" id="ws-plugin--s2member-level3-label" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_label"]) . '" /><br />' . "\n";
638
+ echo 'This is the Label for Membership Level 3.<br />' . "\n";
639
+ echo '</td>' . "\n";
640
+ /**/
641
+ echo '</tr>' . "\n";
642
+ echo '<tr>' . "\n";
643
+ /**/
644
+ echo '<th>' . "\n";
645
+ echo '<label for="ws-plugin--s2member-level4-label">' . "\n";
646
+ echo 'Membership Level #4 Label:' . "\n";
647
+ echo '</label>' . "\n";
648
+ echo '</th>' . "\n";
649
+ /**/
650
+ echo '</tr>' . "\n";
651
+ echo '<tr>' . "\n";
652
+ /**/
653
+ echo '<td>' . "\n";
654
+ echo '<input type="text" name="ws_plugin__s2member_level4_label" id="ws-plugin--s2member-level4-label" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_label"]) . '" /><br />' . "\n";
655
+ echo 'This is the Label for Membership Level 4.<br />' . "\n";
656
+ echo '</td>' . "\n";
657
+ /**/
658
+ echo '</tr>' . "\n";
659
+ echo '</tbody>' . "\n";
660
+ echo '</table>' . "\n";
661
+ echo '</div>' . "\n";
662
+ /**/
663
+ echo '</div>' . "\n";
664
+ /**/
665
+ do_action ("ws_plugin__s2member_during_options_page_during_left_sections_after_membership_levels", get_defined_vars ());
666
+ }
667
+ /**/
668
+ if (apply_filters ("ws_plugin__s2member_during_options_page_during_left_sections_display_post_level_access", true, get_defined_vars ()))
669
+ {
670
+ do_action ("ws_plugin__s2member_during_options_page_during_left_sections_before_post_level_access", get_defined_vars ());
671
+ /**/
672
+ echo '<div class="ws-menu-page-group" title="Post Access Restrictions">' . "\n";
673
+ /**/
674
+ echo '<div class="ws-menu-page-section ws-plugin--s2member-post-level-access-section">' . "\n";
675
+ echo '<h3>Post Level Access Restrictions ( optional )</h3>' . "\n";
676
+ echo '<p>Here you can specify Posts that are restricted to certain Membership Access Levels. These fields also support Custom Post Types, which were first introduced in WordPress® 3.0. If you have a theme/plugin installed that has enabled Custom Post Types ( i.e. Music/Videos/etc ), you can put the IDs for those Posts here.</p>' . "\n";
677
+ do_action ("ws_plugin__s2member_during_options_page_during_left_sections_during_post_level_access", get_defined_vars ());
678
+ /**/
679
+ echo '<table class="form-table">' . "\n";
680
+ echo '<tbody>' . "\n";
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";
687
+ echo '</th>' . "\n";
688
+ /**/
689
+ echo '</tr>' . "\n";
690
+ echo '<tr>' . "\n";
691
+ /**/
692
+ echo '<td>' . "\n";
693
+ echo '<input type="text" name="ws_plugin__s2member_level1_posts" id="ws-plugin--s2member-level1-posts" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_posts"]) . '" /><br />' . "\n";
694
+ echo 'Post IDs in comma delimited format. Example: <code>1,2,3,34,8,21</code> — or you can type: <code>all</code>.' . "\n";
695
+ echo '</td>' . "\n";
696
+ /**/
697
+ echo '</tr>' . "\n";
698
+ echo '<tr>' . "\n";
699
+ /**/
700
+ echo '<th>' . "\n";
701
+ echo '<label for="ws-plugin--s2member-level2-posts">' . "\n";
702
+ echo 'Posts That Require Level #2 Or Higher:' . "\n";
703
+ echo '</label>' . "\n";
704
+ echo '</th>' . "\n";
705
+ /**/
706
+ echo '</tr>' . "\n";
707
+ echo '<tr>' . "\n";
708
+ /**/
709
+ echo '<td>' . "\n";
710
+ echo '<input type="text" name="ws_plugin__s2member_level2_posts" id="ws-plugin--s2member-level2-posts" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_posts"]) . '" /><br />' . "\n";
711
+ echo 'Post IDs in comma delimited format. Example: <code>1,2,3,34,8,21</code> — or you can type: <code>all</code>.' . "\n";
712
+ echo '</td>' . "\n";
713
+ /**/
714
+ echo '</tr>' . "\n";
715
+ echo '<tr>' . "\n";
716
+ /**/
717
+ echo '<th>' . "\n";
718
+ echo '<label for="ws-plugin--s2member-level3-posts">' . "\n";
719
+ echo 'Posts That Require Level #3 Or Higher:' . "\n";
720
+ echo '</label>' . "\n";
721
+ echo '</th>' . "\n";
722
+ /**/
723
+ echo '</tr>' . "\n";
724
+ echo '<tr>' . "\n";
725
+ /**/
726
+ echo '<td>' . "\n";
727
+ echo '<input type="text" name="ws_plugin__s2member_level3_posts" id="ws-plugin--s2member-level3-posts" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_posts"]) . '" /><br />' . "\n";
728
+ echo 'Post IDs in comma delimited format. Example: <code>1,2,3,34,8,21</code> — or you can type: <code>all</code>.' . "\n";
729
+ echo '</td>' . "\n";
730
+ /**/
731
+ echo '</tr>' . "\n";
732
+ echo '<tr>' . "\n";
733
+ /**/
734
+ echo '<th>' . "\n";
735
+ echo '<label for="ws-plugin--s2member-level4-posts">' . "\n";
736
+ echo 'Posts That Require Highest Level #4:' . "\n";
737
+ echo '</label>' . "\n";
738
+ echo '</th>' . "\n";
739
+ /**/
740
+ echo '</tr>' . "\n";
741
+ echo '<tr>' . "\n";
742
+ /**/
743
+ echo '<td>' . "\n";
744
+ echo '<input type="text" name="ws_plugin__s2member_level4_posts" id="ws-plugin--s2member-level4-posts" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_posts"]) . '" /><br />' . "\n";
745
+ echo 'Post IDs in comma delimited format. Example: <code>1,2,3,34,8,21</code> — or you can type: <code>all</code>.' . "\n";
746
+ echo '</td>' . "\n";
747
+ /**/
748
+ echo '</tr>' . "\n";
749
+ echo '</tbody>' . "\n";
750
+ echo '</table>' . "\n";
751
+ echo '</div>' . "\n";
752
+ /**/
753
+ echo '</div>' . "\n";
754
+ /**/
755
+ do_action ("ws_plugin__s2member_during_options_page_during_left_sections_after_post_level_access", get_defined_vars ());
756
+ }
757
+ /**/
758
+ if (apply_filters ("ws_plugin__s2member_during_options_page_during_left_sections_display_page_level_access", true, get_defined_vars ()))
759
+ {
760
+ do_action ("ws_plugin__s2member_during_options_page_during_left_sections_before_page_level_access", get_defined_vars ());
761
+ /**/
762
+ echo '<div class="ws-menu-page-group" title="Page Access Restrictions">' . "\n";
763
+ /**/
764
+ echo '<div class="ws-menu-page-section ws-plugin--s2member-page-level-access-section">' . "\n";
765
+ echo '<h3>Page Level Access Restrictions ( optional )</h3>' . "\n";
766
+ echo '<p>Here you can specify Pages that are restricted to certain Membership Access Levels.</p>' . "\n";
767
+ do_action ("ws_plugin__s2member_during_options_page_during_left_sections_during_page_level_access", get_defined_vars ());
768
+ /**/
769
+ echo '<table class="form-table">' . "\n";
770
+ echo '<tbody>' . "\n";
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";
777
+ echo '</th>' . "\n";
778
+ /**/
779
+ echo '</tr>' . "\n";
780
+ echo '<tr>' . "\n";
781
+ /**/
782
+ echo '<td>' . "\n";
783
+ echo '<input type="text" name="ws_plugin__s2member_level1_pages" id="ws-plugin--s2member-level1-pages" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_pages"]) . '" /><br />' . "\n";
784
+ echo 'Page IDs in comma delimited format. Example: <code>1,2,3,34,8,21</code> — or you can type: <code>all</code>.' . "\n";
785
+ echo '</td>' . "\n";
786
+ /**/
787
+ echo '</tr>' . "\n";
788
+ echo '<tr>' . "\n";
789
+ /**/
790
+ echo '<th>' . "\n";
791
+ echo '<label for="ws-plugin--s2member-level2-pages">' . "\n";
792
+ echo 'Pages That Require Level #2 Or Higher:' . "\n";
793
+ echo '</label>' . "\n";
794
+ echo '</th>' . "\n";
795
+ /**/
796
+ echo '</tr>' . "\n";
797
+ echo '<tr>' . "\n";
798
+ /**/
799
+ echo '<td>' . "\n";
800
+ echo '<input type="text" name="ws_plugin__s2member_level2_pages" id="ws-plugin--s2member-level2-pages" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_pages"]) . '" /><br />' . "\n";
801
+ echo 'Page IDs in comma delimited format. Example: <code>1,2,3,34,8,21</code> — or you can type: <code>all</code>.' . "\n";
802
+ echo '</td>' . "\n";
803
+ /**/
804
+ echo '</tr>' . "\n";
805
+ echo '<tr>' . "\n";
806
+ /**/
807
+ echo '<th>' . "\n";
808
+ echo '<label for="ws-plugin--s2member-level3-pages">' . "\n";
809
+ echo 'Pages That Require Level #3 Or Higher:' . "\n";
810
+ echo '</label>' . "\n";
811
+ echo '</th>' . "\n";
812
+ /**/
813
+ echo '</tr>' . "\n";
814
+ echo '<tr>' . "\n";
815
+ /**/
816
+ echo '<td>' . "\n";
817
+ echo '<input type="text" name="ws_plugin__s2member_level3_pages" id="ws-plugin--s2member-level3-pages" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_pages"]) . '" /><br />' . "\n";
818
+ echo 'Page IDs in comma delimited format. Example: <code>1,2,3,34,8,21</code> — or you can type: <code>all</code>.' . "\n";
819
+ echo '</td>' . "\n";
820
+ /**/
821
+ echo '</tr>' . "\n";
822
+ echo '<tr>' . "\n";
823
+ /**/
824
+ echo '<th>' . "\n";
825
+ echo '<label for="ws-plugin--s2member-level4-pages">' . "\n";
826
+ echo 'Pages That Require Highest Level #4:' . "\n";
827
+ echo '</label>' . "\n";
828
+ echo '</th>' . "\n";
829
+ /**/
830
+ echo '</tr>' . "\n";
831
+ echo '<tr>' . "\n";
832
+ /**/
833
+ echo '<td>' . "\n";
834
+ echo '<input type="text" name="ws_plugin__s2member_level4_pages" id="ws-plugin--s2member-level4-pages" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_pages"]) . '" /><br />' . "\n";
835
+ echo 'Page IDs in comma delimited format. Example: <code>1,2,3,34,8,21</code> — or you can type: <code>all</code>.' . "\n";
836
+ echo '</td>' . "\n";
837
+ /**/
838
+ echo '</tr>' . "\n";
839
+ echo '</tbody>' . "\n";
840
+ echo '</table>' . "\n";
841
+ echo '</div>' . "\n";
842
+ /**/
843
+ echo '</div>' . "\n";
844
+ /**/
845
+ do_action ("ws_plugin__s2member_during_options_page_during_left_sections_after_page_level_access", get_defined_vars ());
846
+ }
847
+ /**/
848
+ if (apply_filters ("ws_plugin__s2member_during_options_page_during_left_sections_display_tag_level_access", true, get_defined_vars ()))
849
+ {
850
+ do_action ("ws_plugin__s2member_during_options_page_during_left_sections_before_tag_level_access", get_defined_vars ());
851
+ /**/
852
+ echo '<div class="ws-menu-page-group" title="Tag Access Restrictions">' . "\n";
853
+ /**/
854
+ echo '<div class="ws-menu-page-section ws-plugin--s2member-tag-level-access-section">' . "\n";
855
+ echo '<h3>Tag Level Access Restrictions ( optional )</h3>' . "\n";
856
+ echo '<p>Here yo