| 1 |
<?php |
| 2 |
// @codingStandardsIgnoreFile |
| 3 |
/** |
| 4 |
* System configuration for the s2Member plugin. |
| 5 |
* |
| 6 |
* **WARNING:** This is a system configuration file, please DO NOT EDIT this file directly. |
| 7 |
* Instead, use the plugin options panel in WordPress to override these settings. |
| 8 |
* |
| 9 |
* Copyright: © 2009-2011 |
| 10 |
* {@link http://websharks-inc.com/ WebSharks, Inc.} |
| 11 |
* (coded in the USA) |
| 12 |
* |
| 13 |
* Released under the terms of the GNU General Public License. |
| 14 |
* You should have received a copy of the GNU General Public License, |
| 15 |
* along with this software. In the main directory, see: /licensing/ |
| 16 |
* If not, see: {@link http://www.gnu.org/licenses/}. |
| 17 |
* |
| 18 |
* @package s2Member |
| 19 |
* @since 3.0 |
| 20 |
*/ |
| 21 |
if(!defined('WPINC')) // MUST have WordPress. |
| 22 |
exit('Do not access this file directly.'); |
| 23 |
/* |
| 24 |
Determine the directory. |
| 25 |
*/ |
| 26 |
$GLOBALS['WS_PLUGIN__']['s2member']['c']['dir'] = dirname(dirname(dirname(__FILE__))); |
| 27 |
/* |
| 28 |
Determine the base directory name. |
| 29 |
*/ |
| 30 |
$GLOBALS['WS_PLUGIN__']['s2member']['c']['dir_base'] = basename(dirname(dirname(dirname(__FILE__)))); |
| 31 |
/* |
| 32 |
Determine the full URL to the directory this plugin resides in. |
| 33 |
*/ |
| 34 |
$GLOBALS['WS_PLUGIN__']['s2member']['c']['dir_url'] = (stripos(__FILE__, WP_CONTENT_DIR) !== 0) ? // Have to assume plugins dir? |
| 35 |
plugins_url('/'.basename(dirname(dirname(dirname(__FILE__))))) : // Otherwise, this gives it a chance to live anywhere in the content dir. |
| 36 |
content_url(preg_replace('/^(.*?)\/'.preg_quote(basename(WP_CONTENT_DIR), '/').'/', '', str_replace(DIRECTORY_SEPARATOR, '/', dirname(dirname(dirname(__FILE__)))))); |
| 37 |
/* |
| 38 |
Determine full URL to the s2Member-only file that loads WordPress with only s2Member active. |
| 39 |
*/ |
| 40 |
$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'])); |
| 41 |
/* |
| 42 |
Determine correct ``plugin_basename()`` here. WordPress has a few issues with its ``plugin_basename()`` function across different platforms. |
| 43 |
*/ |
| 44 |
$GLOBALS['WS_PLUGIN__']['s2member']['c']['plugin_basename'] = basename(dirname($GLOBALS['WS_PLUGIN__']['s2member']['l'])).'/'.basename($GLOBALS['WS_PLUGIN__']['s2member']['l']); |
| 45 |
/* |
| 46 |
Configure the number of Membership Levels being used with s2Member. This is now possible. All areas of s2Member are now capable of adapting to this. |
| 47 |
*/ |
| 48 |
$GLOBALS['WS_PLUGIN__']['s2member']['c']['levels'] = 4; // Hard coded in at 4 Levels. This can only be extended when/if s2Member Pro is installed. |
| 49 |
$GLOBALS['WS_PLUGIN__']['s2member']['c']['min_levels'] = 1; // A lower limit to protect the integrity of the s2Member software application. |
| 50 |
$GLOBALS['WS_PLUGIN__']['s2member']['c']['max_levels'] = apply_filters('ws_plugin__s2member_max_levels', 100); // Filterable. |
| 51 |
/* |
| 52 |
Configure regular expression matches for Membership Access Item Numbers (including those with only Custom Capabilities). |
| 53 |
*/ |
| 54 |
$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])?)?)?$/'; |
| 55 |
$GLOBALS['WS_PLUGIN__']['s2member']['c']['membership_item_number_wo_level_regex'] = '/^(\*)(?:(?:\:((?:-all\+|\+-all|-all|\+)?[a-z_0-9,\+]*)?)?(?:\:([0-9]+ [A-Z])?)?)?$/'; |
| 56 |
$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])?)?)?$/'; |
| 57 |
/* |
| 58 |
Configure regular expression match for Specific Post/Page Access Item Numbers (all elements required here). |
| 59 |
*/ |
| 60 |
$GLOBALS['WS_PLUGIN__']['s2member']['c']['sp_access_item_number_regex'] = '/^(sp)(?:(?:\:([1-9][0-9,]*))(?:\:([1-9][0-9]*)))$/'; |
| 61 |
/* |
| 62 |
Configure multibyte detection order when charset is unknown ( used by calls to `mb_convert_encoding()` ). |
| 63 |
*/ |
| 64 |
$GLOBALS['WS_PLUGIN__']['s2member']['c']['mb_detection_order'] = 'UTF-8, ISO-8859-1, WINDOWS-1252, ASCII, JIS, EUC-JP, SJIS'; |
| 65 |
/* |
| 66 |
Configure an array of file extensions associated with streaming media file types. See: <http://www.spartanicus.utvinternet.ie/streaming.htm> Also see: <http://www.longtailvideo.com/support/jw-player/jw-player-for-flash-v5/12539/supported-video-and-audio-formats> |
| 67 |
*/ |
| 68 |
$GLOBALS['WS_PLUGIN__']['s2member']['c']['streaming_file_extns'] = array_unique(array('avi', 'wav', 'mpa', 'mpeg', 'mpv', 'mps', 'm1v', 'm2v', 'mp4', 'mp3', 'm3u', 'mp4', 'flv', 'f4v', '3gp', '3g2', 'aac', 'm4a', 'webm', 'ogg', 'ogv', 'pls', 'm3u', 'ogm', 'm4u', 'mov', 'qtl', 'mp4', 'asf', 'wmv', 'wvx', 'wma', 'wax', 'ra', 'rm', 'ram')); |
| 69 |
/* |
| 70 |
Configure directory and .htaccess for files protected by s2Member. |
| 71 |
*/ |
| 72 |
$GLOBALS['WS_PLUGIN__']['s2member']['c']['default_files_dir'] = dirname(dirname(dirname(__FILE__))).'-files'.((stripos(PHP_OS, 'win') === 0 && stripos($_SERVER['SERVER_SOFTWARE'], 'apache') === FALSE) ? '/app_data' : ''); |
| 73 |
$GLOBALS['WS_PLUGIN__']['s2member']['c']['files_dir'] = apply_filters('ws_plugin__s2member_files_dir', $GLOBALS['WS_PLUGIN__']['s2member']['c']['default_files_dir']); |
| 74 |
$GLOBALS['WS_PLUGIN__']['s2member']['c']['files_no_gzip_htaccess'] = dirname(__FILE__).'/templates/cfg-files/s2member-files-no-gzip.php'; |
| 75 |
$GLOBALS['WS_PLUGIN__']['s2member']['c']['files_dir_htaccess'] = dirname(__FILE__).'/templates/cfg-files/s2member-files.php'; |
| 76 |
/* |
| 77 |
Configure the directory for logs protected by s2Member. |
| 78 |
*/ |
| 79 |
$GLOBALS['WS_PLUGIN__']['s2member']['c']['default_logs_dir'] = dirname(dirname(dirname(__FILE__))).'-logs'.((stripos(PHP_OS, 'win') === 0 && stripos($_SERVER['SERVER_SOFTWARE'], 'apache') === FALSE) ? '/app_data' : ''); |
| 80 |
$GLOBALS['WS_PLUGIN__']['s2member']['c']['logs_dir'] = apply_filters('ws_plugin__s2member_logs_dir', $GLOBALS['WS_PLUGIN__']['s2member']['c']['default_logs_dir']); |
| 81 |
$GLOBALS['WS_PLUGIN__']['s2member']['c']['logs_dir_htaccess'] = dirname(__FILE__).'/templates/cfg-files/s2member-logs.php'; |
| 82 |
/* |
| 83 |
Configure the global reCaptcha (www.websharks-inc.net / or any domain). These public/private keys work on any installation. |
| 84 |
*/ |
| 85 |
$GLOBALS['WS_PLUGIN__']['s2member']['c']['recaptcha'] = array('public_key' => '6LeCANsSAAAAAIIrlB3FrXe42mr0OSSZpT0pkpFK', 'private_key' => '6LeCANsSAAAAAGBXMIKAirv6G4PmaGa-ORxdD-oZ', 'lang' => 'en'); |
| 86 |
/* |
| 87 |
Configure the right menu options panel for s2Member. |
| 88 |
*/ |
| 89 |
$GLOBALS['WS_PLUGIN__']['s2member']['c']['menu_pages'] = array('updates' => TRUE, 'upsell-pro' => TRUE, 'installation' => FALSE, 'tools' => FALSE, 'kb' => TRUE, 'videos' => TRUE, 'support' => TRUE, 'donations' => TRUE, 'beta' => TRUE); |
| 90 |
/* |
| 91 |
Check if s2Member has been configured *should be set after the first config via options panel*. |
| 92 |
*/ |
| 93 |
$GLOBALS['WS_PLUGIN__']['s2member']['c']['configured'] = get_option('ws_plugin__s2member_configured'); |
| 94 |
/* |
| 95 |
This is a special option cache that holds some additional information autoloaded into WordPress. |
| 96 |
*/ |
| 97 |
$GLOBALS['WS_PLUGIN__']['s2member']['c']['cache'] = get_option('ws_plugin__s2member_cache'); |
| 98 |
/* |
| 99 |
Configure checksum time for the syscon.inc.php file. |
| 100 |
*/ |
| 101 |
$GLOBALS['WS_PLUGIN__']['s2member']['c']['checksum'] = filemtime(__FILE__); |
| 102 |
/* |
| 103 |
Configure an array of pluggable functions handled by s2Member. |
| 104 |
*/ |
| 105 |
$GLOBALS['WS_PLUGIN__']['s2member']['c']['pluggables'] = array(); |
| 106 |
/* |
| 107 |
Configure & validate all of the s2Member options; and set their defaults. |
| 108 |
*/ |
| 109 |
if(!function_exists('ws_plugin__s2member_configure_options_and_their_defaults')) |
| 110 |
{ |
| 111 |
/** |
| 112 |
* Configures an options array for the s2Member plugin. |
| 113 |
* |
| 114 |
* **WARNING:** This is a system configuration function, please DO NOT EDIT this function directly. |
| 115 |
* Instead, use the plugin options panel in WordPress to override these settings. |
| 116 |
* |
| 117 |
* @package s2Member |
| 118 |
* @since 3.0 |
| 119 |
* |
| 120 |
* @param boolean|array $options Optional. An array of new options, to be merged with the defaults. |
| 121 |
* |
| 122 |
* @return array This merged array of options: ``$GLOBALS['WS_PLUGIN__']['s2member']['o']`` |
| 123 |
*/ |
| 124 |
function ws_plugin__s2member_configure_options_and_their_defaults($options = FALSE) |
| 125 |
{ |
| 126 |
global $current_site, $current_blog; |
| 127 |
|
| 128 |
$default_options['options_checksum'] = ''; |
| 129 |
$default_options['options_version'] = '1.0'; |
| 130 |
|
| 131 |
$default_options['gateway_debug_logs'] = '0'; |
| 132 |
$default_options['gateway_debug_logs_extensive'] = '0'; |
| 133 |
|
| 134 |
$default_options['lazy_load_css_js'] = '0'; |
| 135 |
$default_options['static_css'] = '0'; //260903.0612 Generated static CSS delivery remains opt-in while frontend asset generation is beta. |
| 136 |
$default_options['static_css_minify'] = '0'; //260902.2107 Static CSS minification is independently opt-in while generated asset delivery is beta. |
| 137 |
$default_options['static_js'] = '0'; //260903.0437 Static frontend JavaScript delivery remains opt-in while generated assets are beta. |
| 138 |
$default_options['static_js_text'] = 'static'; //260906.2049 Keep JavaScript text in cacheable static files by default; multilingual sites can load it with each WordPress page instead. |
| 139 |
$default_options['static_js_minify'] = '0'; //260903.0437 Static JavaScript minification is independently opt-in and uses readable source files. |
| 140 |
$default_options['static_assets_combine'] = '0'; //260903.1918 Keep Framework/Pro generated files separate by default; combining is an explicit request-reduction optimization. |
| 141 |
$default_options['asset_health_wait_seconds'] = '3'; //260912.0522 Wait briefly after page load before treating an asset that cannot be confirmed active as Late. |
| 142 |
//260904.1923 Keep the repaired s2Member Dynamic Loader as the default; WordPress routing is an explicit compatibility option. |
| 143 |
$default_options['dynamic_asset_loader'] = 's2o'; //260910.0724 In current terminology, that established default is the s2Member-Only Dynamic Loader served by s2member-o.php. |
| 144 |
$default_options['no_cache_headers_mode'] = 'always'; //260308 No-cache headers mode: `always`, `selective`, `evaluative`. |
| 145 |
$default_options['no_cache_headers_debug'] = '0'; //260308 Adds Server-Timing no-cache debug header (support use only). |
| 146 |
$default_options['sc_conds_allow_arbitrary_php'] = '0'; |
| 147 |
$default_options['sc_conds_whitelist'] = ''; |
| 148 |
|
| 149 |
//260812 New shared whitelist; keep the old s2Get option synchronized temporarily for rollback compatibility. |
| 150 |
$default_options['sc_user_fields_whitelist'] = ''; |
| 151 |
$default_options['sc_s2get_userid_whitelist'] = ''; |
| 152 |
|
| 153 |
$default_options['sec_encryption_key'] = ''; |
| 154 |
$default_options['sec_encryption_key_history'] = array(); |
| 155 |
|
| 156 |
$default_options['def_combo_encryption_key'] = ''; |
| 157 |
$default_options['def_combo_encryption_key_history'] = array(); |
| 158 |
$default_options['def_custom_combo_encryption_keys'] = array(); |
| 159 |
|
| 160 |
//260809 Store new Defuse key mappings by one-way hashes instead of raw secret keys. |
| 161 |
$default_options['secret_key_to_defuse_key'] = array(); |
| 162 |
$default_options['secret_key_to_defuse_key_history'] = array(); |
| 163 |
$default_options['custom_secret_key_to_defuse_key'] = array(); |
| 164 |
|
| 165 |
$default_options['s_badge_status_enabled'] = '0'; |
| 166 |
|
| 167 |
$default_options['max_ip_restriction'] = '5'; |
| 168 |
$default_options['max_ip_restriction_time'] = '3600'; |
| 169 |
$default_options['max_failed_login_attempts'] = '5'; |
| 170 |
$default_options['max_simultaneous_logins'] = '0'; |
| 171 |
$default_options['max_simultaneous_logins_timeout'] = '30 minutes'; |
| 172 |
|
| 173 |
$default_options['run_uninstall_routines'] = '0'; |
| 174 |
|
| 175 |
$default_options['custom_reg_fields'] = ''; |
| 176 |
$default_options['custom_reg_names'] = '1'; |
| 177 |
$default_options['custom_reg_display_name'] = 'full'; |
| 178 |
$default_options['custom_reg_password'] = '0'; |
| 179 |
$default_options['custom_reg_password_min_length'] = '8'; // Minimum characters. |
| 180 |
$default_options['custom_reg_password_min_strength'] = 'good'; // `weak`, `good` or `strong`. |
| 181 |
|
| 182 |
$default_options['custom_reg_opt_in'] = '1'; |
| 183 |
$default_options['custom_reg_opt_in_label'] = 'Yes, I want to receive updates via email.'; |
| 184 |
|
| 185 |
$default_options['custom_reg_auto_opt_outs'] = array(); |
| 186 |
$default_options['custom_reg_auto_opt_out_transitions'] = '0'; |
| 187 |
|
| 188 |
$default_options['custom_reg_fields_4bp'] = array(); |
| 189 |
$default_options['custom_reg_force_personal_emails'] = ''; |
| 190 |
|
| 191 |
$default_options['allow_subscribers_in'] = '0'; |
| 192 |
$default_options['force_admin_lockouts'] = '0'; |
| 193 |
$default_options['filter_wp_query'] = array('all'); |
| 194 |
|
| 195 |
$default_options['default_url_shortener'] = 's2member'; //260612 |
| 196 |
$default_options['default_url_shortener_key'] = ''; |
| 197 |
$default_options['default_custom_str_url_shortener'] = ''; |
| 198 |
|
| 199 |
$default_options['mms_auto_patch'] = '1'; |
| 200 |
$default_options['mms_registration_file'] = 'wp-login'; |
| 201 |
$default_options['mms_registration_grants'] = 'none'; |
| 202 |
for($n = 0, $v = 0; $n <= $GLOBALS['WS_PLUGIN__']['s2member']['c']['levels']; $n++, $v = $v + 5) |
| 203 |
$default_options['mms_registration_blogs_level'.$n] = (string)$v; |
| 204 |
|
| 205 |
$default_options['login_welcome_page'] = ''; |
| 206 |
$default_options['login_redirection_override'] = ''; |
| 207 |
$default_options['membership_options_page'] = ''; |
| 208 |
$default_options['membership_options_page_vars_enable'] = '1'; |
| 209 |
$default_options['membership_options_page_ga_vars_enable'] = '1'; |
| 210 |
|
| 211 |
$default_options['login_reg_design_enabled'] = '1'; |
| 212 |
|
| 213 |
$default_options['login_reg_background_color'] = 'FFFFFF'; |
| 214 |
$default_options['login_reg_background_image'] = $GLOBALS['WS_PLUGIN__']['s2member']['c']['dir_url'].'/src/images/bg.png'; |
| 215 |
$default_options['login_reg_background_image_repeat'] = 'repeat'; |
| 216 |
|
| 217 |
$default_options['login_reg_background_text_color'] = '000000'; |
| 218 |
$default_options['login_reg_background_text_shadow_color'] = 'EEEEEE'; |
| 219 |
$default_options['login_reg_background_box_shadow_color'] = 'EEEEEE'; |
| 220 |
|
| 221 |
$default_options['login_reg_logo_src'] = $GLOBALS['WS_PLUGIN__']['s2member']['c']['dir_url'].'/src/images/logo.png'; |
| 222 |
$default_options['login_reg_logo_src_width'] = '550'; |
| 223 |
$default_options['login_reg_logo_src_height'] = '100'; |
| 224 |
$default_options['login_reg_logo_url'] = home_url('/'); |
| 225 |
$default_options['login_reg_logo_title'] = get_bloginfo('name'); |
| 226 |
|
| 227 |
$default_options['login_reg_font_size'] = '12px'; |
| 228 |
$default_options['login_reg_font_family'] = "'Verdana', 'Arial', sans-serif"; |
| 229 |
$default_options['login_reg_font_field_size'] = '18px'; |
| 230 |
|
| 231 |
$default_options['login_reg_footer_backtoblog'] = '0'; |
| 232 |
$default_options['login_reg_footer_design'] = ''; |
| 233 |
|
| 234 |
$default_options['html_emails_enabled'] = 0; //250615 |
| 235 |
|
| 236 |
$default_options['reg_email_from_name'] = get_bloginfo('name'); |
| 237 |
$default_options['reg_email_from_email'] = get_bloginfo('admin_email'); |
| 238 |
$default_options['reg_email_support_link'] = 'mailto:'.get_bloginfo('admin_email'); |
| 239 |
|
| 240 |
$default_options['new_user_emails_enabled'] = '0'; |
| 241 |
|
| 242 |
$default_options['new_user_email_subject'] = sprintf('[%s] Username/Password', get_bloginfo('name')); |
| 243 |
$default_options['new_user_email_message'] = sprintf("Your Username/Password for: \n%s\n\nUsername: %%%%user_login%%%%\nTo set your password, visit: %%%%wp_set_pass_url%%%%\n\n%%%%wp_login_url%%%%", get_bloginfo('name')); |
| 244 |
|
| 245 |
$default_options['new_user_admin_email_recipients'] = get_bloginfo('admin_email'); |
| 246 |
$default_options['new_user_admin_email_subject'] = sprintf('[%s] New User Registration', get_bloginfo('name')); |
| 247 |
$default_options['new_user_admin_email_message'] = sprintf("New User Registration on your site: \n%s\n\nUser ID: %%%%user_id%%%%\nUsername: %%%%user_login%%%%\nEmail: %%%%user_email%%%%\nIP Address: %%%%user_ip%%%%", get_bloginfo('name')); |
| 248 |
|
| 249 |
$default_options['paypal_sandbox'] = '0'; |
| 250 |
$default_options['paypal_business'] = ''; |
| 251 |
$default_options['paypal_merchant_id'] = ''; |
| 252 |
$default_options['paypal_api_username'] = ''; |
| 253 |
$default_options['paypal_api_password'] = ''; |
| 254 |
$default_options['paypal_api_signature'] = ''; |
| 255 |
$default_options['paypal_identity_token'] = ''; |
| 256 |
$default_options['paypal_btn_encryption'] = '0'; |
| 257 |
|
| 258 |
//260106 |
| 259 |
$default_options['paypal_checkout_enable'] = '0'; |
| 260 |
$default_options['paypal_checkout_sandbox'] = '0'; |
| 261 |
$default_options['paypal_checkout_client_id'] = ''; |
| 262 |
$default_options['paypal_checkout_client_secret'] = ''; |
| 263 |
$default_options['paypal_checkout_sandbox_client_id'] = ''; |
| 264 |
$default_options['paypal_checkout_sandbox_client_secret']= ''; |
| 265 |
$default_options['paypal_checkout_webhook_id'] = ''; |
| 266 |
$default_options['paypal_checkout_sandbox_webhook_id'] = ''; |
| 267 |
|
| 268 |
$default_options['paypal_checkout_cache'] = array(); |
| 269 |
|
| 270 |
$default_options['paypal_payflow_api_username'] = ''; |
| 271 |
$default_options['paypal_payflow_api_partner'] = 'PayPal'; |
| 272 |
$default_options['paypal_payflow_api_vendor'] = ''; |
| 273 |
$default_options['paypal_payflow_api_password'] = ''; |
| 274 |
|
| 275 |
$default_options['ipn_signup_vars_fallback'] = '0'; //250427 |
| 276 |
$default_options['skip_ipn_domain_validation'] = '0'; //250606 |
| 277 |
|
| 278 |
$default_options['signup_tracking_codes'] = ''; |
| 279 |
$default_options['modification_tracking_codes'] = ''; |
| 280 |
$default_options['ccap_tracking_codes'] = ''; |
| 281 |
$default_options['sp_tracking_codes'] = ''; |
| 282 |
|
| 283 |
$default_options['signup_email_recipients'] = '"%%full_name%%" <%%payer_email%%>'; |
| 284 |
$default_options['signup_email_subject'] = 'Congratulations! (your membership has been approved)'; |
| 285 |
$default_options['signup_email_message'] = sprintf("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", get_bloginfo('name')); |
| 286 |
|
| 287 |
$default_options['modification_email_recipients'] = '"%%full_name%%" <%%payer_email%%>'; |
| 288 |
$default_options['modification_email_subject'] = 'Thank you! Your account has been updated.'; |
| 289 |
$default_options['modification_email_message'] = sprintf("Thanks %%%%first_name%%%%! Your account now has access to: %%%%item_name%%%%.\n\nIf you have any trouble, please feel free to contact us.\n\nBest Regards,\n%s", get_bloginfo('name')); |
| 290 |
|
| 291 |
$default_options['ccap_email_recipients'] = '"%%full_name%%" <%%payer_email%%>'; |
| 292 |
$default_options['ccap_email_subject'] = 'Thank you! Your account has been updated.'; |
| 293 |
$default_options['ccap_email_message'] = sprintf("Thanks %%%%first_name%%%%! Your account now has access to: %%%%item_name%%%%.\n\nIf you have any trouble, please feel free to contact us.\n\nBest Regards,\n%s", get_bloginfo('name')); |
| 294 |
|
| 295 |
$default_options['sp_email_recipients'] = '"%%full_name%%" <%%payer_email%%>'; |
| 296 |
$default_options['sp_email_subject'] = 'Thank You! (instructions for access)'; |
| 297 |
$default_options['sp_email_message'] = sprintf("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", get_bloginfo('name')); |
| 298 |
|
| 299 |
$default_options['mailchimp_api_key'] = ''; |
| 300 |
$default_options['getresponse_api_key'] = ''; |
| 301 |
$default_options['aweber_api_key'] = ''; |
| 302 |
$default_options['aweber_internal_api_key'] = ''; |
| 303 |
$default_options['aweber_api_type'] = 'api'; |
| 304 |
if($GLOBALS['WS_PLUGIN__']['s2member']['c']['configured']) |
| 305 |
$default_options['aweber_api_type'] = 'email'; |
| 306 |
|
| 307 |
for($n = 0; $n <= $GLOBALS['WS_PLUGIN__']['s2member']['c']['levels']; $n++) |
| 308 |
$default_options['level'.$n.'_mailchimp_list_ids'] = ''; |
| 309 |
|
| 310 |
for($n = 0; $n <= $GLOBALS['WS_PLUGIN__']['s2member']['c']['levels']; $n++) |
| 311 |
$default_options['level'.$n.'_getresponse_list_ids'] = ''; |
| 312 |
|
| 313 |
for($n = 0; $n <= $GLOBALS['WS_PLUGIN__']['s2member']['c']['levels']; $n++) |
| 314 |
$default_options['level'.$n.'_aweber_list_ids'] = ''; |
| 315 |
|
| 316 |
$default_options['signup_notification_urls'] = ''; |
| 317 |
$default_options['registration_notification_urls'] = ''; |
| 318 |
$default_options['payment_notification_urls'] = ''; |
| 319 |
$default_options['modification_notification_urls'] = ''; |
| 320 |
$default_options['cancellation_notification_urls'] = ''; |
| 321 |
$default_options['eot_del_notification_urls'] = ''; |
| 322 |
$default_options['ref_rev_notification_urls'] = ''; |
| 323 |
$default_options['sp_sale_notification_urls'] = ''; |
| 324 |
$default_options['sp_ref_rev_notification_urls'] = ''; |
| 325 |
|
| 326 |
$default_options['signup_notification_recipients'] = ''; |
| 327 |
$default_options['registration_notification_recipients'] = ''; |
| 328 |
$default_options['payment_notification_recipients'] = ''; |
| 329 |
$default_options['modification_notification_recipients'] = ''; |
| 330 |
$default_options['cancellation_notification_recipients'] = ''; |
| 331 |
$default_options['eot_del_notification_recipients'] = ''; |
| 332 |
$default_options['ref_rev_notification_recipients'] = ''; |
| 333 |
$default_options['sp_sale_notification_recipients'] = ''; |
| 334 |
$default_options['sp_ref_rev_notification_recipients'] = ''; |
| 335 |
|
| 336 |
for ($n = 0, $l = array('Free Subscriber', 'Bronze Member', 'Silver Member', 'Gold Member', 'Platinum Member'); $n <= $GLOBALS['WS_PLUGIN__']['s2member']['c']['levels']; $n++) { |
| 337 |
$default_options['level'.$n.'_label'] = (!empty($l[$n])) ? $l[$n] : 'Level '.$n.' Member'; |
| 338 |
} |
| 339 |
|
| 340 |
$default_options['apply_label_translations'] = '0'; |
| 341 |
|
| 342 |
for($n = 0; $n <= $GLOBALS['WS_PLUGIN__']['s2member']['c']['levels']; $n++) |
| 343 |
$default_options['level'.$n.'_file_downloads_allowed'] = ''; |
| 344 |
|
| 345 |
for($n = 0; $n <= $GLOBALS['WS_PLUGIN__']['s2member']['c']['levels']; $n++) |
| 346 |
$default_options['level'.$n.'_file_downloads_allowed_days'] = ''; |
| 347 |
|
| 348 |
$default_options['file_download_limit_exceeded_page'] = ''; |
| 349 |
$default_options['file_download_inline_extensions'] = ''; |
| 350 |
$default_options['file_download_stream_extensions'] = ''; |
| 351 |
$default_options['file_download_content_encodong_none'] = '0'; |
| 352 |
|
| 353 |
$default_options['amazon_s3_files_bucket'] = ''; |
| 354 |
$default_options['amazon_s3_files_bucket_region'] = ''; |
| 355 |
$default_options['amazon_s3_files_access_key'] = ''; |
| 356 |
$default_options['amazon_s3_files_secret_key'] = ''; |
| 357 |
|
| 358 |
$default_options['amazon_cf_files_private_key'] = ''; |
| 359 |
$default_options['amazon_cf_files_private_key_id'] = ''; |
| 360 |
$default_options['amazon_cf_files_distros_access_id'] = ''; |
| 361 |
$default_options['amazon_cf_files_distros_s3_access_id'] = ''; |
| 362 |
$default_options['amazon_cf_files_distro_downloads_id'] = ''; |
| 363 |
$default_options['amazon_cf_files_distro_downloads_cname'] = ''; |
| 364 |
$default_options['amazon_cf_files_distro_downloads_dname'] = ''; |
| 365 |
$default_options['amazon_cf_files_distro_streaming_id'] = ''; |
| 366 |
$default_options['amazon_cf_files_distro_streaming_cname'] = ''; |
| 367 |
$default_options['amazon_cf_files_distro_streaming_dname'] = ''; |
| 368 |
$default_options['amazon_cf_files_distros_auto_config_status'] = ''; |
| 369 |
$default_options['amazon_cf_files_rtmp_policy_include_ip'] = '1'; |
| 370 |
|
| 371 |
$default_options['ruris_case_sensitive'] = '0'; // No by default. |
| 372 |
|
| 373 |
for($n = 0; $n <= $GLOBALS['WS_PLUGIN__']['s2member']['c']['levels']; $n++) |
| 374 |
$default_options['level'.$n.'_ruris'] = ''; |
| 375 |
for($n = 0; $n <= $GLOBALS['WS_PLUGIN__']['s2member']['c']['levels']; $n++) |
| 376 |
$default_options['level'.$n.'_catgs'] = ''; |
| 377 |
for($n = 0; $n <= $GLOBALS['WS_PLUGIN__']['s2member']['c']['levels']; $n++) |
| 378 |
$default_options['level'.$n.'_ptags'] = ''; |
| 379 |
for($n = 0; $n <= $GLOBALS['WS_PLUGIN__']['s2member']['c']['levels']; $n++) |
| 380 |
$default_options['level'.$n.'_posts'] = ''; |
| 381 |
for($n = 0; $n <= $GLOBALS['WS_PLUGIN__']['s2member']['c']['levels']; $n++) |
| 382 |
$default_options['level'.$n.'_pages'] = ''; |
| 383 |
|
| 384 |
$default_options['specific_ids'] = ''; |
| 385 |
|
| 386 |
$default_options['triggers_immediate_eot'] = 'reversals'; |
| 387 |
$default_options['membership_eot_behavior'] = 'demote'; |
| 388 |
$default_options['eot_time_ext_behavior'] = 'extend'; |
| 389 |
$default_options['auto_eot_system_enabled'] = '1'; |
| 390 |
$default_options['auto_eot_system_runtime_mode'] = 'auto'; |
| 391 |
$default_options['auto_eot_system_runtime_custom'] = '30'; |
| 392 |
$default_options['eots_remove_ccaps'] = '1'; |
| 393 |
$default_options['eot_grace_time'] = '86400'; |
| 394 |
|
| 395 |
$default_options['wp_footer_code'] = ''; |
| 396 |
|
| 397 |
$default_options = apply_filters('ws_plugin__s2member_default_options', $default_options); |
| 398 |
|
| 399 |
unset($n, $v, $l); // Unset/cleanup these working variables from the routines above. |
| 400 |
/* |
| 401 |
Here they are merged. User options will overwrite some or all default values. |
| 402 |
*/ |
| 403 |
$_stored_options = (($options !== FALSE) ? (array)$options : (array)get_option('ws_plugin__s2member_options')); |
| 404 |
$GLOBALS['WS_PLUGIN__']['s2member']['o'] = array_merge($default_options, $_stored_options); |
| 405 |
|
| 406 |
//260812 Keep both whitelist option names synchronized, with the legacy value taking precedence after a rollback. |
| 407 |
if(isset($_stored_options['sc_s2get_userid_whitelist']) && is_string($_stored_options['sc_s2get_userid_whitelist'])) |
| 408 |
{ |
| 409 |
if(!array_key_exists('sc_user_fields_whitelist', $_stored_options) || $GLOBALS['WS_PLUGIN__']['s2member']['o']['sc_user_fields_whitelist'] !== $_stored_options['sc_s2get_userid_whitelist']) |
| 410 |
$GLOBALS['WS_PLUGIN__']['s2member']['o']['sc_user_fields_whitelist'] = $_stored_options['sc_s2get_userid_whitelist']; |
| 411 |
} |
| 412 |
else if(isset($_stored_options['sc_user_fields_whitelist']) && is_string($_stored_options['sc_user_fields_whitelist'])) |
| 413 |
$GLOBALS['WS_PLUGIN__']['s2member']['o']['sc_s2get_userid_whitelist'] = $_stored_options['sc_user_fields_whitelist']; |
| 414 |
unset($_stored_options); |
| 415 |
|
| 416 |
/* |
| 417 |
* Ditch this old option key; no longer in use. |
| 418 |
*/ |
| 419 |
if(isset($GLOBALS['WS_PLUGIN__']['s2member']['o']['run_deactivation_routines'])) unset($GLOBALS['WS_PLUGIN__']['s2member']['o']['run_deactivation_routines']); |
| 420 |
/* |
| 421 |
This builds an MD5 checksum for the full array of options. This also includes the config checksum and the current set of default options. |
| 422 |
*/ |
| 423 |
$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)))); |
| 424 |
/* |
| 425 |
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. |
| 426 |
*/ |
| 427 |
if($options !== FALSE || ($GLOBALS['WS_PLUGIN__']['s2member']['o']['options_checksum'] !== $checksum && $GLOBALS['WS_PLUGIN__']['s2member']['o'] !== $default_options)) |
| 428 |
{ |
| 429 |
foreach($GLOBALS['WS_PLUGIN__']['s2member']['o'] as $key => &$value) |
| 430 |
{ |
| 431 |
if(!isset($default_options[$key]) && !preg_match('/^pro_/', $key)) |
| 432 |
unset($GLOBALS['WS_PLUGIN__']['s2member']['o'][$key]); |
| 433 |
|
| 434 |
else if($key === 'options_checksum' && (!is_string($value) || !strlen($value))) |
| 435 |
$value = $default_options[$key]; |
| 436 |
|
| 437 |
else if($key === 'options_version' && (!is_string($value) || !is_numeric($value))) |
| 438 |
$value = $default_options[$key]; |
| 439 |
|
| 440 |
else if(preg_match('/^gateway_debug_logs|gateway_debug_logs_extensive/', $key) && (!is_string($value) || !is_numeric($value))) |
| 441 |
$value = $default_options[$key]; |
| 442 |
|
| 443 |
else if($key === 'lazy_load_css_js' && (!is_string($value) || !is_numeric($value))) |
| 444 |
$value = $default_options[$key]; |
| 445 |
|
| 446 |
else if(preg_match('/^static_(?:css|js)(?:_minify)?$/', $key) && (!is_string($value) || !is_numeric($value))) //260903.0437 |
| 447 |
$value = $default_options[$key]; |
| 448 |
|
| 449 |
//260912.0522 Keep the operator-facing wait bounded so an accidental value cannot effectively disable health checking. |
| 450 |
//260911.0010 Here, bounded means the explicit 1–60-second range exposed by the setting. |
| 451 |
else if($key === 'asset_health_wait_seconds') |
| 452 |
$value = (!is_string($value) || !is_numeric($value) || (int)$value < 1 || (int)$value > 60) ? $default_options[$key] : (string)(int)$value; |
| 453 |
|
| 454 |
else if($key === 'no_cache_headers_mode' && (!is_string($value) || !in_array($value, array('always', 'selective', 'evaluative'), TRUE))) |
| 455 |
$value = $default_options[$key]; |
| 456 |
|
| 457 |
else if($key === 'no_cache_headers_debug' && (!is_string($value) || !is_numeric($value))) |
| 458 |
$value = $default_options[$key]; |
| 459 |
|
| 460 |
else if($key === 'sc_conds_allow_arbitrary_php' && (!is_string($value) || !is_numeric($value))) |
| 461 |
$value = $default_options[$key]; |
| 462 |
|
| 463 |
else if($key === 'sc_s2get_userid_whitelist' && !is_string($value)) //260324 |
| 464 |
$value = $default_options[$key]; |
| 465 |
else if($key === 'sc_user_fields_whitelist' && !is_string($value)) //260812 |
| 466 |
$value = $default_options[$key]; |
| 467 |
|
| 468 |
else if($key === 'sec_encryption_key' && (!is_string($value) || !strlen($value))) |
| 469 |
$value = $default_options[$key]; |
| 470 |
|
| 471 |
else if($key === 'sec_encryption_key_history' && (!is_array($value) || empty($value))) |
| 472 |
$value = $default_options[$key]; |
| 473 |
|
| 474 |
else if($key === 'def_combo_encryption_key' && (!is_string($value) || !strlen($value))) |
| 475 |
$value = $default_options[$key]; |
| 476 |
|
| 477 |
else if($key === 'def_combo_encryption_key_history' && (!is_array($value) || empty($value))) |
| 478 |
$value = $default_options[$key]; |
| 479 |
|
| 480 |
else if($key === 'def_custom_combo_encryption_keys' && (!is_array($value) || empty($value))) |
| 481 |
$value = $default_options[$key]; |
| 482 |
|
| 483 |
//260809 Validate the hashed Defuse key mappings independently of the legacy options. |
| 484 |
else if(preg_match('/^(?:secret_key_to_defuse_key|secret_key_to_defuse_key_history|custom_secret_key_to_defuse_key)$/', $key) && (!is_array($value) || empty($value))) |
| 485 |
$value = $default_options[$key]; |
| 486 |
|
| 487 |
else if($key === 's_badge_status_enabled' && (!is_string($value) || !is_numeric($value))) |
| 488 |
$value = $default_options[$key]; |
| 489 |
|
| 490 |
else if($key === 'max_ip_restriction' && (!is_string($value) || !is_numeric($value) || $value < 0 || $value > 100)) |
| 491 |
$value = $default_options[$key]; |
| 492 |
|
| 493 |
else if($key === 'max_ip_restriction_time' && (!is_string($value) || !is_numeric($value) || $value < 300 || $value > 31556926)) |
| 494 |
$value = $default_options[$key]; |
| 495 |
|
| 496 |
else if($key === 'max_failed_login_attempts' && (!is_string($value) || !is_numeric($value) || $value < 0 || $value > 100)) |
| 497 |
$value = $default_options[$key]; |
| 498 |
|
| 499 |
else if($key === 'max_simultaneous_logins' && (!is_string($value) || !is_numeric($value) || $value < 0)) |
| 500 |
$value = $default_options[$key]; |
| 501 |
|
| 502 |
else if($key === 'max_simultaneous_logins_timeout' && (!is_string($value) || !strlen($value))) |
| 503 |
$value = $default_options[$key]; |
| 504 |
|
| 505 |
else if($key === 'run_uninstall_routines' && (!is_string($value) || !is_numeric($value))) |
| 506 |
$value = $default_options[$key]; |
| 507 |
|
| 508 |
else if($key === 'custom_reg_fields' && (!is_string($value) || !strlen($value))) |
| 509 |
$value = $default_options[$key]; |
| 510 |
|
| 511 |
else if(preg_match('/^custom_reg_(?:names|password|password_min_length|opt_in|auto_opt_out_transitions)$/', $key) && (!is_string($value) || !is_numeric($value))) |
| 512 |
$value = $default_options[$key]; |
| 513 |
|
| 514 |
else if($key === 'custom_reg_password_min_strength' && (!is_string($value) || !strlen($value))) |
| 515 |
$value = $default_options[$key]; |
| 516 |
|
| 517 |
else if($key === 'custom_reg_display_name' && (!is_string($value) || !preg_match('/^(?:full|first|last|login|0)$/', $value))) |
| 518 |
$value = $default_options[$key]; |
| 519 |
|
| 520 |
else if($key === 'custom_reg_opt_in_label' && (!is_string($value) || !strlen($value))) |
| 521 |
$value = $default_options[$key]; |
| 522 |
|
| 523 |
else if($key === 'custom_reg_auto_opt_outs' && (!is_array($value) || empty($value))) |
| 524 |
$value = $default_options[$key]; |
| 525 |
|
| 526 |
else if($key === 'custom_reg_fields_4bp' && (!is_array($value) || empty($value))) |
| 527 |
$value = $default_options[$key]; |
| 528 |
|
| 529 |
else if($key === 'custom_reg_force_personal_emails' && (!is_string($value) || !strlen($value = preg_replace('/\s+/', '', $value)))) |
| 530 |
$value = $default_options[$key]; |
| 531 |
|
| 532 |
else if($key === 'allow_subscribers_in' && (!is_string($value) || !is_numeric($value))) |
| 533 |
$value = $default_options[$key]; |
| 534 |
|
| 535 |
else if($key === 'mms_auto_patch' && (!is_string($value) || !is_numeric($value))) |
| 536 |
$value = $default_options[$key]; |
| 537 |
|
| 538 |
else if($key === 'mms_registration_file' && (!is_string($value) || !preg_match('/^(?:wp-login|wp-signup)$/', $value))) |
| 539 |
$value = $default_options[$key]; |
| 540 |
|
| 541 |
else if($key === 'mms_registration_grants' && (!is_string($value) || !preg_match('/^(?:none|user|all)$/', $value))) |
| 542 |
$value = $default_options[$key]; |
| 543 |
|
| 544 |
else if(preg_match('/^mms_registration_blogs_level[0-9]+$/', $key) && (!is_string($value) || !is_numeric($value) || $value < 0)) |
| 545 |
$value = $default_options[$key]; |
| 546 |
|
| 547 |
else if($key === 'force_admin_lockouts' && (!is_string($value) || !is_numeric($value))) |
| 548 |
$value = $default_options[$key]; |
| 549 |
|
| 550 |
else if($key === 'filter_wp_query' && !is_array($value) /* This array CAN be empty. */) |
| 551 |
$value = $default_options[$key]; |
| 552 |
|
| 553 |
else if(preg_match('/^default_(?:custom_str_)?url_shortener$/', $key) && (!is_string($value) || !strlen($value))) |
| 554 |
$value = $default_options[$key]; |
| 555 |
|
| 556 |
else if($key === 'login_welcome_page' && (!is_string($value) || !is_numeric($value))) |
| 557 |
$value = $default_options[$key]; |
| 558 |
|
| 559 |
else if($key === 'login_redirection_override' && (!is_string($value) || !strlen($value))) |
| 560 |
$value = $default_options[$key]; |
| 561 |
|
| 562 |
else if($key === 'membership_options_page' && (!is_string($value) || !is_numeric($value))) |
| 563 |
$value = $default_options[$key]; |
| 564 |
|
| 565 |
else if($key === 'membership_options_page_vars_enable' && (!is_string($value) || !is_numeric($value))) |
| 566 |
$value = $default_options[$key]; |
| 567 |
|
| 568 |
else if($key === 'membership_options_page_ga_vars_enable' && (!is_string($value) || !is_numeric($value))) |
| 569 |
$value = $default_options[$key]; |
| 570 |
|
| 571 |
else if($key === 'login_reg_design_enabled' && (!is_string($value) || !is_numeric($value))) |
| 572 |
$value = $default_options[$key]; |
| 573 |
|
| 574 |
else if($key === 'login_reg_background_image' && !is_string($value) /* This is optional. */) |
| 575 |
$value = $default_options[$key]; |
| 576 |
|
| 577 |
else if($key === 'login_reg_background_image_repeat' && (!is_string($value) || !preg_match('/^(?:repeat|repeat-x|repeat-y|no-repeat)$/', $value))) |
| 578 |
$value = $default_options[$key]; |
| 579 |
|
| 580 |
else if(preg_match('/^login_reg_(?:background|logo|font|footer)_/', $key) && !preg_match('/background_image/', $key) && (!is_string($value) || !strlen($value))) |
| 581 |
$value = $default_options[$key]; |
| 582 |
|
| 583 |
else if($key === 'login_reg_footer_backtoblog' && (!is_string($value) || !is_numeric($value))) |
| 584 |
$value = $default_options[$key]; |
| 585 |
|
| 586 |
else if(preg_match('/^reg_email_(?:from_name|from_email|support_link)$/', $key) && (!is_string($value) || !strlen($value))) |
| 587 |
$value = $default_options[$key]; |
| 588 |
|
| 589 |
else if($key === 'new_user_emails_enabled' && (!is_string($value) || !is_numeric($value))) |
| 590 |
$value = $default_options[$key]; |
| 591 |
|
| 592 |
else if(preg_match('/^new_user_email_(?:subject|message)$/', $key) && (!is_string($value) || !strlen($value))) |
| 593 |
$value = $default_options[$key]; |
| 594 |
|
| 595 |
else if(preg_match('/^new_user_admin_email_(?:recipients|subject|message)$/', $key) && (!is_string($value) || !strlen($value))) |
| 596 |
$value = $default_options[$key]; |
| 597 |
|
| 598 |
else if($key === 'paypal_sandbox' && (!is_string($value) || !is_numeric($value))) |
| 599 |
$value = $default_options[$key]; |
| 600 |
|
| 601 |
else if(preg_match('/^paypal_(?:business|merchant_id|api_username|api_password|api_signature|identity_token)$/', $key) && (!is_string($value) || !strlen($value))) |
| 602 |
$value = $default_options[$key]; |
| 603 |
|
| 604 |
else if(preg_match('/^paypal_payflow(?:api_username|api_partner|api_vendor|api_password)$/', $key) && (!is_string($value) || !strlen($value))) |
| 605 |
$value = $default_options[$key]; |
| 606 |
|
| 607 |
else if($key === 'paypal_btn_encryption' && (!is_string($value) || !is_numeric($value))) |
| 608 |
$value = $default_options[$key]; |
| 609 |
|
| 610 |
//260106 |
| 611 |
else if($key === 'paypal_checkout_enable' && (!is_string($value) || !is_numeric($value))) |
| 612 |
$value = $default_options[$key]; |
| 613 |
else if($key === 'paypal_checkout_sandbox' && (!is_string($value) || !is_numeric($value))) |
| 614 |
$value = $default_options[$key]; |
| 615 |
else if(preg_match('/^paypal_checkout_(?:client_id|client_secret|sandbox_client_id|sandbox_client_secret)$/', $key) && !is_string($value)) |
| 616 |
$value = $default_options[$key]; |
| 617 |
|
| 618 |
else if(preg_match('/^(?:signup|modification|ccap|sp)_tracking_codes$/', $key) && (!is_string($value) || !strlen($value))) |
| 619 |
$value = $default_options[$key]; |
| 620 |
|
| 621 |
else if(preg_match('/^(?:signup|modification|ccap|sp)_email_recipients$/', $key) && !is_string($value) /* Can be empty. */) |
| 622 |
$value = $default_options[$key]; |
| 623 |
|
| 624 |
else if(preg_match('/^(?:signup|modification|ccap|sp)_email_(?:subject|message)$/', $key) && (!is_string($value) || !strlen($value))) |
| 625 |
$value = $default_options[$key]; |
| 626 |
|
| 627 |
else if($key === 'aweber_api_type' && (!is_string($value) || !preg_match('/^(?:api|email)$/', $value))) |
| 628 |
$value = $default_options[$key]; |
| 629 |
|
| 630 |
else if(preg_match('/^(?:mailchimp|getresponse|aweber)(?:_internal)?_api_key$/', $key) && (!is_string($value) || !strlen($value))) |
| 631 |
$value = $default_options[$key]; |
| 632 |
|
| 633 |
else if(preg_match('/^level[0-9]+_mailchimp_list_ids$/', $key) && (!is_string($value) || !strlen($value = preg_replace('/['."\r\n\t".']+/', '', $value)))) |
| 634 |
$value = $default_options[$key]; |
| 635 |
|
| 636 |
else if(preg_match('/^level[0-9]+_getresponse_list_ids$/', $key) && (!is_string($value) || !strlen($value = preg_replace('/\s+/', '', $value)))) |
| 637 |
$value = $default_options[$key]; |
| 638 |
|
| 639 |
else if(preg_match('/^level[0-9]+_aweber_list_ids$/', $key) && (!is_string($value) || !strlen($value = preg_replace('/\s+/', '', $value)))) |
| 640 |
$value = $default_options[$key]; |
| 641 |
|
| 642 |
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))) |
| 643 |
$value = $default_options[$key]; |
| 644 |
|
| 645 |
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))) |
| 646 |
$value = $default_options[$key]; |
| 647 |
|
| 648 |
else if(preg_match('/^level[0-9]+_label$/', $key) && (!is_string($value) || !strlen($value))) |
| 649 |
$value = $default_options[$key]; |
| 650 |
|
| 651 |
else if($key === 'apply_label_translations' && (!is_string($value) || !is_numeric($value))) |
| 652 |
$value = $default_options[$key]; |
| 653 |
|
| 654 |
else if(preg_match('/^level[0-9]+_file_downloads_allowed$/', $key) && (!is_string($value) || !is_numeric($value) || $value < 0)) |
| 655 |
$value = $default_options[$key]; |
| 656 |
|
| 657 |
else if(preg_match('/^level[0-9]+_file_downloads_allowed_days$/', $key) && (!is_string($value) || !is_numeric($value) || $value < 0)) |
| 658 |
$value = $default_options[$key]; |
| 659 |
|
| 660 |
else if($key === 'file_download_limit_exceeded_page' && (!is_string($value) || !is_numeric($value))) |
| 661 |
$value = $default_options[$key]; |
| 662 |
|
| 663 |
else if(preg_match('/^file_download_(?:inline|stream)_extensions$/', $key) && (!is_string($value) || !($value = strtolower(preg_replace('/\s+/', '', $value))))) |
| 664 |
$value = $default_options[$key]; |
| 665 |
|
| 666 |
else if(preg_match('/^amazon_(?:s3|cf)_files_/', $key) && (!is_string($value) || !strlen($value))) |
| 667 |
$value = $default_options[$key]; |
| 668 |
|
| 669 |
else if($key === 'ruris_case_sensitive' && (!is_string($value) || !is_numeric($value))) |
| 670 |
$value = $default_options[$key]; |
| 671 |
|
| 672 |
else if(preg_match('/^level[0-9]+_ruris$/', $key) && (!is_string($value) || !strlen($value))) |
| 673 |
$value = $default_options[$key]; |
| 674 |
|
| 675 |
else if(preg_match('/^level[0-9]+_catgs$/', $key) && (!is_string($value) || !($value = ((strcasecmp($value, 'all') === 0) ? strtolower($value) : trim(preg_replace('/[^0-9,]/', '', $value), ','))))) |
| 676 |
$value = $default_options[$key]; |
| 677 |
|
| 678 |
else if(preg_match('/^level[0-9]+_ptags$/', $key) && (!is_string($value) || !($value = ((strcasecmp($value, 'all') === 0) ? strtolower($value) : trim(preg_replace('/ +/', ' ', trim(preg_replace('/ *, */', ',', $value))), ','))))) |
| 679 |
$value = $default_options[$key]; |
| 680 |
|
| 681 |
else if(preg_match('/^level[0-9]+_posts$/', $key) && (!is_string($value) || !($value = trim( /* Supports `all` or `1,2,3,all-[type]s`. */ |
| 682 |
preg_replace('/[^a-z0-9_\-,]/', '', strtolower($value)), ','))) |
| 683 |
) $value = $default_options[$key]; |
| 684 |
|
| 685 |
else if(preg_match('/^level[0-9]+_pages$/', $key) && (!is_string($value) || !($value = ((strcasecmp($value, 'all') === 0) ? strtolower($value) : trim(preg_replace('/[^0-9,]/', '', $value), ','))))) |
| 686 |
$value = $default_options[$key]; |
| 687 |
|
| 688 |
else if($key === 'specific_ids' && (!is_string($value) || !($value = trim(preg_replace('/[^0-9,]/', '', $value), ',')))) |
| 689 |
$value = $default_options[$key]; |
| 690 |
|
| 691 |
else if($key === 'triggers_immediate_eot' && (!is_string($value) || !preg_match('/^(?:none|refunds|reversals|refunds,reversals|refunds,partial_refunds,reversals)$/', $value))) |
| 692 |
$value = $default_options[$key]; |
| 693 |
|
| 694 |
else if($key === 'membership_eot_behavior' && (!is_string($value) || !preg_match('/^(?:demote|delete)$/', $value))) |
| 695 |
$value = $default_options[$key]; |
| 696 |
|
| 697 |
else if($key === 'eot_time_ext_behavior' && (!is_string($value) || !preg_match('/^(?:extend|reset)$/', $value))) |
| 698 |
$value = $default_options[$key]; |
| 699 |
|
| 700 |
else if($key === 'auto_eot_system_runtime_mode' && (!is_string($value) || !preg_match('/^(?:auto|custom)$/', $value))) |
| 701 |
$value = $default_options[$key]; |
| 702 |
|
| 703 |
else if($key === 'auto_eot_system_runtime_custom' && (!is_string($value) || !is_numeric($value) || (float)$value < 1 || (float)$value > 3600)) |
| 704 |
$value = $default_options[$key]; |
| 705 |
|
| 706 |
else if(preg_match('/^(?:auto_eot_system_enabled|eot_grace_time|eots_remove_ccaps)$/', $key) && (!is_string($value) || !is_numeric($value))) |
| 707 |
$value = $default_options[$key]; |
| 708 |
|
| 709 |
else if($key === 'wp_footer_code' && (!is_string($value) || !strlen($value))) |
| 710 |
$value = $default_options[$key]; |
| 711 |
} |
| 712 |
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'])) { |
| 713 |
array_unshift($GLOBALS['WS_PLUGIN__']['s2member']['o']['sec_encryption_key_history'], $options['sec_encryption_key']); |
| 714 |
$GLOBALS['WS_PLUGIN__']['s2member']['o']['sec_encryption_key_history'] = array_slice($GLOBALS['WS_PLUGIN__']['s2member']['o']['sec_encryption_key_history'], 0, 10); |
| 715 |
} |
| 716 |
if($options !== FALSE && is_string($options['def_combo_encryption_key']) && strlen($options['def_combo_encryption_key']) && !in_array($options['def_combo_encryption_key'], $GLOBALS['WS_PLUGIN__']['s2member']['o']['def_combo_encryption_key_history'])) { |
| 717 |
array_unshift($GLOBALS['WS_PLUGIN__']['s2member']['o']['def_combo_encryption_key_history'], $options['def_combo_encryption_key']); |
| 718 |
$GLOBALS['WS_PLUGIN__']['s2member']['o']['def_combo_encryption_key_history'] = array_slice($GLOBALS['WS_PLUGIN__']['s2member']['o']['def_combo_encryption_key_history'], 0, 10); |
| 719 |
} |
| 720 |
//260809 Keep a recovery-only history of default hashed Defuse key mappings. |
| 721 |
if($options !== FALSE && is_array($options['secret_key_to_defuse_key']) && !empty($options['secret_key_to_defuse_key']) && !in_array($options['secret_key_to_defuse_key'], $GLOBALS['WS_PLUGIN__']['s2member']['o']['secret_key_to_defuse_key_history'], TRUE)) { |
| 722 |
array_unshift($GLOBALS['WS_PLUGIN__']['s2member']['o']['secret_key_to_defuse_key_history'], $options['secret_key_to_defuse_key']); |
| 723 |
$GLOBALS['WS_PLUGIN__']['s2member']['o']['secret_key_to_defuse_key_history'] = array_slice($GLOBALS['WS_PLUGIN__']['s2member']['o']['secret_key_to_defuse_key_history'], 0, 10); |
| 724 |
} |
| 725 |
$GLOBALS['WS_PLUGIN__']['s2member']['o'] = apply_filters_ref_array('ws_plugin__s2member_options_before_checksum', array(&$GLOBALS['WS_PLUGIN__']['s2member']['o'])); |
| 726 |
|
| 727 |
$GLOBALS['WS_PLUGIN__']['s2member']['o']['options_checksum'] = md5($checksum_prefix.serialize(array_merge($GLOBALS['WS_PLUGIN__']['s2member']['o'], array('options_checksum' => 0)))); |
| 728 |
} |
| 729 |
|
| 730 |
return apply_filters_ref_array('ws_plugin__s2member_options', array(&$GLOBALS['WS_PLUGIN__']['s2member']['o'])); |
| 731 |
} |
| 732 |
} |
| 733 |
|
| 734 |
//250506 Move _x's to init to avoid PHP Notice since WP 6.7 |
| 735 |
add_action('init', function () { |
| 736 |
$o =& $GLOBALS['WS_PLUGIN__']['s2member']['o']; |
| 737 |
|
| 738 |
// Apply the filter to retrieve default values (not global) |
| 739 |
$default_values = apply_filters('ws_plugin__s2member_default_options', []); |
| 740 |
|
| 741 |
// Translated defaults for $o[...] options, only applied if still at their original defaults |
| 742 |
$translated_defaults = [ |
| 743 |
'custom_reg_opt_in_label' => _x('Yes, I want to receive updates via email.', 's2member-front', 's2member'), |
| 744 |
'new_user_email_subject' => sprintf(_x('[%s] Username/Password', 's2member-front', 's2member'), get_bloginfo('name')), |
| 745 |
'new_user_email_message' => sprintf(_x("Your Username/Password for: \n%s\n\nUsername: %%%%user_login%%%%\nTo set your password, visit: %%%%wp_set_pass_url%%%%\n\n%%%%wp_login_url%%%%", 's2member-front', 's2member'), get_bloginfo('name')), |
| 746 |
'new_user_admin_email_subject' => sprintf(_x('[%s] New User Registration', 's2member-front', 's2member'), get_bloginfo('name')), |
| 747 |
'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')), |
| 748 |
'signup_email_subject' => _x('Congratulations! (your membership has been approved)', 's2member-front', 's2member'), |
| 749 |
'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')), |
| 750 |
'modification_email_subject' => _x('Thank you! Your account has been updated.', 's2member-front', 's2member'), |
| 751 |
'modification_email_message' => sprintf(_x("Thanks %%%%first_name%%%%! Your account now has access to: %%%%item_name%%%%.\n\nIf you have any trouble, please feel free to contact us.\n\nBest Regards,\n%s", 's2member-front', 's2member'), get_bloginfo('name')), |
| 752 |
'ccap_email_subject' => _x('Thank you! Your account has been updated.', 's2member-front', 's2member'), |
| 753 |
'ccap_email_message' => sprintf(_x("Thanks %%%%first_name%%%%! Your account now has access to: %%%%item_name%%%%.\n\nIf you have any trouble, please feel free to contact us.\n\nBest Regards,\n%s", 's2member-front', 's2member'), get_bloginfo('name')), |
| 754 |
'sp_email_subject' => _x('Thank You! (instructions for access)', 's2member-front', 's2member'), |
| 755 |
'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')), |
| 756 |
'level0_label' => _x('Free Subscriber', 's2member-front', 's2member'), |
| 757 |
'level1_label' => _x('Bronze Member', 's2member-front', 's2member'), |
| 758 |
'level2_label' => _x('Silver Member', 's2member-front', 's2member'), |
| 759 |
'level3_label' => _x('Gold Member', 's2member-front', 's2member'), |
| 760 |
'level4_label' => _x('Platinum Member', 's2member-front', 's2member'), |
| 761 |
]; |
| 762 |
|
| 763 |
// Add extra levels if they exist. |
| 764 |
for ($n = 5; $n <= $GLOBALS['WS_PLUGIN__']['s2member']['c']['levels']; $n++) { |
| 765 |
$translated_defaults['level'.$n.'_label'] = sprintf(_x('Level %s Member', 's2member-front', 's2member'), $n); |
| 766 |
} |
| 767 |
|
| 768 |
// Apply translations to options if they are at their default |
| 769 |
foreach ($translated_defaults as $key => $translated) { |
| 770 |
if (isset($default_values[$key]) && isset($o[$key]) && $default_values[$key] === $o[$key]) { |
| 771 |
$o[$key] = $translated; |
| 772 |
} |
| 773 |
} |
| 774 |
|
| 775 |
// Handle recaptcha_lang separately |
| 776 |
if (isset($GLOBALS['WS_PLUGIN__']['s2member']['c']['recaptcha']['lang']) && $GLOBALS['WS_PLUGIN__']['s2member']['c']['recaptcha']['lang'] === 'en') { |
| 777 |
$GLOBALS['WS_PLUGIN__']['s2member']['c']['recaptcha']['lang'] = _x('en', 's2member-front recaptcha-lang-code', 's2member'); |
| 778 |
} |
| 779 |
}); |
| 780 |
|