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

Version Description

  • Framework updated; general cleanup.
  • (s2Member/s2Member Pro). Optimizations. Further internal optimizations applied through configuration checksums that allow s2Member and s2Member Pro to load with even less overhead now.
  • (s2Member/s2Member Pro). Optimizations. Further internal optimizations applied with Hook priorities that allow s2Member and s2Member Pro to load dynamic CSS/JS files with even less overhead now.
  • (s2Member). Bug fix. Due to changes in WordPress 3.1+, s2Member was including it's JavaScript routines twice on the /wp-login.php page. This has been resolved in s2Member v3.5.2+.
  • **(s2Member). Hook change. Attn WP developers: s2Member's Hook _ws_plugin__s2member_force_ssl_buffer_tags is now _ws_plugin__s2member_force_ssl_buffer_tags_array.
  • **(s2Member). API Constant change. Attn WP developers: s2Member's API Constant S2MEMBER_CURRENT_USER_SUBSCR_ID is now accompanied with a new API Constant S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID. The values returned by these API Constants have changed (slightly). For further details, check your Dashboard under: s2Member -> API Scripting -> API Constants.
  • (s2Member Pro). Bug fix. s2Member's ccBill DataLink routines were sometimes generating the error Too Many Connections due to an invalid data storage routine under a delayed scenario. This has been resolved in s2Member v3.5.2+.
Download this release

Release Info

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

Code changes from version 3.5.1 to 3.5.2

Files changed (49) hide show
  1. includes/classes/admin-css-js-in.inc.php +89 -0
  2. includes/classes/admin-css-js.inc.php +4 -48
  3. includes/classes/constants.inc.php +72 -72
  4. includes/classes/cron-jobs-in.inc.php +59 -0
  5. includes/classes/cron-jobs.inc.php +5 -25
  6. includes/classes/css-js-in.inc.php +157 -0
  7. includes/classes/css-js-themes.inc.php +73 -0
  8. includes/classes/css-js.inc.php +4 -164
  9. includes/classes/files-checks.inc.php +34 -0
  10. includes/classes/files.inc.php +0 -11
  11. includes/classes/installation.inc.php +6 -15
  12. includes/classes/labels.inc.php +1 -1
  13. includes/classes/login-customizations.inc.php +8 -5
  14. includes/classes/login-redirects-r.inc.php +35 -0
  15. includes/classes/login-redirects.inc.php +1 -13
  16. includes/classes/menu-pages.inc.php +4 -4
  17. includes/classes/meta-box-saves.inc.php +2 -2
  18. includes/classes/meta-boxes.inc.php +6 -5
  19. includes/classes/{misc-redirects.inc.php → mo-page-in.inc.php} +8 -7
  20. includes/classes/mo-page.inc.php +39 -0
  21. includes/classes/nocache.inc.php +5 -4
  22. includes/classes/op-notices.inc.php +5 -4
  23. includes/classes/profile-in.inc.php +40 -0
  24. includes/classes/profile-mods-in.inc.php +3 -3
  25. includes/classes/profile.inc.php +3 -11
  26. includes/classes/sc-paypal-button-e.inc.php +2 -2
  27. includes/classes/sc-paypal-button-in.inc.php +6 -3
  28. includes/classes/ssl-in.inc.php +121 -0
  29. includes/classes/ssl.inc.php +3 -64
  30. includes/classes/tracking-cookies-in.inc.php +61 -0
  31. includes/classes/tracking-cookies.inc.php +4 -20
  32. includes/classes/user-access.inc.php +3 -3
  33. includes/classes/user-new.inc.php +1 -1
  34. includes/classes/utilities.inc.php +11 -0
  35. includes/classes/utils-arrays.inc.php +2 -4
  36. includes/classes/utils-css.inc.php +2 -2
  37. includes/classes/utils-users.inc.php +23 -7
  38. includes/funcs.inc.php +1 -1
  39. includes/functions/class-autoloader.inc.php +17 -18
  40. includes/hooks.inc.php +30 -25
  41. includes/menu-pages/code-samples/api-mop-vars.php +3 -0
  42. includes/menu-pages/code-samples/current-user-fields.php +4 -1
  43. includes/menu-pages/code-samples/current-user-subscr-id.php +5 -4
  44. includes/menu-pages/code-samples/current-user-subscr-or-wp-id.php +11 -0
  45. includes/menu-pages/scripting.inc.php +15 -6
  46. includes/profile.inc.php +3 -1
  47. includes/syscon.inc.php +187 -175
  48. readme.txt +13 -4
  49. s2member.php +12 -8
includes/classes/admin-css-js-in.inc.php ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Copyright: © 2009 WebSharks, Inc. ( coded in the USA )
4
+ <mailto:support@websharks-inc.com> <http://www.websharks-inc.com/>
5
+
6
+ Released under the terms of the GNU General Public License.
7
+ You should have received a copy of the GNU General Public License,
8
+ along with this software. In the main directory, see: /licensing/
9
+ If not, see: <http://www.gnu.org/licenses/>.
10
+ */
11
+ /*
12
+ Direct access denial.
13
+ */
14
+ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
+ /**/
17
+ if (!class_exists ("c_ws_plugin__s2member_admin_css_js_in"))
18
+ {
19
+ class c_ws_plugin__s2member_admin_css_js_in
20
+ {
21
+ /*
22
+ Function that outputs the CSS for menu pages.
23
+ Attach to: add_action("init");
24
+ */
25
+ public static function menu_pages_css ()
26
+ {
27
+ do_action ("ws_plugin__s2member_before_menu_pages_css", get_defined_vars ());
28
+ /**/
29
+ if ($_GET["ws_plugin__s2member_menu_pages_css"] && is_user_logged_in () && current_user_can ("create_users"))
30
+ {
31
+ header ("Content-Type: text/css; charset=utf-8");
32
+ header ("Expires: " . gmdate ("D, d M Y H:i:s", strtotime ("-1 week")) . " GMT");
33
+ header ("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
34
+ header ("Cache-Control: no-cache, must-revalidate, max-age=0");
35
+ header ("Pragma: no-cache");
36
+ /**/
37
+ $u = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"];
38
+ $i = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images";
39
+ /**/
40
+ ob_start ("c_ws_plugin__s2member_utils_css::compress_css"); /* Compress. */
41
+ /**/
42
+ include_once dirname (dirname (__FILE__)) . "/menu-pages/menu-pages.css";
43
+ /**/
44
+ echo "\n"; /* Add a line break before inclusion of this file. */
45
+ /**/
46
+ @include_once dirname (dirname (__FILE__)) . "/menu-pages/menu-pages-s.css";
47
+ /**/
48
+ do_action ("ws_plugin__s2member_during_menu_pages_css", get_defined_vars ());
49
+ /**/
50
+ exit (); /* Clean exit. */
51
+ }
52
+ /**/
53
+ do_action ("ws_plugin__s2member_after_menu_pages_css", get_defined_vars ());
54
+ }
55
+ /*
56
+ Function that outputs the JS for menu pages.
57
+ Attach to: add_action("init");
58
+ */
59
+ public static function menu_pages_js ()
60
+ {
61
+ do_action ("ws_plugin__s2member_before_menu_pages_js", get_defined_vars ());
62
+ /**/
63
+ if ($_GET["ws_plugin__s2member_menu_pages_js"] && is_user_logged_in () && current_user_can ("create_users"))
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: no-cache, must-revalidate, max-age=0");
69
+ header ("Pragma: no-cache");
70
+ /**/
71
+ $u = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"];
72
+ $i = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images";
73
+ /**/
74
+ include_once dirname (dirname (__FILE__)) . "/menu-pages/menu-pages-min.js";
75
+ /**/
76
+ echo "\n"; /* Add a line break before inclusion of this file. */
77
+ /**/
78
+ @include_once dirname (dirname (__FILE__)) . "/menu-pages/menu-pages-s-min.js";
79
+ /**/
80
+ do_action ("ws_plugin__s2member_during_menu_pages_js", get_defined_vars ());
81
+ /**/
82
+ exit (); /* Clean exit. */
83
+ }
84
+ /**/
85
+ do_action ("ws_plugin__s2member_after_menu_pages_js", get_defined_vars ());
86
+ }
87
+ }
88
+ }
89
+ ?>
includes/classes/admin-css-js.inc.php CHANGED
@@ -24,33 +24,10 @@ if (!class_exists ("c_ws_plugin__s2member_admin_css_js"))
24
  */
25
  public static function menu_pages_css ()
26
  {
27
- do_action ("ws_plugin__s2member_before_menu_pages_css", get_defined_vars ());
28
- /**/
29
- if ($_GET["ws_plugin__s2member_menu_pages_css"] && is_user_logged_in () && current_user_can ("create_users"))
30
  {
31
- header ("Content-Type: text/css; charset=utf-8");
32
- header ("Expires: " . gmdate ("D, d M Y H:i:s", strtotime ("-1 week")) . " GMT");
33
- header ("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
34
- header ("Cache-Control: no-cache, must-revalidate, max-age=0");
35
- header ("Pragma: no-cache");
36
- /**/
37
- $u = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"];
38
- $i = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images";
39
- /**/
40
- ob_start ("c_ws_plugin__s2member_utils_css::compress_css"); /* Compress. */
41
- /**/
42
- include_once dirname (dirname (__FILE__)) . "/menu-pages/menu-pages.css";
43
- /**/
44
- echo "\n"; /* Add a line break before inclusion of this file. */
45
- /**/
46
- @include_once dirname (dirname (__FILE__)) . "/menu-pages/menu-pages-s.css";
47
- /**/
48
- do_action ("ws_plugin__s2member_during_menu_pages_css", get_defined_vars ());
49
- /**/
50
- exit ();
51
  }
52
- /**/
53
- do_action ("ws_plugin__s2member_after_menu_pages_css", get_defined_vars ());
54
  }
55
  /*
56
  Function that outputs the JS for menu pages.
@@ -58,31 +35,10 @@ if (!class_exists ("c_ws_plugin__s2member_admin_css_js"))
58
  */
59
  public static function menu_pages_js ()
60
  {
61
- do_action ("ws_plugin__s2member_before_menu_pages_js", get_defined_vars ());
62
- /**/
63
- if ($_GET["ws_plugin__s2member_menu_pages_js"] && is_user_logged_in () && current_user_can ("create_users"))
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: no-cache, must-revalidate, max-age=0");
69
- header ("Pragma: no-cache");
70
- /**/
71
- $u = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"];
72
- $i = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images";
73
- /**/
74
- include_once dirname (dirname (__FILE__)) . "/menu-pages/menu-pages-min.js";
75
- /**/
76
- echo "\n"; /* Add a line break before inclusion of this file. */
77
- /**/
78
- @include_once dirname (dirname (__FILE__)) . "/menu-pages/menu-pages-s-min.js";
79
- /**/
80
- do_action ("ws_plugin__s2member_during_menu_pages_js", get_defined_vars ());
81
- /**/
82
- exit ();
83
  }
84
- /**/
85
- do_action ("ws_plugin__s2member_after_menu_pages_js", get_defined_vars ());
86
  }
87
  }
88
  }
24
  */
25
  public static function menu_pages_css ()
26
  {
27
+ if ($_GET["ws_plugin__s2member_menu_pages_css"]) /* Call inner function? */
 
 
28
  {
29
+ return c_ws_plugin__s2member_admin_css_js_in::menu_pages_css ();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  }
 
 
31
  }
32
  /*
33
  Function that outputs the JS for menu pages.
35
  */
36
  public static function menu_pages_js ()
37
  {
38
+ if ($_GET["ws_plugin__s2member_menu_pages_js"]) /* Call inner function? */
 
 
39
  {
40
+ return c_ws_plugin__s2member_admin_css_js_in::menu_pages_js ();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  }
 
 
42
  }
43
  }
44
  }
includes/classes/constants.inc.php CHANGED
@@ -19,6 +19,71 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
19
  class c_ws_plugin__s2member_constants
20
  {
21
  /*
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  Define several API Constants for s2Member.
23
  Note that these are duplicated into the JavaScript API as well.
24
  Attach to: add_action("init");
@@ -42,13 +107,14 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
42
  do_action ("ws_plugin__s2member_during_constants", get_defined_vars ());
43
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
44
  /**/
45
- define ("S2MEMBER_VERSION", ($c[] = WS_PLUGIN__S2MEMBER_VERSION)); /* Since 3.0. */
46
  /**/
47
  define ("S2MEMBER_CURRENT_USER_IS_LOGGED_IN", ($c[] = (($current_user) ? true : false)));
48
  define ("S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER", ($c[] = ( ($current_user && $level >= 1) ? true : false)));
49
  define ("S2MEMBER_CURRENT_USER_ACCESS_LEVEL", ($c[] = (int)$level));
50
  define ("S2MEMBER_CURRENT_USER_ACCESS_LABEL", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_label"]));
51
- define ("S2MEMBER_CURRENT_USER_SUBSCR_ID", ($c[] = (($current_user) ? (($subscr_id) ? (string)$subscr_id : (string)$current_user->ID) : "")));
 
52
  define ("S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY", ($c[] = (($current_user) ? (string)$subscr_gateway : "")));
53
  define ("S2MEMBER_CURRENT_USER_CUSTOM", ($c[] = (string)$custom));
54
  define ("S2MEMBER_CURRENT_USER_REGISTRATION_TIME", ($c[] = ( ($current_user && $current_user->user_registered) ? (int)strtotime ($current_user->user_registered) : 0)));
@@ -62,7 +128,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
62
  define ("S2MEMBER_CURRENT_USER_EMAIL", ($c[] = (($current_user) ? (string)$current_user->user_email : "")));
63
  define ("S2MEMBER_CURRENT_USER_IP", ($c[] = (string)$_SERVER["REMOTE_ADDR"]));
64
  define ("S2MEMBER_CURRENT_USER_ID", ($c[] = (($current_user) ? (int)$current_user->ID : 0)));
65
- define ("S2MEMBER_CURRENT_USER_FIELDS", ($c[] = (($current_user) ? json_encode (array_merge (array ("id" => S2MEMBER_CURRENT_USER_ID, "ip" => S2MEMBER_CURRENT_USER_IP, "email" => S2MEMBER_CURRENT_USER_EMAIL, "login" => S2MEMBER_CURRENT_USER_LOGIN, "first_name" => S2MEMBER_CURRENT_USER_FIRST_NAME, "last_name" => S2MEMBER_CURRENT_USER_LAST_NAME, "display_name" => S2MEMBER_CURRENT_USER_DISPLAY_NAME, "subscr_id" => S2MEMBER_CURRENT_USER_SUBSCR_ID, "subscr_gateway" => S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY, "custom" => S2MEMBER_CURRENT_USER_CUSTOM), (array)$custom_fields)) : json_encode (array ()))));
66
  /**/
67
  define ("S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED", ($c[] = (int)$file_downloads["allowed"]));
68
  define ("S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED", ($c[] = ( ($file_downloads["allowed"] >= 999999999) ? true : false)));
@@ -115,83 +181,17 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
115
  /**/
116
  define ("S2MEMBER_PAYPAL_PDT_IDENTITY_TOKEN", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_identity_token"]));
117
  /**/
118
- define ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0", ($c[] = ((S2MEMBER_CURRENT_USER_SUBSCR_ID) ? "Updating Subscr. ID" : "")));
119
- define ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0", ($c[] = ((S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0) ? S2MEMBER_CURRENT_USER_SUBSCR_ID : "")));
120
  /**/
121
  $c = apply_filters ("ws_plugin__s2member_during_constants_c", $c, get_defined_vars ()); /* Allows other Constants to be calculated nicely. */
122
  /**/
123
- define ("WS_PLUGIN__S2MEMBER_API_CONSTANTS_MD5", md5 (serialize ($c))); /* Used as a Checksum against the state of these Constants. */
124
  /**/
125
  do_action ("ws_plugin__s2member_after_constants", get_defined_vars ()); /* Calls the after Hook. Do NOT set Constants here. */
126
  /**/
127
  return; /* Return for uniformity. */
128
  }
129
- /*
130
- This function pulls all of the Page links needed for Constants.
131
- Page links are cached into the s2Member options on 15 min intervals.
132
- This allows the API Constants to provide quick access to them without being
133
- forced to execute get_page_link() all the time, which piles up DB queries.
134
- */
135
- public static function constant_links ()
136
- {
137
- do_action ("ws_plugin__s2member_before_constant_links", get_defined_vars ());
138
- /**/
139
- $l = array ("login_welcome_page" => "", "membership_options_page" => "", "file_download_limit_exceeded_page" => "");
140
- /**/
141
- $login_welcome_page = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"];
142
- $membership_options_page = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"];
143
- $file_download_limit_exceeded_page = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"];
144
- /**/
145
- $login_welcome_page_cache = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["login_welcome_page"];
146
- $membership_options_page_cache = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"];
147
- $file_download_limit_exceeded_page_cache = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["file_download_limit_exceeded_page"];
148
- /**/
149
- if ($login_welcome_page_cache["page"] === $login_welcome_page && $login_welcome_page_cache["time"] >= strtotime ("-15 minutes"))
150
- {
151
- $l["login_welcome_page"] = $login_welcome_page_cache["link"];
152
- }
153
- else /* Otherwise, we need to query the database using get_page_link() and update the cache. */
154
- {
155
- $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["login_welcome_page"]["time"] = strtotime ("now");
156
- $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["login_welcome_page"]["page"] = $login_welcome_page;
157
- $l["login_welcome_page"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["login_welcome_page"]["link"] = get_page_link ($login_welcome_page);
158
- /**/
159
- $cache_needs_updating = true;
160
- }
161
- /**/
162
- if ($membership_options_page_cache["page"] === $membership_options_page && $membership_options_page_cache["time"] >= strtotime ("-15 minutes"))
163
- {
164
- $l["membership_options_page"] = $membership_options_page_cache["link"];
165
- }
166
- else /* Otherwise, we need to query the database using get_page_link() and update the cache. */
167
- {
168
- $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"]["time"] = strtotime ("now");
169
- $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"]["page"] = $membership_options_page;
170
- $l["membership_options_page"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"]["link"] = get_page_link ($membership_options_page);
171
- /**/
172
- $cache_needs_updating = true;
173
- }
174
- /**/
175
- if ($file_download_limit_exceeded_page_cache["page"] === $file_download_limit_exceeded_page && $file_download_limit_exceeded_page_cache["time"] >= strtotime ("-15 minutes"))
176
- {
177
- $l["file_download_limit_exceeded_page"] = $file_download_limit_exceeded_page_cache["link"];
178
- }
179
- else /* Otherwise, we need to query the database using get_page_link() and update the cache. */
180
- {
181
- $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["file_download_limit_exceeded_page"]["time"] = strtotime ("now");
182
- $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["file_download_limit_exceeded_page"]["page"] = $file_download_limit_exceeded_page;
183
- $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);
184
- /**/
185
- $cache_needs_updating = true;
186
- }
187
- /**/
188
- if ($cache_needs_updating) /* The cache is also reset when options are updated from a menu page. */
189
- {
190
- update_option ("ws_plugin__s2member_cache", $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]);
191
- }
192
- /**/
193
- return apply_filters ("ws_plugin__s2member_constant_links", $l, get_defined_vars ());
194
- }
195
  }
196
  }
197
  ?>
19
  class c_ws_plugin__s2member_constants
20
  {
21
  /*
22
+ This function pulls all of the Page links needed for Constants.
23
+ Page links are cached into the s2Member options on 15 min intervals.
24
+ This allows the API Constants to provide quick access to them without being forced to execute get_page_link() all the time, which piles up DB queries.
25
+ */
26
+ public static function constant_links ()
27
+ {
28
+ do_action ("ws_plugin__s2member_before_constant_links", get_defined_vars ());
29
+ /**/
30
+ $l = array ("login_welcome_page" => "", "membership_options_page" => "", "file_download_limit_exceeded_page" => "");
31
+ /**/
32
+ $login_welcome_page = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"];
33
+ $membership_options_page = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"];
34
+ $file_download_limit_exceeded_page = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"];
35
+ /**/
36
+ $login_welcome_page_cache = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["login_welcome_page"];
37
+ $membership_options_page_cache = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"];
38
+ $file_download_limit_exceeded_page_cache = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["file_download_limit_exceeded_page"];
39
+ /**/
40
+ if ($login_welcome_page_cache["page"] === $login_welcome_page && $login_welcome_page_cache["time"] >= strtotime ("-15 minutes"))
41
+ {
42
+ $l["login_welcome_page"] = $login_welcome_page_cache["link"];
43
+ }
44
+ else /* Otherwise, we need to query the database using get_page_link() and update the cache. */
45
+ {
46
+ $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["login_welcome_page"]["time"] = time ();
47
+ $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["login_welcome_page"]["page"] = $login_welcome_page;
48
+ $l["login_welcome_page"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["login_welcome_page"]["link"] = get_page_link ($login_welcome_page);
49
+ /**/
50
+ $cache_needs_updating = true;
51
+ }
52
+ /**/
53
+ if ($membership_options_page_cache["page"] === $membership_options_page && $membership_options_page_cache["time"] >= strtotime ("-15 minutes"))
54
+ {
55
+ $l["membership_options_page"] = $membership_options_page_cache["link"];
56
+ }
57
+ else /* Otherwise, we need to query the database using get_page_link() and update the cache. */
58
+ {
59
+ $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"]["time"] = time ();
60
+ $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"]["page"] = $membership_options_page;
61
+ $l["membership_options_page"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"]["link"] = get_page_link ($membership_options_page);
62
+ /**/
63
+ $cache_needs_updating = true;
64
+ }
65
+ /**/
66
+ if ($file_download_limit_exceeded_page_cache["page"] === $file_download_limit_exceeded_page && $file_download_limit_exceeded_page_cache["time"] >= strtotime ("-15 minutes"))
67
+ {
68
+ $l["file_download_limit_exceeded_page"] = $file_download_limit_exceeded_page_cache["link"];
69
+ }
70
+ else /* Otherwise, we need to query the database using get_page_link() and update the cache. */
71
+ {
72
+ $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["file_download_limit_exceeded_page"]["time"] = time ();
73
+ $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["file_download_limit_exceeded_page"]["page"] = $file_download_limit_exceeded_page;
74
+ $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);
75
+ /**/
76
+ $cache_needs_updating = true;
77
+ }
78
+ /**/
79
+ if ($cache_needs_updating) /* The cache is also reset when options are updated from a menu page. */
80
+ {
81
+ update_option ("ws_plugin__s2member_cache", $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]);
82
+ }
83
+ /**/
84
+ return apply_filters ("ws_plugin__s2member_constant_links", $l, get_defined_vars ());
85
+ }
86
+ /*
87
  Define several API Constants for s2Member.
88
  Note that these are duplicated into the JavaScript API as well.
89
  Attach to: add_action("init");
107
  do_action ("ws_plugin__s2member_during_constants", get_defined_vars ());
108
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
109
  /**/
110
+ define ("S2MEMBER_VERSION", ($c[] = WS_PLUGIN__S2MEMBER_VERSION));
111
  /**/
112
  define ("S2MEMBER_CURRENT_USER_IS_LOGGED_IN", ($c[] = (($current_user) ? true : false)));
113
  define ("S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER", ($c[] = ( ($current_user && $level >= 1) ? true : false)));
114
  define ("S2MEMBER_CURRENT_USER_ACCESS_LEVEL", ($c[] = (int)$level));
115
  define ("S2MEMBER_CURRENT_USER_ACCESS_LABEL", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_label"]));
116
+ define ("S2MEMBER_CURRENT_USER_SUBSCR_ID", ($c[] = ( ($current_user && $subscr_id) ? (string)$subscr_id : "")));
117
+ define ("S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID", ($c[] = (($current_user) ? (($subscr_id) ? (string)$subscr_id : (string)$current_user->ID) : "")));
118
  define ("S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY", ($c[] = (($current_user) ? (string)$subscr_gateway : "")));
119
  define ("S2MEMBER_CURRENT_USER_CUSTOM", ($c[] = (string)$custom));
120
  define ("S2MEMBER_CURRENT_USER_REGISTRATION_TIME", ($c[] = ( ($current_user && $current_user->user_registered) ? (int)strtotime ($current_user->user_registered) : 0)));
128
  define ("S2MEMBER_CURRENT_USER_EMAIL", ($c[] = (($current_user) ? (string)$current_user->user_email : "")));
129
  define ("S2MEMBER_CURRENT_USER_IP", ($c[] = (string)$_SERVER["REMOTE_ADDR"]));
130
  define ("S2MEMBER_CURRENT_USER_ID", ($c[] = (($current_user) ? (int)$current_user->ID : 0)));
131
+ define ("S2MEMBER_CURRENT_USER_FIELDS", ($c[] = (($current_user) ? json_encode (array_merge (array ("id" => S2MEMBER_CURRENT_USER_ID, "ip" => S2MEMBER_CURRENT_USER_IP, "email" => S2MEMBER_CURRENT_USER_EMAIL, "login" => S2MEMBER_CURRENT_USER_LOGIN, "first_name" => S2MEMBER_CURRENT_USER_FIRST_NAME, "last_name" => S2MEMBER_CURRENT_USER_LAST_NAME, "display_name" => S2MEMBER_CURRENT_USER_DISPLAY_NAME, "subscr_id" => S2MEMBER_CURRENT_USER_SUBSCR_ID, "subscr_or_wp_id" => S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID, "subscr_gateway" => S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY, "custom" => S2MEMBER_CURRENT_USER_CUSTOM), (array)$custom_fields)) : json_encode (array ()))));
132
  /**/
133
  define ("S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED", ($c[] = (int)$file_downloads["allowed"]));
134
  define ("S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED", ($c[] = ( ($file_downloads["allowed"] >= 999999999) ? true : false)));
181
  /**/
182
  define ("S2MEMBER_PAYPAL_PDT_IDENTITY_TOKEN", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_identity_token"]));
183
  /**/
184
+ define ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0", ($c[] = ((S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID) ? "Updating Subscr. ID" : "")));
185
+ define ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0", ($c[] = ((S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID) ? S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID : "")));
186
  /**/
187
  $c = apply_filters ("ws_plugin__s2member_during_constants_c", $c, get_defined_vars ()); /* Allows other Constants to be calculated nicely. */
188
  /**/
189
+ define ("WS_PLUGIN__S2MEMBER_API_CONSTANTS_MD5", md5 (serialize ($c) . c_ws_plugin__s2member_utilities::ver_checksum ())); /* Checksum. */
190
  /**/
191
  do_action ("ws_plugin__s2member_after_constants", get_defined_vars ()); /* Calls the after Hook. Do NOT set Constants here. */
192
  /**/
193
  return; /* Return for uniformity. */
194
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
195
  }
196
  }
197
  ?>
includes/classes/cron-jobs-in.inc.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Copyright: © 2009 WebSharks, Inc. ( coded in the USA )
4
+ <mailto:support@websharks-inc.com> <http://www.websharks-inc.com/>
5
+
6
+ Released under the terms of the GNU General Public License.
7
+ You should have received a copy of the GNU General Public License,
8
+ along with this software. In the main directory, see: /licensing/
9
+ If not, see: <http://www.gnu.org/licenses/>.
10
+ */
11
+ /*
12
+ Direct access denial.
13
+ */
14
+ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
+ /**/
17
+ if (!class_exists ("c_ws_plugin__s2member_cron_jobs_in"))
18
+ {
19
+ class c_ws_plugin__s2member_cron_jobs_in
20
+ {
21
+ /*
22
+ Extends the WP-Cron schedules to support 10 minute intervals.
23
+ Attach to: add_filter("cron_schedules");
24
+ */
25
+ public static function extend_cron_schedules ($schedules = array ())
26
+ {
27
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
28
+ do_action ("ws_plugin__s2member_before_extend_cron_schedules", get_defined_vars ());
29
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
30
+ /**/
31
+ $array = array ("every10m" => array ("interval" => 600, "display" => "Every 10 Minutes"));
32
+ /**/
33
+ return apply_filters ("ws_plugin__s2member_extend_cron_schedules", array_merge ($array, $schedules), get_defined_vars ());
34
+ }
35
+ /*
36
+ This function allows the Auto-EOT Sytem to be processed through a server-side Cron Job.
37
+ Attach to: add_action("init");
38
+ */
39
+ public static function auto_eot_system_via_cron ()
40
+ {
41
+ do_action ("ws_plugin__s2member_before_auto_eot_system_via_cron", get_defined_vars ());
42
+ /**/
43
+ if ($_GET["s2member_auto_eot_system_via_cron"]) /* Being called through HTTP? */
44
+ {
45
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["auto_eot_system_enabled"])
46
+ {
47
+ c_ws_plugin__s2member_auto_eots::auto_eot_system (); /* Process Auto EOTs now. */
48
+ /**/
49
+ do_action ("ws_plugin__s2member_during_auto_eot_system_via_cron", get_defined_vars ());
50
+ }
51
+ /**/
52
+ exit (); /* Clean exit. */
53
+ }
54
+ /**/
55
+ do_action ("ws_plugin__s2member_after_auto_eot_system_via_cron", get_defined_vars ());
56
+ }
57
+ }
58
+ }
59
+ ?>
includes/classes/cron-jobs.inc.php CHANGED
@@ -22,40 +22,20 @@ if (!class_exists ("c_ws_plugin__s2member_cron_jobs"))
22
  Extends the WP-Cron schedules to support 10 minute intervals.
23
  Attach to: add_filter("cron_schedules");
24
  */
25
- public static function extend_cron_schedules ($schedules = array ())
26
  {
27
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
28
- do_action ("ws_plugin__s2member_before_extend_cron_schedules", get_defined_vars ());
29
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
30
- /**/
31
- $array = array ("every10m" => array ("interval" => 600, "display" => "Every 10 Minutes"));
32
- /**/
33
- return apply_filters ("ws_plugin__s2member_extend_cron_schedules", array_merge ($array, $schedules), get_defined_vars ());
34
  }
35
  /*
36
- This function allows the Auto-EOT Sytem to be
37
- processed through a server-side Cron Job.
38
  Attach to: add_action("init");
39
  */
40
  public static function auto_eot_system_via_cron ()
41
  {
42
- do_action ("ws_plugin__s2member_before_auto_eot_system_via_cron", get_defined_vars ());
43
- /**/
44
- if ($_GET["s2member_auto_eot_system_via_cron"]) /* Being called through HTTP? */
45
  {
46
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["auto_eot_system_enabled"])
47
- {
48
- c_ws_plugin__s2member_auto_eots::auto_eot_system (); /* Process Auto EOTs now. */
49
- /**/
50
- do_action ("ws_plugin__s2member_during_auto_eot_system_via_cron", get_defined_vars ());
51
- }
52
- /**/
53
- exit (); /* Clean exit. */
54
  }
55
- /**/
56
- do_action ("ws_plugin__s2member_after_auto_eot_system_via_cron", get_defined_vars ());
57
- /**/
58
- return; /* Return for uniformity. */
59
  }
60
  }
61
  }
22
  Extends the WP-Cron schedules to support 10 minute intervals.
23
  Attach to: add_filter("cron_schedules");
24
  */
25
+ public static function extend_cron_schedules ($schedules = array ()) /* Call inner function? */
26
  {
27
+ return c_ws_plugin__s2member_cron_jobs_in::extend_cron_schedules ($schedules);
 
 
 
 
 
 
28
  }
29
  /*
30
+ This function allows the Auto-EOT Sytem to be processed through a server-side Cron Job.
 
31
  Attach to: add_action("init");
32
  */
33
  public static function auto_eot_system_via_cron ()
34
  {
35
+ if ($_GET["s2member_auto_eot_system_via_cron"]) /* Call inner function? */
 
 
36
  {
37
+ return c_ws_plugin__s2member_cron_jobs_in::auto_eot_system_via_cron ();
 
 
 
 
 
 
 
38
  }
 
 
 
 
39
  }
40
  }
41
  }
includes/classes/css-js-in.inc.php ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Copyright: © 2009 WebSharks, Inc. ( coded in the USA )
4
+ <mailto:support@websharks-inc.com> <http://www.websharks-inc.com/>
5
+
6
+ Released under the terms of the GNU General Public License.
7
+ You should have received a copy of the GNU General Public License,
8
+ along with this software. In the main directory, see: /licensing/
9
+ If not, see: <http://www.gnu.org/licenses/>.
10
+ */
11
+ /*
12
+ Direct access denial.
13
+ */
14
+ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
+ /**/
17
+ if (!class_exists ("c_ws_plugin__s2member_css_js_in"))
18
+ {
19
+ class c_ws_plugin__s2member_css_js_in
20
+ {
21
+ /*
22
+ Builds CSS files.
23
+ Attach to: add_action("init");
24
+ */
25
+ public static function css ()
26
+ {
27
+ do_action ("ws_plugin__s2member_before_css", get_defined_vars ());
28
+ /**/
29
+ if ($_GET["ws_plugin__s2member_css"])
30
+ {
31
+ header ("Content-Type: text/css; charset=utf-8");
32
+ header ("Expires: " . gmdate ("D, d M Y H:i:s", strtotime ("+1 week")) . " GMT");
33
+ header ("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
34
+ header ("Cache-Control: max-age=604800");
35
+ header ("Pragma: public");
36
+ /**/
37
+ $u = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"];
38
+ $i = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images";
39
+ /**/
40
+ ob_start ("c_ws_plugin__s2member_utils_css::compress_css");
41
+ /**/
42
+ include_once dirname (dirname (__FILE__)) . "/s2member.css";
43
+ /**/
44
+ do_action ("ws_plugin__s2member_during_css", get_defined_vars ());
45
+ /**/
46
+ exit (); /* Clean exit. */
47
+ }
48
+ /**/
49
+ do_action ("ws_plugin__s2member_after_css", get_defined_vars ());
50
+ }
51
+ /*
52
+ Builds JavaScript files.
53
+ Attach to: add_action("init");
54
+ * Be sure s2Member's API Constants are already defined before firing this.
55
+ */
56
+ public static function js_w_globals ()
57
+ {
58
+ do_action ("ws_plugin__s2member_before_js_w_globals", get_defined_vars ());
59
+ /**/
60
+ if ($_GET["ws_plugin__s2member_js_w_globals"])
61
+ {
62
+ header ("Content-Type: text/javascript; charset=utf-8");
63
+ header ("Expires: " . gmdate ("D, d M Y H:i:s", strtotime ("+1 week")) . " GMT");
64
+ header ("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
65
+ header ("Cache-Control: max-age=604800");
66
+ header ("Pragma: public");
67
+ /**/
68
+ $g = "var S2MEMBER_VERSION = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_VERSION) . "',"; /* Since 3.0. */
69
+ /**/
70
+ $g .= "S2MEMBER_CURRENT_USER_IS_LOGGED_IN = " . ((S2MEMBER_CURRENT_USER_IS_LOGGED_IN) ? "true" : "false") . ",";
71
+ $g .= "S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER = " . ((S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER) ? "true" : "false") . ",";
72
+ $g .= "S2MEMBER_CURRENT_USER_ACCESS_LEVEL = " . S2MEMBER_CURRENT_USER_ACCESS_LEVEL . ",";
73
+ $g .= "S2MEMBER_CURRENT_USER_ACCESS_LABEL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_CURRENT_USER_ACCESS_LABEL) . "',";
74
+ $g .= "S2MEMBER_CURRENT_USER_SUBSCR_ID = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_CURRENT_USER_SUBSCR_ID) . "',";
75
+ $g .= "S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID) . "',";
76
+ $g .= "S2MEMBER_CURRENT_USER_CUSTOM = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_CURRENT_USER_CUSTOM) . "',";
77
+ $g .= "S2MEMBER_CURRENT_USER_REGISTRATION_TIME = " . S2MEMBER_CURRENT_USER_REGISTRATION_TIME . ",";
78
+ $g .= "S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME = " . S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME . ",";
79
+ $g .= "S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS = " . S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS . ",";
80
+ $g .= "S2MEMBER_CURRENT_USER_REGISTRATION_DAYS = " . S2MEMBER_CURRENT_USER_REGISTRATION_DAYS . ",";
81
+ $g .= "S2MEMBER_CURRENT_USER_DISPLAY_NAME = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_CURRENT_USER_DISPLAY_NAME) . "',";
82
+ $g .= "S2MEMBER_CURRENT_USER_FIRST_NAME = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_CURRENT_USER_FIRST_NAME) . "',";
83
+ $g .= "S2MEMBER_CURRENT_USER_LAST_NAME = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_CURRENT_USER_LAST_NAME) . "',";
84
+ $g .= "S2MEMBER_CURRENT_USER_LOGIN = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_CURRENT_USER_LOGIN) . "',";
85
+ $g .= "S2MEMBER_CURRENT_USER_EMAIL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_CURRENT_USER_EMAIL) . "',";
86
+ $g .= "S2MEMBER_CURRENT_USER_IP = '" . c_ws_plugin__s2member_utils_strings::esc_sq (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 = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL) . "',";
100
+ $g .= "S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL) . "',";
101
+ $g .= "S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL) . "',";
102
+ $g .= "S2MEMBER_LOGIN_WELCOME_PAGE_URL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_LOGIN_WELCOME_PAGE_URL) . "',";
103
+ $g .= "S2MEMBER_LOGOUT_PAGE_URL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_LOGOUT_PAGE_URL) . "',";
104
+ $g .= "S2MEMBER_LOGIN_PAGE_URL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_LOGIN_PAGE_URL) . "',";
105
+ /**/
106
+ $g .= "S2MEMBER_LEVEL0_LABEL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_LEVEL0_LABEL) . "',";
107
+ $g .= "S2MEMBER_LEVEL1_LABEL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_LEVEL1_LABEL) . "',";
108
+ $g .= "S2MEMBER_LEVEL2_LABEL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_LEVEL2_LABEL) . "',";
109
+ $g .= "S2MEMBER_LEVEL3_LABEL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_LEVEL3_LABEL) . "',";
110
+ $g .= "S2MEMBER_LEVEL4_LABEL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_LEVEL4_LABEL) . "',";
111
+ /**/
112
+ $g .= "S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED = " . S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED . ",";
113
+ $g .= "S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED = " . S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED . ",";
114
+ $g .= "S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED = " . S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED . ",";
115
+ $g .= "S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED = " . S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED . ",";
116
+ $g .= "S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED = " . S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED . ",";
117
+ /**/
118
+ $g .= "S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED_DAYS = " . S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED_DAYS . ",";
119
+ $g .= "S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED_DAYS = " . S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED_DAYS . ",";
120
+ $g .= "S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED_DAYS = " . S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED_DAYS . ",";
121
+ $g .= "S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED_DAYS = " . S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED_DAYS . ",";
122
+ $g .= "S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED_DAYS = " . S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED_DAYS . ",";
123
+ /**/
124
+ $g .= "S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS) . "',";
125
+ /**/
126
+ $g .= "S2MEMBER_REG_EMAIL_FROM_NAME = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_REG_EMAIL_FROM_NAME) . "',";
127
+ $g .= "S2MEMBER_REG_EMAIL_FROM_EMAIL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_REG_EMAIL_FROM_EMAIL) . "',";
128
+ /**/
129
+ $g .= "S2MEMBER_PAYPAL_NOTIFY_URL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_PAYPAL_NOTIFY_URL) . "',";
130
+ $g .= "S2MEMBER_PAYPAL_RETURN_URL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_PAYPAL_RETURN_URL) . "',";
131
+ /**/
132
+ $g .= "S2MEMBER_PAYPAL_BUSINESS = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_PAYPAL_BUSINESS) . "',";
133
+ $g .= "S2MEMBER_PAYPAL_ENDPOINT = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_PAYPAL_ENDPOINT) . "',";
134
+ $g .= "S2MEMBER_PAYPAL_API_ENDPOINT = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_PAYPAL_API_ENDPOINT) . "',";
135
+ /**/
136
+ $g .= "S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0 = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0) . "',";
137
+ $g .= "S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0 = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0) . "',";
138
+ /**/
139
+ $g = trim ($g, " ,") . ";"; /* Trim & add semicolon. */
140
+ /**/
141
+ $u = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"];
142
+ $i = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images";
143
+ /**/
144
+ echo $g . "\n"; /* Add a line break before inclusion. */
145
+ /**/
146
+ include_once dirname (dirname (__FILE__)) . "/s2member-min.js";
147
+ /**/
148
+ do_action ("ws_plugin__s2member_during_js_w_globals", get_defined_vars ());
149
+ /**/
150
+ exit (); /* Clean exit. */
151
+ }
152
+ /**/
153
+ do_action ("ws_plugin__s2member_after_js_w_globals", get_defined_vars ());
154
+ }
155
+ }
156
+ }
157
+ ?>
includes/classes/css-js-themes.inc.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Copyright: © 2009 WebSharks, Inc. ( coded in the USA )
4
+ <mailto:support@websharks-inc.com> <http://www.websharks-inc.com/>
5
+
6
+ Released under the terms of the GNU General Public License.
7
+ You should have received a copy of the GNU General Public License,
8
+ along with this software. In the main directory, see: /licensing/
9
+ If not, see: <http://www.gnu.org/licenses/>.
10
+ */
11
+ /*
12
+ Direct access denial.
13
+ */
14
+ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
+ /**/
17
+ if (!class_exists ("c_ws_plugin__s2member_css_js_themes"))
18
+ {
19
+ class c_ws_plugin__s2member_css_js_themes
20
+ {
21
+ /*
22
+ Adds CSS files.
23
+ Attach to: add_action("wp_print_styles");
24
+ */
25
+ public static function add_css ()
26
+ {
27
+ do_action ("ws_plugin__s2member_before_add_css", get_defined_vars ());
28
+ /**/
29
+ if (!is_admin ()) /* Not in the admin. */
30
+ {
31
+ wp_enqueue_style ("ws-plugin--s2member", site_url ("/?ws_plugin__s2member_css=1&qcABC=1"), array (), c_ws_plugin__s2member_utilities::ver_checksum (), "all");
32
+ /**/
33
+ do_action ("ws_plugin__s2member_during_add_css", get_defined_vars ());
34
+ }
35
+ /**/
36
+ do_action ("ws_plugin__s2member_after_add_css", get_defined_vars ());
37
+ /**/
38
+ return; /* Return for uniformity. */
39
+ }
40
+ /*
41
+ Adds JavaScript files.
42
+ Attach to: add_action("wp_print_scripts");
43
+ */
44
+ public static function add_js_w_globals ()
45
+ {
46
+ global $pagenow; /* Need this for comparisons. */
47
+ /**/
48
+ do_action ("ws_plugin__s2member_before_add_js_w_globals", get_defined_vars ());
49
+ /**/
50
+ if (!is_admin () || (c_ws_plugin__s2member_utils_conds::is_user_admin () && $pagenow === "profile.php" && !current_user_can ("edit_users")))
51
+ {
52
+ if (is_user_logged_in ()) /* Separate version for logged-in Users/Members. */
53
+ {
54
+ $md5 = WS_PLUGIN__S2MEMBER_API_CONSTANTS_MD5; /* An MD5 hash based on global key => values. */
55
+ /* The MD5 hash allows the script to be cached in the browser until the globals happen to change. */
56
+ /* For instance, the global variables may change when a User who is logged-in changes their Profile. */
57
+ wp_enqueue_script ("ws-plugin--s2member", site_url ("/?ws_plugin__s2member_js_w_globals=" . urlencode ($md5) . "&qcABC=1"), array ("jquery"), c_ws_plugin__s2member_utilities::ver_checksum ());
58
+ }
59
+ else /* Else if they are not logged in, we distinguish the JavaScript file by NOT including $md5. */
60
+ { /* This essentially creates 2 versions of the script. One while logged in & another when not. */
61
+ wp_enqueue_script ("ws-plugin--s2member", site_url ("/?ws_plugin__s2member_js_w_globals=1&qcABC=1"), array ("jquery"), c_ws_plugin__s2member_utilities::ver_checksum ());
62
+ }
63
+ /**/
64
+ do_action ("ws_plugin__s2member_during_add_js_w_globals", get_defined_vars ());
65
+ }
66
+ /**/
67
+ do_action ("ws_plugin__s2member_after_add_js_w_globals", get_defined_vars ());
68
+ /**/
69
+ return; /* Return for uniformity. */
70
+ }
71
+ }
72
+ }
73
+ ?>
includes/classes/css-js.inc.php CHANGED
@@ -19,84 +19,15 @@ if (!class_exists ("c_ws_plugin__s2member_css_js"))
19
  class c_ws_plugin__s2member_css_js
20
  {
21
  /*
22
- Adds CSS files.
23
- Attach to: add_action("wp_print_styles");
24
- */
25
- public static function add_css ()
26
- {
27
- do_action ("ws_plugin__s2member_before_add_css", get_defined_vars ());
28
- /**/
29
- if (!is_admin ()) /* Not in the admin. */
30
- {
31
- wp_enqueue_style ("ws-plugin--s2member", site_url ("/?ws_plugin__s2member_css=1&qcABC=1"), array (), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["options_version"] . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["filemtime"], "all");
32
- /**/
33
- do_action ("ws_plugin__s2member_during_add_css", get_defined_vars ());
34
- }
35
- /**/
36
- do_action ("ws_plugin__s2member_after_add_css", get_defined_vars ());
37
- /**/
38
- return; /* Return for uniformity. */
39
- }
40
- /*
41
  Builds CSS files.
42
  Attach to: add_action("init");
43
  */
44
  public static function css ()
45
  {
46
- do_action ("ws_plugin__s2member_before_css", get_defined_vars ());
47
- /**/
48
- if ($_GET["ws_plugin__s2member_css"])
49
- {
50
- header ("Content-Type: text/css; charset=utf-8");
51
- header ("Expires: " . gmdate ("D, d M Y H:i:s", strtotime ("+1 week")) . " GMT");
52
- header ("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
53
- header ("Cache-Control: max-age=604800");
54
- header ("Pragma: public");
55
- /**/
56
- $u = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"];
57
- $i = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images";
58
- /**/
59
- ob_start ("c_ws_plugin__s2member_utils_css::compress_css"); /* Compress. */
60
- /**/
61
- include_once dirname (dirname (__FILE__)) . "/s2member.css";
62
- /**/
63
- do_action ("ws_plugin__s2member_during_css", get_defined_vars ());
64
- /**/
65
- exit (); /* Clean exit. */
66
- }
67
- /**/
68
- do_action ("ws_plugin__s2member_after_css", get_defined_vars ());
69
- }
70
- /*
71
- Adds JavaScript files.
72
- Attach to: add_action("wp_print_scripts");
73
- */
74
- public static function add_js_w_globals ()
75
- {
76
- global $pagenow; /* Need this for comparisons. */
77
- /**/
78
- do_action ("ws_plugin__s2member_before_add_js_w_globals", get_defined_vars ());
79
- /**/
80
- if (!is_admin () || (c_ws_plugin__s2member_utils_conds::is_user_admin () && $pagenow === "profile.php" && !current_user_can ("edit_users")))
81
  {
82
- if (is_user_logged_in ()) /* Separate version for logged-in Users/Members. */
83
- {
84
- $md5 = WS_PLUGIN__S2MEMBER_API_CONSTANTS_MD5; /* An MD5 hash based on global key => values. */
85
- /* The MD5 hash allows the script to be cached in the browser until the globals happen to change. */
86
- /* For instance, the global variables may change when a User who is logged-in changes their Profile. */
87
- wp_enqueue_script ("ws-plugin--s2member", site_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"]);
88
- }
89
- else /* Else if they are not logged in, we distinguish the JavaScript file by NOT including $md5. */
90
- { /* This essentially creates 2 versions of the script. One while logged in & another when not. */
91
- wp_enqueue_script ("ws-plugin--s2member", site_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"]);
92
- }
93
- /**/
94
- do_action ("ws_plugin__s2member_during_add_js_w_globals", get_defined_vars ());
95
  }
96
- /**/
97
- do_action ("ws_plugin__s2member_after_add_js_w_globals", get_defined_vars ());
98
- /**/
99
- return; /* Return for uniformity. */
100
  }
101
  /*
102
  Builds JavaScript files.
@@ -104,101 +35,10 @@ if (!class_exists ("c_ws_plugin__s2member_css_js"))
104
  */
105
  public static function js_w_globals ()
106
  {
107
- do_action ("ws_plugin__s2member_before_js_w_globals", get_defined_vars ());
108
- /**/
109
- if ($_GET["ws_plugin__s2member_js_w_globals"])
110
  {
111
- header ("Content-Type: text/javascript; charset=utf-8");
112
- header ("Expires: " . gmdate ("D, d M Y H:i:s", strtotime ("+1 week")) . " GMT");
113
- header ("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
114
- header ("Cache-Control: max-age=604800");
115
- header ("Pragma: public");
116
- /**/
117
- $g = "var S2MEMBER_VERSION = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_VERSION) . "',"; /* Since 3.0. */
118
- /**/
119
- $g .= "S2MEMBER_CURRENT_USER_IS_LOGGED_IN = " . ((S2MEMBER_CURRENT_USER_IS_LOGGED_IN) ? "true" : "false") . ",";
120
- $g .= "S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER = " . ((S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER) ? "true" : "false") . ",";
121
- $g .= "S2MEMBER_CURRENT_USER_ACCESS_LEVEL = " . S2MEMBER_CURRENT_USER_ACCESS_LEVEL . ",";
122
- $g .= "S2MEMBER_CURRENT_USER_ACCESS_LABEL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_CURRENT_USER_ACCESS_LABEL) . "',";
123
- $g .= "S2MEMBER_CURRENT_USER_SUBSCR_ID = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_CURRENT_USER_SUBSCR_ID) . "',";
124
- $g .= "S2MEMBER_CURRENT_USER_CUSTOM = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_CURRENT_USER_CUSTOM) . "',";
125
- $g .= "S2MEMBER_CURRENT_USER_REGISTRATION_TIME = " . S2MEMBER_CURRENT_USER_REGISTRATION_TIME . ",";
126
- $g .= "S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME = " . S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME . ",";
127
- $g .= "S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS = " . S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS . ",";
128
- $g .= "S2MEMBER_CURRENT_USER_REGISTRATION_DAYS = " . S2MEMBER_CURRENT_USER_REGISTRATION_DAYS . ",";
129
- $g .= "S2MEMBER_CURRENT_USER_DISPLAY_NAME = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_CURRENT_USER_DISPLAY_NAME) . "',";
130
- $g .= "S2MEMBER_CURRENT_USER_FIRST_NAME = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_CURRENT_USER_FIRST_NAME) . "',";
131
- $g .= "S2MEMBER_CURRENT_USER_LAST_NAME = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_CURRENT_USER_LAST_NAME) . "',";
132
- $g .= "S2MEMBER_CURRENT_USER_LOGIN = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_CURRENT_USER_LOGIN) . "',";
133
- $g .= "S2MEMBER_CURRENT_USER_EMAIL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_CURRENT_USER_EMAIL) . "',";
134
- $g .= "S2MEMBER_CURRENT_USER_IP = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_CURRENT_USER_IP) . "',";
135
- $g .= "S2MEMBER_CURRENT_USER_ID = " . S2MEMBER_CURRENT_USER_ID . ",";
136
- $g .= "S2MEMBER_CURRENT_USER_FIELDS = " . S2MEMBER_CURRENT_USER_FIELDS . ",";
137
- /**/
138
- $g .= "S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED = " . S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED . ",";
139
- $g .= "S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED = " . ((S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED) ? "true" : "false") . ",";
140
- $g .= "S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY = " . S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY . ",";
141
- $g .= "S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS = " . S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS . ",";
142
- /**/
143
- $g .= "S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID = " . S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID . ",";
144
- $g .= "S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID = " . S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID . ",";
145
- $g .= "S2MEMBER_LOGIN_WELCOME_PAGE_ID = " . S2MEMBER_LOGIN_WELCOME_PAGE_ID . ",";
146
- /**/
147
- $g .= "S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL) . "',";
148
- $g .= "S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL) . "',";
149
- $g .= "S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL) . "',";
150
- $g .= "S2MEMBER_LOGIN_WELCOME_PAGE_URL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_LOGIN_WELCOME_PAGE_URL) . "',";
151
- $g .= "S2MEMBER_LOGOUT_PAGE_URL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_LOGOUT_PAGE_URL) . "',";
152
- $g .= "S2MEMBER_LOGIN_PAGE_URL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_LOGIN_PAGE_URL) . "',";
153
- /**/
154
- $g .= "S2MEMBER_LEVEL0_LABEL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_LEVEL0_LABEL) . "',";
155
- $g .= "S2MEMBER_LEVEL1_LABEL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_LEVEL1_LABEL) . "',";
156
- $g .= "S2MEMBER_LEVEL2_LABEL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_LEVEL2_LABEL) . "',";
157
- $g .= "S2MEMBER_LEVEL3_LABEL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_LEVEL3_LABEL) . "',";
158
- $g .= "S2MEMBER_LEVEL4_LABEL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_LEVEL4_LABEL) . "',";
159
- /**/
160
- $g .= "S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED = " . S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED . ",";
161
- $g .= "S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED = " . S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED . ",";
162
- $g .= "S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED = " . S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED . ",";
163
- $g .= "S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED = " . S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED . ",";
164
- $g .= "S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED = " . S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED . ",";
165
- /**/
166
- $g .= "S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED_DAYS = " . S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED_DAYS . ",";
167
- $g .= "S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED_DAYS = " . S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED_DAYS . ",";
168
- $g .= "S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED_DAYS = " . S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED_DAYS . ",";
169
- $g .= "S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED_DAYS = " . S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED_DAYS . ",";
170
- $g .= "S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED_DAYS = " . S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED_DAYS . ",";
171
- /**/
172
- $g .= "S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS) . "',";
173
- /**/
174
- $g .= "S2MEMBER_REG_EMAIL_FROM_NAME = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_REG_EMAIL_FROM_NAME) . "',";
175
- $g .= "S2MEMBER_REG_EMAIL_FROM_EMAIL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_REG_EMAIL_FROM_EMAIL) . "',";
176
- /**/
177
- $g .= "S2MEMBER_PAYPAL_NOTIFY_URL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_PAYPAL_NOTIFY_URL) . "',";
178
- $g .= "S2MEMBER_PAYPAL_RETURN_URL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_PAYPAL_RETURN_URL) . "',";
179
- /**/
180
- $g .= "S2MEMBER_PAYPAL_BUSINESS = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_PAYPAL_BUSINESS) . "',";
181
- $g .= "S2MEMBER_PAYPAL_ENDPOINT = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_PAYPAL_ENDPOINT) . "',";
182
- $g .= "S2MEMBER_PAYPAL_API_ENDPOINT = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_PAYPAL_API_ENDPOINT) . "',";
183
- /**/
184
- $g .= "S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0 = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0) . "',";
185
- $g .= "S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0 = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0) . "',";
186
- /**/
187
- $g = trim ($g, " ,") . ";"; /* Trim & add semicolon. */
188
- /**/
189
- $u = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"];
190
- $i = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images";
191
- /**/
192
- echo $g . "\n"; /* Add a line break before inclusion. */
193
- /**/
194
- include_once dirname (dirname (__FILE__)) . "/s2member-min.js";
195
- /**/
196
- do_action ("ws_plugin__s2member_during_js_w_globals", get_defined_vars ());
197
- /**/
198
- exit (); /* Clean exit. */
199
  }
200
- /**/
201
- do_action ("ws_plugin__s2member_after_js_w_globals", get_defined_vars ());
202
  }
203
  }
204
  }
19
  class c_ws_plugin__s2member_css_js
20
  {
21
  /*
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  Builds CSS files.
23
  Attach to: add_action("init");
24
  */
25
  public static function css ()
26
  {
27
+ if ($_GET["ws_plugin__s2member_css"]) /* Call inner function? */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  {
29
+ return c_ws_plugin__s2member_css_js_in::css ();
 
 
 
 
 
 
 
 
 
 
 
 
30
  }
 
 
 
 
31
  }
32
  /*
33
  Builds JavaScript files.
35
  */
36
  public static function js_w_globals ()
37
  {
38
+ if ($_GET["ws_plugin__s2member_js_w_globals"]) /* Call inner function? */
 
 
39
  {
40
+ return c_ws_plugin__s2member_css_js_in::js_w_globals ();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  }
 
 
42
  }
43
  }
44
  }
includes/classes/files-checks.inc.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Copyright: © 2009 WebSharks, Inc. ( coded in the USA )
4
+ <mailto:support@websharks-inc.com> <http://www.websharks-inc.com/>
5
+
6
+ Released under the terms of the GNU General Public License.
7
+ You should have received a copy of the GNU General Public License,
8
+ along with this software. In the main directory, see: /licensing/
9
+ If not, see: <http://www.gnu.org/licenses/>.
10
+ */
11
+ /*
12
+ Direct access denial.
13
+ */
14
+ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
+ /**/
17
+ if (!class_exists ("c_ws_plugin__s2member_files_checks"))
18
+ {
19
+ class c_ws_plugin__s2member_files_checks
20
+ {
21
+ /*
22
+ Function for handling download access permissions.
23
+ Attach to: add_action("init");
24
+ */
25
+ public static function check_file_download_access ()
26
+ {
27
+ if ($_GET["s2member_file_download"]) /* Call inner function? */
28
+ {
29
+ return c_ws_plugin__s2member_files_in::check_file_download_access ();
30
+ }
31
+ }
32
+ }
33
+ }
34
+ ?>
includes/classes/files.inc.php CHANGED
@@ -19,17 +19,6 @@ if (!class_exists ("c_ws_plugin__s2member_files"))
19
  class c_ws_plugin__s2member_files
20
  {
21
  /*
22
- Function for handling download access permissions.
23
- Attach to: add_action("init");
24
- */
25
- public static function check_file_download_access ()
26
- {
27
- if ($_GET["s2member_file_download"]) /* Call inner function? */
28
- {
29
- return c_ws_plugin__s2member_files_in::check_file_download_access ();
30
- }
31
- }
32
- /*
33
  Function creates a special File Download Key.
34
  Uses: date("Y-m-d") . $_SERVER["REMOTE_ADDR"] . $_SERVER["HTTP_USER_AGENT"] . $file.
35
 
19
  class c_ws_plugin__s2member_files
20
  {
21
  /*
 
 
 
 
 
 
 
 
 
 
 
22
  Function creates a special File Download Key.
23
  Uses: date("Y-m-d") . $_SERVER["REMOTE_ADDR"] . $_SERVER["HTTP_USER_AGENT"] . $file.
24
 
includes/classes/installation.inc.php CHANGED
@@ -19,14 +19,7 @@ if (!class_exists ("c_ws_plugin__s2member_installation"))
19
  class c_ws_plugin__s2member_installation
20
  {
21
  /*
22
- Function for handling activation routines.
23
- This function should match the array key for this plugin:
24
- ws_plugin__$plugin_key_activate() is called by our themes.
25
-
26
- We also initialize some option values here.
27
- Initializing these options will force them to be
28
- autoloaded into WordPress® instead of generating
29
- extra queries before they are set.
30
  */
31
  public static function activate ()
32
  {
@@ -225,9 +218,7 @@ if (!class_exists ("c_ws_plugin__s2member_installation"))
225
  return; /* Return for uniformity. */
226
  }
227
  /*
228
- Function for handling de-activation cleanup routines.
229
- This function should match the array key for this plugin:
230
- ws_plugin__$plugin_key_deactivate() is called by our themes.
231
  */
232
  public static function deactivate ()
233
  {
@@ -288,9 +279,9 @@ if (!class_exists ("c_ws_plugin__s2member_installation"))
288
  {
289
  if (file_exists ($htaccess = $files_dir . "/.htaccess"))
290
  if (is_writable ($htaccess))
291
- unlink($htaccess);
292
  /**/
293
- @rmdir($files_dir) . @rmdir (c_ws_plugin__s2member_utils_dirs::strip_dir_app_data ($files_dir));
294
  }
295
  /**/
296
  if (is_dir ($logs_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"]))
@@ -298,9 +289,9 @@ if (!class_exists ("c_ws_plugin__s2member_installation"))
298
  foreach (scandir ($logs_dir) as $log_file)
299
  if (is_file ($log_file = $logs_dir . "/" . $log_file))
300
  if (is_writable ($log_file))
301
- unlink($log_file);
302
  /**/
303
- @rmdir($logs_dir) . @rmdir (c_ws_plugin__s2member_utils_dirs::strip_dir_app_data ($logs_dir));
304
  }
305
  /**/
306
  delete_option ("ws_plugin__s2member_cache");
19
  class c_ws_plugin__s2member_installation
20
  {
21
  /*
22
+ Handles activation routines.
 
 
 
 
 
 
 
23
  */
24
  public static function activate ()
25
  {
218
  return; /* Return for uniformity. */
219
  }
220
  /*
221
+ Handles de-activation / cleanup routines.
 
 
222
  */
223
  public static function deactivate ()
224
  {
279
  {
280
  if (file_exists ($htaccess = $files_dir . "/.htaccess"))
281
  if (is_writable ($htaccess))
282
+ unlink ($htaccess);
283
  /**/
284
+ @rmdir ($files_dir) . @rmdir (c_ws_plugin__s2member_utils_dirs::strip_dir_app_data ($files_dir));
285
  }
286
  /**/
287
  if (is_dir ($logs_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"]))
289
  foreach (scandir ($logs_dir) as $log_file)
290
  if (is_file ($log_file = $logs_dir . "/" . $log_file))
291
  if (is_writable ($log_file))
292
+ unlink ($log_file);
293
  /**/
294
+ @rmdir ($logs_dir) . @rmdir (c_ws_plugin__s2member_utils_dirs::strip_dir_app_data ($logs_dir));
295
  }
296
  /**/
297
  delete_option ("ws_plugin__s2member_cache");
includes/classes/labels.inc.php CHANGED
@@ -39,7 +39,7 @@ if (!class_exists ("c_ws_plugin__s2member_labels"))
39
  */
40
  public static function _label_translations ($translation = FALSE, $text = FALSE, $context = FALSE)
41
  {
42
- if ($text && $context && preg_match ("/^User role$/i", $context) && ($role = $text))
43
  {
44
  if (preg_match ("/^(Free )?Subscriber$/i", $role) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_label"])
45
  $translation = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_label"];
39
  */
40
  public static function _label_translations ($translation = FALSE, $text = FALSE, $context = FALSE)
41
  {
42
+ if ($text && $context && stripos ($context, "User role") === 0 && ($role = $text))
43
  {
44
  if (preg_match ("/^(Free )?Subscriber$/i", $role) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_label"])
45
  $translation = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_label"];
includes/classes/login-customizations.inc.php CHANGED
@@ -19,7 +19,7 @@ if (!class_exists ("c_ws_plugin__s2member_login_customizations"))
19
  class c_ws_plugin__s2member_login_customizations
20
  {
21
  /*
22
- Function filters the Login/Registration Logo Url.
23
  Attach to: add_filter("login_headerurl");
24
  */
25
  public static function login_header_url ($url = FALSE)
@@ -31,7 +31,7 @@ if (!class_exists ("c_ws_plugin__s2member_login_customizations"))
31
  return apply_filters ("ws_plugin__s2member_login_header_url", $url, get_defined_vars ());
32
  }
33
  /*
34
- Function filters the Login/Registration Logo Title.
35
  Attach to: add_filter("login_headertitle");
36
  */
37
  public static function login_header_title ($title = FALSE)
@@ -43,7 +43,7 @@ if (!class_exists ("c_ws_plugin__s2member_login_customizations"))
43
  return apply_filters ("ws_plugin__s2member_login_header_title", $title, get_defined_vars ());
44
  }
45
  /*
46
- Function creates styles for the Login/Registration panel.
47
  Attach to: add_action("login_head");
48
  */
49
  public static function login_header_styles ()
@@ -57,8 +57,11 @@ if (!class_exists ("c_ws_plugin__s2member_login_customizations"))
57
  /* The !important declarations can be disabled here if you need to apply other hard-coded styles. */
58
  $important = $i = apply_filters ("ws_plugin__s2member_login_header_styles_important", " !important", get_defined_vars ());
59
  /**/
60
- $s .= "\n" . '<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>' . "\n";
61
- $s .= '<script type="text/javascript" src="' . esc_attr (site_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
  /**/
19
  class c_ws_plugin__s2member_login_customizations
20
  {
21
  /*
22
+ Filters the Login/Registration Logo Url.
23
  Attach to: add_filter("login_headerurl");
24
  */
25
  public static function login_header_url ($url = FALSE)
31
  return apply_filters ("ws_plugin__s2member_login_header_url", $url, get_defined_vars ());
32
  }
33
  /*
34
+ Filters the Login/Registration Logo Title.
35
  Attach to: add_filter("login_headertitle");
36
  */
37
  public static function login_header_title ($title = FALSE)
43
  return apply_filters ("ws_plugin__s2member_login_header_title", $title, get_defined_vars ());
44
  }
45
  /*
46
+ Creates styles for the Login/Registration panel.
47
  Attach to: add_action("login_head");
48
  */
49
  public static function login_header_styles ()
57
  /* The !important declarations can be disabled here if you need to apply other hard-coded styles. */
58
  $important = $i = apply_filters ("ws_plugin__s2member_login_header_styles_important", " !important", get_defined_vars ());
59
  /**/
60
+ if (!version_compare (get_bloginfo ("version"), "3.1-RC", ">=")) /* No longer required with WordPress® 3.1+. */
61
+ {
62
+ $s .= "\n" . '<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>' . "\n";
63
+ $s .= '<script type="text/javascript" src="' . esc_attr (site_url ("/?ws_plugin__s2member_js_w_globals=1&amp;no-cache=" . urlencode (md5 (mt_rand ())))) . '"></script>' . "\n";
64
+ }
65
  /**/
66
  $s .= "\n" . '<style type="text/css">' . "\n";
67
  /**/
includes/classes/login-redirects-r.inc.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Copyright: © 2009 WebSharks, Inc. ( coded in the USA )
4
+ <mailto:support@websharks-inc.com> <http://www.websharks-inc.com/>
5
+
6
+ Released under the terms of the GNU General Public License.
7
+ You should have received a copy of the GNU General Public License,
8
+ along with this software. In the main directory, see: /licensing/
9
+ If not, see: <http://www.gnu.org/licenses/>.
10
+ */
11
+ /*
12
+ Direct access denial.
13
+ */
14
+ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
+ /**/
17
+ if (!class_exists ("c_ws_plugin__s2member_login_redirects_r"))
18
+ {
19
+ class c_ws_plugin__s2member_login_redirects_r
20
+ {
21
+ /*
22
+ This function removes login_redirect Filters to prevent conflicts with s2Member.
23
+ Attach to: add_action("init");
24
+ */
25
+ public static function remove_login_redirect_filters () /* For compatibility. */
26
+ {
27
+ do_action ("ws_plugin__s2member_before_remove_login_redirect_filters", get_defined_vars ());
28
+ /**/
29
+ remove_all_filters ("login_redirect"); /* Removes ALL `login_redirect` Filters. */
30
+ /**/
31
+ do_action ("ws_plugin__s2member_after_remove_login_redirect_filters", get_defined_vars ());
32
+ }
33
+ }
34
+ }
35
+ ?>
includes/classes/login-redirects.inc.php CHANGED
@@ -19,18 +19,6 @@ if (!class_exists ("c_ws_plugin__s2member_login_redirects"))
19
  class c_ws_plugin__s2member_login_redirects
20
  {
21
  /*
22
- This function removes login_redirect Filters to prevent conflicts with s2Member.
23
- Attach to: add_action("init");
24
- */
25
- public static function remove_login_redirect_filters () /* For compatibility. */
26
- {
27
- do_action ("ws_plugin__s2member_before_remove_login_redirect_filters", get_defined_vars ());
28
- /**/
29
- remove_all_filters ("login_redirect"); /* Removes ALL `login_redirect` Filters. */
30
- /**/
31
- do_action ("ws_plugin__s2member_after_remove_login_redirect_filters", get_defined_vars ());
32
- }
33
- /*
34
  Function for handling login redirections.
35
  Attach to: add_action("wp_login");
36
  */
@@ -59,7 +47,7 @@ if (!class_exists ("c_ws_plugin__s2member_login_redirects"))
59
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
60
  /**/
61
  if ($special_redirection_url = c_ws_plugin__s2member_login_redirects::login_redirection_url ($user))
62
- wp_redirect($special_redirection_url); /* Special Redirection. */
63
  /**/
64
  else /* Else we use the Login Welcome Page configured for s2Member. */
65
  wp_redirect (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]));
19
  class c_ws_plugin__s2member_login_redirects
20
  {
21
  /*
 
 
 
 
 
 
 
 
 
 
 
 
22
  Function for handling login redirections.
23
  Attach to: add_action("wp_login");
24
  */
47
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
48
  /**/
49
  if ($special_redirection_url = c_ws_plugin__s2member_login_redirects::login_redirection_url ($user))
50
+ wp_redirect ($special_redirection_url); /* Special Redirection. */
51
  /**/
52
  else /* Else we use the Login Welcome Page configured for s2Member. */
53
  wp_redirect (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]));
includes/classes/menu-pages.inc.php CHANGED
@@ -228,9 +228,9 @@ if (!class_exists ("c_ws_plugin__s2member_menu_pages"))
228
  wp_enqueue_script ("thickbox");
229
  wp_enqueue_script ("media-upload");
230
  wp_enqueue_script ("jquery-ui-core");
231
- wp_enqueue_script ("jquery-json-ps", $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/includes/menu-pages/jquery-json-ps-min.js", array ("jquery"), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["options_version"] . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["filemtime"]);
232
- wp_enqueue_script ("jquery-ui-effects", $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/includes/menu-pages/jquery-ui-effects.js", array ("jquery", "jquery-ui-core"), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["options_version"] . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["filemtime"]);
233
- wp_enqueue_script ("ws-plugin--s2member-menu-pages", site_url ("/?ws_plugin__s2member_menu_pages_js=" . urlencode (mt_rand ())), array ("jquery", "thickbox", "media-upload", "jquery-json-ps", "jquery-ui-core", "jquery-ui-effects"), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["options_version"] . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["filemtime"]);
234
  /**/
235
  do_action ("ws_plugin__s2member_during_add_admin_scripts", get_defined_vars ());
236
  }
@@ -250,7 +250,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_pages"))
250
  if ($_GET["page"] && preg_match ("/ws-plugin--s2member-/", $_GET["page"]))
251
  {
252
  wp_enqueue_style ("thickbox");
253
- wp_enqueue_style ("ws-plugin--s2member-menu-pages", site_url ("/?ws_plugin__s2member_menu_pages_css=" . urlencode (mt_rand ())), array ("thickbox"), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["options_version"] . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["filemtime"], "all");
254
  /**/
255
  do_action ("ws_plugin__s2member_during_add_admin_styles", get_defined_vars ());
256
  }
228
  wp_enqueue_script ("thickbox");
229
  wp_enqueue_script ("media-upload");
230
  wp_enqueue_script ("jquery-ui-core");
231
+ wp_enqueue_script ("jquery-json-ps", $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/includes/menu-pages/jquery-json-ps-min.js", array ("jquery"), c_ws_plugin__s2member_utilities::ver_checksum ());
232
+ wp_enqueue_script ("jquery-ui-effects", $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/includes/menu-pages/jquery-ui-effects.js", array ("jquery", "jquery-ui-core"), c_ws_plugin__s2member_utilities::ver_checksum ());
233
+ wp_enqueue_script ("ws-plugin--s2member-menu-pages", site_url ("/?ws_plugin__s2member_menu_pages_js=" . urlencode (mt_rand ())), array ("jquery", "thickbox", "media-upload", "jquery-json-ps", "jquery-ui-core", "jquery-ui-effects"), c_ws_plugin__s2member_utilities::ver_checksum ());
234
  /**/
235
  do_action ("ws_plugin__s2member_during_add_admin_scripts", get_defined_vars ());
236
  }
250
  if ($_GET["page"] && preg_match ("/ws-plugin--s2member-/", $_GET["page"]))
251
  {
252
  wp_enqueue_style ("thickbox");
253
+ wp_enqueue_style ("ws-plugin--s2member-menu-pages", site_url ("/?ws_plugin__s2member_menu_pages_css=" . urlencode (mt_rand ())), array ("thickbox"), c_ws_plugin__s2member_utilities::ver_checksum (), "all");
254
  /**/
255
  do_action ("ws_plugin__s2member_during_add_admin_styles", get_defined_vars ());
256
  }
includes/classes/meta-box-saves.inc.php CHANGED
@@ -62,7 +62,7 @@ if (!class_exists ("c_ws_plugin__s2member_meta_box_saves"))
62
  if (!$pages[$_p["ws_plugin__s2member_security_meta_box_level"]] !== array ("all"))
63
  array_push ($pages[$_p["ws_plugin__s2member_security_meta_box_level"]], $page_id);
64
  /**/
65
- $new_options = array_merge ((array)$new_options, array ("ws_plugin__s2member_level0_pages" => implode (",", $pages[0]), "ws_plugin__s2member_level1_pages" => implode (",", $pages[1]), "ws_plugin__s2member_level2_pages" => implode (",", $pages[2]), "ws_plugin__s2member_level3_pages" => implode (",", $pages[3]), "ws_plugin__s2member_level4_pages" => implode (",", $pages[4])));
66
  /**/
67
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
68
  do_action ("ws_plugin__s2member_during_save_meta_boxes", get_defined_vars ());
@@ -97,7 +97,7 @@ if (!class_exists ("c_ws_plugin__s2member_meta_box_saves"))
97
  if (!$posts[$_p["ws_plugin__s2member_security_meta_box_level"]] !== array ("all"))
98
  array_push ($posts[$_p["ws_plugin__s2member_security_meta_box_level"]], $post_id);
99
  /**/
100
- $new_options = array_merge ((array)$new_options, array ("ws_plugin__s2member_level0_posts" => implode (",", $posts[0]), "ws_plugin__s2member_level1_posts" => implode (",", $posts[1]), "ws_plugin__s2member_level2_posts" => implode (",", $posts[2]), "ws_plugin__s2member_level3_posts" => implode (",", $posts[3]), "ws_plugin__s2member_level4_posts" => implode (",", $posts[4])));
101
  /**/
102
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
103
  do_action ("ws_plugin__s2member_during_save_meta_boxes", get_defined_vars ());
62
  if (!$pages[$_p["ws_plugin__s2member_security_meta_box_level"]] !== array ("all"))
63
  array_push ($pages[$_p["ws_plugin__s2member_security_meta_box_level"]], $page_id);
64
  /**/
65
+ $new_options = array_merge ((array)$new_options, array ("ws_plugin__s2member_level0_pages" => implode (",", $pages["0"]), "ws_plugin__s2member_level1_pages" => implode (",", $pages["1"]), "ws_plugin__s2member_level2_pages" => implode (",", $pages["2"]), "ws_plugin__s2member_level3_pages" => implode (",", $pages["3"]), "ws_plugin__s2member_level4_pages" => implode (",", $pages["4"])));
66
  /**/
67
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
68
  do_action ("ws_plugin__s2member_during_save_meta_boxes", get_defined_vars ());
97
  if (!$posts[$_p["ws_plugin__s2member_security_meta_box_level"]] !== array ("all"))
98
  array_push ($posts[$_p["ws_plugin__s2member_security_meta_box_level"]], $post_id);
99
  /**/
100
+ $new_options = array_merge ((array)$new_options, array ("ws_plugin__s2member_level0_posts" => implode (",", $posts["0"]), "ws_plugin__s2member_level1_posts" => implode (",", $posts["1"]), "ws_plugin__s2member_level2_posts" => implode (",", $posts["2"]), "ws_plugin__s2member_level3_posts" => implode (",", $posts["3"]), "ws_plugin__s2member_level4_posts" => implode (",", $posts["4"])));
101
  /**/
102
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
103
  do_action ("ws_plugin__s2member_during_save_meta_boxes", get_defined_vars ());
includes/classes/meta-boxes.inc.php CHANGED
@@ -20,15 +20,16 @@ if (!class_exists ("c_ws_plugin__s2member_meta_boxes"))
20
  {
21
  /*
22
  Function adds meta boxes to Post/Page editing stations.
23
- Attach to: add_action("admin_menu");
 
 
24
  */
25
- public static function add_meta_boxes ()
26
  {
27
  do_action ("ws_plugin__s2member_before_add_meta_boxes", get_defined_vars ());
28
  /**/
29
- foreach (get_post_types () as $type) /* Handles Custom Post Types as well. */
30
- if (!in_array ($type, array ("revision", "attachment", "nav_menu_item"))) /* But NOT on these Post Types. */
31
- add_meta_box ("ws-plugin--s2member-security", "s2Member", "c_ws_plugin__s2member_meta_box_security::security_meta_box", $type, "side", "high");
32
  /**/
33
  do_action ("ws_plugin__s2member_after_add_meta_boxes", get_defined_vars ());
34
  /**/
20
  {
21
  /*
22
  Function adds meta boxes to Post/Page editing stations.
23
+ * Note: WordPress® also calls this Hook with $type set to: `link` and `comment` Possibly others.
24
+ Thus, the need for: `in_array ($type, array_keys (get_post_types ()))`.
25
+ Attach to: add_action("add_meta_boxes");
26
  */
27
+ public static function add_meta_boxes ($type = FALSE)
28
  {
29
  do_action ("ws_plugin__s2member_before_add_meta_boxes", get_defined_vars ());
30
  /**/
31
+ if (in_array ($type, array_keys (get_post_types ())) && !in_array ($type, array ("link", "comment", "revision", "attachment", "nav_menu_item")))
32
+ add_meta_box ("ws-plugin--s2member-security", "s2Member", "c_ws_plugin__s2member_meta_box_security::security_meta_box", $type, "side", "high");
 
33
  /**/
34
  do_action ("ws_plugin__s2member_after_add_meta_boxes", get_defined_vars ());
35
  /**/
includes/classes/{misc-redirects.inc.php → mo-page-in.inc.php} RENAMED
@@ -14,33 +14,34 @@ Direct access denial.
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
  exit ("Do not access this file directly.");
16
  /**/
17
- if (!class_exists ("c_ws_plugin__s2member_misc_redirects"))
18
  {
19
- class c_ws_plugin__s2member_misc_redirects
20
  {
21
  /*
22
  This forces a redirection to the Membership Options Page for s2Member.
23
- This can be used by 3rd party applications that are not aware of which
24
- Page is currently set as the Membership Options Page.
25
 
26
  This is used by s2Member's bbPress Bridge integration.
27
 
28
- Attach to: add_action("template_redirect");
29
  Example usage: http://example.com/?s2member_membership_options_page=1
30
  */
31
  public static function membership_options_page () /* Force a redirection. */
32
  {
33
  do_action ("ws_plugin__s2member_before_membership_options_page", get_defined_vars ());
34
  /**/
35
- if ($_GET["s2member_membership_options_page"] && !is_page ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))
36
  {
37
  $query_args = array (); /* Initialize array. */
38
  foreach ($_GET as $var => $val) /* Include any s2member_ vars. */
39
  if (preg_match ("/^s2member_/", $var) && $var !== "s2member_membership_options_page")
40
  $query_args[$var] = $val;
 
41
  /**/
42
  wp_redirect (add_query_arg (urlencode_deep ($query_args), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), 301);
43
- exit ();
 
44
  }
45
  /**/
46
  do_action ("ws_plugin__s2member_after_membership_options_page", get_defined_vars ());
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
  exit ("Do not access this file directly.");
16
  /**/
17
+ if (!class_exists ("c_ws_plugin__s2member_mo_page_in"))
18
  {
19
+ class c_ws_plugin__s2member_mo_page_in
20
  {
21
  /*
22
  This forces a redirection to the Membership Options Page for s2Member.
23
+ This can be used by 3rd party applications that are not aware of which Page is currently set as the Membership Options Page.
 
24
 
25
  This is used by s2Member's bbPress Bridge integration.
26
 
27
+ Attach to: add_action("init");
28
  Example usage: http://example.com/?s2member_membership_options_page=1
29
  */
30
  public static function membership_options_page () /* Force a redirection. */
31
  {
32
  do_action ("ws_plugin__s2member_before_membership_options_page", get_defined_vars ());
33
  /**/
34
+ if ($_GET["s2member_membership_options_page"]) /* An incoming request? */
35
  {
36
  $query_args = array (); /* Initialize array. */
37
  foreach ($_GET as $var => $val) /* Include any s2member_ vars. */
38
  if (preg_match ("/^s2member_/", $var) && $var !== "s2member_membership_options_page")
39
  $query_args[$var] = $val;
40
+ /* Do NOT include `s2member_membership_options_page` as that could create a redirect loop. */
41
  /**/
42
  wp_redirect (add_query_arg (urlencode_deep ($query_args), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), 301);
43
+ /**/
44
+ exit (); /* Clean exit. */
45
  }
46
  /**/
47
  do_action ("ws_plugin__s2member_after_membership_options_page", get_defined_vars ());
includes/classes/mo-page.inc.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Copyright: © 2009 WebSharks, Inc. ( coded in the USA )
4
+ <mailto:support@websharks-inc.com> <http://www.websharks-inc.com/>
5
+
6
+ Released under the terms of the GNU General Public License.
7
+ You should have received a copy of the GNU General Public License,
8
+ along with this software. In the main directory, see: /licensing/
9
+ If not, see: <http://www.gnu.org/licenses/>.
10
+ */
11
+ /*
12
+ Direct access denial.
13
+ */
14
+ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
+ /**/
17
+ if (!class_exists ("c_ws_plugin__s2member_mo_page"))
18
+ {
19
+ class c_ws_plugin__s2member_mo_page
20
+ {
21
+ /*
22
+ This forces a redirection to the Membership Options Page for s2Member.
23
+ This can be used by 3rd party applications that are not aware of which Page is currently set as the Membership Options Page.
24
+
25
+ This is used by s2Member's bbPress Bridge integration.
26
+
27
+ Attach to: add_action("init");
28
+ Example usage: http://example.com/?s2member_membership_options_page=1
29
+ */
30
+ public static function membership_options_page () /* Force a redirection. */
31
+ {
32
+ if ($_GET["s2member_membership_options_page"]) /* Call inner function? */
33
+ {
34
+ return c_ws_plugin__s2member_mo_page_in::membership_options_page ();
35
+ }
36
+ }
37
+ }
38
+ }
39
+ ?>
includes/classes/nocache.inc.php CHANGED
@@ -27,7 +27,8 @@ if (!class_exists ("c_ws_plugin__s2member_nocache"))
27
  {
28
  do_action ("ws_plugin__s2member_before_nocache", get_defined_vars ());
29
  /**/
30
- c_ws_plugin__s2member_nocache::nocache_constants () . c_ws_plugin__s2member_nocache::nocache_headers ();
 
31
  /**/
32
  do_action ("ws_plugin__s2member_after_nocache", get_defined_vars ());
33
  /**/
@@ -40,7 +41,7 @@ if (!class_exists ("c_ws_plugin__s2member_nocache"))
40
  Actually, Quick Cache is compatible with either of these defined constants.
41
 
42
  Always disallow caching for logged in users and GET requests with /?s2member systematic use.
43
- For clarity on the systematic use with s2member in the request, see: is-systematic.inc.php.
44
  - Also disallow caching if the $nocache param is passed in as true by other routines.
45
  * BUT, always obey the qcAC param that specifically allows caching.
46
 
@@ -102,8 +103,8 @@ if (!class_exists ("c_ws_plugin__s2member_nocache"))
102
  if (!$once && !$_GET["qcABC"] && (!$using_selective_behavior || $selective) && !apply_filters ("ws_plugin__s2member_disable_nocache_headers", false, get_defined_vars ()))
103
  {
104
  if (is_array ($headers = headers_list ()))
105
- foreach ($headers as $k => $header)
106
- if (preg_match ("/no-cache/i", $header))
107
  $no_cache_already_sent = true;
108
  /**/
109
  if (!$no_cache_already_sent)
27
  {
28
  do_action ("ws_plugin__s2member_before_nocache", get_defined_vars ());
29
  /**/
30
+ c_ws_plugin__s2member_nocache::nocache_constants (); /* This first. */
31
+ c_ws_plugin__s2member_nocache::nocache_headers (); /* Now run headers. */
32
  /**/
33
  do_action ("ws_plugin__s2member_after_nocache", get_defined_vars ());
34
  /**/
41
  Actually, Quick Cache is compatible with either of these defined constants.
42
 
43
  Always disallow caching for logged in users and GET requests with /?s2member systematic use.
44
+ For clarity on the systematic use with s2member in the request, see: /classes/systematics.inc.php.
45
  - Also disallow caching if the $nocache param is passed in as true by other routines.
46
  * BUT, always obey the qcAC param that specifically allows caching.
47
 
103
  if (!$once && !$_GET["qcABC"] && (!$using_selective_behavior || $selective) && !apply_filters ("ws_plugin__s2member_disable_nocache_headers", false, get_defined_vars ()))
104
  {
105
  if (is_array ($headers = headers_list ()))
106
+ foreach ($headers as $header) /* Already? */
107
+ if (stripos ($header, "no-cache") !== false)
108
  $no_cache_already_sent = true;
109
  /**/
110
  if (!$no_cache_already_sent)
includes/classes/op-notices.inc.php CHANGED
@@ -20,7 +20,7 @@ if (!class_exists ("c_ws_plugin__s2member_op_notices"))
20
  {
21
  /*
22
  Function that describes the General Option overrides for clarity.
23
- Attach to: add_action("admin_init");
24
  */
25
  public static function general_ops_notice ()
26
  {
@@ -47,7 +47,8 @@ if (!class_exists ("c_ws_plugin__s2member_op_notices"))
47
  }
48
  /*
49
  Function that describes the Multisite Option overrides for clarity.
50
- Attach to: add_action("admin_init");
 
51
  */
52
  public static function multisite_ops_notice ()
53
  {
@@ -65,7 +66,7 @@ if (!class_exists ("c_ws_plugin__s2member_op_notices"))
65
  $js .= "jQuery('input[name=registration], input#add_new_users').attr('disabled', 'disabled');";
66
  $js .= '</script>';
67
  }
68
- else /* Else we use the old WordPress® v3.0.x method of disabling these important options. */
69
  {
70
  $notice = "<em>* Note: The s2Member plugin has control over four options on this page.<br /><code>Dashboard Blog = " . esc_html (get_site_option ("dashboard_blog")) . " / Main Site</code>, <code>Default Role = " . esc_html (get_site_option ("default_user_role")) . "</code>, <code>Allow Open Registration = " . esc_html (get_site_option ("registration")) . "</code>, and <code>Add New Users = " . esc_html (get_site_option ("add_new_users")) . "</code>.<br />In your Dashboard ( on the Main Site ), see: <code>s2Member -> Multisite ( Config )</code>.";
71
  /**/
@@ -85,7 +86,7 @@ if (!class_exists ("c_ws_plugin__s2member_op_notices"))
85
  }
86
  /*
87
  Function that deals with Reading Option conflicts.
88
- Attach to: add_action("admin_init");
89
  */
90
  public static function reading_ops_notice ()
91
  {
20
  {
21
  /*
22
  Function that describes the General Option overrides for clarity.
23
+ Attach to: add_action("load-options-general.php");
24
  */
25
  public static function general_ops_notice ()
26
  {
47
  }
48
  /*
49
  Function that describes the Multisite Option overrides for clarity.
50
+ Attach to: add_action("load-ms-options.php");
51
+ Attach to: add_action("load-settings.php");
52
  */
53
  public static function multisite_ops_notice ()
54
  {
66
  $js .= "jQuery('input[name=registration], input#add_new_users').attr('disabled', 'disabled');";
67
  $js .= '</script>';
68
  }
69
+ else /* Else we use the old WordPress® v3.0.x method of disabling these important options on the `ms-options.php` page. */
70
  {
71
  $notice = "<em>* Note: The s2Member plugin has control over four options on this page.<br /><code>Dashboard Blog = " . esc_html (get_site_option ("dashboard_blog")) . " / Main Site</code>, <code>Default Role = " . esc_html (get_site_option ("default_user_role")) . "</code>, <code>Allow Open Registration = " . esc_html (get_site_option ("registration")) . "</code>, and <code>Add New Users = " . esc_html (get_site_option ("add_new_users")) . "</code>.<br />In your Dashboard ( on the Main Site ), see: <code>s2Member -> Multisite ( Config )</code>.";
72
  /**/
86
  }
87
  /*
88
  Function that deals with Reading Option conflicts.
89
+ Attach to: add_action("load-options-reading.php");
90
  */
91
  public static function reading_ops_notice ()
92
  {
includes/classes/profile-in.inc.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Copyright: © 2009 WebSharks, Inc. ( coded in the USA )
4
+ <mailto:support@websharks-inc.com> <http://www.websharks-inc.com/>
5
+
6
+ Released under the terms of the GNU General Public License.
7
+ You should have received a copy of the GNU General Public License,
8
+ along with this software. In the main directory, see: /licensing/
9
+ If not, see: <http://www.gnu.org/licenses/>.
10
+ */
11
+ /*
12
+ Direct access denial.
13
+ */
14
+ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
+ /**/
17
+ if (!class_exists ("c_ws_plugin__s2member_profile_in"))
18
+ {
19
+ class c_ws_plugin__s2member_profile_in
20
+ {
21
+ /*
22
+ Function that displays a Profile Modification Form.
23
+ Attach to: add_action("init");
24
+ */
25
+ public static function profile ()
26
+ {
27
+ do_action ("ws_plugin__s2member_before_profile", get_defined_vars ());
28
+ /**/
29
+ if ($_GET["s2member_profile"] && is_user_logged_in ()) /* Logged in? */
30
+ {
31
+ include_once dirname (dirname (__FILE__)) . "/profile.inc.php";
32
+ /* Additional Hooks/Filters inside profile.inc.php. */
33
+ exit (); /* Clean exit. */
34
+ }
35
+ /**/
36
+ do_action ("ws_plugin__s2member_after_profile", get_defined_vars ());
37
+ }
38
+ }
39
+ }
40
+ ?>
includes/classes/profile-mods-in.inc.php CHANGED
@@ -24,7 +24,7 @@ if (!class_exists ("c_ws_plugin__s2member_profile_mods_in"))
24
  */
25
  public static function handle_profile_modifications ()
26
  {
27
- global $current_user; /* We'll need to update this object. */
28
  /**/
29
  do_action ("ws_plugin__s2member_before_handle_profile_modifications", get_defined_vars ());
30
  /**/
@@ -36,7 +36,7 @@ if (!class_exists ("c_ws_plugin__s2member_profile_mods_in"))
36
  /**/
37
  $_POST = c_ws_plugin__s2member_utils_strings::trim_deep (stripslashes_deep ($_POST)); /* Clean POST vars. */
38
  /**/
39
- $userdata["ID"] = $user_id = $current_user->ID;
40
  /**/
41
  include_once ABSPATH . WPINC . "/registration.php";
42
  /**/
@@ -57,7 +57,7 @@ if (!class_exists ("c_ws_plugin__s2member_profile_mods_in"))
57
  if ($_POST["ws_plugin__s2member_profile_last_name"])
58
  $userdata["last_name"] = $_POST["ws_plugin__s2member_profile_last_name"];
59
  /**/
60
- wp_update_user($userdata); /* OK. Now send this array for an update. */
61
  /**/
62
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"])
63
  if ($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level ("auto-detection"))
24
  */
25
  public static function handle_profile_modifications ()
26
  {
27
+ global $current_user; /* We'll need to update this global object. */
28
  /**/
29
  do_action ("ws_plugin__s2member_before_handle_profile_modifications", get_defined_vars ());
30
  /**/
36
  /**/
37
  $_POST = c_ws_plugin__s2member_utils_strings::trim_deep (stripslashes_deep ($_POST)); /* Clean POST vars. */
38
  /**/
39
+ $userdata["ID"] = $user_id = $current_user->ID; /* Needed for database update. */
40
  /**/
41
  include_once ABSPATH . WPINC . "/registration.php";
42
  /**/
57
  if ($_POST["ws_plugin__s2member_profile_last_name"])
58
  $userdata["last_name"] = $_POST["ws_plugin__s2member_profile_last_name"];
59
  /**/
60
+ wp_update_user ($userdata); /* OK. Now send this array for an update. */
61
  /**/
62
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"])
63
  if ($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level ("auto-detection"))
includes/classes/profile.inc.php CHANGED
@@ -20,22 +20,14 @@ if (!class_exists ("c_ws_plugin__s2member_profile"))
20
  {
21
  /*
22
  Function that displays a Profile Modification Form.
23
- Attach to: add_action("template_redirect");
24
  */
25
  public static function profile ()
26
  {
27
- do_action ("ws_plugin__s2member_before_profile", get_defined_vars ());
28
- /**/
29
- if ($_GET["s2member_profile"] && is_user_logged_in ()) /* Logged in? */
30
  {
31
- include_once dirname (dirname (__FILE__)) . "/profile.inc.php";
32
- /* Additional Hooks/Filters inside profile.inc.php. */
33
- exit (); /* Clean exit. */
34
  }
35
- /**/
36
- do_action ("ws_plugin__s2member_after_profile", get_defined_vars ());
37
- /**/
38
- return; /* Return for uniformity. */
39
  }
40
  }
41
  }
20
  {
21
  /*
22
  Function that displays a Profile Modification Form.
23
+ Attach to: add_action("init");
24
  */
25
  public static function profile ()
26
  {
27
+ if ($_GET["s2member_profile"]) /* Call inner function? */
 
 
28
  {
29
+ return c_ws_plugin__s2member_profile_in::profile ();
 
 
30
  }
 
 
 
 
31
  }
32
  }
33
  }
includes/classes/sc-paypal-button-e.inc.php CHANGED
@@ -35,8 +35,8 @@ if (!class_exists ("c_ws_plugin__s2member_sc_paypal_button_e"))
35
  /**/
36
  eval ('$_code = $vars["_code"]; $attr = $vars["attr"];'); /* Let's unpack ( i.e. use shorter references ) to these two important data vars. */
37
  /**/
38
- if ($cache && ($transient = "s2m_btn_" . md5 ($code . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["options_version"] . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["filemtime"])) && ($cache = get_transient ($transient)))
39
- $code = $cache; /* Great, so we can use the cached version here to save processing time. Notice the MD5 hash uses $code and NOT $_code; just in case a different `output=""` format was requested. */
40
  /**/
41
  else if (is_array ($inputs = c_ws_plugin__s2member_utils_forms::form_whips_2_array ($_code)) && !empty ($inputs)) /* Were we able to parse the hidden inputs variables? */
42
  {
35
  /**/
36
  eval ('$_code = $vars["_code"]; $attr = $vars["attr"];'); /* Let's unpack ( i.e. use shorter references ) to these two important data vars. */
37
  /**/
38
+ if ($cache && ($transient = "s2m_btn_" . md5 ($code . c_ws_plugin__s2member_utilities::ver_checksum ())) && ($cache = get_transient ($transient)))
39
+ $code = $cache; /* Great, so we can use the cached version here to save processing time. Notice the MD5 hash uses $code and NOT $_code. */
40
  /**/
41
  else if (is_array ($inputs = c_ws_plugin__s2member_utils_forms::form_whips_2_array ($_code)) && !empty ($inputs)) /* Were we able to parse the hidden inputs variables? */
42
  {
includes/classes/sc-paypal-button-in.inc.php CHANGED
@@ -103,6 +103,9 @@ if (!class_exists ("c_ws_plugin__s2member_sc_paypal_button_in"))
103
  {
104
  $default_image = "https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif"; /* Default PayPal® Image. */
105
  /**/
 
 
 
106
  $attr["desc"] = (!$attr["desc"]) ? $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $attr["level"] . "_label"] : $attr["desc"];
107
  /**/
108
  $attr["level_ccaps_eotper"] = ($attr["rr"] === "BN" && $attr["rt"] !== "L") ? $attr["level"] . ":" . $attr["ccaps"] . ":" . $attr["rp"] . " " . $attr["rt"] : $attr["level"] . ":" . $attr["ccaps"];
@@ -134,9 +137,9 @@ if (!class_exists ("c_ws_plugin__s2member_sc_paypal_button_in"))
134
  $code = preg_replace ('/ name\="page_style" value\="(.*?)"/', ' name="page_style" value="' . c_ws_plugin__s2member_utils_strings::esc_ds (esc_attr ($attr["ps"])) . '"', $code);
135
  $code = preg_replace ('/ name\="currency_code" value\="(.*?)"/', ' name="currency_code" value="' . c_ws_plugin__s2member_utils_strings::esc_ds (esc_attr ($attr["cc"])) . '"', $code);
136
  $code = preg_replace ('/ name\="custom" value\="(.*?)"/', ' name="custom" value="' . c_ws_plugin__s2member_utils_strings::esc_ds (esc_attr ($attr["custom"])) . '"', $code);
137
- $code = preg_replace ('/ name\="on0" value\="(.*?)"/', ' name="on0" value="' . c_ws_plugin__s2member_utils_strings::esc_ds (esc_attr (S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0)) . '"', $code);
138
- $code = preg_replace ('/ name\="os0" value\="(.*?)"/', ' name="os0" value="' . c_ws_plugin__s2member_utils_strings::esc_ds (esc_attr (S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0)) . '"', $code);
139
- $code = preg_replace ('/ name\="modify" value\="(.*?)"/', ' name="modify" value="' . c_ws_plugin__s2member_utils_strings::esc_ds (esc_attr (($attr["modify"]) ? "1" : "0")) . '"', $code);
140
  $code = preg_replace ('/ name\="amount" value\="(.*?)"/', ' name="amount" value="' . c_ws_plugin__s2member_utils_strings::esc_ds (esc_attr ($attr["ra"])) . '"', $code);
141
  $code = preg_replace ('/ name\="src" value\="(.*?)"/', ' name="src" value="' . c_ws_plugin__s2member_utils_strings::esc_ds (esc_attr ($attr["rr"])) . '"', $code);
142
  $code = preg_replace ('/ name\="a1" value\="(.*?)"/', ' name="a1" value="' . c_ws_plugin__s2member_utils_strings::esc_ds (esc_attr ($attr["ta"])) . '"', $code);
103
  {
104
  $default_image = "https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif"; /* Default PayPal® Image. */
105
  /**/
106
+ $paypal_on0_input_value = ($updating = c_ws_plugin__s2member_utils_users::get_user_subscr_or_wp_id ()) ? "Updating Subscr. ID" : "";
107
+ $paypal_os0_input_value = ($updating) ? $updating : ""; /* Current User's Paid Subscr. ID. Their WP® User ID will also suffice. */
108
+ /**/
109
  $attr["desc"] = (!$attr["desc"]) ? $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $attr["level"] . "_label"] : $attr["desc"];
110
  /**/
111
  $attr["level_ccaps_eotper"] = ($attr["rr"] === "BN" && $attr["rt"] !== "L") ? $attr["level"] . ":" . $attr["ccaps"] . ":" . $attr["rp"] . " " . $attr["rt"] : $attr["level"] . ":" . $attr["ccaps"];
137
  $code = preg_replace ('/ name\="page_style" value\="(.*?)"/', ' name="page_style" value="' . c_ws_plugin__s2member_utils_strings::esc_ds (esc_attr ($attr["ps"])) . '"', $code);
138
  $code = preg_replace ('/ name\="currency_code" value\="(.*?)"/', ' name="currency_code" value="' . c_ws_plugin__s2member_utils_strings::esc_ds (esc_attr ($attr["cc"])) . '"', $code);
139
  $code = preg_replace ('/ name\="custom" value\="(.*?)"/', ' name="custom" value="' . c_ws_plugin__s2member_utils_strings::esc_ds (esc_attr ($attr["custom"])) . '"', $code);
140
+ $code = preg_replace ('/ name\="on0" value\="(.*?)"/', ' name="on0" value="' . c_ws_plugin__s2member_utils_strings::esc_ds (esc_attr ($paypal_on0_input_value)) . '"', $code);
141
+ $code = preg_replace ('/ name\="os0" value\="(.*?)"/', ' name="os0" value="' . c_ws_plugin__s2member_utils_strings::esc_ds (esc_attr ($paypal_os0_input_value)) . '"', $code);
142
+ $code = preg_replace ('/ name\="modify" value\="(.*?)"/', ' name="modify" value="' . c_ws_plugin__s2member_utils_strings::esc_ds (esc_attr ($attr["modify"])) . '"', $code);
143
  $code = preg_replace ('/ name\="amount" value\="(.*?)"/', ' name="amount" value="' . c_ws_plugin__s2member_utils_strings::esc_ds (esc_attr ($attr["ra"])) . '"', $code);
144
  $code = preg_replace ('/ name\="src" value\="(.*?)"/', ' name="src" value="' . c_ws_plugin__s2member_utils_strings::esc_ds (esc_attr ($attr["rr"])) . '"', $code);
145
  $code = preg_replace ('/ name\="a1" value\="(.*?)"/', ' name="a1" value="' . c_ws_plugin__s2member_utils_strings::esc_ds (esc_attr ($attr["ta"])) . '"', $code);
includes/classes/ssl-in.inc.php ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Copyright: © 2009 WebSharks, Inc. ( coded in the USA )
4
+ <mailto:support@websharks-inc.com> <http://www.websharks-inc.com/>
5
+
6
+ Released under the terms of the GNU General Public License.
7
+ You should have received a copy of the GNU General Public License,
8
+ along with this software. In the main directory, see: /licensing/
9
+ If not, see: <http://www.gnu.org/licenses/>.
10
+ */
11
+ /*
12
+ Direct access denial.
13
+ */
14
+ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
+ /**/
17
+ if (!class_exists ("c_ws_plugin__s2member_ssl_in"))
18
+ {
19
+ class c_ws_plugin__s2member_ssl_in
20
+ {
21
+ /*
22
+ Function that forces SSL on specific Posts/Pages.
23
+ Attach to: add_action("template_redirect");
24
+
25
+ Triggered by Custom Field:
26
+ s2member_force_ssl = yes
27
+ ( i.e. https://www.example.com/ )
28
+
29
+ Or with a specific port number:
30
+ s2member_force_ssl = 443 ( or whatever port you require )
31
+ ( i.e. https://www.example.com:443/ )
32
+
33
+ * Phase 2 of `c_ws_plugin__s2member_ssl::check_force_ssl()`.
34
+ */
35
+ public static function force_ssl ($vars = array ()) /* Phase 2 of `c_ws_plugin__s2member_ssl::check_force_ssl()`. */
36
+ {
37
+ extract ($vars); /* Extract vars passed in from `c_ws_plugin__s2member_ssl::check_force_ssl()`. */
38
+ /**/
39
+ if (!is_ssl ()) /* SSL must be enabled here. Redirect to the equivalent https:// scheme. */
40
+ {
41
+ $ssl_host = preg_replace ("/\:[0-9]+$/", "", $_SERVER["HTTP_HOST"]);
42
+ $ssl_port = (is_numeric ($force_ssl) && $force_ssl > 1) ? $force_ssl : false;
43
+ $ssl_host_port = $ssl_host . (($ssl_port) ? ":" . $ssl_port : "");
44
+ /**/
45
+ wp_redirect ("https://" . $ssl_host_port . $_SERVER["REQUEST_URI"]);
46
+ /**/
47
+ exit (); /* Clean exit. Redirecting to SSL version of the page. */
48
+ }
49
+ else /* Otherwise, we buffer all output, and switch all content over to https. */
50
+ {
51
+ add_filter ("redirect_canonical", "__return_false");
52
+ /**/
53
+ $ssl_host = preg_replace ("/\:[0-9]+$/", "", $_SERVER["HTTP_HOST"]);
54
+ $ssl_port = (is_numeric ($force_ssl) && $force_ssl > 1) ? $force_ssl : false;
55
+ $ssl_host_port = $ssl_host . (($ssl_port) ? ":" . $ssl_port : "");
56
+ /**/
57
+ define ("_ws_plugin__s2member_force_ssl_host", $ssl_host);
58
+ define ("_ws_plugin__s2member_force_ssl_port", $ssl_port);
59
+ define ("_ws_plugin__s2member_force_ssl_host_port", $ssl_host_port);
60
+ /**/
61
+ /* Except these. We do NOT want to create a sitewide https conversion! */
62
+ add_filter ("home_url", "_ws_plugin__s2member_force_non_ssl_scheme", 10, 3);
63
+ add_filter ("network_home_url", "_ws_plugin__s2member_force_non_ssl_scheme", 10, 3);
64
+ add_filter ("site_url", "_ws_plugin__s2member_force_non_ssl_scheme", 10, 3);
65
+ add_filter ("network_site_url", "_ws_plugin__s2member_force_non_ssl_scheme", 10, 3);
66
+ /**/
67
+ if (!function_exists ("_ws_plugin__s2member_force_non_ssl_scheme"))
68
+ {
69
+ function _ws_plugin__s2member_force_non_ssl_scheme ($url = FALSE, $path = FALSE, $scheme = FALSE)
70
+ {
71
+ return ($scheme) ? $url : preg_replace ("/^https\:\/\//i", "http://", $url);
72
+ }
73
+ }
74
+ /**/
75
+ if (!function_exists ("_ws_plugin__s2member_force_ssl_buffer"))
76
+ {
77
+ function _ws_plugin__s2member_force_ssl_buffer ($buffer = FALSE)
78
+ {
79
+ $o_pcre = @ini_get ("pcre.backtrack_limit");
80
+ /**/
81
+ @ini_set ("pcre.backtrack_limit", 10000000);
82
+ /**/
83
+ $tags = array ("script", "style", "link", "img", "input", "iframe", "object", "embed");
84
+ $tags = apply_filters ("_ws_plugin__s2member_force_ssl_buffer_tags_array", $tags, get_defined_vars ());
85
+ $tags = array_unique (array_map ("strtolower", $tags)); /* This array should be lowercase / unique. */
86
+ /**/
87
+ $regex_tags = implode ("|", array_map ("preg_quote", $tags)); /* Prepare for regex. */
88
+ /**/
89
+ $buffer = ($regex_tags) ? preg_replace_callback ("/\<(" . $regex_tags . ")[^\>]+\>/i", "_ws_plugin__s2member_force_ssl_buffer_callback", $buffer) : $buffer;
90
+ $buffer = (in_array ("script", $tags)) ? preg_replace_callback ("/\<script[^\>]*\>(.+?)\<\/script\>/is", "_ws_plugin__s2member_force_ssl_buffer_callback", $buffer) : $buffer;
91
+ $buffer = (in_array ("style", $tags)) ? preg_replace_callback ("/\<style[^\>]*\>(.+?)\<\/style\>/is", "_ws_plugin__s2member_force_ssl_buffer_callback", $buffer) : $buffer;
92
+ /**/
93
+ @ini_set ("pcre.backtrack_limit", $o_pcre);
94
+ /**/
95
+ return apply_filters ("_ws_plugin__s2member_force_ssl_buffer", $buffer, get_defined_vars ());
96
+ }
97
+ }
98
+ /**/
99
+ if (!function_exists ("_ws_plugin__s2member_force_ssl_buffer_callback"))
100
+ {
101
+ function _ws_plugin__s2member_force_ssl_buffer_callback ($m = FALSE)
102
+ {
103
+ $c = preg_replace ("/http\:\/\//i", "https://", $m[0]);
104
+ /**/
105
+ if (_ws_plugin__s2member_force_ssl_port && _ws_plugin__s2member_force_ssl_host && _ws_plugin__s2member_force_ssl_host_port) /* Need port conversions? */
106
+ $c = preg_replace ("/\/" . preg_quote (_ws_plugin__s2member_force_ssl_host, "/") . "(\:[0-9]+)?\//i", "/" . _ws_plugin__s2member_force_ssl_host_port . "/", $c);
107
+ /**/
108
+ $c = (strtolower ($m[1]) === "link" && preg_match ("/['\"]alternate['\"]/i", $m[0])) ? $m[0] : $c; /* Alternates are fine to leave like they are. */
109
+ /**/
110
+ return $c; /* Return string with conversions. */
111
+ }
112
+ }
113
+ /**/
114
+ ob_start ("_ws_plugin__s2member_force_ssl_buffer");
115
+ }
116
+ /**/
117
+ return; /* Return for uniformity. */
118
+ }
119
+ }
120
+ }
121
+ ?>
includes/classes/ssl.inc.php CHANGED
@@ -38,72 +38,11 @@ if (!class_exists ("c_ws_plugin__s2member_ssl"))
38
  /**/
39
  $force_ssl = apply_filters ("ws_plugin__s2member_check_force_ssl", false, get_defined_vars ());
40
  /**/
41
- if (($force_ssl || (is_singular () && is_object ($post) && ($__id = $post->ID))) && strtolower ($force_ssl) !== "no")
42
  /**/
43
- if (($force_ssl || ($force_ssl = get_post_meta ($__id, "s2member_force_ssl", true))) && strtolower ($force_ssl) !== "no")
44
  {
45
- if (!is_ssl ()) /* SSL must be enabled here. Redirect to the equivalent https:// scheme. */
46
- {
47
- $ssl_host = preg_replace ("/\:[0-9]+$/", "", $_SERVER["HTTP_HOST"]);
48
- $ssl_port = (is_numeric ($force_ssl) && $force_ssl > 1) ? $force_ssl : 0;
49
- $ssl_host_port = $ssl_host . (($ssl_port) ? ":" . $ssl_port : "");
50
- /**/
51
- wp_redirect ("https://" . $ssl_host_port . $_SERVER["REQUEST_URI"]);
52
- exit (); /* ^ So let's redirect to the SSL enabled version. */
53
- }
54
- else /* Otherwise, we buffer all output, and switch all content over to https. */
55
- {
56
- add_filter ("redirect_canonical", "__return_false");
57
- /**/
58
- $ssl_host = preg_replace ("/\:[0-9]+$/", "", $_SERVER["HTTP_HOST"]);
59
- $ssl_port = (is_numeric ($force_ssl) && $force_ssl > 1) ? $force_ssl : 0;
60
- $ssl_host_port = $ssl_host . (($ssl_port) ? ":" . $ssl_port : "");
61
- /**/
62
- define ("_ws_plugin__s2member_force_ssl_host", $ssl_host);
63
- define ("_ws_plugin__s2member_force_ssl_port", $ssl_port);
64
- define ("_ws_plugin__s2member_force_ssl_host_port", $ssl_host_port);
65
- /**/
66
- /* Except these. We do NOT want to create a sitewide https conversion! */
67
- add_filter ("home_url", "_ws_plugin__s2member_force_non_ssl_scheme", 10, 3);
68
- add_filter ("network_home_url", "_ws_plugin__s2member_force_non_ssl_scheme", 10, 3);
69
- add_filter ("site_url", "_ws_plugin__s2member_force_non_ssl_scheme", 10, 3);
70
- add_filter ("network_site_url", "_ws_plugin__s2member_force_non_ssl_scheme", 10, 3);
71
- /**/
72
- function _ws_plugin__s2member_force_non_ssl_scheme ($url = FALSE, $path = FALSE, $scheme = FALSE)
73
- {
74
- return ($scheme) ? $url : preg_replace ("/^https\:\/\//i", "http://", $url);
75
- }
76
- /**/
77
- function _ws_plugin__s2member_force_ssl_buffer ($buffer = FALSE)
78
- {
79
- $o_pcre = @ini_get ("pcre.backtrack_limit");
80
- /**/
81
- @ini_set ("pcre.backtrack_limit", 10000000);
82
- /**/
83
- $tags = "script|style|link|img|input|iframe|object|embed"; /* Specific tags. */
84
- /**/
85
- $tags = apply_filters ("_ws_plugin__s2member_force_ssl_buffer_tags", $tags, get_defined_vars ());
86
- /**/
87
- $buffer = preg_replace_callback ("/\<(" . $tags . ")[^\>]+\>/i", "_ws_plugin__s2member_force_ssl_buffer_callback", $buffer);
88
- $buffer = preg_replace_callback ("/\<style[^\>]*\>(.+?)\<\/style\>/is", "_ws_plugin__s2member_force_ssl_buffer_callback", $buffer);
89
- /**/
90
- @ini_set ("pcre.backtrack_limit", $o_pcre);
91
- /**/
92
- return apply_filters ("_ws_plugin__s2member_force_ssl_buffer", $buffer, get_defined_vars ());
93
- }
94
- /**/
95
- function _ws_plugin__s2member_force_ssl_buffer_callback ($m = FALSE)
96
- {
97
- $c = preg_replace ("/http\:\/\//i", "https://", $m[0]);
98
- /**/
99
- if (_ws_plugin__s2member_force_ssl_port && _ws_plugin__s2member_force_ssl_host && _ws_plugin__s2member_force_ssl_host_port) /* Do we ALSO need port conversions? */
100
- $c = preg_replace ("/\/" . preg_quote (_ws_plugin__s2member_force_ssl_host, "/") . "(\:[0-9]+)?\//i", "/" . _ws_plugin__s2member_force_ssl_host_port . "/", $c);
101
- /**/
102
- return (strtolower ($m[1]) === "link" && preg_match ("/['\"]alternate['\"]/i", $m[0])) ? $m[0] : $c; /* Return string with conversions. */
103
- }
104
- /**/
105
- ob_start ("_ws_plugin__s2member_force_ssl_buffer");
106
- }
107
  }
108
  /**/
109
  do_action ("ws_plugin__s2member_after_check_force_ssl", get_defined_vars ());
38
  /**/
39
  $force_ssl = apply_filters ("ws_plugin__s2member_check_force_ssl", false, get_defined_vars ());
40
  /**/
41
+ if (($force_ssl || (is_singular () && is_object ($post) && ($__id = $post->ID))) && !preg_match ("/^(no|false)$/i", $force_ssl))
42
  /**/
43
+ if (($force_ssl || ($force_ssl = get_post_meta ($__id, "s2member_force_ssl", true))) && !preg_match ("/^(no|false)$/i", $force_ssl))
44
  {
45
+ c_ws_plugin__s2member_ssl_in::force_ssl (get_defined_vars ()); /* Call inner function now. */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  }
47
  /**/
48
  do_action ("ws_plugin__s2member_after_check_force_ssl", get_defined_vars ());
includes/classes/tracking-cookies-in.inc.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Copyright: © 2009 WebSharks, Inc. ( coded in the USA )
4
+ <mailto:support@websharks-inc.com> <http://www.websharks-inc.com/>
5
+
6
+ Released under the terms of the GNU General Public License.
7
+ You should have received a copy of the GNU General Public License,
8
+ along with this software. In the main directory, see: /licensing/
9
+ If not, see: <http://www.gnu.org/licenses/>.
10
+ */
11
+ /*
12
+ Direct access denial.
13
+ */
14
+ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
+ /**/
17
+ if (!class_exists ("c_ws_plugin__s2member_tracking_cookies_in"))
18
+ {
19
+ class c_ws_plugin__s2member_tracking_cookies_in
20
+ {
21
+ /*
22
+ Deletes s2Member's temporary tracking cookie.
23
+ Attach to: add_action("init");
24
+ */
25
+ public static function delete_signup_tracking_cookie ()
26
+ {
27
+ do_action ("ws_plugin__s2member_before_delete_signup_tracking_cookie", get_defined_vars ());
28
+ /**/
29
+ if ($_GET["s2member_delete_signup_tracking_cookie"]) /* Deletes cookie. */
30
+ {
31
+ setcookie ("s2member_signup_tracking", "", time () + 31556926, "/");
32
+ /**/
33
+ do_action ("ws_plugin__s2member_during_delete_signup_tracking_cookie", get_defined_vars ());
34
+ /**/
35
+ exit (); /* Clean exit. */
36
+ }
37
+ /**/
38
+ do_action ("ws_plugin__s2member_after_delete_signup_tracking_cookie", get_defined_vars ());
39
+ }
40
+ /*
41
+ Deletes s2Member's temporary tracking cookie.
42
+ Attach to: add_action("init");
43
+ */
44
+ public static function delete_sp_tracking_cookie ()
45
+ {
46
+ do_action ("ws_plugin__s2member_before_delete_sp_tracking_cookie", get_defined_vars ());
47
+ /**/
48
+ if ($_GET["s2member_delete_sp_tracking_cookie"]) /* Deletes cookie. */
49
+ {
50
+ setcookie ("s2member_sp_tracking", "", time () + 31556926, "/");
51
+ /**/
52
+ do_action ("ws_plugin__s2member_during_delete_sp_tracking_cookie", get_defined_vars ());
53
+ /**/
54
+ exit (); /* Clean exit. */
55
+ }
56
+ /**/
57
+ do_action ("ws_plugin__s2member_after_delete_sp_tracking_cookie", get_defined_vars ());
58
+ }
59
+ }
60
+ }
61
+ ?>
includes/classes/tracking-cookies.inc.php CHANGED
@@ -24,18 +24,10 @@ if (!class_exists ("c_ws_plugin__s2member_tracking_cookies"))
24
  */
25
  public static function delete_signup_tracking_cookie ()
26
  {
27
- do_action ("ws_plugin__s2member_before_delete_signup_tracking_cookie", get_defined_vars ());
28
- /**/
29
- if ($_GET["s2member_delete_signup_tracking_cookie"]) /* Deletes cookie. */
30
  {
31
- setcookie ("s2member_signup_tracking", "", time () + 31556926, "/");
32
- /**/
33
- do_action ("ws_plugin__s2member_during_delete_signup_tracking_cookie", get_defined_vars ());
34
- /**/
35
- exit (); /* Clean exit. */
36
  }
37
- /**/
38
- do_action ("ws_plugin__s2member_after_delete_signup_tracking_cookie", get_defined_vars ());
39
  }
40
  /*
41
  Deletes s2Member's temporary tracking cookie.
@@ -43,18 +35,10 @@ if (!class_exists ("c_ws_plugin__s2member_tracking_cookies"))
43
  */
44
  public static function delete_sp_tracking_cookie ()
45
  {
46
- do_action ("ws_plugin__s2member_before_delete_sp_tracking_cookie", get_defined_vars ());
47
- /**/
48
- if ($_GET["s2member_delete_sp_tracking_cookie"]) /* Deletes cookie. */
49
  {
50
- setcookie ("s2member_sp_tracking", "", time () + 31556926, "/");
51
- /**/
52
- do_action ("ws_plugin__s2member_during_delete_sp_tracking_cookie", get_defined_vars ());
53
- /**/
54
- exit (); /* Clean exit. */
55
  }
56
- /**/
57
- do_action ("ws_plugin__s2member_after_delete_sp_tracking_cookie", get_defined_vars ());
58
  }
59
  }
60
  }
24
  */
25
  public static function delete_signup_tracking_cookie ()
26
  {
27
+ if ($_GET["s2member_delete_signup_tracking_cookie"]) /* Call inner function? */
 
 
28
  {
29
+ return c_ws_plugin__s2member_tracking_cookies_in::delete_signup_tracking_cookie ();
 
 
 
 
30
  }
 
 
31
  }
32
  /*
33
  Deletes s2Member's temporary tracking cookie.
35
  */
36
  public static function delete_sp_tracking_cookie ()
37
  {
38
+ if ($_GET["s2member_delete_sp_tracking_cookie"]) /* Call inner function? */
 
 
39
  {
40
+ return c_ws_plugin__s2member_tracking_cookies_in::delete_sp_tracking_cookie ();
 
 
 
 
41
  }
 
 
42
  }
43
  }
44
  }
includes/classes/user-access.inc.php CHANGED
@@ -27,7 +27,7 @@ if (!class_exists ("c_ws_plugin__s2member_user_access"))
27
  {
28
  $user = (func_num_args () && is_object ($user)) ? $user : false;
29
  /**/
30
- if ((func_num_args () && !$user) || (!$user && (! ($user = (is_user_logged_in ()) ? wp_get_current_user () : false) || !reset ($user->roles))))
31
  {
32
  return apply_filters ("ws_plugin__s2member_user_access_role", "", get_defined_vars ());
33
  /* Return of "", means $user was passed in but is NOT an object; or nobody is logged in, or they have to Role. */
@@ -45,7 +45,7 @@ if (!class_exists ("c_ws_plugin__s2member_user_access"))
45
  {
46
  $user = (func_num_args () && is_object ($user)) ? $user : false;
47
  /**/
48
- if ((func_num_args () && !$user) || (!$user && ! ($user = (is_user_logged_in ()) ? wp_get_current_user () : false)))
49
  {
50
  return apply_filters ("ws_plugin__s2member_user_access_ccaps", array (), get_defined_vars ());
51
  }
@@ -73,7 +73,7 @@ if (!class_exists ("c_ws_plugin__s2member_user_access"))
73
  {
74
  $user = (func_num_args () && is_object ($user)) ? $user : false;
75
  /**/
76
- if ((func_num_args () && !$user) || (!$user && ! ( (is_user_logged_in ()) ? wp_get_current_user () : false)))
77
  {
78
  return apply_filters ("ws_plugin__s2member_user_access_level", -1, get_defined_vars ());
79
  /* Return of -1, means $user was passed in but is NOT an object; or nobody is logged in. */
27
  {
28
  $user = (func_num_args () && is_object ($user)) ? $user : false;
29
  /**/
30
+ if ((func_num_args () && !$user) || (!$user && (!is_object ($user = (is_user_logged_in ()) ? wp_get_current_user () : false) || !reset ($user->roles))))
31
  {
32
  return apply_filters ("ws_plugin__s2member_user_access_role", "", get_defined_vars ());
33
  /* Return of "", means $user was passed in but is NOT an object; or nobody is logged in, or they have to Role. */
45
  {
46
  $user = (func_num_args () && is_object ($user)) ? $user : false;
47
  /**/
48
+ if ((func_num_args () && !$user) || (!$user && !is_object ($user = (is_user_logged_in ()) ? wp_get_current_user () : false)))
49
  {
50
  return apply_filters ("ws_plugin__s2member_user_access_ccaps", array (), get_defined_vars ());
51
  }
73
  {
74
  $user = (func_num_args () && is_object ($user)) ? $user : false;
75
  /**/
76
+ if ((func_num_args () && !$user) || (!$user && !is_object ((is_user_logged_in ()) ? wp_get_current_user () : false)))
77
  {
78
  return apply_filters ("ws_plugin__s2member_user_access_level", -1, get_defined_vars ());
79
  /* Return of -1, means $user was passed in but is NOT an object; or nobody is logged in. */
includes/classes/user-new.inc.php CHANGED
@@ -21,7 +21,7 @@ if (!class_exists ("c_ws_plugin__s2member_user_new"))
21
  /*
22
  Function that adds custom fields to `/wp-admin/user-new.php`.
23
  We have to buffer output because `/user-new.php` has NO Hooks.
24
- Attach to: add_action("admin_init");
25
  */
26
  public static function admin_user_new_fields ()
27
  {
21
  /*
22
  Function that adds custom fields to `/wp-admin/user-new.php`.
23
  We have to buffer output because `/user-new.php` has NO Hooks.
24
+ Attach to: add_action("load-user-new.php");
25
  */
26
  public static function admin_user_new_fields ()
27
  {
includes/classes/utilities.inc.php CHANGED
@@ -57,6 +57,17 @@ if (!class_exists ("c_ws_plugin__s2member_utilities"))
57
  else /* Else return null. */
58
  return;
59
  }
 
 
 
 
 
 
 
 
 
 
 
60
  }
61
  }
62
  ?>
57
  else /* Else return null. */
58
  return;
59
  }
60
+ /*
61
+ Function builds a version checksum for this installation.
62
+ */
63
+ public static function ver_checksum ()
64
+ {
65
+ $checksum = WS_PLUGIN__S2MEMBER_VERSION; /* Software version string. */
66
+ $checksum .= (defined ("WS_PLUGIN__S2MEMBER_PRO_VERSION")) ? "-" . WS_PLUGIN__S2MEMBER_PRO_VERSION : ""; /* Pro version string? */
67
+ $checksum .= "-" . abs (crc32 ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["checksum"] . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["options_checksum"] . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["options_version"]));
68
+ /**/
69
+ return $checksum; /* ( i.e. version-pro version-checksum ) */
70
+ }
71
  }
72
  }
73
  ?>
includes/classes/utils-arrays.inc.php CHANGED
@@ -19,8 +19,7 @@ if (!class_exists ("c_ws_plugin__s2member_utils_arrays"))
19
  class c_ws_plugin__s2member_utils_arrays
20
  {
21
  /*
22
- Function that extends array_unique to
23
- support multi-dimensional arrays.
24
  */
25
  public static function array_unique ($array = FALSE)
26
  {
@@ -46,8 +45,7 @@ if (!class_exists ("c_ws_plugin__s2member_utils_arrays"))
46
  }
47
  }
48
  /*
49
- Function that searches a multi-dimensional array
50
- using a regular expression match against array values.
51
  */
52
  public static function regex_in_array ($regex = FALSE, $array = FALSE)
53
  {
19
  class c_ws_plugin__s2member_utils_arrays
20
  {
21
  /*
22
+ Function that extends array_unique to support multi-dimensional arrays.
 
23
  */
24
  public static function array_unique ($array = FALSE)
25
  {
45
  }
46
  }
47
  /*
48
+ Function that searches a multi-dimensional array using a regular expression match against array values.
 
49
  */
50
  public static function regex_in_array ($regex = FALSE, $array = FALSE)
51
  {
includes/classes/utils-css.inc.php CHANGED
@@ -46,10 +46,10 @@ if (!class_exists ("c_ws_plugin__s2member_utils_css"))
46
  $css = preg_replace ("/ ; | ;|; /", ";", $css);
47
  $css = preg_replace ("/;\}/", "}", $css);
48
  /**/
49
- return preg_replace_callback ($c6, "c_ws_plugin__s2member_utils_css::compress_css_c3", $css);
50
  }
51
  /**/
52
- public static function compress_css_c3 ($m = FALSE)
53
  {
54
  if ($m[2][0] === $m[2][1] && $m[2][2] === $m[2][3] && $m[2][4] === $m[2][5])
55
  return $m[1] . $m[2][0] . $m[2][2] . $m[2][4];
46
  $css = preg_replace ("/ ; | ;|; /", ";", $css);
47
  $css = preg_replace ("/;\}/", "}", $css);
48
  /**/
49
+ return preg_replace_callback ($c6, "c_ws_plugin__s2member_utils_css::_compress_css_c3", $css);
50
  }
51
  /**/
52
+ public static function _compress_css_c3 ($m = FALSE)
53
  {
54
  if ($m[2][0] === $m[2][1] && $m[2][2] === $m[2][3] && $m[2][4] === $m[2][5])
55
  return $m[1] . $m[2][0] . $m[2][2] . $m[2][4];
includes/classes/utils-users.inc.php CHANGED
@@ -19,7 +19,7 @@ if (!class_exists ("c_ws_plugin__s2member_utils_users"))
19
  class c_ws_plugin__s2member_utils_users
20
  {
21
  /*
22
- Function determines the total Users/Members in the database.
23
  */
24
  public static function users_in_database ()
25
  {
@@ -61,7 +61,7 @@ if (!class_exists ("c_ws_plugin__s2member_utils_users"))
61
  return false; /* Otherwise, return false. */
62
  }
63
  /*
64
- Get the custom value for an existing Member, referenced by a Subscr. ID.
65
  A second lookup parameter can be provided as well ( optional ).
66
  */
67
  public static function get_user_custom_with ($subscr_id = FALSE, $os0 = FALSE)
@@ -85,7 +85,7 @@ if (!class_exists ("c_ws_plugin__s2member_utils_users"))
85
  return false; /* Otherwise, return false. */
86
  }
87
  /*
88
- Get the user ID for an existing Member, referenced by a Subscr. ID.
89
  A second lookup parameter can be provided as well ( optional ).
90
  */
91
  public static function get_user_id_with ($subscr_id = FALSE, $os0 = FALSE)
@@ -107,7 +107,7 @@ if (!class_exists ("c_ws_plugin__s2member_utils_users"))
107
  return false; /* Otherwise, return false. */
108
  }
109
  /*
110
- Get the email value for an existing Member, referenced by a Subscr. ID.
111
  A second lookup parameter can be provided as well ( optional ).
112
  */
113
  public static function get_user_email_with ($subscr_id = FALSE, $os0 = FALSE)
@@ -148,7 +148,23 @@ if (!class_exists ("c_ws_plugin__s2member_utils_users"))
148
  return false; /* Otherwise, return false. */
149
  }
150
  /*
151
- Function determines whether or not a Username/Email is already in the database.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
152
  Returns the WordPress® User ID if they exist.
153
  */
154
  public static function user_login_email_exists ($user_login = FALSE, $user_email = FALSE)
@@ -162,7 +178,7 @@ if (!class_exists ("c_ws_plugin__s2member_utils_users"))
162
  return false; /* Else return false. */
163
  }
164
  /*
165
- Function determines whether or not a Username/Email is already in the database for this Blog.
166
  Returns the WordPress® User ID if they exist.
167
  */
168
  public static function ms_user_login_email_exists_but_not_on_blog ($user_login = FALSE, $user_email = FALSE, $blog_id = FALSE)
@@ -174,7 +190,7 @@ if (!class_exists ("c_ws_plugin__s2member_utils_users"))
174
  return false; /* Else return false. */
175
  }
176
  /*
177
- Function determines whether or not a Username/Email is already in the database for this Blog.
178
  Returns the WordPress® User ID if they exist.
179
  This is an alias for: `c_ws_plugin__s2member_utils_users::ms_user_login_email_exists_but_not_on_blog()`.
180
  */
19
  class c_ws_plugin__s2member_utils_users
20
  {
21
  /*
22
+ Determines the total Users/Members in the database.
23
  */
24
  public static function users_in_database ()
25
  {
61
  return false; /* Otherwise, return false. */
62
  }
63
  /*
64
+ Gets the custom value for an existing Member, referenced by a Subscr. ID.
65
  A second lookup parameter can be provided as well ( optional ).
66
  */
67
  public static function get_user_custom_with ($subscr_id = FALSE, $os0 = FALSE)
85
  return false; /* Otherwise, return false. */
86
  }
87
  /*
88
+ Gets the user ID for an existing Member, referenced by a Subscr. ID.
89
  A second lookup parameter can be provided as well ( optional ).
90
  */
91
  public static function get_user_id_with ($subscr_id = FALSE, $os0 = FALSE)
107
  return false; /* Otherwise, return false. */
108
  }
109
  /*
110
+ Gets the email value for an existing Member, referenced by a Subscr. ID.
111
  A second lookup parameter can be provided as well ( optional ).
112
  */
113
  public static function get_user_email_with ($subscr_id = FALSE, $os0 = FALSE)
148
  return false; /* Otherwise, return false. */
149
  }
150
  /*
151
+ Gets a User's Paid Subscr. ID ( if available ); otherwise their WP database ID.
152
+ If $user IS passed in, this function will return data from a specific $user.
153
+ If $user is NOT passed in, check the current User/Member.
154
+ */
155
+ public static function get_user_subscr_or_wp_id ($user = FALSE)
156
+ {
157
+ $user = (func_num_args () && is_object ($user)) ? $user : false;
158
+ /**/
159
+ if ((func_num_args () && !$user) || (!$user && !is_object ($user = (is_user_logged_in ()) ? wp_get_current_user () : false)))
160
+ {
161
+ return false; /* The $user was passed in but is NOT an object; or nobody is logged in. */
162
+ }
163
+ else /* Else return Paid Subscr. ID ( if available ), otherwise return their WP database User ID. */
164
+ return ($subscr_id = get_user_option ("s2member_subscr_id", $user->ID)) ? $subscr_id : $user->ID;
165
+ }
166
+ /*
167
+ Determines whether or not a Username/Email is already in the database.
168
  Returns the WordPress® User ID if they exist.
169
  */
170
  public static function user_login_email_exists ($user_login = FALSE, $user_email = FALSE)
178
  return false; /* Else return false. */
179
  }
180
  /*
181
+ Determines whether or not a Username/Email is already in the database for this Blog.
182
  Returns the WordPress® User ID if they exist.
183
  */
184
  public static function ms_user_login_email_exists_but_not_on_blog ($user_login = FALSE, $user_email = FALSE, $blog_id = FALSE)
190
  return false; /* Else return false. */
191
  }
192
  /*
193
+ Determines whether or not a Username/Email is already in the database for this Blog.
194
  Returns the WordPress® User ID if they exist.
195
  This is an alias for: `c_ws_plugin__s2member_utils_users::ms_user_login_email_exists_but_not_on_blog()`.
196
  */
includes/funcs.inc.php CHANGED
@@ -18,7 +18,7 @@ Include all of the functions that came with this plugin.
18
  */
19
  if (is_dir ($ws_plugin__s2member_temp_dir = dirname (__FILE__) . "/functions"))
20
  foreach (scandir ($ws_plugin__s2member_temp_dir) as $ws_plugin__s2member_temp_s)
21
- if (preg_match ("/\.php$/", $ws_plugin__s2member_temp_s) && !preg_match ("/^index\.php$/i", $ws_plugin__s2member_temp_s))
22
  include_once $ws_plugin__s2member_temp_dir . "/" . $ws_plugin__s2member_temp_s;
23
  /**/
24
  unset ($ws_plugin__s2member_temp_dir, $ws_plugin__s2member_temp_s);
18
  */
19
  if (is_dir ($ws_plugin__s2member_temp_dir = dirname (__FILE__) . "/functions"))
20
  foreach (scandir ($ws_plugin__s2member_temp_dir) as $ws_plugin__s2member_temp_s)
21
+ if (preg_match ("/\.php$/", $ws_plugin__s2member_temp_s) && $ws_plugin__s2member_temp_s !== "index.php")
22
  include_once $ws_plugin__s2member_temp_dir . "/" . $ws_plugin__s2member_temp_s;
23
  /**/
24
  unset ($ws_plugin__s2member_temp_dir, $ws_plugin__s2member_temp_s);
includes/functions/class-autoloader.inc.php CHANGED
@@ -23,35 +23,34 @@ if (!function_exists ("ws_plugin__s2member_classes")) /* Already exists? */
23
  function ws_plugin__s2member_classes ($class = FALSE) /* Build dynamic __autoload function. */
24
  {
25
  static $c; /* Holds the classes directory location ( location is optimized with a static var ). */
26
- static $class_dirs; /* All possible class directory locations ( optimized with a static var ). */
27
- /**/
28
- $c = (!isset ($c)) ? dirname (dirname (__FILE__)) . "/classes" : $c; /* Configures location of classes. */
29
- /**/
30
- $class_dirs = (!isset ($class_dirs)) ? array_merge (array ($c), _ws_plugin__s2member_classes_scan_dirs_r ($c)) : $class_dirs;
31
  /**/
32
  if (strpos ($class, "c_ws_plugin__s2member_") === 0 && strpos ($class, "c_ws_plugin__s2member_pro_") === false)
33
  {
 
 
 
34
  $class = str_replace ("_", "-", str_replace ("c_ws_plugin__s2member_", "", $class));
35
  /**/
36
- foreach ($class_dirs as $class_dir) /* Start looking for the class. */
37
- {
38
- if ($class_dir === $c || strpos ($class, basename ($class_dir)) === 0)
39
- if (file_exists ($class_dir . "/" . $class . ".inc.php"))
40
- {
41
- include_once $class_dir . "/" . $class . ".inc.php";
42
- /**/
43
- break; /* Now stop looking. */
44
- }
45
- }
46
  }
47
  }
48
  function _ws_plugin__s2member_classes_scan_dirs_r ($starting_dir = FALSE)
49
  {
50
  $dirs = array (); /* Initialize dirs array. */
51
  /**/
52
- foreach (scandir ($starting_dir) as $dir) /* Scan this directory. */
53
- if ($dir !== "." && $dir !== ".." && is_dir ($dir = $starting_dir . "/" . $dir))
54
- $dirs = array_merge ($dirs, array ($dir), _ws_plugin__s2member_classes_scan_dirs_r ($dir));
 
 
55
  /**/
56
  return $dirs; /* Return array of all directories. */
57
  }
23
  function ws_plugin__s2member_classes ($class = FALSE) /* Build dynamic __autoload function. */
24
  {
25
  static $c; /* Holds the classes directory location ( location is optimized with a static var ). */
26
+ static $c_class_dirs; /* All possible dir & sub-directory locations ( with a static var ). */
 
 
 
 
27
  /**/
28
  if (strpos ($class, "c_ws_plugin__s2member_") === 0 && strpos ($class, "c_ws_plugin__s2member_pro_") === false)
29
  {
30
+ $c = (!isset ($c)) ? dirname (dirname (__FILE__)) . "/classes" : $c; /* Configures location of classes. */
31
+ $c_class_dirs = (!isset ($c_class_dirs)) ? array_merge (array ($c), _ws_plugin__s2member_classes_scan_dirs_r ($c)) : $c_class_dirs;
32
+ /**/
33
  $class = str_replace ("_", "-", str_replace ("c_ws_plugin__s2member_", "", $class));
34
  /**/
35
+ foreach ($c_class_dirs as $class_dir) /* Start looking for the class. */
36
+ if ($class_dir === $c || strpos ($class, basename ($class_dir)) === 0)
37
+ if (file_exists ($class_dir . "/" . $class . ".inc.php"))
38
+ {
39
+ include_once $class_dir . "/" . $class . ".inc.php";
40
+ /**/
41
+ break; /* Now stop looking. */
42
+ }
 
 
43
  }
44
  }
45
  function _ws_plugin__s2member_classes_scan_dirs_r ($starting_dir = FALSE)
46
  {
47
  $dirs = array (); /* Initialize dirs array. */
48
  /**/
49
+ foreach (func_get_args () as $starting_dir)
50
+ if (is_dir ($starting_dir)) /* Does this directory exist? */
51
+ foreach (scandir ($starting_dir) as $dir) /* Scan this directory. */
52
+ if ($dir !== "." && $dir !== ".." && is_dir ($dir = $starting_dir . "/" . $dir))
53
+ $dirs = array_merge ($dirs, array ($dir), _ws_plugin__s2member_classes_scan_dirs_r ($dir));
54
  /**/
55
  return $dirs; /* Return array of all directories. */
56
  }
includes/hooks.inc.php CHANGED
@@ -20,32 +20,35 @@ add_action ("pre_get_posts", /* WP Query. */
20
  "c_ws_plugin__s2member_security::security_gate_query", 20);
21
  /* Priority matches `/api-functions.inc.php`.
22
  /**/
23
- add_action ("init", "c_ws_plugin__s2member_nocache::nocache");
24
- add_action ("init", "c_ws_plugin__s2member_constants::constants");
25
- add_action ("init", "c_ws_plugin__s2member_register::register");
26
- add_action ("init", "c_ws_plugin__s2member_css_js::css");
27
- add_action ("init", "c_ws_plugin__s2member_css_js::js_w_globals");
28
- add_action ("init", "c_ws_plugin__s2member_admin_css_js::menu_pages_js");
29
- add_action ("init", "c_ws_plugin__s2member_admin_css_js::menu_pages_css");
30
- add_action ("init", "c_ws_plugin__s2member_paypal_return::paypal_return");
31
- add_action ("init", "c_ws_plugin__s2member_paypal_notify::paypal_notify");
32
- add_action ("init", "c_ws_plugin__s2member_files::check_file_download_access");
33
- add_action ("init", "c_ws_plugin__s2member_profile_mods::handle_profile_modifications");
34
- add_action ("init", "c_ws_plugin__s2member_tracking_cookies::delete_signup_tracking_cookie");
35
- add_action ("init", "c_ws_plugin__s2member_tracking_cookies::delete_sp_tracking_cookie");
36
- add_action ("init", "c_ws_plugin__s2member_cron_jobs::auto_eot_system_via_cron");
 
 
 
 
 
37
  add_action ("init", "c_ws_plugin__s2member_labels::config_label_translations");
38
- add_action ("init", "c_ws_plugin__s2member_login_redirects::remove_login_redirect_filters", 11);
39
  /**/
40
  add_action ("template_redirect", "c_ws_plugin__s2member_ssl::check_force_ssl", 1);
41
  add_action ("template_redirect", "c_ws_plugin__s2member_security::security_gate", 1);
42
- add_action ("template_redirect", "c_ws_plugin__s2member_misc_redirects::membership_options_page");
43
- add_action ("template_redirect", "c_ws_plugin__s2member_profile::profile");
44
  /**/
45
  add_filter ("widget_text", "do_shortcode"); /* Shortcodes in widgets. */
46
  /**/
47
- add_action ("wp_print_styles", "c_ws_plugin__s2member_css_js::add_css");
48
- add_action ("wp_print_scripts", "c_ws_plugin__s2member_css_js::add_js_w_globals");
49
  add_filter ("gettext", "c_ws_plugin__s2member_translations::translation_mangler", 10, 3);
50
  /**/
51
  add_action ("wp_login_failed", "c_ws_plugin__s2member_brute_force::track_failed_logins");
@@ -92,14 +95,16 @@ add_action ("login_footer", "c_ws_plugin__s2member_tracking_codes::display_signu
92
  add_action ("wp_footer", "c_ws_plugin__s2member_tracking_codes::display_signup_tracking_codes");
93
  add_action ("wp_footer", "c_ws_plugin__s2member_tracking_codes::display_sp_tracking_codes");
94
  /**/
95
- add_action ("admin_init", "c_ws_plugin__s2member_admin_lockouts::admin_lockout");
96
  add_action ("admin_init", "c_ws_plugin__s2member_check_activation::check");
97
- add_action ("admin_init", "c_ws_plugin__s2member_op_notices::general_ops_notice");
98
- add_action ("admin_init", "c_ws_plugin__s2member_op_notices::multisite_ops_notice");
99
- add_action ("admin_init", "c_ws_plugin__s2member_op_notices::reading_ops_notice");
100
- add_action ("admin_init", "c_ws_plugin__s2member_user_new::admin_user_new_fields");
101
  /**/
102
- add_action ("admin_menu", "c_ws_plugin__s2member_meta_boxes::add_meta_boxes");
 
 
 
 
 
 
103
  add_action ("save_post", "c_ws_plugin__s2member_meta_box_saves::save_meta_boxes");
104
  add_action ("admin_menu", "c_ws_plugin__s2member_menu_pages::add_admin_options");
105
  add_action ("network_admin_menu", "c_ws_plugin__s2member_menu_pages::add_network_admin_options");
20
  "c_ws_plugin__s2member_security::security_gate_query", 20);
21
  /* Priority matches `/api-functions.inc.php`.
22
  /**/
23
+ add_action ("init", "c_ws_plugin__s2member_nocache::nocache", 1);
24
+ add_action ("init", "c_ws_plugin__s2member_profile::profile", 1);
25
+ add_action ("init", "c_ws_plugin__s2member_register::register", 1);
26
+ add_action ("init", "c_ws_plugin__s2member_paypal_return::paypal_return", 1);
27
+ add_action ("init", "c_ws_plugin__s2member_paypal_notify::paypal_notify", 1);
28
+ add_action ("init", "c_ws_plugin__s2member_files_checks::check_file_download_access", 1);
29
+ add_action ("init", "c_ws_plugin__s2member_profile_mods::handle_profile_modifications", 1);
30
+ add_action ("init", "c_ws_plugin__s2member_tracking_cookies::delete_signup_tracking_cookie", 1);
31
+ add_action ("init", "c_ws_plugin__s2member_tracking_cookies::delete_sp_tracking_cookie", 1);
32
+ add_action ("init", "c_ws_plugin__s2member_cron_jobs::auto_eot_system_via_cron", 1);
33
+ add_action ("init", "c_ws_plugin__s2member_mo_page::membership_options_page", 1);
34
+ /**/
35
+ add_action ("init", "c_ws_plugin__s2member_admin_css_js::menu_pages_css", 1);
36
+ add_action ("init", "c_ws_plugin__s2member_admin_css_js::menu_pages_js", 1);
37
+ /**/
38
+ add_action ("init", "c_ws_plugin__s2member_css_js::css", 1);
39
+ add_action ("init", "c_ws_plugin__s2member_constants::constants", 1);
40
+ add_action ("init", "c_ws_plugin__s2member_css_js::js_w_globals", 1);
41
+ /**/
42
  add_action ("init", "c_ws_plugin__s2member_labels::config_label_translations");
43
+ add_action ("init", "c_ws_plugin__s2member_login_redirects_r::remove_login_redirect_filters", 11);
44
  /**/
45
  add_action ("template_redirect", "c_ws_plugin__s2member_ssl::check_force_ssl", 1);
46
  add_action ("template_redirect", "c_ws_plugin__s2member_security::security_gate", 1);
 
 
47
  /**/
48
  add_filter ("widget_text", "do_shortcode"); /* Shortcodes in widgets. */
49
  /**/
50
+ add_action ("wp_print_styles", "c_ws_plugin__s2member_css_js_themes::add_css");
51
+ add_action ("wp_print_scripts", "c_ws_plugin__s2member_css_js_themes::add_js_w_globals");
52
  add_filter ("gettext", "c_ws_plugin__s2member_translations::translation_mangler", 10, 3);
53
  /**/
54
  add_action ("wp_login_failed", "c_ws_plugin__s2member_brute_force::track_failed_logins");
95
  add_action ("wp_footer", "c_ws_plugin__s2member_tracking_codes::display_signup_tracking_codes");
96
  add_action ("wp_footer", "c_ws_plugin__s2member_tracking_codes::display_sp_tracking_codes");
97
  /**/
98
+ add_action ("admin_init", "c_ws_plugin__s2member_admin_lockouts::admin_lockout", 1);
99
  add_action ("admin_init", "c_ws_plugin__s2member_check_activation::check");
 
 
 
 
100
  /**/
101
+ add_action ("load-options-general.php", "c_ws_plugin__s2member_op_notices::general_ops_notice");
102
+ add_action ("load-ms-options.php", "c_ws_plugin__s2member_op_notices::multisite_ops_notice");
103
+ add_action ("load-settings.php", "c_ws_plugin__s2member_op_notices::multisite_ops_notice");
104
+ add_action ("load-options-reading.php", "c_ws_plugin__s2member_op_notices::reading_ops_notice");
105
+ add_action ("load-user-new.php", "c_ws_plugin__s2member_user_new::admin_user_new_fields");
106
+ /**/
107
+ add_action ("add_meta_boxes", "c_ws_plugin__s2member_meta_boxes::add_meta_boxes");
108
  add_action ("save_post", "c_ws_plugin__s2member_meta_box_saves::save_meta_boxes");
109
  add_action ("admin_menu", "c_ws_plugin__s2member_menu_pages::add_admin_options");
110
  add_action ("network_admin_menu", "c_ws_plugin__s2member_menu_pages::add_network_admin_options");
includes/menu-pages/code-samples/api-mop-vars.php CHANGED
@@ -11,6 +11,7 @@ These example redirection links include all possible MOP Variable variations in
11
  .../membership-options-page/?s2member_seeking=post-369&s2member_sp_req=369
12
  .../membership-options-page/?s2member_seeking=bbpress&s2member_level_req=1
13
  .../membership-options-page/?s2member_seeking=ruri-aHR0cDovL3d3dy5leGFtcGxlLmNvbS8&s2member_level_req=1
 
14
 
15
  -----------------------------------------------------------------------------------------------------------
16
 
@@ -18,6 +19,7 @@ Here is a breakdown on each of these Variables:
18
 
19
  * `s2member_seeking` = [post|page|catg|ptag]-[ID number] ( Post ID, Page ID, Category ID, Tag ID )
20
  Or: `s2member_seeking` = ruri-[base64 encoded URI] ( only applies w/ Membership URI Restrictions )
 
21
  Or: `s2member_seeking` = bbpress ( only applies when the s2Member -> bbPress Bridge is installed )
22
  * `s2member_level_req` = a Membership Level # required for access ( only applies to Membership Level Access )
23
  * `s2member_ccap_req` = a Custom Capability required for access ( only applies to Custom Capability Restrictions )
@@ -35,6 +37,7 @@ Example PHP code ( and conditionals ) that could be implemented within your Memb
35
  <?php /* Parse s2Member's MOP Vars into local variables. */
36
  list($seeking, $id) = preg_split("/-/", $_GET["s2member_seeking"], 2);
37
  list($seeking, $uri) = preg_split("/-/", $_GET["s2member_seeking"], 2);
 
38
  $level_req = $_GET["s2member_level_req"];
39
  $ccap_req = $_GET["s2member_ccap_req"];
40
  $sp_req = $_GET["s2member_sp_req"]; ?>
11
  .../membership-options-page/?s2member_seeking=post-369&s2member_sp_req=369
12
  .../membership-options-page/?s2member_seeking=bbpress&s2member_level_req=1
13
  .../membership-options-page/?s2member_seeking=ruri-aHR0cDovL3d3dy5leGFtcGxlLmNvbS8&s2member_level_req=1
14
+ .../membership-options-page/?s2member_seeking=file-example.zip&s2member_level_req=1
15
 
16
  -----------------------------------------------------------------------------------------------------------
17
 
19
 
20
  * `s2member_seeking` = [post|page|catg|ptag]-[ID number] ( Post ID, Page ID, Category ID, Tag ID )
21
  Or: `s2member_seeking` = ruri-[base64 encoded URI] ( only applies w/ Membership URI Restrictions )
22
+ Or: `s2member_seeking` = file-[protected file name] ( only applies w/ Download Restrictions )
23
  Or: `s2member_seeking` = bbpress ( only applies when the s2Member -> bbPress Bridge is installed )
24
  * `s2member_level_req` = a Membership Level # required for access ( only applies to Membership Level Access )
25
  * `s2member_ccap_req` = a Custom Capability required for access ( only applies to Custom Capability Restrictions )
37
  <?php /* Parse s2Member's MOP Vars into local variables. */
38
  list($seeking, $id) = preg_split("/-/", $_GET["s2member_seeking"], 2);
39
  list($seeking, $uri) = preg_split("/-/", $_GET["s2member_seeking"], 2);
40
+ list($seeking, $file) = preg_split("/-/", $_GET["s2member_seeking"], 2);
41
  $level_req = $_GET["s2member_level_req"];
42
  $ccap_req = $_GET["s2member_ccap_req"];
43
  $sp_req = $_GET["s2member_sp_req"]; ?>
includes/menu-pages/code-samples/current-user-fields.php CHANGED
@@ -21,4 +21,7 @@ You can also pull details from the meta table.
21
  [s2Get user_option="s2member_subscr_gateway" /]
22
  [s2Get user_option="s2member_last_payment_time" /]
23
  [s2Get user_option="s2member_auto_eot_time" /]
24
- [s2Get user_option="any other meta_key" /]
 
 
 
21
  [s2Get user_option="s2member_subscr_gateway" /]
22
  [s2Get user_option="s2member_last_payment_time" /]
23
  [s2Get user_option="s2member_auto_eot_time" /]
24
+ [s2Get user_option="any other meta_key" /]
25
+
26
+ Or to include the JSON encoded array into a JavaScript routine.
27
+ [s2Get constant="S2MEMBER_CURRENT_USER_FIELDS" /]
includes/menu-pages/code-samples/current-user-subscr-id.php CHANGED
@@ -1,8 +1,9 @@
1
  <?php echo S2MEMBER_CURRENT_USER_SUBSCR_ID; ?>
2
- This may output something like: S-82234JD0923423
3
- ( this is the Paid Subscription ID associated with their account )
4
- ( if the User is a Free Subscriber, this is their Free Subscriber ID )
5
- ( for Lifetime subscriptions sold through Buy Now buttons, this will hold the Paid Transaction ID associated with their purchase )
 
6
 
7
  ---- s2member Shortcode Equivalent ----
8
 
1
  <?php echo S2MEMBER_CURRENT_USER_SUBSCR_ID; ?>
2
+ This may output something like: I-82234JD0923423
3
+
4
+ This is the Paid Subscription ID associated with their account.
5
+ Or, for Lifetime subscriptions sold through Buy Now buttons, this will hold the Paid Transaction ID associated with their purchase.
6
+ Or, if the User is a Free Subscriber ( i.e. NOT a paying Member ), this will simply be an empty string.
7
 
8
  ---- s2member Shortcode Equivalent ----
9
 
includes/menu-pages/code-samples/current-user-subscr-or-wp-id.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php echo S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID; ?>
2
+ This may output something like: I-82234JD0923423
3
+ Or possibly something like: 8845
4
+
5
+ This is the Paid Subscription ID associated with their account.
6
+ Or, for Lifetime subscriptions sold through Buy Now buttons, this will hold the Paid Transaction ID associated with their purchase.
7
+ Or, if the User is a Free Subscriber ( i.e. NOT a paying Member ), this will hold their Free Subscriber ID ( i.e. a WordPress® User ID ).
8
+
9
+ ---- s2member Shortcode Equivalent ----
10
+
11
+ [s2Get constant="S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID" /]
includes/menu-pages/scripting.inc.php CHANGED
@@ -468,7 +468,11 @@ if (apply_filters ("ws_plugin__s2member_during_scripting_page_during_left_sectio
468
  /**/
469
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
470
  /**/
471
- echo '<p><strong>S2MEMBER_CURRENT_USER_SUBSCR_ID</strong><br />This will always be a (string) containing the current User\'s Paid Subscr. ID. If they\'ve NOT paid yet, this will be their WordPress® User ID#. Empty if not logged in.</p>' . "\n";
 
 
 
 
472
  /**/
473
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
474
  /**/
@@ -524,7 +528,7 @@ if (apply_filters ("ws_plugin__s2member_during_scripting_page_during_left_sectio
524
  /**/
525
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
526
  /**/
527
- #echo '<p><strong>S2MEMBER_CURRENT_USER_FIELDS</strong><br />This will always be a JSON encoded array, in (string) format. An empty JSON encoded array, in (string) format, if not logged in. This JSON encoded array will contain the following fields: <code>id, ip, email, login, first_name, last_name, display_name, subscr_id, subscr_gateway, custom</code>. If you\'ve configured additional Custom Fields, those Custom Fields will also be added to this array. For example, if you configured the Custom Field: <code>Street Address</code>, it would be included in this array as: <code>street_address</code>. Custom Field references are converted to lowercase format, and spaces are replaced by underscores. You can do <code>print_r(json_decode(S2MEMBER_CURRENT_USER_FIELDS, true));</code> to get a full list for testing.</p>' . "\n";
528
  /**/
529
  #echo '<div class="ws-menu-page-hr"></div>' . "\n";
530
  /**/
@@ -678,7 +682,7 @@ if (apply_filters ("ws_plugin__s2member_during_scripting_page_during_left_sectio
678
  do_action ("ws_plugin__s2member_during_scripting_page_during_left_sections_during_list_of_api_constants_farm", get_defined_vars ());
679
  /**/
680
  echo '<p><strong>S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0</strong> ... This auto-fills the <code>on0</code> value in PayPal® Button Codes. If a Button Code is presented to a logged-in Member, this will auto-fill the value for the <code>on0</code> input variable, with the string: <code>"Updating Subscr. ID"</code>. Otherwise, it will be an empty string.</p>' . "\n";
681
- echo '<p><strong>S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0</strong> ... This auto-fills the <code>os0</code> value in PayPal® Button Codes. If a Button Code is presented to a logged-in Member, this will auto-fill the value for the <code>os0</code> input variable, with the value of <code>S2MEMBER_CURRENT_USER_SUBSCR_ID</code>. Otherwise, it will be an empty string.</p>' . "\n";
682
  echo '<p>These two Constants are special. They are used by the PayPal® Button Generator for s2Member. This is how s2Member identifies an existing Member ( and/or a Free Subscriber ), who is already logged in when they click a PayPal® Modification Button that was generated for you by s2Member. Instead of forcing a Member ( and/or a Free Subscriber ) to re-register for a new account, s2Member can identify their existing account, and update it, according to the modified terms in your Button Code. These three Button Code parameters: <code>on0, os0, modify</code>, work together in harmony. If you\'re using the Shortcode Format for PayPal® Buttons, you won\'t even see these, because they\'re added internally by the Shortcode processor. Anyway, they\'re just documented here for clarity; you probably won\'t use these directly; the Button Generator pops them in.</p>' . "\n";
683
  /**/
684
  echo '</div>' . "\n";
@@ -732,11 +736,16 @@ if (apply_filters ("ws_plugin__s2member_during_scripting_page_during_left_sectio
732
  /**/
733
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
734
  /**/
735
- echo '<p><strong>S2MEMBER_CURRENT_USER_SUBSCR_ID</strong><br />This will always be a (string) containing the current User\'s Paid Subscr. ID. If they\'ve NOT paid yet, this will be their WordPress® User ID#. Empty if not logged in.</p>' . "\n";
736
  echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-subscr-id.php")) . '</p>' . "\n";
737
  /**/
738
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
739
  /**/
 
 
 
 
 
740
  echo '<p><strong>S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY</strong><br />This will always be a (string) containing the current User\'s Paid Subscr. Gateway. If they\'ve NOT paid yet, this will be empty. Empty if not logged in.</p>' . "\n";
741
  echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-subscr-gateway.php")) . '</p>' . "\n";
742
  /**/
@@ -802,7 +811,7 @@ if (apply_filters ("ws_plugin__s2member_during_scripting_page_during_left_sectio
802
  /**/
803
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
804
  /**/
805
- echo '<p><strong>S2MEMBER_CURRENT_USER_FIELDS</strong><br />This will always be a JSON encoded array, in (string) format. An empty JSON encoded array, in (string) format, if not logged in. This JSON encoded array will contain the following fields: <code>id, ip, email, login, first_name, last_name, display_name, subscr_id, subscr_gateway, custom</code>. If you\'ve configured additional Custom Fields, those Custom Fields will also be added to this array. For example, if you configured the Custom Field: <code>Street Address</code>, it would be included in this array as: <code>street_address</code>. Custom Field references are converted to lowercase format, and spaces are replaced by underscores. You can do <code>print_r(json_decode(S2MEMBER_CURRENT_USER_FIELDS, true));</code> to get a full list for testing.</p>' . "\n";
806
  echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-fields.php")) . '</p>' . "\n";
807
  /**/
808
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
@@ -1007,7 +1016,7 @@ if (apply_filters ("ws_plugin__s2member_during_scripting_page_during_left_sectio
1007
  do_action ("ws_plugin__s2member_during_scripting_page_during_left_sections_during_list_of_api_constants", get_defined_vars ());
1008
  /**/
1009
  echo '<p><strong>S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0</strong> ... This auto-fills the <code>on0</code> value in PayPal® Button Codes. If a Button Code is presented to a logged-in Member, this will auto-fill the value for the <code>on0</code> input variable, with the string: <code>"Updating Subscr. ID"</code>. Otherwise, it will be an empty string.</p>' . "\n";
1010
- echo '<p><strong>S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0</strong> ... This auto-fills the <code>os0</code> value in PayPal® Button Codes. If a Button Code is presented to a logged-in Member, this will auto-fill the value for the <code>os0</code> input variable, with the value of <code>S2MEMBER_CURRENT_USER_SUBSCR_ID</code>. Otherwise, it will be an empty string.</p>' . "\n";
1011
  echo '<p>These two Constants are special. They are used by the PayPal® Button Generator for s2Member. This is how s2Member identifies an existing Member ( and/or a Free Subscriber ), who is already logged in when they click a PayPal® Modification Button that was generated for you by s2Member. Instead of forcing a Member ( and/or a Free Subscriber ) to re-register for a new account, s2Member can identify their existing account, and update it, according to the modified terms in your Button Code. These three Button Code parameters: <code>on0, os0, modify</code>, work together in harmony. If you\'re using the Shortcode Format for PayPal® Buttons, you won\'t even see these, because they\'re added internally by the Shortcode processor. Anyway, they\'re just documented here for clarity; you probably won\'t use these directly; the Button Generator pops them in.</p>' . "\n";
1012
  echo '<p><em>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-value-for-pp-on0-os0.php")) . '</em></p>' . "\n";
1013
  /**/
468
  /**/
469
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
470
  /**/
471
+ echo '<p><strong>S2MEMBER_CURRENT_USER_SUBSCR_ID</strong><br />This will always be a (string) containing the current User\'s Paid Subscr. ID. If they\'ve NOT paid yet, this will be an empty string. Also empty if not logged in.</p>' . "\n";
472
+ /**/
473
+ echo '<div class="ws-menu-page-hr"></div>' . "\n";
474
+ /**/
475
+ echo '<p><strong>S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID</strong><br />This will always be a (string) containing the current User\'s Paid Subscr. ID. If they\'ve NOT paid yet, this will be their WordPress® User ID#. Empty if not logged in.</p>' . "\n";
476
  /**/
477
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
478
  /**/
528
  /**/
529
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
530
  /**/
531
+ #echo '<p><strong>S2MEMBER_CURRENT_USER_FIELDS</strong><br />This will always be a JSON encoded array, in (string) format. An empty JSON encoded array, in (string) format, if not logged in. This JSON encoded array will contain the following fields: <code>id, ip, email, login, first_name, last_name, display_name, subscr_id, subscr_or_wp_id, subscr_gateway, custom</code>. If you\'ve configured additional Custom Fields, those Custom Fields will also be added to this array. For example, if you configured the Custom Field: <code>Street Address</code>, it would be included in this array as: <code>street_address</code>. Custom Field references are converted to lowercase format, and spaces are replaced by underscores. You can do <code>print_r(json_decode(S2MEMBER_CURRENT_USER_FIELDS, true));</code> to get a full list for testing.</p>' . "\n";
532
  /**/
533
  #echo '<div class="ws-menu-page-hr"></div>' . "\n";
534
  /**/
682
  do_action ("ws_plugin__s2member_during_scripting_page_during_left_sections_during_list_of_api_constants_farm", get_defined_vars ());
683
  /**/
684
  echo '<p><strong>S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0</strong> ... This auto-fills the <code>on0</code> value in PayPal® Button Codes. If a Button Code is presented to a logged-in Member, this will auto-fill the value for the <code>on0</code> input variable, with the string: <code>"Updating Subscr. ID"</code>. Otherwise, it will be an empty string.</p>' . "\n";
685
+ echo '<p><strong>S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0</strong> ... This auto-fills the <code>os0</code> value in PayPal® Button Codes. If a Button Code is presented to a logged-in Member, this will auto-fill the value for the <code>os0</code> input variable, with the value of <code>S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID</code>. Otherwise, it will be an empty string.</p>' . "\n";
686
  echo '<p>These two Constants are special. They are used by the PayPal® Button Generator for s2Member. This is how s2Member identifies an existing Member ( and/or a Free Subscriber ), who is already logged in when they click a PayPal® Modification Button that was generated for you by s2Member. Instead of forcing a Member ( and/or a Free Subscriber ) to re-register for a new account, s2Member can identify their existing account, and update it, according to the modified terms in your Button Code. These three Button Code parameters: <code>on0, os0, modify</code>, work together in harmony. If you\'re using the Shortcode Format for PayPal® Buttons, you won\'t even see these, because they\'re added internally by the Shortcode processor. Anyway, they\'re just documented here for clarity; you probably won\'t use these directly; the Button Generator pops them in.</p>' . "\n";
687
  /**/
688
  echo '</div>' . "\n";
736
  /**/
737
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
738
  /**/
739
+ echo '<p><strong>S2MEMBER_CURRENT_USER_SUBSCR_ID</strong><br />This will always be a (string) containing the current User\'s Paid Subscr. ID. If they\'ve NOT paid yet, this will be an empty string. Also empty if not logged in.</p>' . "\n";
740
  echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-subscr-id.php")) . '</p>' . "\n";
741
  /**/
742
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
743
  /**/
744
+ echo '<p><strong>S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID</strong><br />This will always be a (string) containing the current User\'s Paid Subscr. ID. If they\'ve NOT paid yet, this will be their WordPress® User ID#. Empty if not logged in.</p>' . "\n";
745
+ echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-subscr-or-wp-id.php")) . '</p>' . "\n";
746
+ /**/
747
+ echo '<div class="ws-menu-page-hr"></div>' . "\n";
748
+ /**/
749
  echo '<p><strong>S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY</strong><br />This will always be a (string) containing the current User\'s Paid Subscr. Gateway. If they\'ve NOT paid yet, this will be empty. Empty if not logged in.</p>' . "\n";
750
  echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-subscr-gateway.php")) . '</p>' . "\n";
751
  /**/
811
  /**/
812
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
813
  /**/
814
+ echo '<p><strong>S2MEMBER_CURRENT_USER_FIELDS</strong><br />This will always be a JSON encoded array, in (string) format. An empty JSON encoded array, in (string) format, if not logged in. This JSON encoded array will contain the following fields: <code>id, ip, email, login, first_name, last_name, display_name, subscr_id, subscr_or_wp_id, subscr_gateway, custom</code>. If you\'ve configured additional Custom Fields, those Custom Fields will also be added to this array. For example, if you configured the Custom Field: <code>Street Address</code>, it would be included in this array as: <code>street_address</code>. Custom Field references are converted to lowercase format, and spaces are replaced by underscores. You can do <code>print_r(json_decode(S2MEMBER_CURRENT_USER_FIELDS, true));</code> to get a full list for testing.</p>' . "\n";
815
  echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-fields.php")) . '</p>' . "\n";
816
  /**/
817
  echo '<div class="ws-menu-page-hr"></div>' . "\n";
1016
  do_action ("ws_plugin__s2member_during_scripting_page_during_left_sections_during_list_of_api_constants", get_defined_vars ());
1017
  /**/
1018
  echo '<p><strong>S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0</strong> ... This auto-fills the <code>on0</code> value in PayPal® Button Codes. If a Button Code is presented to a logged-in Member, this will auto-fill the value for the <code>on0</code> input variable, with the string: <code>"Updating Subscr. ID"</code>. Otherwise, it will be an empty string.</p>' . "\n";
1019
+ echo '<p><strong>S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0</strong> ... This auto-fills the <code>os0</code> value in PayPal® Button Codes. If a Button Code is presented to a logged-in Member, this will auto-fill the value for the <code>os0</code> input variable, with the value of <code>S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID</code>. Otherwise, it will be an empty string.</p>' . "\n";
1020
  echo '<p>These two Constants are special. They are used by the PayPal® Button Generator for s2Member. This is how s2Member identifies an existing Member ( and/or a Free Subscriber ), who is already logged in when they click a PayPal® Modification Button that was generated for you by s2Member. Instead of forcing a Member ( and/or a Free Subscriber ) to re-register for a new account, s2Member can identify their existing account, and update it, according to the modified terms in your Button Code. These three Button Code parameters: <code>on0, os0, modify</code>, work together in harmony. If you\'re using the Shortcode Format for PayPal® Buttons, you won\'t even see these, because they\'re added internally by the Shortcode processor. Anyway, they\'re just documented here for clarity; you probably won\'t use these directly; the Button Generator pops them in.</p>' . "\n";
1021
  echo '<p><em>' . c_ws_plugin__s2member_utils_strings::highlight_php (file_get_contents (dirname (__FILE__) . "/code-samples/current-user-value-for-pp-on0-os0.php")) . '</em></p>' . "\n";
1022
  /**/
includes/profile.inc.php CHANGED
@@ -20,6 +20,8 @@ See: s2Member -> API Scripting -> PHP Constants
20
  */
21
  $tabindex = 0; /* Incremented tabindex starting with 0. */
22
  $current_user = wp_get_current_user (); /* Current user. */
 
 
23
  /**/
24
  echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\n";
25
  /**/
@@ -40,7 +42,7 @@ echo '</head>' . "\n";
40
  /**/
41
  echo '<body style="' . esc_attr (apply_filters ("ws_plugin__s2member_profile_body_styles", "background:#FFFFFF; color:#333333; font-family:'Verdana', sans-serif; font-size:13px;", get_defined_vars ())) . '">' . "\n";
42
  /**/
43
- echo '<form method="post" name="ws_plugin__s2member_profile" id="ws-plugin--s2member-profile">' . "\n";
44
  /**/
45
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
46
  do_action ("ws_plugin__s2member_during_profile_before_table", get_defined_vars ());
20
  */
21
  $tabindex = 0; /* Incremented tabindex starting with 0. */
22
  $current_user = wp_get_current_user (); /* Current user. */
23
+ /* This file is only loaded when/if a User is logged in.
24
+ Hence the dependence on $current_user. */
25
  /**/
26
  echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\n";
27
  /**/
42
  /**/
43
  echo '<body style="' . esc_attr (apply_filters ("ws_plugin__s2member_profile_body_styles", "background:#FFFFFF; color:#333333; font-family:'Verdana', sans-serif; font-size:13px;", get_defined_vars ())) . '">' . "\n";
44
  /**/
45
+ echo '<form method="post" name="ws_plugin__s2member_profile" id="ws-plugin--s2member-profile" action="' . esc_attr (site_url ("/")) . '">' . "\n";
46
  /**/
47
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
48
  do_action ("ws_plugin__s2member_during_profile_before_table", get_defined_vars ());
includes/syscon.inc.php CHANGED
@@ -46,9 +46,9 @@ This is a special option cache that holds some additional information autoloaded
46
  */
47
  $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"] = get_option ("ws_plugin__s2member_cache");
48
  /*
49
- Configure the file modification time for the syscon.inc.php file.
50
  */
51
- $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["filemtime"] = filemtime (__FILE__);
52
  /*
53
  Configure & validate all of the plugin options; and set their defaults.
54
  */
@@ -61,9 +61,11 @@ if (!function_exists ("ws_plugin__s2member_configure_options_and_their_defaults"
61
  It is important to note that sometimes default options may not or should not be pre-filled on an options form.
62
  These defaults are for the system to use in various ways, we may choose not to pre-fill certain fields.
63
  In other words, some defaults may be used internally, but to the user, the option will be empty. */
64
- $default_options = apply_filters ("ws_plugin__s2member_default_options", array ( /* For filters. */
65
  /**/
66
- "options_version" => "1.0", /* Used internally to keep runtime files up-to-date. */
 
 
67
  /**/
68
  "gateway_debug_logs" => "0", /* Enable debugging / logging for development testing? */
69
  /**/
@@ -247,184 +249,194 @@ if (!function_exists ("ws_plugin__s2member_configure_options_and_their_defaults"
247
  if (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_api_signature"] && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_paypal_api_signature"])
248
  $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_api_signature"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_paypal_api_signature"];
249
  /*
250
- Validate each option, possibly reverting back to the default value if invalid.
251
  */
252
- foreach ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"] as $key => &$value)
253
- {
254
- if (!isset ($default_options[$key]) && !preg_match ("/^pro_/", $key))
255
- unset ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"][$key]);
256
- /**/
257
- else if ($key === "options_version" && (!is_string ($value) || !is_numeric ($value)))
258
- $value = $default_options[$key];
259
- /**/
260
- else if ($key === "gateway_debug_logs" && (!is_string ($value) || !is_numeric ($value)))
261
- $value = $default_options[$key];
262
- /**/
263
- else if ($key === "sec_encryption_key" && (!is_string ($value) || !strlen ($value)))
264
- $value = $default_options[$key];
265
- /**/
266
- else if ($key === "sec_encryption_key_history" && (!is_array ($value) || empty ($value)))
267
- $value = $default_options[$key];
268
- /**/
269
- else if ($key === "max_ip_restriction" && (!is_string ($value) || !is_numeric ($value) || $value < 0 || $value > 100))
270
- $value = $default_options[$key];
271
- /**/
272
- else if ($key === "max_ip_restriction_time" && (!is_string ($value) || !is_numeric ($value) || $value < 900 || $value > 31556926))
273
- $value = $default_options[$key];
274
- /**/
275
- else if ($key === "max_failed_login_attempts" && (!is_string ($value) || !is_numeric ($value) || $value < 0 || $value > 100))
276
- $value = $default_options[$key];
277
- /**/
278
- else if ($key === "run_deactivation_routines" && (!is_string ($value) || !is_numeric ($value)))
279
- $value = $default_options[$key];
280
- /**/
281
- else if ($key === "custom_reg_fields" && (!is_string ($value) || !strlen ($value)))
282
- $value = $default_options[$key];
283
- /**/
284
- else if ($key === "custom_reg_password" && (!is_string ($value) || !is_numeric ($value)))
285
- $value = $default_options[$key];
286
- /**/
287
- else if ($key === "custom_reg_opt_in" && (!is_string ($value) || !is_numeric ($value)))
288
- $value = $default_options[$key];
289
- /**/
290
- else if ($key === "custom_reg_opt_in_label" && (!is_string ($value) || !strlen ($value)))
291
- $value = $default_options[$key];
292
- /**/
293
- else if ($key === "custom_reg_auto_opt_outs" && (!is_array ($value) || empty ($value)))
294
- $value = $default_options[$key];
295
- /**/
296
- else if ($key === "allow_subscribers_in" && (!is_string ($value) || !is_numeric ($value)))
297
- $value = $default_options[$key];
298
- /**/
299
- else if ($key === "mms_auto_patch" && (!is_string ($value) || !is_numeric ($value)))
300
- $value = $default_options[$key];
301
- /**/
302
- else if ($key === "mms_registration_file" && (!is_string ($value) || !preg_match ("/^(wp-login|wp-signup)$/", $value)))
303
- $value = $default_options[$key];
304
- /**/
305
- else if ($key === "mms_registration_grants" && (!is_string ($value) || !preg_match ("/^(none|user|all)$/", $value)))
306
- $value = $default_options[$key];
307
- /**/
308
- else if (preg_match ("/^mms_registration_blogs_level[0-4]$/", $key) && (!is_string ($value) || !is_numeric ($value) || $value < 0))
309
- $value = $default_options[$key];
310
- /**/
311
- else if ($key === "force_admin_lockouts" && (!is_string ($value) || !is_numeric ($value)))
312
- $value = $default_options[$key];
313
- /**/
314
- else if ($key === "filter_wp_query" && (!is_string ($value) || !preg_match ("/^(none|searches|feeds|searches,feeds|all)$/", $value)))
315
- $value = $default_options[$key];
316
- /**/
317
- else if ($key === "login_welcome_page" && (!is_string ($value) || !is_numeric ($value)))
318
- $value = $default_options[$key];
319
- /**/
320
- else if ($key === "login_redirection_override" && (!is_string ($value) || !strlen ($value)))
321
- $value = $default_options[$key];
322
- /**/
323
- else if ($key === "membership_options_page" && (!is_string ($value) || !is_numeric ($value)))
324
- $value = $default_options[$key];
325
- /**/
326
- else if ($key === "login_reg_background_image" && !is_string ($value)) /* This is optional. */
327
- $value = $default_options[$key];
328
- /**/
329
- else if ($key === "login_reg_background_image_repeat" && (!is_string ($value) || !preg_match ("/^(repeat|repeat-x|repeat-y|no-repeat)$/", $value)))
330
- $value = $default_options[$key];
331
- /**/
332
- else if (preg_match ("/^login_reg_(background|logo|font|footer)_/", $key) && !preg_match ("/background_image/", $key) && (!is_string ($value) || !strlen ($value)))
333
- $value = $default_options[$key];
334
- /**/
335
- else if (preg_match ("/^reg_email_from_(name|email)$/", $key) && (!is_string ($value) || !strlen ($value)))
336
- $value = $default_options[$key];
337
- /**/
338
- else if ($key === "paypal_sandbox" && (!is_string ($value) || !is_numeric ($value)))
339
- $value = $default_options[$key];
340
- /**/
341
- else if (preg_match ("/^paypal_(business|api_username|api_password|api_signature|identity_token)$/", $key) && (!is_string ($value) || !strlen ($value)))
342
- $value = $default_options[$key];
343
- /**/
344
- else if ($key === "paypal_btn_encryption" && (!is_string ($value) || !is_numeric ($value)))
345
- $value = $default_options[$key];
346
- /**/
347
- else if (preg_match ("/^(signup|sp)_tracking_codes$/", $key) && (!is_string ($value) || !strlen ($value)))
348
- $value = $default_options[$key];
349
- /**/
350
- else if (preg_match ("/^(signup|sp)_email_recipients$/", $key) && !is_string ($value)) /* Can be empty. */
351
- $value = $default_options[$key];
352
- /**/
353
- else if (preg_match ("/^(signup|sp)_email_(subject|message)$/", $key) && (!is_string ($value) || !strlen ($value)))
354
- $value = $default_options[$key];
355
- /**/
356
- else if ($key === "mailchimp_api_key" && (!is_string ($value) || !strlen ($value)))
357
- $value = $default_options[$key];
358
- /**/
359
- else if (preg_match ("/^level[0-4]_mailchimp_list_ids$/", $key) && (!is_string ($value) || !strlen ($value = preg_replace ("/\s+/", "", $value))))
360
- $value = $default_options[$key];
361
- /**/
362
- else if (preg_match ("/^level[0-4]_aweber_list_ids$/", $key) && (!is_string ($value) || !strlen ($value = preg_replace ("/\s+/", "", $value))))
363
- $value = $default_options[$key];
364
- /**/
365
- else if (preg_match ("/^(signup|registration|payment|cancellation|eot_del|ref_rev|sp_sale|sp_ref_rev)_notification_urls$/", $key) && (!is_string ($value) || !strlen ($value)))
366
- $value = $default_options[$key];
367
- /**/
368
- else if (preg_match ("/^(signup|registration|payment|cancellation|eot_del|ref_rev|sp_sale|sp_ref_rev)_notification_recipients$/", $key) && (!is_string ($value) || !strlen ($value)))
369
- $value = $default_options[$key];
370
- /**/
371
- else if (preg_match ("/^level[0-4]_label$/", $key) && (!is_string ($value) || !strlen ($value)))
372
- $value = $default_options[$key];
373
- /**/
374
- else if ($key === "apply_label_translations" && (!is_string ($value) || !is_numeric ($value)))
375
- $value = $default_options[$key];
376
- /**/
377
- else if (preg_match ("/^level[0-4]_file_downloads_allowed$/", $key) && (!is_string ($value) || !is_numeric ($value) || $value < 0))
378
- $value = $default_options[$key];
379
- /**/
380
- else if (preg_match ("/^level[0-4]_file_downloads_allowed_days$/", $key) && (!is_string ($value) || !is_numeric ($value) || $value < 0))
381
- $value = $default_options[$key];
382
- /**/
383
- else if ($key === "file_download_limit_exceeded_page" && (!is_string ($value) || !is_numeric ($value)))
384
- $value = $default_options[$key];
385
- /**/
386
- else if ($key === "file_download_inline_extensions" && (!is_string ($value) || ! ($value = strtolower (preg_replace ("/\s+/", "", $value)))))
387
- $value = $default_options[$key];
388
- /**/
389
- else if (preg_match ("/^level[0-4]_ruris$/", $key) && (!is_string ($value) || !strlen ($value)))
390
- $value = $default_options[$key];
391
- /**/
392
- else if (preg_match ("/^level[0-4]_catgs$/", $key) && (!is_string ($value) || ! ($value = ( ($value === "all") ? $value : trim (preg_replace ("/[^0-9,]/", "", $value), ",")))))
393
- $value = $default_options[$key];
394
- /**/
395
- else if (preg_match ("/^level[0-4]_ptags$/", $key) && (!is_string ($value) || ! ($value = ( ($value === "all") ? $value : trim (preg_replace ("/( +)/", " ", trim (preg_replace ("/( *),( *)/", ",", $value))), ",")))))
396
- $value = $default_options[$key];
397
- /**/
398
- else if (preg_match ("/^level[0-4]_posts$/", $key) && (!is_string ($value) || ! ($value = ( ($value === "all") ? $value : trim (preg_replace ("/[^0-9,]/", "", $value), ",")))))
399
- $value = $default_options[$key];
400
- /**/
401
- else if (preg_match ("/^level[0-4]_pages$/", $key) && (!is_string ($value) || ! ($value = ( ($value === "all") ? $value : trim (preg_replace ("/[^0-9,]/", "", $value), ",")))))
402
- $value = $default_options[$key];
403
- /**/
404
- else if ($key === "specific_ids" && (!is_string ($value) || ! ($value = trim (preg_replace ("/[^0-9,]/", "", $value), ","))))
405
- $value = $default_options[$key];
406
- /**/
407
- else if ($key === "triggers_immediate_eot" && (!is_string ($value) || !preg_match ("/^(none|refunds|reversals|refunds,reversals)$/", $value)))
408
- $value = $default_options[$key];
409
- /**/
410
- else if ($key === "membership_eot_behavior" && (!is_string ($value) || !preg_match ("/^(demote|delete)$/", $value)))
411
- $value = $default_options[$key];
412
- /**/
413
- else if ($key === "auto_eot_system_enabled" && (!is_string ($value) || !is_numeric ($value)))
414
- $value = $default_options[$key];
415
- }
416
  /*
417
- Keeps a history of the last 10 Security Encryption Keys configured for this installation.
418
  */
419
- if ($options !== false && is_string ($options["sec_encryption_key"]) && strlen ($options["sec_encryption_key"]) && !in_array ($options["sec_encryption_key"], $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sec_encryption_key_history"]))
420
  {
421
- array_unshift ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sec_encryption_key_history"], $options["sec_encryption_key"]);
422
- $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sec_encryption_key_history"] = array_slice ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sec_encryption_key_history"], 0, 10);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
423
  }
424
  /**/
425
  return apply_filters_ref_array ("ws_plugin__s2member_options", array (&$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]));
426
  }
427
- /**/
428
- call_user_func ("ws_plugin__s2member_configure_options_and_their_defaults");
429
  }
430
  ?>
46
  */
47
  $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"] = get_option ("ws_plugin__s2member_cache");
48
  /*
49
+ Configure checksum time for the syscon.inc.php file.
50
  */
51
+ $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["checksum"] = filemtime (__FILE__);
52
  /*
53
  Configure & validate all of the plugin options; and set their defaults.
54
  */
61
  It is important to note that sometimes default options may not or should not be pre-filled on an options form.
62
  These defaults are for the system to use in various ways, we may choose not to pre-fill certain fields.
63
  In other words, some defaults may be used internally, but to the user, the option will be empty. */
64
+ $default_options = apply_filters ("ws_plugin__s2member_default_options", array ( /* For Filters. */
65
  /**/
66
+ "options_checksum" => "", /* Used internally to maintain the integrity of all options in the array. */
67
+ /**/
68
+ "options_version" => "1.0", /* Used internally to maintain integrity of all options in the array. */
69
  /**/
70
  "gateway_debug_logs" => "0", /* Enable debugging / logging for development testing? */
71
  /**/
249
  if (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_api_signature"] && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_paypal_api_signature"])
250
  $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_api_signature"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_paypal_api_signature"];
251
  /*
252
+ This builds an MD5 checksum for the full array of options. This also includes the config checksum and the current set of default options.
253
  */
254
+ $checksum = md5 (($checksum_prefix = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["checksum"] . serialize ($default_options)) . serialize (array_merge ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"], array ("options_checksum" => 0))));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
255
  /*
256
+ Validate each option, possibly reverting back to the default value in some cases.
257
  */
258
+ if ($options !== false || ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["options_checksum"] !== $checksum && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"] !== $default_options))
259
  {
260
+ foreach ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"] as $key => &$value)
261
+ {
262
+ if (!isset ($default_options[$key]) && !preg_match ("/^pro_/", $key))
263
+ unset ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"][$key]);
264
+ /**/
265
+ else if ($key === "options_checksum" && (!is_string ($value) || !strlen ($value)))
266
+ $value = $default_options[$key];
267
+ /**/
268
+ else if ($key === "options_version" && (!is_string ($value) || !is_numeric ($value)))
269
+ $value = $default_options[$key];
270
+ /**/
271
+ else if ($key === "gateway_debug_logs" && (!is_string ($value) || !is_numeric ($value)))
272
+ $value = $default_options[$key];
273
+ /**/
274
+ else if ($key === "sec_encryption_key" && (!is_string ($value) || !strlen ($value)))
275
+ $value = $default_options[$key];
276
+ /**/
277
+ else if ($key === "sec_encryption_key_history" && (!is_array ($value) || empty ($value)))
278
+ $value = $default_options[$key];
279
+ /**/
280
+ else if ($key === "max_ip_restriction" && (!is_string ($value) || !is_numeric ($value) || $value < 0 || $value > 100))
281
+ $value = $default_options[$key];
282
+ /**/
283
+ else if ($key === "max_ip_restriction_time" && (!is_string ($value) || !is_numeric ($value) || $value < 900 || $value > 31556926))
284
+ $value = $default_options[$key];
285
+ /**/
286
+ else if ($key === "max_failed_login_attempts" && (!is_string ($value) || !is_numeric ($value) || $value < 0 || $value > 100))
287
+ $value = $default_options[$key];
288
+ /**/
289
+ else if ($key === "run_deactivation_routines" && (!is_string ($value) || !is_numeric ($value)))
290
+ $value = $default_options[$key];
291
+ /**/
292
+ else if ($key === "custom_reg_fields" && (!is_string ($value) || !strlen ($value)))
293
+ $value = $default_options[$key];
294
+ /**/
295
+ else if ($key === "custom_reg_password" && (!is_string ($value) || !is_numeric ($value)))
296
+ $value = $default_options[$key];
297
+ /**/
298
+ else if ($key === "custom_reg_opt_in" && (!is_string ($value) || !is_numeric ($value)))
299
+ $value = $default_options[$key];
300
+ /**/
301
+ else if ($key === "custom_reg_opt_in_label" && (!is_string ($value) || !strlen ($value)))
302
+ $value = $default_options[$key];
303
+ /**/
304
+ else if ($key === "custom_reg_auto_opt_outs" && (!is_array ($value) || empty ($value)))
305
+ $value = $default_options[$key];
306
+ /**/
307
+ else if ($key === "allow_subscribers_in" && (!is_string ($value) || !is_numeric ($value)))
308
+ $value = $default_options[$key];
309
+ /**/
310
+ else if ($key === "mms_auto_patch" && (!is_string ($value) || !is_numeric ($value)))
311
+ $value = $default_options[$key];
312
+ /**/
313
+ else if ($key === "mms_registration_file" && (!is_string ($value) || !preg_match ("/^(wp-login|wp-signup)$/", $value)))
314
+ $value = $default_options[$key];
315
+ /**/
316
+ else if ($key === "mms_registration_grants" && (!is_string ($value) || !preg_match ("/^(none|user|all)$/", $value)))
317
+ $value = $default_options[$key];
318
+ /**/
319
+ else if (preg_match ("/^mms_registration_blogs_level[0-4]$/", $key) && (!is_string ($value) || !is_numeric ($value) || $value < 0))
320
+ $value = $default_options[$key];
321
+ /**/
322
+ else if ($key === "force_admin_lockouts" && (!is_string ($value) || !is_numeric ($value)))
323
+ $value = $default_options[$key];
324
+ /**/
325
+ else if ($key === "filter_wp_query" && (!is_string ($value) || !preg_match ("/^(none|searches|feeds|searches,feeds|all)$/", $value)))
326
+ $value = $default_options[$key];
327
+ /**/
328
+ else if ($key === "login_welcome_page" && (!is_string ($value) || !is_numeric ($value)))
329
+ $value = $default_options[$key];
330
+ /**/
331
+ else if ($key === "login_redirection_override" && (!is_string ($value) || !strlen ($value)))
332
+ $value = $default_options[$key];
333
+ /**/
334
+ else if ($key === "membership_options_page" && (!is_string ($value) || !is_numeric ($value)))
335
+ $value = $default_options[$key];
336
+ /**/
337
+ else if ($key === "login_reg_background_image" && !is_string ($value)) /* This is optional. */
338
+ $value = $default_options[$key];
339
+ /**/
340
+ else if ($key === "login_reg_background_image_repeat" && (!is_string ($value) || !preg_match ("/^(repeat|repeat-x|repeat-y|no-repeat)$/", $value)))
341
+ $value = $default_options[$key];
342
+ /**/
343
+ else if (preg_match ("/^login_reg_(background|logo|font|footer)_/", $key) && !preg_match ("/background_image/", $key) && (!is_string ($value) || !strlen ($value)))
344
+ $value = $default_options[$key];
345
+ /**/
346
+ else if (preg_match ("/^reg_email_from_(name|email)$/", $key) && (!is_string ($value) || !strlen ($value)))
347
+ $value = $default_options[$key];
348
+ /**/
349
+ else if ($key === "paypal_sandbox" && (!is_string ($value) || !is_numeric ($value)))
350
+ $value = $default_options[$key];
351
+ /**/
352
+ else if (preg_match ("/^paypal_(business|api_username|api_password|api_signature|identity_token)$/", $key) && (!is_string ($value) || !strlen ($value)))
353
+ $value = $default_options[$key];
354
+ /**/
355
+ else if ($key === "paypal_btn_encryption" && (!is_string ($value) || !is_numeric ($value)))
356
+ $value = $default_options[$key];
357
+ /**/
358
+ else if (preg_match ("/^(signup|sp)_tracking_codes$/", $key) && (!is_string ($value) || !strlen ($value)))
359
+ $value = $default_options[$key];
360
+ /**/
361
+ else if (preg_match ("/^(signup|sp)_email_recipients$/", $key) && !is_string ($value)) /* Can be empty. */
362
+ $value = $default_options[$key];
363
+ /**/
364
+ else if (preg_match ("/^(signup|sp)_email_(subject|message)$/", $key) && (!is_string ($value) || !strlen ($value)))
365
+ $value = $default_options[$key];
366
+ /**/
367
+ else if ($key === "mailchimp_api_key" && (!is_string ($value) || !strlen ($value)))
368
+ $value = $default_options[$key];
369
+ /**/
370
+ else if (preg_match ("/^level[0-4]_mailchimp_list_ids$/", $key) && (!is_string ($value) || !strlen ($value = preg_replace ("/\s+/", "", $value))))
371
+ $value = $default_options[$key];
372
+ /**/
373
+ else if (preg_match ("/^level[0-4]_aweber_list_ids$/", $key) && (!is_string ($value) || !strlen ($value = preg_replace ("/\s+/", "", $value))))
374
+ $value = $default_options[$key];
375
+ /**/
376
+ else if (preg_match ("/^(signup|registration|payment|cancellation|eot_del|ref_rev|sp_sale|sp_ref_rev)_notification_urls$/", $key) && (!is_string ($value) || !strlen ($value)))
377
+ $value = $default_options[$key];
378
+ /**/
379
+ else if (preg_match ("/^(signup|registration|payment|cancellation|eot_del|ref_rev|sp_sale|sp_ref_rev)_notification_recipients$/", $key) && (!is_string ($value) || !strlen ($value)))
380
+ $value = $default_options[$key];
381
+ /**/
382
+ else if (preg_match ("/^level[0-4]_label$/", $key) && (!is_string ($value) || !strlen ($value)))
383
+ $value = $default_options[$key];
384
+ /**/
385
+ else if ($key === "apply_label_translations" && (!is_string ($value) || !is_numeric ($value)))
386
+ $value = $default_options[$key];
387
+ /**/
388
+ else if (preg_match ("/^level[0-4]_file_downloads_allowed$/", $key) && (!is_string ($value) || !is_numeric ($value) || $value < 0))
389
+ $value = $default_options[$key];
390
+ /**/
391
+ else if (preg_match ("/^level[0-4]_file_downloads_allowed_days$/", $key) && (!is_string ($value) || !is_numeric ($value) || $value < 0))
392
+ $value = $default_options[$key];
393
+ /**/
394
+ else if ($key === "file_download_limit_exceeded_page" && (!is_string ($value) || !is_numeric ($value)))
395
+ $value = $default_options[$key];
396
+ /**/
397
+ else if ($key === "file_download_inline_extensions" && (!is_string ($value) || ! ($value = strtolower (preg_replace ("/\s+/", "", $value)))))
398
+ $value = $default_options[$key];
399
+ /**/
400
+ else if (preg_match ("/^level[0-4]_ruris$/", $key) && (!is_string ($value) || !strlen ($value)))
401
+ $value = $default_options[$key];
402
+ /**/
403
+ else if (preg_match ("/^level[0-4]_catgs$/", $key) && (!is_string ($value) || ! ($value = ( ($value === "all") ? $value : trim (preg_replace ("/[^0-9,]/", "", $value), ",")))))
404
+ $value = $default_options[$key];
405
+ /**/
406
+ else if (preg_match ("/^level[0-4]_ptags$/", $key) && (!is_string ($value) || ! ($value = ( ($value === "all") ? $value : trim (preg_replace ("/( +)/", " ", trim (preg_replace ("/( *),( *)/", ",", $value))), ",")))))
407
+ $value = $default_options[$key];
408
+ /**/
409
+ else if (preg_match ("/^level[0-4]_posts$/", $key) && (!is_string ($value) || ! ($value = ( ($value === "all") ? $value : trim (preg_replace ("/[^0-9,]/", "", $value), ",")))))
410
+ $value = $default_options[$key];
411
+ /**/
412
+ else if (preg_match ("/^level[0-4]_pages$/", $key) && (!is_string ($value) || ! ($value = ( ($value === "all") ? $value : trim (preg_replace ("/[^0-9,]/", "", $value), ",")))))
413
+ $value = $default_options[$key];
414
+ /**/
415
+ else if ($key === "specific_ids" && (!is_string ($value) || ! ($value = trim (preg_replace ("/[^0-9,]/", "", $value), ","))))
416
+ $value = $default_options[$key];
417
+ /**/
418
+ else if ($key === "triggers_immediate_eot" && (!is_string ($value) || !preg_match ("/^(none|refunds|reversals|refunds,reversals)$/", $value)))
419
+ $value = $default_options[$key];
420
+ /**/
421
+ else if ($key === "membership_eot_behavior" && (!is_string ($value) || !preg_match ("/^(demote|delete)$/", $value)))
422
+ $value = $default_options[$key];
423
+ /**/
424
+ else if ($key === "auto_eot_system_enabled" && (!is_string ($value) || !is_numeric ($value)))
425
+ $value = $default_options[$key];
426
+ }
427
+ /**/
428
+ if ($options !== false && is_string ($options["sec_encryption_key"]) && strlen ($options["sec_encryption_key"]) && !in_array ($options["sec_encryption_key"], $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sec_encryption_key_history"]))
429
+ {
430
+ array_unshift ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sec_encryption_key_history"], $options["sec_encryption_key"]);
431
+ $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sec_encryption_key_history"] = array_slice ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sec_encryption_key_history"], 0, 10);
432
+ }
433
+ /**/
434
+ $GLOBALS["WS_PLUGIN__"]["s2member"]["o"] = apply_filters_ref_array ("ws_plugin__s2member_options_before_checksum", array (&$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]));
435
+ /**/
436
+ $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["options_checksum"] = md5 ($checksum_prefix . serialize (array_merge ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"], array ("options_checksum" => 0))));
437
  }
438
  /**/
439
  return apply_filters_ref_array ("ws_plugin__s2member_options", array (&$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]));
440
  }
 
 
441
  }
442
  ?>
readme.txt CHANGED
@@ -1,8 +1,8 @@
1
  === s2Member ( Membership w/ PayPal® ) ===
2
 
3
- Version: 3.5.1
4
- Stable tag: 3.5.1
5
- Framework: WS-P-3.1
6
 
7
  SSL Compatible: yes
8
  bbPress Compatible: yes
@@ -169,11 +169,20 @@ Yes and no. We've left this feature out of the plugin intentionally, because man
169
 
170
  == Upgrade Notice ==
171
 
172
- = 3.5.1+ =
173
  * Upgrade highly recommended. Many new features, WordPress® 3.1 compatible, speed optimizations, and several bug fixes.
174
 
175
  == Changelog ==
176
 
 
 
 
 
 
 
 
 
 
177
  = 3.5.1 =
178
  * **(s2Member). Bug fix.** Errors regarding `class-autoloader.inc.php / glob()`, which were associated with installation servers running NFS ( network file systems ) have been corrected in this release.
179
  * **(s2Member). Bug fix.** Errors regarding `ws_plugin__s2member_trim_deep()` during an upgrade from previous versions of s2Member have been corrected in this release.
1
  === s2Member ( Membership w/ PayPal® ) ===
2
 
3
+ Version: 3.5.2
4
+ Stable tag: 3.5.2
5
+ Framework: WS-P-3.5
6
 
7
  SSL Compatible: yes
8
  bbPress Compatible: yes
169
 
170
  == Upgrade Notice ==
171
 
172
+ = 3.5+ =
173
  * Upgrade highly recommended. Many new features, WordPress® 3.1 compatible, speed optimizations, and several bug fixes.
174
 
175
  == Changelog ==
176
 
177
+ = 3.5.2 =
178
+ * Framework updated; general cleanup.
179
+ * **(s2Member/s2Member Pro). Optimizations.** Further internal optimizations applied through configuration checksums that allow s2Member and s2Member Pro to load with even less overhead now.
180
+ * **(s2Member/s2Member Pro). Optimizations.** Further internal optimizations applied with Hook priorities that allow s2Member and s2Member Pro to load dynamic CSS/JS files with even less overhead now.
181
+ * **(s2Member). Bug fix.** Due to changes in WordPress® 3.1+, s2Member was including it's JavaScript routines twice on the `/wp-login.php` page. This has been resolved in s2Member v3.5.2+.
182
+ * **(s2Member). Hook change. Attn WP developers: s2Member's Hook `_ws_plugin__s2member_force_ssl_buffer_tags` is now `_ws_plugin__s2member_force_ssl_buffer_tags_array`.
183
+ * **(s2Member). API Constant change. Attn WP developers: s2Member's API Constant `S2MEMBER_CURRENT_USER_SUBSCR_ID` is now accompanied with a new API Constant `S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID`. The values returned by these API Constants have changed (slightly). For further details, check your Dashboard under: `s2Member -> API Scripting -> API Constants`.
184
+ * **(s2Member Pro). Bug fix.** s2Member's ccBill® DataLink routines were sometimes generating the error `Too Many Connections` due to an invalid data storage routine under a delayed scenario. This has been resolved in s2Member v3.5.2+.
185
+
186
  = 3.5.1 =
187
  * **(s2Member). Bug fix.** Errors regarding `class-autoloader.inc.php / glob()`, which were associated with installation servers running NFS ( network file systems ) have been corrected in this release.
188
  * **(s2Member). Bug fix.** Errors regarding `ws_plugin__s2member_trim_deep()` during an upgrade from previous versions of s2Member have been corrected in this release.
s2member.php CHANGED
@@ -9,9 +9,9 @@ along with this software. In the main directory, see: /licensing/
9
  If not, see: <http://www.gnu.org/licenses/>.
10
  */
11
  /*
12
- Version: 3.5.1
13
- Stable tag: 3.5.1
14
- Framework: WS-P-3.1
15
 
16
  SSL Compatible: yes
17
  bbPress Compatible: yes
@@ -54,10 +54,10 @@ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
54
  /*
55
  Define versions.
56
  */
57
- define ("WS_PLUGIN__S2MEMBER_VERSION", "3.5.1");
58
  define ("WS_PLUGIN__S2MEMBER_MIN_PHP_VERSION", "5.2");
59
  define ("WS_PLUGIN__S2MEMBER_MIN_WP_VERSION", "3.0");
60
- define ("WS_PLUGIN__S2MEMBER_MIN_PRO_VERSION", "1.5.1");
61
  /*
62
  Compatibility checks.
63
  */
@@ -73,11 +73,11 @@ if (version_compare (PHP_VERSION, WS_PLUGIN__S2MEMBER_MIN_PHP_VERSION, ">=") &&
73
  */
74
  include_once dirname (__FILE__) . "/includes/syscon.inc.php";
75
  /*
76
- Hooks and filters.
77
  */
78
  include_once dirname (__FILE__) . "/includes/hooks.inc.php";
79
  /*
80
- Hook after system config & hooks are loaded.
81
  */
82
  do_action ("ws_plugin__s2member_config_hooks_loaded");
83
  /*
@@ -86,11 +86,15 @@ if (version_compare (PHP_VERSION, WS_PLUGIN__S2MEMBER_MIN_PHP_VERSION, ">=") &&
86
  if (apply_filters ("ws_plugin__s2member_load_pro", true))
87
  @include_once dirname (__FILE__) . "-pro/pro-module.php";
88
  /*
 
 
 
 
89
  Function includes.
90
  */
91
  include_once dirname (__FILE__) . "/includes/funcs.inc.php";
92
  /*
93
- Include shortcodes.
94
  */
95
  include_once dirname (__FILE__) . "/includes/codes.inc.php";
96
  /*
9
  If not, see: <http://www.gnu.org/licenses/>.
10
  */
11
  /*
12
+ Version: 3.5.2
13
+ Stable tag: 3.5.2
14
+ Framework: WS-P-3.5
15
 
16
  SSL Compatible: yes
17
  bbPress Compatible: yes
54
  /*
55
  Define versions.
56
  */
57
+ define ("WS_PLUGIN__S2MEMBER_VERSION", "3.5.2");
58
  define ("WS_PLUGIN__S2MEMBER_MIN_PHP_VERSION", "5.2");
59
  define ("WS_PLUGIN__S2MEMBER_MIN_WP_VERSION", "3.0");
60
+ define ("WS_PLUGIN__S2MEMBER_MIN_PRO_VERSION", "1.5.2");
61
  /*
62
  Compatibility checks.
63
  */
73
  */
74
  include_once dirname (__FILE__) . "/includes/syscon.inc.php";
75
  /*
76
+ Hooks and Filters.
77
  */
78
  include_once dirname (__FILE__) . "/includes/hooks.inc.php";
79
  /*
80
+ Hook after system config & Hooks are loaded.
81
  */
82
  do_action ("ws_plugin__s2member_config_hooks_loaded");
83
  /*
86
  if (apply_filters ("ws_plugin__s2member_load_pro", true))
87
  @include_once dirname (__FILE__) . "-pro/pro-module.php";
88
  /*
89
+ Configure options and their defaults.
90
+ */
91
+ ws_plugin__s2member_configure_options_and_their_defaults ();
92
+ /*
93
  Function includes.
94
  */
95
  include_once dirname (__FILE__) . "/includes/funcs.inc.php";
96
  /*
97
+ Include Shortcodes.
98
  */
99
  include_once dirname (__FILE__) . "/includes/codes.inc.php";
100
  /*