PluginProbe
s2Member – Excellent for All Kinds of Memberships, Content Restriction Paywalls & Member Access Subscriptions / 110912
s2Member – Excellent for All Kinds of Memberships, Content Restriction Paywalls & Member Access Subscriptions v110912
260917 260913 260909 260829 260814 260805 110710 110731 110812 110815 110912 110913 110915 110926 110927 111002 111003 111011 111017 111029 111105 111206 111216 111220 120213 All 189 releases
s2member / includes / syscon.inc.php

syscon.inc.php in s2Member – Excellent for All Kinds of Memberships, Content Restriction Paywalls & Member Access Subscriptions 110912, at includes/syscon.inc.php

525 lines 31.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * System configuration for the s2Member plugin.
4 *
5 * **WARNING:** This is a system configuration file, please DO NOT EDIT this file directly.
6 * Instead, use the plugin options panel in WordPress® to override these settings.
7 *
8 * Copyright: © 2009-2011
9 * {@link http://www.websharks-inc.com/ WebSharks, Inc.}
10 * ( coded in the USA )
11 *
12 * Released under the terms of the GNU General Public License.
13 * You should have received a copy of the GNU General Public License,
14 * along with this software. In the main directory, see: /licensing/
15 * If not, see: {@link http://www.gnu.org/licenses/}.
16 *
17 * @package s2Member
18 * @since 3.0
19 */
20 if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
21 exit ("Do not access this file directly.");
22 /*
23 Determine the directory.
24 */
25 $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir"] = dirname (dirname (__FILE__));
26 /*
27 Determine the base directory name.
28 */
29 $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_base"] = basename (dirname (dirname (__FILE__)));
30 /*
31 Determine the full URL to the directory this plugin resides in.
32 */
33 $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] = (stripos (__FILE__, WP_CONTENT_DIR) !== 0) ? /* Have to assume plugins dir? */
34 plugins_url ("/" . basename (dirname (dirname (__FILE__)))) : /* Otherwise, this gives it a chance to live anywhere in the content dir. */
35 content_url (preg_replace ("/^(.*?)\/" . preg_quote (basename (WP_CONTENT_DIR), "/") . "/", "", str_replace (DIRECTORY_SEPARATOR, "/", dirname (dirname (__FILE__)))));
36 /*
37 Determine full URL to the s2Member-only file that loads WordPress® with only s2Member active.
38 */
39 $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["s2o_url"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/" . preg_replace ("/\.php$/", "-o.php", basename ($GLOBALS["WS_PLUGIN__"]["s2member"]["l"]));
40 /*
41 Configure the number of Membership Levels being used with s2Member. This is NOT ready ( yet ). Some areas of s2Member are still hard-coded at 4 Levels + Subscribers.
42 */
43 $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"] = 4; /* Hard coded in at 4 Levels. This can only be extended when/if s2Member Pro is installed. */
44 $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["min_levels"] = 1; /* A lower limit to protect the integrity of the s2Member software application. */
45 $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["max_levels"] = apply_filters ("ws_plugin__s2member_max_levels", 100); /* Filterable. */
46 /*
47 Configure regular expression matches for Membership Access Item Numbers ( including those with only Custom Capabilities ).
48 */
49 $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_w_level_regex"] = "/^([1-9][0-9]*)(?:(?:\:((?:-all\+|\+-all|-all|\+)?[a-z_0-9,\+]*)?)?(?:\:([0-9]+ [A-Z])?)?)?$/";
50 $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_wo_level_regex"] = "/^(\*)(?:(?:\:((?:-all\+|\+-all|-all|\+)?[a-z_0-9,\+]*)?)?(?:\:([0-9]+ [A-Z])?)?)?$/";
51 $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_w_or_wo_level_regex"] = "/^([1-9][0-9]*|\*)(?:(?:\:((?:-all\+|\+-all|-all|\+)?[a-z_0-9,\+]*)?)?(?:\:([0-9]+ [A-Z])?)?)?$/";
52 /*
53 Configure regular expression match for Specific Post/Page Access Item Numbers ( all elements required here ).
54 */
55 $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["sp_access_item_number_regex"] = "/^(sp)(?:(?:\:([1-9][0-9,]*))(?:\:([1-9][0-9]*)))$/";
56 /*
57 Configure multibyte detection order when charset is unknown ( used by calls to `mb_convert_encoding()` ).
58 */
59 $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["mb_detection_order"] = "UTF-8, ISO-8859-1, WINDOWS-1252, ASCII, JIS, EUC-JP, SJIS";
60 /*
61 Configure directory and .htaccess for files protected by s2Member.
62 */
63 $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"] = apply_filters ("ws_plugin__s2member_files_dir", dirname (dirname (__FILE__)) . "-files" . ((stripos (PHP_OS, "win") === 0 && (!function_exists ("apache_get_version") || apache_get_version () === false)) ? "/app_data" : ""));
64 $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir_htaccess"] = dirname (__FILE__) . "/templates/cfg-files/s2member-files.php";
65 /*
66 Configure the directory for logs protected by s2Member.
67 */
68 $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"] = apply_filters ("ws_plugin__s2member_logs_dir", dirname (dirname (__FILE__)) . "-logs" . ((stripos (PHP_OS, "win") === 0 && (!function_exists ("apache_get_version") || apache_get_version () === false)) ? "/app_data" : ""));
69 $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir_htaccess"] = dirname (__FILE__) . "/templates/cfg-files/s2member-logs.php";
70 /*
71 Configure the global reCaptcha for ( www.s2-all-domains.com ). These public/private keys work on any installation.
72 */
73 $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["recaptcha"] = array ("public_key" => "6LdxxcESAAAAANL7vrhz2glFIhmLGY58hXOhGkE0", "private_key" => "6LdxxcESAAAAAOlXATQTR75735n0eSIcOnp4GeNd", "lang" => _x ("en", "s2member-front recaptcha-lang-code", "s2member"));
74 /*
75 Configure the right menu options panel for s2Member.
76 */
77 $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"] = array ("mlist" => true, "upsell-pro" => true, "installation" => false, "tools" => false, "videos" => true, "support" => true, "donations" => true);
78 /*
79 Check if s2Member has been configured *should be set after the first config via options panel*.
80 */
81 $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["configured"] = get_option ("ws_plugin__s2member_configured");
82 /*
83 This is a special option cache that holds some additional information autoloaded into WordPress®.
84 */
85 $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"] = get_option ("ws_plugin__s2member_cache");
86 /*
87 Configure checksum time for the syscon.inc.php file.
88 */
89 $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["checksum"] = filemtime (__FILE__);
90 /*
91 Configure an array of pluggable functions handled by s2Member.
92 */
93 $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["pluggables"] = array ();
94 /*
95 Configure & validate all of the s2Member options; and set their defaults.
96 */
97 if (!function_exists ("ws_plugin__s2member_configure_options_and_their_defaults"))
98 {
99 /**
100 * Configures an options array for the s2Member plugin.
101 *
102 * **WARNING:** This is a system configuration function, please DO NOT EDIT this function directly.
103 * Instead, use the plugin options panel in WordPress® to override these settings.
104 *
105 * @package s2Member
106 * @since 3.0
107 *
108 * @param array $options Optional. An array of new options, to be merged with the defaults.
109 * @return array This merged array of options: ``$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]``
110 */
111 function ws_plugin__s2member_configure_options_and_their_defaults ($options = FALSE)
112 {
113 global $current_site, $current_blog;
114 /**/
115 $default_options["options_checksum"] = "";
116 $default_options["options_version"] = "1.0";
117 /**/
118 $default_options["gateway_debug_logs"] = "0";
119 /**/
120 $default_options["sec_encryption_key"] = "";
121 $default_options["sec_encryption_key_history"] = array ();
122 $default_options["s_badge_status_enabled"] = "0";
123 /**/
124 $default_options["max_ip_restriction"] = "5";
125 $default_options["max_ip_restriction_time"] = "3600";
126 $default_options["max_failed_login_attempts"] = "5";
127 /**/
128 $default_options["run_deactivation_routines"] = "0";
129 /**/
130 $default_options["custom_reg_fields"] = "";
131 $default_options["custom_reg_names"] = "1";
132 $default_options["custom_reg_display_name"] = "full";
133 $default_options["custom_reg_password"] = "0";
134 /**/
135 $default_options["custom_reg_opt_in"] = "1";
136 $default_options["custom_reg_opt_in_label"] = _x ("Yes, I want to receive updates via email.", "s2member-front", "s2member");
137 /**/
138 $default_options["custom_reg_auto_opt_outs"] = array ();
139 $default_options["custom_reg_auto_opt_out_transitions"] = "0";
140 /**/
141 $default_options["custom_reg_fields_4bp"] = array ();
142 $default_options["custom_reg_force_personal_emails"] = "";
143 /**/
144 $default_options["allow_subscribers_in"] = "0";
145 $default_options["force_admin_lockouts"] = "0";
146 $default_options["filter_wp_query"] = array ();
147 /**/
148 $default_options["mms_auto_patch"] = "1";
149 $default_options["mms_registration_file"] = "wp-login";
150 $default_options["mms_registration_grants"] = "none";
151 for ($n = 0, $v = 0; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++, $v = $v + 5)
152 $default_options["mms_registration_blogs_level" . $n] = (string)$v;
153 /**/
154 $default_options["login_welcome_page"] = "";
155 $default_options["login_redirection_override"] = "";
156 $default_options["membership_options_page"] = "";
157 /**/
158 $default_options["login_reg_background_color"] = "FFFFFF";
159 $default_options["login_reg_background_image"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images/bg.png";
160 $default_options["login_reg_background_image_repeat"] = "repeat";
161 /**/
162 $default_options["login_reg_background_text_color"] = "000000";
163 $default_options["login_reg_background_text_shadow_color"] = "EEEEEE";
164 $default_options["login_reg_background_box_shadow_color"] = "EEEEEE";
165 /**/
166 $default_options["login_reg_logo_src"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images/logo.png";
167 $default_options["login_reg_logo_src_width"] = "550";
168 $default_options["login_reg_logo_src_height"] = "100";
169 $default_options["login_reg_logo_url"] = home_url ("/");
170 $default_options["login_reg_logo_title"] = get_bloginfo ("name");
171 /**/
172 $default_options["login_reg_font_size"] = "12px";
173 $default_options["login_reg_font_family"] = "'Verdana', 'Arial', sans-serif";
174 $default_options["login_reg_font_field_size"] = "18px";
175 /**/
176 $default_options["login_reg_footer_design"] = "";
177 /**/
178 $default_options["reg_email_from_name"] = get_bloginfo ("name");
179 $default_options["reg_email_from_email"] = get_bloginfo ("admin_email");
180 $default_options["reg_email_support_link"] = "mailto:" . get_bloginfo ("admin_email");
181 /**/
182 $default_options["new_user_emails_enabled"] = "0";
183 /**/
184 $default_options["new_user_email_subject"] = sprintf (_x ("[%s] Username/Password", "s2member-front", "s2member"), get_bloginfo ("name"));
185 $default_options["new_user_email_message"] = sprintf (_x ("Your Username/Password for:\n%s\n\nUsername: %%user_login%%\nPassword: %%user_pass%%\n%%wp_login_url%%", "s2member-front", "s2member"), get_bloginfo ("name"));
186 /**/
187 $default_options["new_user_admin_email_recipients"] = get_bloginfo ("admin_email");
188 $default_options["new_user_admin_email_subject"] = sprintf (_x ("[%s] New User Registration", "s2member-front", "s2member"), get_bloginfo ("name"));
189 $default_options["new_user_admin_email_message"] = sprintf (_x ("New User Registration on your site:\n%s\n\nUser ID: %%user_id%%\nUsername: %%user_login%%\nEmail: %%user_email%%\nIP Address: %%user_ip%%", "s2member-front", "s2member"), get_bloginfo ("name"));
190 /**/
191 $default_options["paypal_sandbox"] = "0";
192 $default_options["paypal_business"] = "";
193 $default_options["paypal_api_username"] = "";
194 $default_options["paypal_api_password"] = "";
195 $default_options["paypal_api_signature"] = "";
196 $default_options["paypal_identity_token"] = "";
197 $default_options["paypal_btn_encryption"] = "0";
198 /**/
199 $default_options["signup_tracking_codes"] = "";
200 $default_options["modification_tracking_codes"] = "";
201 $default_options["ccap_tracking_codes"] = "";
202 $default_options["sp_tracking_codes"] = "";
203 /**/
204 $default_options["signup_email_recipients"] = '"%%full_name%%" <%%payer_email%%>';
205 $default_options["signup_email_subject"] = _x ("Congratulations! ( your membership has been approved )", "s2member-front", "s2member");
206 $default_options["signup_email_message"] = sprintf (_x ("Thanks %%first_name%%! Your membership has been approved.\n\nIf you haven't already done so, the next step is to Register a Username.\n\nComplete your registration here:\n%%registration_url%%\n\nIf you have any trouble, please feel free to contact us.\n\nBest Regards,\n%s", "s2member-front", "s2member"), get_bloginfo ("name"));
207 /**/
208 $default_options["sp_email_recipients"] = '"%%full_name%%" <%%payer_email%%>';
209 $default_options["sp_email_subject"] = _x ("Thank You! ( instructions for access )", "s2member-front", "s2member");
210 $default_options["sp_email_message"] = sprintf (_x ("Thanks %%first_name%%!\n\n%%item_name%%\n\nYour order can be retrieved here:\n%%sp_access_url%%\n( link expires in %%sp_access_exp%% )\n\nIf you have any trouble, please feel free to contact us.\n\nBest Regards,\n%s", "s2member-front", "s2member"), get_bloginfo ("name"));
211 /**/
212 $default_options["mailchimp_api_key"] = "";
213 /**/
214 for ($n = 0; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++)
215 $default_options["level" . $n . "_mailchimp_list_ids"] = "";
216 /**/
217 for ($n = 0; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++)
218 $default_options["level" . $n . "_aweber_list_ids"] = "";
219 /**/
220 $default_options["signup_notification_urls"] = "";
221 $default_options["registration_notification_urls"] = "";
222 $default_options["payment_notification_urls"] = "";
223 $default_options["modification_notification_urls"] = "";
224 $default_options["cancellation_notification_urls"] = "";
225 $default_options["eot_del_notification_urls"] = "";
226 $default_options["ref_rev_notification_urls"] = "";
227 $default_options["sp_sale_notification_urls"] = "";
228 $default_options["sp_ref_rev_notification_urls"] = "";
229 /**/
230 $default_options["signup_notification_recipients"] = "";
231 $default_options["registration_notification_recipients"] = "";
232 $default_options["payment_notification_recipients"] = "";
233 $default_options["modification_notification_recipients"] = "";
234 $default_options["cancellation_notification_recipients"] = "";
235 $default_options["eot_del_notification_recipients"] = "";
236 $default_options["ref_rev_notification_recipients"] = "";
237 $default_options["sp_sale_notification_recipients"] = "";
238 $default_options["sp_ref_rev_notification_recipients"] = "";
239 /**/
240 for ($n = 0, $l = array (_x ("Free Subscriber", "s2member-front", "s2member"), _x ("Bronze Member", "s2member-front", "s2member"), _x ("Silver Member", "s2member-front", "s2member"), _x ("Gold Member", "s2member-front", "s2member"), _x ("Platinum Member", "s2member-front", "s2member")); $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++)
241 $default_options["level" . $n . "_label"] = (!empty ($l[$n])) ? $l[$n] : sprintf (_x ("Level %s Member", "s2member-front", "s2member"), $n);
242 /**/
243 $default_options["apply_label_translations"] = "0";
244 /**/
245 for ($n = 0; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++)
246 $default_options["level" . $n . "_file_downloads_allowed"] = "";
247 /**/
248 for ($n = 0; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++)
249 $default_options["level" . $n . "_file_downloads_allowed_days"] = "";
250 /**/
251 $default_options["file_download_limit_exceeded_page"] = "";
252 $default_options["file_download_inline_extensions"] = "";
253 /**/
254 $default_options["amazon_s3_files_bucket"] = "";
255 $default_options["amazon_s3_files_access_key"] = "";
256 $default_options["amazon_s3_files_secret_key"] = "";
257 /**/
258 for ($n = 0; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++)
259 $default_options["level" . $n . "_ruris"] = "";
260 /**/
261 for ($n = 0; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++)
262 $default_options["level" . $n . "_catgs"] = "";
263 /**/
264 for ($n = 0; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++)
265 $default_options["level" . $n . "_ptags"] = "";
266 /**/
267 for ($n = 0; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++)
268 $default_options["level" . $n . "_posts"] = "";
269 /**/
270 for ($n = 0; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++)
271 $default_options["level" . $n . "_pages"] = "";
272 /**/
273 $default_options["specific_ids"] = "";
274 /**/
275 $default_options["triggers_immediate_eot"] = "refunds,reversals";
276 $default_options["membership_eot_behavior"] = "demote";
277 $default_options["eot_time_ext_behavior"] = "extend";
278 $default_options["auto_eot_system_enabled"] = "1";
279 /**/
280 $default_options["wp_footer_code"] = "";
281 /**/
282 $default_options = apply_filters ("ws_plugin__s2member_default_options", $default_options);
283 /**/
284 unset ($n, $v, $l); /* Unset/cleanup these working variables from the routines above. */
285 /*
286 Here they are merged. User options will overwrite some or all default values.
287 */
288 $GLOBALS["WS_PLUGIN__"]["s2member"]["o"] = array_merge ($default_options, (($options !== false) ? (array)$options : (array)get_option ("ws_plugin__s2member_options")));
289 /**/
290 /* Back compatibility for `filter_wp_query`. Changed in v110912 to array. */
291 if (is_string ($_ov = &$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["filter_wp_query"]))
292 $_ov = (!$_ov || $_ov === "none") ? $default_options["filter_wp_query"] : array_unique (preg_split ("/[;,\r\n\t\s ]+/", $_ov));
293 /**/
294 /* Backward compatibility for old logo image width of 500 pixels. Changed in v110604. */
295 if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_logo_src"] === $default_options["login_reg_logo_src"])
296 $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_logo_src_width"] = $default_options["login_reg_logo_src_width"];
297 /**/
298 /* Backward compatibility for PayPal® API Credentials. Starting with v3.5+, this info is stored by the free version of s2Member. */
299 if (empty ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_api_username"]) && !empty ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_paypal_api_username"]))
300 $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_api_username"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_paypal_api_username"];
301 /**/
302 if (empty ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_api_password"]) && !empty ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_paypal_api_password"]))
303 $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_api_password"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_paypal_api_password"];
304 /**/
305 if (empty ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_api_signature"]) && !empty ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_paypal_api_signature"]))
306 $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_api_signature"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_paypal_api_signature"];
307 /*
308 This builds an MD5 checksum for the full array of options. This also includes the config checksum and the current set of default options.
309 */
310 $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))));
311 /*
312 Validate each option, possibly reverting back to the default value in some cases. This is only processed when/if the checksum is not up-to-date.
313 */
314 if ($options !== false || ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["options_checksum"] !== $checksum && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"] !== $default_options))
315 {
316 foreach ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"] as $key => &$value)
317 {
318 if (!isset ($default_options[$key]) && !preg_match ("/^pro_/", $key))
319 unset ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"][$key]);
320 /**/
321 else if ($key === "options_checksum" && (!is_string ($value) || !strlen ($value)))
322 $value = $default_options[$key];
323 /**/
324 else if ($key === "options_version" && (!is_string ($value) || !is_numeric ($value)))
325 $value = $default_options[$key];
326 /**/
327 else if ($key === "gateway_debug_logs" && (!is_string ($value) || !is_numeric ($value)))
328 $value = $default_options[$key];
329 /**/
330 else if ($key === "sec_encryption_key" && (!is_string ($value) || !strlen ($value)))
331 $value = $default_options[$key];
332 /**/
333 else if ($key === "sec_encryption_key_history" && (!is_array ($value) || empty ($value)))
334 $value = $default_options[$key];
335 /**/
336 else if ($key === "s_badge_status_enabled" && (!is_string ($value) || !is_numeric ($value)))
337 $value = $default_options[$key];
338 /**/
339 else if ($key === "max_ip_restriction" && (!is_string ($value) || !is_numeric ($value) || $value < 0 || $value > 100))
340 $value = $default_options[$key];
341 /**/
342 else if ($key === "max_ip_restriction_time" && (!is_string ($value) || !is_numeric ($value) || $value < 900 || $value > 31556926))
343 $value = $default_options[$key];
344 /**/
345 else if ($key === "max_failed_login_attempts" && (!is_string ($value) || !is_numeric ($value) || $value < 0 || $value > 100))
346 $value = $default_options[$key];
347 /**/
348 else if ($key === "run_deactivation_routines" && (!is_string ($value) || !is_numeric ($value)))
349 $value = $default_options[$key];
350 /**/
351 else if ($key === "custom_reg_fields" && (!is_string ($value) || !strlen ($value)))
352 $value = $default_options[$key];
353 /**/
354 else if (preg_match ("/^custom_reg_(names|password|opt_in|auto_opt_out_transitions)$/", $key) && (!is_string ($value) || !is_numeric ($value)))
355 $value = $default_options[$key];
356 /**/
357 else if ($key === "custom_reg_display_name" && (!is_string ($value) || !preg_match ("/^(full|first|last|login|0)$/", $value)))
358 $value = $default_options[$key];
359 /**/
360 else if ($key === "custom_reg_opt_in_label" && (!is_string ($value) || !strlen ($value)))
361 $value = $default_options[$key];
362 /**/
363 else if ($key === "custom_reg_auto_opt_outs" && (!is_array ($value) || empty ($value)))
364 $value = $default_options[$key];
365 /**/
366 else if ($key === "custom_reg_fields_4bp" && (!is_array ($value) || empty ($value)))
367 $value = $default_options[$key];
368 /**/
369 else if ($key === "custom_reg_force_personal_emails" && (!is_string ($value) || !strlen ($value = preg_replace ("/\s+/", "", $value))))
370 $value = $default_options[$key];
371 /**/
372 else if ($key === "allow_subscribers_in" && (!is_string ($value) || !is_numeric ($value)))
373 $value = $default_options[$key];
374 /**/
375 else if ($key === "mms_auto_patch" && (!is_string ($value) || !is_numeric ($value)))
376 $value = $default_options[$key];
377 /**/
378 else if ($key === "mms_registration_file" && (!is_string ($value) || !preg_match ("/^(wp-login|wp-signup)$/", $value)))
379 $value = $default_options[$key];
380 /**/
381 else if ($key === "mms_registration_grants" && (!is_string ($value) || !preg_match ("/^(none|user|all)$/", $value)))
382 $value = $default_options[$key];
383 /**/
384 else if (preg_match ("/^mms_registration_blogs_level[0-9]+$/", $key) && (!is_string ($value) || !is_numeric ($value) || $value < 0))
385 $value = $default_options[$key];
386 /**/
387 else if ($key === "force_admin_lockouts" && (!is_string ($value) || !is_numeric ($value)))
388 $value = $default_options[$key];
389 /**/
390 else if ($key === "filter_wp_query" && !is_array ($value)) /* Array CAN be empty. */
391 $value = $default_options[$key];
392 /**/
393 else if ($key === "login_welcome_page" && (!is_string ($value) || !is_numeric ($value)))
394 $value = $default_options[$key];
395 /**/
396 else if ($key === "login_redirection_override" && (!is_string ($value) || !strlen ($value)))
397 $value = $default_options[$key];
398 /**/
399 else if ($key === "membership_options_page" && (!is_string ($value) || !is_numeric ($value)))
400 $value = $default_options[$key];
401 /**/
402 else if ($key === "login_reg_background_image" && !is_string ($value)) /* This is optional. */
403 $value = $default_options[$key];
404 /**/
405 else if ($key === "login_reg_background_image_repeat" && (!is_string ($value) || !preg_match ("/^(repeat|repeat-x|repeat-y|no-repeat)$/", $value)))
406 $value = $default_options[$key];
407 /**/
408 else if (preg_match ("/^login_reg_(background|logo|font|footer)_/", $key) && !preg_match ("/background_image/", $key) && (!is_string ($value) || !strlen ($value)))
409 $value = $default_options[$key];
410 /**/
411 else if (preg_match ("/^reg_email_(from_name|from_email|support_link)$/", $key) && (!is_string ($value) || !strlen ($value)))
412 $value = $default_options[$key];
413 /**/
414 else if ($key === "new_user_emails_enabled" && (!is_string ($value) || !is_numeric ($value)))
415 $value = $default_options[$key];
416 /**/
417 else if (preg_match ("/^new_user_email_(subject|message)$/", $key) && (!is_string ($value) || !strlen ($value)))
418 $value = $default_options[$key];
419 /**/
420 else if (preg_match ("/^new_user_admin_email_(recipients|subject|message)$/", $key) && (!is_string ($value) || !strlen ($value)))
421 $value = $default_options[$key];
422 /**/
423 else if ($key === "paypal_sandbox" && (!is_string ($value) || !is_numeric ($value)))
424 $value = $default_options[$key];
425 /**/
426 else if (preg_match ("/^paypal_(business|api_username|api_password|api_signature|identity_token)$/", $key) && (!is_string ($value) || !strlen ($value)))
427 $value = $default_options[$key];
428 /**/
429 else if ($key === "paypal_btn_encryption" && (!is_string ($value) || !is_numeric ($value)))
430 $value = $default_options[$key];
431 /**/
432 else if (preg_match ("/^(signup|modification|ccap|sp)_tracking_codes$/", $key) && (!is_string ($value) || !strlen ($value)))
433 $value = $default_options[$key];
434 /**/
435 else if (preg_match ("/^(signup|sp)_email_recipients$/", $key) && !is_string ($value)) /* Can be empty. */
436 $value = $default_options[$key];
437 /**/
438 else if (preg_match ("/^(signup|sp)_email_(subject|message)$/", $key) && (!is_string ($value) || !strlen ($value)))
439 $value = $default_options[$key];
440 /**/
441 else if ($key === "mailchimp_api_key" && (!is_string ($value) || !strlen ($value)))
442 $value = $default_options[$key];
443 /**/
444 else if (preg_match ("/^level[0-9]+_mailchimp_list_ids$/", $key) && (!is_string ($value) || !strlen ($value = preg_replace ("/[\r\n\t]+/", "", $value))))
445 $value = $default_options[$key];
446 /**/
447 else if (preg_match ("/^level[0-9]+_aweber_list_ids$/", $key) && (!is_string ($value) || !strlen ($value = preg_replace ("/\s+/", "", $value))))
448 $value = $default_options[$key];
449 /**/
450 else if (preg_match ("/^(signup|registration|payment|modification|cancellation|eot_del|ref_rev|sp_sale|sp_ref_rev)_notification_urls$/", $key) && (!is_string ($value) || !strlen ($value)))
451 $value = $default_options[$key];
452 /**/
453 else if (preg_match ("/^(signup|registration|payment|modification|cancellation|eot_del|ref_rev|sp_sale|sp_ref_rev)_notification_recipients$/", $key) && (!is_string ($value) || !strlen ($value)))
454 $value = $default_options[$key];
455 /**/
456 else if (preg_match ("/^level[0-9]+_label$/", $key) && (!is_string ($value) || !strlen ($value)))
457 $value = $default_options[$key];
458 /**/
459 else if ($key === "apply_label_translations" && (!is_string ($value) || !is_numeric ($value)))
460 $value = $default_options[$key];
461 /**/
462 else if (preg_match ("/^level[0-9]+_file_downloads_allowed$/", $key) && (!is_string ($value) || !is_numeric ($value) || $value < 0))
463 $value = $default_options[$key];
464 /**/
465 else if (preg_match ("/^level[0-9]+_file_downloads_allowed_days$/", $key) && (!is_string ($value) || !is_numeric ($value) || $value < 0))
466 $value = $default_options[$key];
467 /**/
468 else if ($key === "file_download_limit_exceeded_page" && (!is_string ($value) || !is_numeric ($value)))
469 $value = $default_options[$key];
470 /**/
471 else if ($key === "file_download_inline_extensions" && (!is_string ($value) || !($value = strtolower (preg_replace ("/\s+/", "", $value)))))
472 $value = $default_options[$key];
473 /**/
474 else if (preg_match ("/^amazon_s3_files_(bucket|access_key|secret_key)$/", $key) && (!is_string ($value) || !strlen ($value)))
475 $value = $default_options[$key];
476 /**/
477 else if (preg_match ("/^level[0-9]+_ruris$/", $key) && (!is_string ($value) || !strlen ($value)))
478 $value = $default_options[$key];
479 /**/
480 else if (preg_match ("/^level[0-9]+_catgs$/", $key) && (!is_string ($value) || !($value = (($value === "all") ? $value : trim (preg_replace ("/[^0-9,]/", "", $value), ",")))))
481 $value = $default_options[$key];
482 /**/
483 else if (preg_match ("/^level[0-9]+_ptags$/", $key) && (!is_string ($value) || !($value = (($value === "all") ? $value : trim (preg_replace ("/( +)/", " ", trim (preg_replace ("/( *),( *)/", ",", $value))), ",")))))
484 $value = $default_options[$key];
485 /**/
486 else if (preg_match ("/^level[0-9]+_posts$/", $key) && (!is_string ($value) || !($value = (($value === "all") ? $value : trim (preg_replace ("/[^0-9,]/", "", $value), ",")))))
487 $value = $default_options[$key];
488 /**/
489 else if (preg_match ("/^level[0-9]+_pages$/", $key) && (!is_string ($value) || !($value = (($value === "all") ? $value : trim (preg_replace ("/[^0-9,]/", "", $value), ",")))))
490 $value = $default_options[$key];
491 /**/
492 else if ($key === "specific_ids" && (!is_string ($value) || !($value = trim (preg_replace ("/[^0-9,]/", "", $value), ","))))
493 $value = $default_options[$key];
494 /**/
495 else if ($key === "triggers_immediate_eot" && (!is_string ($value) || !preg_match ("/^(none|refunds|reversals|refunds,reversals)$/", $value)))
496 $value = $default_options[$key];
497 /**/
498 else if ($key === "membership_eot_behavior" && (!is_string ($value) || !preg_match ("/^(demote|delete)$/", $value)))
499 $value = $default_options[$key];
500 /**/
501 else if ($key === "eot_time_ext_behavior" && (!is_string ($value) || !preg_match ("/^(extend|reset)$/", $value)))
502 $value = $default_options[$key];
503 /**/
504 else if ($key === "auto_eot_system_enabled" && (!is_string ($value) || !is_numeric ($value)))
505 $value = $default_options[$key];
506 /**/
507 else if ($key === "wp_footer_code" && (!is_string ($value) || !strlen ($value)))
508 $value = $default_options[$key];
509 }
510 /**/
511 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"]))
512 {
513 array_unshift ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sec_encryption_key_history"], $options["sec_encryption_key"]);
514 $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sec_encryption_key_history"] = array_slice ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sec_encryption_key_history"], 0, 10);
515 }
516 /**/
517 $GLOBALS["WS_PLUGIN__"]["s2member"]["o"] = apply_filters_ref_array ("ws_plugin__s2member_options_before_checksum", array (&$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]));
518 /**/
519 $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["options_checksum"] = md5 ($checksum_prefix . serialize (array_merge ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"], array ("options_checksum" => 0))));
520 }
521 /**/
522 return apply_filters_ref_array ("ws_plugin__s2member_options", array (&$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]));
523 }
524 }
525 ?>