diff --git a/s2member/includes/classes/login-customizations.inc.php b/s2member/includes/classes/login-customizations.inc.php index 863da61e..84b4078a 100644 --- a/s2member/includes/classes/login-customizations.inc.php +++ b/s2member/includes/classes/login-customizations.inc.php @@ -133,7 +133,7 @@ public static function login_header_styles() $a[] = 'div#login form#lostpasswordform p.submit { float:none'.$i.'; } div#login form#lostpasswordform input[type="submit"] { float:none'.$i.'; width:100%'.$i.'; box-sizing:border-box'.$i.'; }'; $a[] = 'div#login form#resetpassform #pass-strength-result { float:none'.$i.'; width:100%'.$i.'; box-sizing:border-box'.$i.'; } div#login form#resetpassform p.submit { float:none'.$i.'; } div#login form#resetpassform input[type="submit"] { float:none'.$i.'; width:100%'.$i.'; box-sizing:border-box'.$i.'; }'; - $a[] = 'div.ws-plugin--s2member-password-strength { margin-top:3px'.$i.'; font-color:#000000'.$i.'; background-color:#EEEEEE'.$i.'; padding:3px'.$i.'; border-radius:3px'.$i.'; } div.ws-plugin--s2member-password-strength-short { background-color:#FFA0A0'.$i.'; } div.ws-plugin--s2member-password-strength-bad { background-color:#FFB78C'.$i.'; } div.ws-plugin--s2member-password-strength-good { background-color:#FFEC8B'.$i.'; } div.ws-plugin--s2member-password-strength-strong { background-color:#C3FF88'.$i.'; } div.ws-plugin--s2member-password-strength-mismatch { background-color:#D6C1AB'.$i.'; }'; + $a[] = 'div.ws-plugin--s2member-password-strength { margin-top:3px'.$i.'; font-color:#000000'.$i.'; background-color:#EEEEEE'.$i.'; padding:3px'.$i.'; border-radius:3px'.$i.'; } div.ws-plugin--s2member-password-strength-short { background-color:#FFA0A0'.$i.'; } div.ws-plugin--s2member-password-strength-weak { background-color:#FFB78C'.$i.'; } div.ws-plugin--s2member-password-strength-good { background-color:#FFEC8B'.$i.'; } div.ws-plugin--s2member-password-strength-strong { background-color:#C3FF88'.$i.'; } div.ws-plugin--s2member-password-strength-mismatch { background-color:#D6C1AB'.$i.'; }'; $a[] = 'div#login form#registerform p#reg_passmail { font-style:italic'.$i.'; }'; diff --git a/s2member/includes/classes/user-securities.inc.php b/s2member/includes/classes/user-securities.inc.php index d3635fe9..1468b5af 100644 --- a/s2member/includes/classes/user-securities.inc.php +++ b/s2member/includes/classes/user-securities.inc.php @@ -157,5 +157,111 @@ public static function hide_password_fields($show, $user = NULL) return apply_filters('ws_plugin__s2member_hide_password_fields', $show, get_defined_vars()); } + + /** + * Acquires password minimum length. + * + * @package s2Member\User_Securities + * @since 150717 + * + * @param string $password The password to score. + * + * @return integer Password minimum length. + */ + public static function min_password_length() + { + $min = (integer)$GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_password_min_length']; + return max(6, (integer)apply_filters('ws_plugin__s2member_min_password_length', $min > 0 ? $min : 0)); + } + + /** + * Acquires minimum password strength code. + * + * @package s2Member\User_Securities + * @since 150717 + * + * @return string Minimum password strength code. + */ + public static function min_password_strength_code() + { + $code = $GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_password_min_strength']; + return apply_filters('ws_plugin__s2member_min_password_strength_code', trim($code)); + } + + /** + * Acquires minimum password strength label. + * + * @package s2Member\User_Securities + * @since 150717 + * + * @return string Minimum password strength label. + */ + public static function min_password_strength_label() + { + switch(self::min_password_strength_code()) + { + case 'weak': return _x('`weak`, `good`, or `strong`', 's2member-front', 's2member'); + case 'good': return _x('`good` or `strong` (i.e., use numbers, letters, and mixed caSe)', 's2member-front', 's2member'); + case 'strong': return _x('`strong` (i.e., use numbers, letters, mixed caSe, and punctuation)', 's2member-front', 's2member'); + } + return ''; // Default behavior. + } + + /** + * Acquires minimum password strength score. + * + * @package s2Member\User_Securities + * @since 150717 + * + * @return integer Minimum password strength score. + */ + public static function min_password_strength_score() + { + $score = 0; // Default behavior. + + switch(self::min_password_strength_code()) + { + case 'n/a': $score = 0; break; + case 'weak': $score = 10; break; + case 'good': $score = 30; break; + case 'strong': $score = 50; break; + } + return apply_filters('ws_plugin__s2member_min_password_strength_score', $score > 0 ? $score : 0); + } + + /** + * Acquires password strength score. + * + * @package s2Member\User_Securities + * @since 150717 + * + * @param string $password The password to score. + * + * @return integer Password strength score. + */ + public static function password_strength_score($password) + { + $score = 0; // Initialize score. + + if(strlen($password) < 1) + return $score; + + else if(strlen($password) < self::min_password_length()) + return $score; + + if(preg_match('/[0-9]/', $password)) + $score += 10; + + if(preg_match('/[a-z]/', $password)) + $score += 10; + + if(preg_match('/[A-Z]/', $password)) + $score += 10; + + if(preg_match('/[^0-9a-zA-Z]/', $password)) + $score += $score === 30 ? 20 : 10; + + return apply_filters('ws_plugin__s2member_password_strength_score', $score > 0 ? $score : 0); + } } -} \ No newline at end of file +} diff --git a/s2member/includes/menu-pages/gen-ops.inc.php b/s2member/includes/menu-pages/gen-ops.inc.php index 2f528f31..29e8429c 100644 --- a/s2member/includes/menu-pages/gen-ops.inc.php +++ b/s2member/includes/menu-pages/gen-ops.inc.php @@ -56,7 +56,7 @@ public function __construct() echo '
'."\n"; echo '

Plugin Deletion Safeguards (highly recommended)

'."\n"; - echo '

By default, s2Member will retain all of it\'s Roles, Capabilities, and your Configuration Options when/if you delete s2Member from the Plugins Menu in WordPress. However, if you would like for s2Member to erase itself completely, please choose: No (upon deletion, erase all data/options). See also: s2Member Uninstall Instructions

'; + echo '

By default, s2Member will retain all of it\'s Roles, Capabilities, and your Configuration Options when/if you delete s2Member from the Plugins Menu in WordPress. However, if you would like for s2Member to erase itself completely, please choose: No (upon deletion, erase all data/options). See also: s2Member Uninstall Instructions

'; do_action("ws_plugin__s2member_during_gen_ops_page_during_left_sections_during_uninstall", get_defined_vars()); echo ''."\n"; @@ -1147,16 +1147,32 @@ public function __construct() echo ''."\n"; echo ''."\n"; - echo ''."\n"; + echo ''."\n"; - echo ''."\n"; + + echo ''."\n"; + echo ''."\n"; + + echo ''."\n"; echo ''."\n"; diff --git a/s2member/includes/menu-pages/menu-pages-s-min.js b/s2member/includes/menu-pages/menu-pages-s-min.js index f39046f9..6bae3883 100644 --- a/s2member/includes/menu-pages/menu-pages-s-min.js +++ b/s2member/includes/menu-pages/menu-pages-s-min.js @@ -1 +1 @@ -jQuery(document).ready(function($){var esc_attr=esc_html=function(string){if(/[&\<\>"']/.test(string=String(string))){string=string.replace(/&/g,"&").replace(//g,">"),string=string.replace(/"/g,""").replace(/'/g,"'")}return string};ws_plugin__s2member_generateSecurityKey=function(obj){if(!obj){obj="#ws-plugin--s2member-sec-encryption-key"}var mt_rand=function(min,max){min=(arguments.length<1)?0:min;max=(arguments.length<2)?2147483647:max;return Math.floor(Math.random()*(max-min+1))+min};var chars="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#%^&*()";for(var i=0,key="";i<64;i++){key+=chars.substr(mt_rand(0,chars.length-1),1)}$(obj).val(key);return false};if(location.href.match(/page\=ws-plugin--s2member/)){$("input.ws-plugin--s2member-update-roles-button, input.ws-plugin--s2member-reset-roles-button").click(function(){var $this=$(this);$this.val("one moment please ...");var levels='';var resetUpdate=($this.hasClass("ws-plugin--s2member-reset-roles-button"))?"Reset":"Update";$.post(ajaxurl,{action:"ws_plugin__s2member_update_roles_via_ajax",ws_plugin__s2member_update_roles_via_ajax:''},function(response){if(response==="1"){alert("s2Member's Roles/Capabilities "+((resetUpdate.toLowerCase()==="reset")?"have been successfully reset":"updated successfully")+".\nYour installation of s2Member has Membership Levels 0-"+levels+"."),$this.val(resetUpdate+" Roles/Capabilities")}else{if(response==="l"){alert("Sorry, your request failed.\ns2Member's Roles/Capabilities are locked by Filter:\nws_plugin__s2member_lock_roles_caps"),$this.val(resetUpdate+" Roles/Capabilities")}else{alert("Sorry, your request failed.\nAccess denied. Do you have the ability to `create_users`?"),$this.val(resetUpdate+" Roles/Capabilities")}}});return false})}if(location.href.match(/page\=ws-plugin--s2member-logs/)){$("input#ws-plugin--s2member-gateway-debug-logs-extensive-1").click(function(){var $this=$(this),thisChecked=(this.checked)?true:false;if(thisChecked){$("input#ws-plugin--s2member-gateway-debug-logs-1").attr("checked","checked")}});var $toggles=$("a.ws-plugin--s2member-log-file-viewport-toggle");$toggles.click(function(){$("textarea#ws-plugin--s2member-log-file-viewer").each(function(){var $viewer=$(this);if($viewer.attr("data-state")!=="expanded"){$viewer.css({height:($viewer.prop("scrollHeight")+50)+"px","overflow-y":"auto"});$toggles.html("⇑ normalize viewport ❙");$viewer.attr("data-state","expanded")}else{$viewer.css({height:"auto","overflow-y":"scroll"});$toggles.html("⇓ expand viewport ⇓");$viewer.attr("data-state","scrolling")}});return false})}if(location.href.match(/page\=ws-plugin--s2member-mms-ops/)){$("select#ws-plugin--s2member-mms-registration-file").change(function(){if($(this).val()==="wp-signup"){var gv=$("select#ws-plugin--s2member-mms-registration-grants").val(),l0v=$("input#ws-plugin--s2member-mms-registration-blogs-level0").val();$("div#ws-plugin--s2member-mms-registration-support-package-details-wrapper").show(),$("div.ws-plugin--s2member-mms-registration-wp-login, table.ws-plugin--s2member-mms-registration-wp-login").hide(),$("div.ws-plugin--s2member-mms-registration-wp-signup, table.ws-plugin--s2member-mms-registration-wp-signup").show();$("div.ws-plugin--s2member-mms-registration-wp-signup-blogs-level0, table.ws-plugin--s2member-mms-registration-wp-signup-blogs-level0")[((gv==="all")?"show":"hide")]();$("input#ws-plugin--s2member-mms-registration-blogs-level0").val(((gv==="all")?((l0v>0)?l0v:"1"):"0"))}else{if($(this).val()==="wp-login"){var gv=$("select#ws-plugin--s2member-mms-registration-grants").val(),l0v=$("input#ws-plugin--s2member-mms-registration-blogs-level0").val();$("div#ws-plugin--s2member-mms-registration-support-package-details-wrapper").hide(),$("div.ws-plugin--s2member-mms-registration-wp-login, table.ws-plugin--s2member-mms-registration-wp-login").show(),$("div.ws-plugin--s2member-mms-registration-wp-signup, table.ws-plugin--s2member-mms-registration-wp-signup").hide();$("div.ws-plugin--s2member-mms-registration-wp-signup-blogs-level0, table.ws-plugin--s2member-mms-registration-wp-signup-blogs-level0").hide();$("input#ws-plugin--s2member-mms-registration-blogs-level0").val("0")}}}).trigger("change");$("select#ws-plugin--s2member-mms-registration-grants").change(function(){$("select#ws-plugin--s2member-mms-registration-file").trigger("change")})}if(location.href.match(/page\=ws-plugin--s2member-gen-ops/)){ws_plugin__s2member_enableSecurityKey=function(){if(confirm("Edit Key? Are you sure?\nThis could break your installation!\n\n*Note* If you've been testing s2Member, feel free to change this Key before you go live. Just don't go live, and then change it. You'll have unhappy Customers. Data corruption WILL occur! For your safety, s2Member keeps a history of the last 10 Keys that you've used. If you get yourself into a real situation, s2Member will let you revert back to a previous Key.")){$("input#ws-plugin--s2member-sec-encryption-key").removeAttr("disabled")}return false};ws_plugin__s2member_securityKeyHistory=function(){$("div#ws-plugin--s2member-sec-encryption-key-history").toggle();return false};$("select#ws-plugin--s2member-new-user-emails-enabled").change(function(){var $pluggable=$("input#ws-plugin--s2member-pluggables-wp-new-user-notification"),$this=$(this),$newUserEmails=$("div#ws-plugin--s2member-new-user-emails");if($pluggable.val()==="0"||$this.val()==="0"){($pluggable.val()==="0")?$this.attr("disabled","disabled"):$this.removeAttr("disabled");$(":input",$newUserEmails).attr("disabled","disabled"),$newUserEmails.css("opacity","0.5")}else{$this.removeAttr("disabled"),$(":input",$newUserEmails).removeAttr("disabled"),$newUserEmails.css("opacity","")}}).trigger("change");$("select#ws-plugin--s2member-login-reg-design-enabled").change(function(){var $this=$(this),$loginRegDesign=$("div#ws-plugin--s2member-login-reg-design");if($this.val()==="0"){$(":input",$loginRegDesign).attr("disabled","disabled"),$loginRegDesign.css("opacity","0.5"),$loginRegDesign.hide()}else{$(":input",$loginRegDesign).removeAttr("disabled"),$loginRegDesign.css("opacity",""),$loginRegDesign.show()}}).trigger("change");if($("input#ws-plugin--s2member-custom-reg-fields").length&&$("div#ws-plugin--s2member-custom-reg-field-configuration").length){(function(){var i,fieldDefaults,tools,table,$tools,$table;var $fields=$("input#ws-plugin--s2member-custom-reg-fields");var $configuration=$("div#ws-plugin--s2member-custom-reg-field-configuration");var fields=($fields.val())?$.JSON.parse($fields.val()):[];fields=(fields instanceof Array)?fields:[];fieldDefaults={section:"no",sectitle:"",id:"",label:"",type:"text",deflt:"",options:"",expected:"",required:"yes",levels:"all",editable:"yes",classes:"",styles:"",attrs:""};for(i=0;i',table='
'."\n"; - echo '
'."\n"; - echo 'Auto-generated Passwords are recommended for best security; i.e., this also serves as a form of email confirmation.'."\n"; + echo '
'."\n"; + echo 'Note: Custom passwords are easier for users. However, auto-generated passwords are recommended for best security; i.e., auto-generated passwords also serve as a form of email confirmation.'."\n"; echo (is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && is_main_site()) ? '
* For security purposes, Custom Passwords are not possible on the Main Site of a Blog Farm. [?]'."\n" : ''; echo (c_ws_plugin__s2member_utils_conds::bp_is_installed()) ? '
* Does not affect BuddyPress registration form (always yes with BuddyPress registration).'."\n" : ''; + echo '
'."\n"; + echo '
'."\n"; + echo '
'."\n"; + echo 'Note: Minimum characters and password strength also impact profile updates, so it\'s a good idea to configure these even if you\'re using auto-generated passwords during registration.
'."\n"; + echo 'Minimum characters: '."\n"; + echo 'Minimum strength: '."\n"; + echo '
'."\n"; echo '
';$configuration.html(tools+table);$tools=$("div#ws-plugin--s2member-custom-reg-field-configuration-tools"),$table=$("table#ws-plugin--s2member-custom-reg-field-configuration-table");ws_plugin__s2member_customRegFieldSectionChange=function(select){var section=$(select).val();var sectitle_trs="tr.ws-plugin--s2member-custom-reg-field-configuration-tools-form-sectitle";(section==="yes")?$(sectitle_trs).css("display",""):$(sectitle_trs).css("display","none")};ws_plugin__s2member_customRegFieldTypeChange=function(select){var type=$(select).val();var deflt_trs="tr.ws-plugin--s2member-custom-reg-field-configuration-tools-form-deflt",options_trs="tr.ws-plugin--s2member-custom-reg-field-configuration-tools-form-options",expected_trs="tr.ws-plugin--s2member-custom-reg-field-configuration-tools-form-expected";(type.match(/^(text|textarea)$/))?$(deflt_trs).css("display",""):$(deflt_trs).css("display","none");(type.match(/^(select|selects|checkboxes|radios)$/))?$(options_trs).css("display",""):$(options_trs).css("display","none");(type.match(/^(text|textarea)$/))?$(expected_trs).css("display",""):$(expected_trs).css("display","none")};ws_plugin__s2member_customRegFieldDelete=function(index){var newFields=new Array();for(var i=0;i\<]/)){errors.push('CSS Styles:\nContains invalid characters. Please try again.\n(do NOT use these characters: = " < >)')}if(field.attrs&&field.attrs.match(/[\>\<]/)){errors.push("Other Attributes:\nContains invalid characters. Please try again.\n(do NOT use these characters: < >)")}if(errors.length>0){alert(errors.join("\n\n"));return false}else{return field}};var updateFields=function(){$fields.val(((fields.length>0)?$.JSON.stringify(fields):""))};var fieldId2Var=function(fieldId){return(typeof fieldId==="string")?$.trim(fieldId).toLowerCase().replace(/[^a-z0-9]/g,"_"):""};var fieldTypeDesc=function(type){var types={text:"Text (single line)",textarea:"Textarea (multi-line)",select:"Select Menu (drop-down)",selects:"Select Menu (multi-option)",checkbox:"Checkbox (single)",pre_checkbox:"Checkbox (pre-checked)",checkboxes:"Checkboxes (multi-option)",radios:"Radio Buttons (multi-option)"};if(typeof types[type]==="string"){return types[type]}return""};var fieldIdExists=function(fieldId){for(var i=0;iAdd New Field';tb_remove(),$("div#ws-plugin--s2member-custom-reg-field-configuration-thickbox-tools-form").remove();if(displayForm){form+='
';form+='';form+="";form+='';form+='";form+="";form+='';form+='";form+="";form+='';form+='";form+='";form+="";form+='';form+='';form+='";form+="";form+='';form+='";form+="";form+='';form+='';form+='";form+="";form+='';form+='";form+="";form+='';form+='';form+='";form+="";form+='';form+='";form+="";form+='';form+='';form+='";form+="";form+='';form+='";form+="";form+='';form+='";form+='";form+="";form+='";form+='";form+="";form+='';form+='";form+='";form+="";form+='";form+='";form+="";form+='';form+='";form+='";form+="";form+='";form+='";form+="";form+='';form+='';form+='";form+="";form+='';form+='";form+="";form+='';form+='';form+='";form+="";form+='';form+='";form+="";form+='';form+='';form+='";form+="";form+='';form+='";form+="";form+='';form+='';form+='";form+="";form+='';form+='";form+="";form+='';form+='';form+='";form+="";form+='';form+='";form+="";form+='';form+='';form+='";form+='";form+="";form+="";form+="
';form+='';form+="
';form+='
";form+="Optional. Allows Fields to be grouped into sections.";form+="
 
';form+='';form+="
';form+='
";form+="The options below may change, based on the Field Type you choose here.";form+="
 
';form+='';form+="
';form+='
';form+="Examples: Choose Country, Street Address";form+="
 
';form+='';form+="
';form+='
';form+="Examples: country_code, street_address
";form+='e.g., [s2Get user_field="country_code" /]';form+="
 
';form+='';form+="
';form+='
";form+='If yes, only Users/Members will be "required" to enter this field.
';form+="* Administrators are exempt from this requirement.";form+="
 
';form+='';form+="
';form+='
';form+="Please use comma-delimited Level #'s: 0,1,2,3,4 or type: all.
";form+="This allows you to enable this field - only at specific Membership Levels.";form+="
 
';form+='';form+="
';form+='
";form+="If No, this field will be un-editable after registration.
";form+="* Administrators are exempt from this.";form+="
 
';form+='';form+="
';form+='
';form+="Example: my-style-1 my-style-2";form+="
 
';form+='';form+="
';form+='
';form+="Example: color:#000000; background:#FFFFFF;";form+="
 
';form+='';form+="
';form+='
';form+='Example: onkeyup="" onblur=""';form+="
 
';form+='';form+="';form+='';form+="
";form+="
";$("body").append(form);tb_show(((editing)?"Editing Registration/Profile Field":"New Custom Registration/Profile Field"),"#TB_inline?inlineId=ws-plugin--s2member-custom-reg-field-configuration-thickbox-tools-form");$("table#ws-plugin--s2member-custom-reg-field-configuration-tools-form").show()}$tools.html(html)};var buildTable=function(){var l=fields.length,i=0,html="",eo="o";html+="";html+="";html+="Order";html+="Field Type";html+="Unique ID";html+="Required";html+="Levels";html+="- Tools -";html+="";if(fields.length>0){for(i=0;i';html+='';html+=''+esc_html(fieldTypeDesc(fields[i].type))+"";html+=''+esc_html(fields[i].id)+"";html+=''+esc_html(fields[i].required)+"";html+=''+esc_html(fields[i].levels)+"";html+='';html+=""}}else{html+="";html+='No Custom Fields are configured.';html+=""}html+="";$table.html(html)};buildTools(),buildTable()})()}}if(location.href.match(/page\=ws-plugin--s2member-res-ops/)){$("input#ws-plugin--s2member-brute-force-restrictions-reset-button").click(function(){var $this=$(this);$this.val("one moment please ...");$.post(ajaxurl,{action:"ws_plugin__s2member_delete_reset_all_ip_restrictions_via_ajax",ws_plugin__s2member_delete_reset_all_ip_restrictions_via_ajax:''},function(response){alert("s2Member's Brute Force Restriction Logs have all been reset."),$this.val("Reset Brute Force Logs")});return false});$("input#ws-plugin--s2member-ip-restrictions-reset-button").click(function(){var $this=$(this);$this.val("one moment please ...");$.post(ajaxurl,{action:"ws_plugin__s2member_delete_reset_all_ip_restrictions_via_ajax",ws_plugin__s2member_delete_reset_all_ip_restrictions_via_ajax:''},function(response){alert("s2Member's IP Restriction Logs have all been reset."),$this.val("Reset IP Restriction Logs")});return false});$('div.ws-plugin--s2member-query-level-access-section input[type="checkbox"][name="ws_plugin__s2member_filter_wp_query[]"]').change(function(){var thisChange=$(this).val();$('div.ws-plugin--s2member-query-level-access-section input[type="checkbox"][name="ws_plugin__s2member_filter_wp_query[]"]').each(function(){var $this=$(this),val=$this.val(),checkboxes='input[type="checkbox"]';if(val==="all"&&this.checked){$this.nextAll(checkboxes).attr({checked:"checked",disabled:"disabled"})}else{if(val==="all"&&!this.checked){$this.nextAll(checkboxes).removeAttr("disabled");(thisChange==="all")?$this.nextAll(checkboxes).removeAttr("checked"):null}}})}).last().trigger("change")}if(location.href.match(/page\=ws-plugin--s2member-down-ops/)){var updateCloudFrontPrivateKey=function(){var $hiddenPrivateKey=$("input#ws-plugin--s2member-amazon-cf-files-private-key");var $visiblePrivateKeyEntry=$("textarea#ws-plugin--s2member-amazon-cf-files-private-key-entry");var hiddenPrivateKeyValue=$.trim($hiddenPrivateKey.val()),visiblePrivateKeyEntryValue=$.trim($visiblePrivateKeyEntry.val());if((hiddenPrivateKeyValue&&!visiblePrivateKeyEntryValue)||visiblePrivateKeyEntryValue.match(/[^\r\n\u25CF]/)){$hiddenPrivateKey.val(visiblePrivateKeyEntryValue),$visiblePrivateKeyEntry.val(visiblePrivateKeyEntryValue.replace(/[^\r\n]/g,String.fromCharCode(9679)))}};$("form#ws-plugin--s2member-options-form").submit(updateCloudFrontPrivateKey);$("textarea#ws-plugin--s2member-amazon-cf-files-private-key-entry").change(updateCloudFrontPrivateKey).trigger("change");var updateCloudFrontDistroCfgs=function(){var $hiddenPrivateKey=$("input#ws-plugin--s2member-amazon-cf-files-private-key");var $visiblePrivateKeyId=$("input#ws-plugin--s2member-amazon-cf-files-private-key-id");var $autoConfigDistros=$("input#ws-plugin--s2member-amazon-cf-files-auto-configure-distros");var $autoConfigDistrosStatus=$("input#ws-plugin--s2member-amazon-cf-files-distros-auto-config-status");var autoConfigDistrosStatusValue=$.trim($autoConfigDistrosStatus.val());var hiddenPrivateKeyValue=$.trim($hiddenPrivateKey.val()),visiblePrivateKeyIdValue=$.trim($visiblePrivateKeyId.val());var hiddenPrivateKeyPrevConfigValue=$.trim($hiddenPrivateKey.attr("data-s-prev-config-value")),visiblePrivateKeyIdPrevConfigValue=$.trim($visiblePrivateKeyId.attr("data-s-prev-config-value"));if(autoConfigDistrosStatusValue==="configured"&&((visiblePrivateKeyIdPrevConfigValue&&visiblePrivateKeyIdValue!==visiblePrivateKeyIdPrevConfigValue)||(hiddenPrivateKeyPrevConfigValue&&hiddenPrivateKeyValue!==hiddenPrivateKeyPrevConfigValue))){alert("s2Member will need to delete and re-configure your Amazon CloudFront distributions if you change this. When you're done editing, click (Save All Changes) below.");$autoConfigDistros.attr("checked","checked")}else{if(autoConfigDistrosStatusValue!=="configured"&&visiblePrivateKeyIdValue&&hiddenPrivateKeyValue){alert("s2Member will need to auto-configure your Amazon CloudFront distributions for you. When you're done editing, click (Save All Changes) below.");$autoConfigDistros.attr("checked","checked")}}};$("input#ws-plugin--s2member-amazon-cf-files-private-key-id").change(updateCloudFrontDistroCfgs);$("textarea#ws-plugin--s2member-amazon-cf-files-private-key-entry").change(updateCloudFrontDistroCfgs);$("input#ws-plugin--s2member-amazon-cf-files-auto-configure-distros-w-cnames").change(function(){var $this=$(this),thisChecked=(this.checked)?true:false;var $autoConfigDistros=$("input#ws-plugin--s2member-amazon-cf-files-auto-configure-distros");var $autoConfigDistroCnames=$("div#ws-plugin--s2member-amazon-cf-files-auto-configure-distro-cnames");(thisChecked)?$autoConfigDistroCnames.show():$autoConfigDistroCnames.hide();(thisChecked)?$autoConfigDistros.attr("checked","checked"):null}).trigger("change")}if(location.href.match(/page\=ws-plugin--s2member-paypal-ops/)){$("select#ws-plugin--s2member-auto-eot-system-enabled").change(function(){var $this=$(this),val=$this.val();var $viaCron=$("p#ws-plugin--s2member-auto-eot-system-enabled-via-cron");if(val==2){$viaCron.show()}else{$viaCron.hide()}})}if(location.href.match(/page\=ws-plugin--s2member-paypal-buttons/)){$("div.ws-menu-page select[id]").filter(function(){return this.id.match(/^ws-plugin--s2member-(level[1-9][0-9]*|modification)-term$/)}).change(function(){var button=this.id.replace(/^ws-plugin--s2member-(.+?)-term$/g,"$1");var trialDisabled=($(this).val().split("-")[2].replace(/[^0-1BN]/g,"")==="BN")?1:0;$("p#ws-plugin--s2member-"+button+"-trial-line").css("display",(trialDisabled?"none":""));$("span#ws-plugin--s2member-"+button+"-trial-then").css("display",(trialDisabled?"none":""));$("span#ws-plugin--s2member-"+button+"-20p-rule").css("display",(trialDisabled?"none":""));(trialDisabled)?$("input#ws-plugin--s2member-"+button+"-trial-period").val(0):null;(trialDisabled)?$("input#ws-plugin--s2member-"+button+"-trial-amount").val("0.00"):null});$("div.ws-menu-page input[id]").filter(function(){return this.id.match(/^ws-plugin--s2member-(level[1-9][0-9]*|modification|ccap)-ccaps$/)}).keyup(function(){var value=this.value.replace(/^(-all|-al|-a|-)[;,]*/gi,""),_all=(this.value.match(/^(-all|-al|-a|-)[;,]*/i))?"-all,":"";if(value.match(/[^a-z_0-9,]/)){this.value=_all+$.trim($.trim(value).replace(/[ \-]/g,"_").replace(/[^a-z_0-9,]/gi,"").toLowerCase())}});ws_plugin__s2member_paypalButtonGenerate=function(button){var shortCodeTemplate='[s2Member-PayPal-Button %%attrs%% image="default" output="button" /]',shortCodeTemplateAttrs="",labels={};eval("");var shortCode=$("input#ws-plugin--s2member-"+button+"-shortcode");var code=$("textarea#ws-plugin--s2member-"+button+"-button");var modLevel=$("select#ws-plugin--s2member-modification-level");var level=(button==="modification")?modLevel.val().split(":",2)[1]:button.replace(/^level/,"");var label=labels["level"+level].replace(/"/g,"");var desc=$.trim($("input#ws-plugin--s2member-"+button+"-desc").val().replace(/"/g,""));var trialAmount=$("input#ws-plugin--s2member-"+button+"-trial-amount").val().replace(/[^0-9\.]/g,"");var trialPeriod=$("input#ws-plugin--s2member-"+button+"-trial-period").val().replace(/[^0-9]/g,"");var trialTerm=$("select#ws-plugin--s2member-"+button+"-trial-term").val().replace(/[^A-Z]/g,"");var regAmount=$("input#ws-plugin--s2member-"+button+"-amount").val().replace(/[^0-9\.]/g,"");var regPeriod=$("select#ws-plugin--s2member-"+button+"-term").val().split("-")[0].replace(/[^0-9]/g,"");var regTerm=$("select#ws-plugin--s2member-"+button+"-term").val().split("-")[1].replace(/[^A-Z]/g,"");var regRecur=$("select#ws-plugin--s2member-"+button+"-term").val().split("-")[2].replace(/[^0-1BN]/g,"");var regRecurTimes="",regRecurRetry="1";var localeCode="",digital="0",noShipping="1";var pageStyle=$.trim($("input#ws-plugin--s2member-"+button+"-page-style").val().replace(/"/g,""));var currencyCode=$("select#ws-plugin--s2member-"+button+"-currency").val().replace(/[^A-Z]/g,"");var cCaps=$.trim($.trim($("input#ws-plugin--s2member-"+button+"-ccaps").val()).replace(/^(-all|-al|-a|-)[;,]*/gi,"").replace(/[ \-]/g,"_").replace(/[^a-z_0-9,]/gi,"").toLowerCase());cCaps=($.trim($("input#ws-plugin--s2member-"+button+"-ccaps").val()).match(/^(-all|-al|-a|-)[;,]*/i))?((cCaps)?"-all,":"-all")+cCaps.toLowerCase():cCaps.toLowerCase();trialPeriod=(regRecur==="BN")?"0":trialPeriod;trialAmount=(!trialAmount||isNaN(trialAmount)||trialAmount<0.01||trialPeriod<=0)?"0":trialAmount;var levelCcapsPer=(regRecur==="BN"&®Term!=="L")?level+":"+cCaps+":"+regPeriod+" "+regTerm:level+":"+cCaps;levelCcapsPer=levelCcapsPer.replace(/\:+$/g,"");if(trialAmount!=="0"&&(isNaN(trialAmount)||trialAmount<0)){alert("— Oops, a slight problem: —\n\nWhen provided, Trial Amount must be >= 0.00");return false}else{if(trialAmount!=="0"&&trialAmount>10000&¤cyCode.toUpperCase()==="USD"){alert("— Oops, a slight problem: —\n\nMaximum Trial Amount is: 10000.00");return false}else{if(trialTerm==="D"&&trialPeriod>90){alert("— Oops, a slight problem: —\n\nMaximum Trial Days is: 90.\nIf you want to offer more than 90 days, please choose Weeks or Months from the drop-down.");return false}else{if(trialTerm==="W"&&trialPeriod>52){alert("— Oops, a slight problem: —\n\nMaximum Trial Weeks is: 52.\nIf you want to offer more than 52 weeks, please choose Months from the drop-down.");return false}else{if(trialTerm==="M"&&trialPeriod>24){alert("— Oops, a slight problem: —\n\nMaximum Trial Months is: 24.\nIf you want to offer more than 24 months, please choose Years from the drop-down.");return false}else{if(trialTerm==="Y"&&trialPeriod>5){alert("— Oops, a slight problem: —\n\nMax Trial Period Years is: 5.");return false}else{if(!regAmount||isNaN(regAmount)||regAmount<0.01){alert("— Oops, a slight problem: —\n\nAmount must be >= 0.01");return false}else{if(regAmount>10000&¤cyCode.toUpperCase()==="USD"){alert("— Oops, a slight problem: —\n\nMaximum Amount is: 10000.00");return false}else{if(!desc){alert("— Oops, a slight problem: —\n\nPlease type a Description for this Button.");return false}}}}}}}}}code.html(code.val().replace(/ \<\!--(\)--\>/g," $1"));(parseInt(trialPeriod)<=0)?code.html(code.val().replace(/ (\)/g," ")):null;(regRecur==="BN")?code.html(code.val().replace(/ (\)/g," $1_xclick$3")):null;(regRecur==="BN")?code.html(code.val().replace(/ (\)/g," ")):null;(regRecur!=="BN")?code.html(code.val().replace(/ (\)/g," $1_xclick-subscriptions$3")):null;(regRecur!=="BN")?code.html(code.val().replace(/ (\)/g," ")):null;shortCodeTemplateAttrs+=(button==="modification")?'modify="1" ':"";shortCodeTemplateAttrs+='level="'+esc_attr(level)+'" ccaps="'+esc_attr(cCaps)+'" desc="'+esc_attr(desc)+'" ps="'+esc_attr(pageStyle)+'" lc="'+esc_attr(localeCode)+'" cc="'+esc_attr(currencyCode)+'" dg="'+esc_attr(digital)+'" ns="'+esc_attr(noShipping)+'" custom=""';shortCodeTemplateAttrs+=' ta="'+esc_attr(trialAmount)+'" tp="'+esc_attr(trialPeriod)+'" tt="'+esc_attr(trialTerm)+'" ra="'+esc_attr(regAmount)+'" rp="'+esc_attr(regPeriod)+'" rt="'+esc_attr(regTerm)+'" rr="'+esc_attr(regRecur)+'" rrt="'+esc_attr(regRecurTimes)+'" rra="'+esc_attr(regRecurRetry)+'"';shortCode.val(shortCodeTemplate.replace(/%%attrs%%/,shortCodeTemplateAttrs));code.html(code.val().replace(/ name\="lc" value\="(.*?)"/,' name="lc" value="'+esc_attr(localeCode)+'"'));code.html(code.val().replace(/ name\="no_shipping" value\="(.*?)"/,' name="no_shipping" value="'+esc_attr(noShipping)+'"'));code.html(code.val().replace(/ name\="item_name" value\="(.*?)"/,' name="item_name" value="'+esc_attr(desc)+'"'));code.html(code.val().replace(/ name\="item_number" value\="(.*?)"/,' name="item_number" value="'+esc_attr(levelCcapsPer)+'"'));code.html(code.val().replace(/ name\="page_style" value\="(.*?)"/,' name="page_style" value="'+esc_attr(pageStyle)+'"'));code.html(code.val().replace(/ name\="currency_code" value\="(.*?)"/,' name="currency_code" value="'+esc_attr(currencyCode)+'"'));code.html(code.val().replace(/ name\="custom" value\="(.*?)"/,' name="custom" value=""'));code.html(code.val().replace(/ name\="modify" value\="(.*?)"/,' name="modify" value="'+((button==="modification")?"1":"0")+'"'));code.html(code.val().replace(/ name\="amount" value\="(.*?)"/,' name="amount" value="'+esc_attr(regAmount)+'"'));code.html(code.val().replace(/ name\="src" value\="(.*?)"/,' name="src" value="'+esc_attr(regRecur)+'"'));code.html(code.val().replace(/ name\="srt" value\="(.*?)"/,' name="srt" value="'+esc_attr(regRecurTimes)+'"'));code.html(code.val().replace(/ name\="sra" value\="(.*?)"/,' name="sra" value="'+esc_attr(regRecurRetry)+'"'));code.html(code.val().replace(/ name\="a1" value\="(.*?)"/,' name="a1" value="'+esc_attr(trialAmount)+'"'));code.html(code.val().replace(/ name\="p1" value\="(.*?)"/,' name="p1" value="'+esc_attr(trialPeriod)+'"'));code.html(code.val().replace(/ name\="t1" value\="(.*?)"/,' name="t1" value="'+esc_attr(trialTerm)+'"'));code.html(code.val().replace(/ name\="a3" value\="(.*?)"/,' name="a3" value="'+esc_attr(regAmount)+'"'));code.html(code.val().replace(/ name\="p3" value\="(.*?)"/,' name="p3" value="'+esc_attr(regPeriod)+'"'));code.html(code.val().replace(/ name\="t3" value\="(.*?)"/,' name="t3" value="'+esc_attr(regTerm)+'"'));$("div#ws-plugin--s2member-"+button+"-button-prev").html(code.val().replace(/\
/g,Math.round(new Date().getTime())+'~').replace(/\<\?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_(ON0|OS0|ON1|OS1); \?\>/g,""));(button==="modification")?alert("Your Modification Button has been generated.\nPlease copy/paste the Shortcode into your Login Welcome Page, or wherever you feel it would be most appropriate.\n\n* Remember, Modification Buttons should be displayed to existing Users/Members, and they should be logged-in, BEFORE clicking this Button."):alert("Your Button has been generated.\nPlease copy/paste the Shortcode Format into your Membership Options Page.");shortCode.each(function(){this.focus(),this.select()});return false};ws_plugin__s2member_paypalCcapButtonGenerate=function(){var shortCodeTemplate='[s2Member-PayPal-Button %%attrs%% image="default" output="button" /]',shortCodeTemplateAttrs="";var shortCode=$("input#ws-plugin--s2member-ccap-shortcode");var code=$("textarea#ws-plugin--s2member-ccap-button");var desc=$.trim($("input#ws-plugin--s2member-ccap-desc").val().replace(/"/g,""));var regAmount=$("input#ws-plugin--s2member-ccap-amount").val().replace(/[^0-9\.]/g,"");var regPeriod=$("select#ws-plugin--s2member-ccap-term").val().split("-")[0].replace(/[^0-9]/g,"");var regTerm=$("select#ws-plugin--s2member-ccap-term").val().split("-")[1].replace(/[^A-Z]/g,"");var regRecur=$("select#ws-plugin--s2member-ccap-term").val().split("-")[2].replace(/[^0-1BN]/g,"");var localeCode="",digital="0",noShipping="1";var pageStyle=$.trim($("input#ws-plugin--s2member-ccap-page-style").val().replace(/"/g,""));var currencyCode=$("select#ws-plugin--s2member-ccap-currency").val().replace(/[^A-Z]/g,"");var cCaps=$.trim($.trim($("input#ws-plugin--s2member-ccap-ccaps").val()).replace(/^(-all|-al|-a|-)[;,]*/gi,"").replace(/[ \-]/g,"_").replace(/[^a-z_0-9,]/gi,"").toLowerCase());cCaps=($.trim($("input#ws-plugin--s2member-ccap-ccaps").val()).match(/^(-all|-al|-a|-)[;,]*/i))?((cCaps)?"-all,":"-all")+cCaps.toLowerCase():cCaps.toLowerCase();var levelCcapsPer=(regRecur==="BN"&®Term!=="L")?"*:"+cCaps+":"+regPeriod+" "+regTerm:"*:"+cCaps;levelCcapsPer=levelCcapsPer.replace(/\:+$/g,"");if(!cCaps||cCaps==="-all"){alert("— Oops, a slight problem: —\n\nPlease provide at least one Custom Capability.");return false}else{if(!regAmount||isNaN(regAmount)||regAmount<0.01){alert("— Oops, a slight problem: —\n\nAmount must be >= 0.01");return false}else{if(regAmount>10000&¤cyCode.toUpperCase()==="USD"){alert("— Oops, a slight problem: —\n\nMaximum Amount is: 10000.00");return false}else{if(!desc){alert("— Oops, a slight problem: —\n\nPlease type a Description for this Button.");return false}}}}shortCodeTemplateAttrs+='level="*" ccaps="'+esc_attr(cCaps)+'" desc="'+esc_attr(desc)+'" ps="'+esc_attr(pageStyle)+'" lc="'+esc_attr(localeCode)+'" cc="'+esc_attr(currencyCode)+'" dg="'+esc_attr(digital)+'" ns="'+esc_attr(noShipping)+'"';shortCodeTemplateAttrs+=' custom="" ra="'+esc_attr(regAmount)+'" rp="'+esc_attr(regPeriod)+'" rt="'+esc_attr(regTerm)+'" rr="'+esc_attr(regRecur)+'"';shortCode.val(shortCodeTemplate.replace(/%%attrs%%/,shortCodeTemplateAttrs));code.html(code.val().replace(/ name\="lc" value\="(.*?)"/,' name="lc" value="'+esc_attr(localeCode)+'"'));code.html(code.val().replace(/ name\="no_shipping" value\="(.*?)"/,' name="no_shipping" value="'+esc_attr(noShipping)+'"'));code.html(code.val().replace(/ name\="item_name" value\="(.*?)"/,' name="item_name" value="'+esc_attr(desc)+'"'));code.html(code.val().replace(/ name\="item_number" value\="(.*?)"/,' name="item_number" value="'+esc_attr(levelCcapsPer)+'"'));code.html(code.val().replace(/ name\="page_style" value\="(.*?)"/,' name="page_style" value="'+esc_attr(pageStyle)+'"'));code.html(code.val().replace(/ name\="currency_code" value\="(.*?)"/,' name="currency_code" value="'+esc_attr(currencyCode)+'"'));code.html(code.val().replace(/ name\="custom" value\="(.*?)"/,' name="custom" value=""'));code.html(code.val().replace(/ name\="amount" value\="(.*?)"/,' name="amount" value="'+esc_attr(regAmount)+'"'));$("div#ws-plugin--s2member-ccap-button-prev").html(code.val().replace(/\/g,Math.round(new Date().getTime())+'~').replace(/\<\?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_(ON0|OS0|ON1|OS1); \?\>/g,""));alert("Your Button has been generated.\nPlease copy/paste the Shortcode into your Login Welcome Page, or wherever you feel it would be most appropriate.\n\n* Remember, Independent Custom Capability Buttons should ONLY be displayed to existing Users/Members, and they MUST be logged-in, BEFORE clicking this Button.");shortCode.each(function(){this.focus(),this.select()});return false};ws_plugin__s2member_paypalSpButtonGenerate=function(){var shortCodeTemplate='[s2Member-PayPal-Button %%attrs%% image="default" output="button" /]',shortCodeTemplateAttrs="";var shortCode=$("input#ws-plugin--s2member-sp-shortcode");var code=$("textarea#ws-plugin--s2member-sp-button");var leading=$("select#ws-plugin--s2member-sp-leading-id").val().replace(/[^0-9]/g,"");var additionals=$("select#ws-plugin--s2member-sp-additional-ids").val()||[];var hours=$("select#ws-plugin--s2member-sp-hours").val().replace(/[^0-9]/g,"");var regAmount=$("input#ws-plugin--s2member-sp-amount").val().replace(/[^0-9\.]/g,"");var desc=$.trim($("input#ws-plugin--s2member-sp-desc").val().replace(/"/g,""));var localeCode="",digital="0",noShipping="1";var pageStyle=$.trim($("input#ws-plugin--s2member-sp-page-style").val().replace(/"/g,""));var currencyCode=$("select#ws-plugin--s2member-sp-currency").val().replace(/[^A-Z]/g,"");if(!leading){alert("— Oops, a slight problem: —\n\nPlease select a Leading Post/Page.\n\n*Tip* If there are no Posts/Pages in the menu, it's because you've not configured s2Member for Specific Post/Page Access yet. See: s2Member → Restriction Options → Specific Post/Page Access.");return false}else{if(!regAmount||isNaN(regAmount)||regAmount<0.01){alert("— Oops, a slight problem: —\n\nAmount must be >= 0.01");return false}else{if(regAmount>10000&¤cyCode.toUpperCase()==="USD"){alert("— Oops, a slight problem: —\n\nMaximum Amount is: 10000.00");return false}else{if(!desc){alert("— Oops, a slight problem: —\n\nPlease type a Description for this Button.");return false}}}}for(var i=0,ids=leading;i"'));code.html(code.val().replace(/ name\="amount" value\="(.*?)"/,' name="amount" value="'+esc_attr(regAmount)+'"'));$("div#ws-plugin--s2member-sp-button-prev").html(code.val().replace(/\/g,Math.round(new Date().getTime())+'~').replace(/\<\?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_(ON0|OS0|ON1|OS1); \?\>/g,""));alert("Your Button has been generated.\nPlease copy/paste the Shortcode into your WordPress Editor.");shortCode.each(function(){this.focus(),this.select()});return false};ws_plugin__s2member_paypalRegLinkGenerate=function(){var level=$("select#ws-plugin--s2member-reg-link-level").val().replace(/[^0-9]/g,"");var subscrID=$.trim($("input#ws-plugin--s2member-reg-link-subscr-id").val());var custom=$.trim($("input#ws-plugin--s2member-reg-link-custom").val());var cCaps=$.trim($.trim($("input#ws-plugin--s2member-reg-link-ccaps").val()).replace(/[ \-]/g,"_").replace(/[^a-z_0-9,]/gi,"").toLowerCase());var fixedTerm=$.trim($("input#ws-plugin--s2member-reg-link-fixed-term").val().replace(/[^A-Z 0-9]/gi,"").toUpperCase());var $link=$("p#ws-plugin--s2member-reg-link"),$loading=$("img#ws-plugin--s2member-reg-link-loading");var levelCcapsPer=(fixedTerm&&!fixedTerm.match(/L$/))?level+":"+cCaps+":"+fixedTerm:level+":"+cCaps;levelCcapsPer=levelCcapsPer.replace(/\:+$/g,"");if(!subscrID){alert("— Oops, a slight problem: —\n\nPaid Subscr. ID is a required value.");return false}else{if(!custom||custom.indexOf('')!==0){alert("— Oops, a slight problem: —\n\nThe Custom Value MUST start with your domain name.");return false}else{if(fixedTerm&&!fixedTerm.match(/^[1-9]+ (D|W|M|Y|L)$/)){alert("— Oops, a slight problem: —\n\nThe Fixed Term Length is not formatted properly.");return false}}}$link.hide(),$loading.show(),$.post(ajaxurl,{action:"ws_plugin__s2member_reg_access_link_via_ajax",ws_plugin__s2member_reg_access_link_via_ajax:'',s2member_reg_access_link_subscr_gateway:"paypal",s2member_reg_access_link_subscr_id:subscrID,s2member_reg_access_link_custom:custom,s2member_reg_access_link_item_number:levelCcapsPer},function(response){$link.show().html(''+esc_html(response)+""),$loading.hide()});return false};ws_plugin__s2member_paypalSpLinkGenerate=function(){var leading=$("select#ws-plugin--s2member-sp-link-leading-id").val().replace(/[^0-9]/g,"");var additionals=$("select#ws-plugin--s2member-sp-link-additional-ids").val()||[];var hours=$("select#ws-plugin--s2member-sp-link-hours").val().replace(/[^0-9]/g,"");var $link=$("p#ws-plugin--s2member-sp-link"),$loading=$("img#ws-plugin--s2member-sp-link-loading");if(!leading){alert("— Oops, a slight problem: —\n\nPlease select a Leading Post/Page.\n\n*Tip* If there are no Posts/Pages in the menu, it's because you've not configured s2Member for Specific Post/Page Access yet. See: s2Member → Restriction Options → Specific Post/Page Access.");return false}for(var i=0,ids=leading;i',s2member_sp_access_link_ids:ids,s2member_sp_access_link_hours:hours},function(response){$link.show().html(''+esc_html(response)+""),$loading.hide()});return false}}if(location.href.match(/page\=ws-plugin--s2member-els-ops/)){$("select#ws-plugin--s2member-custom-reg-opt-in").change(function(){var $this=$(this),val=$this.val();var $rows=$("tr.ws-plugin--s2member-custom-reg-opt-in-label-row");var $prevImg=$("img.ws-plugin--s2member-custom-reg-opt-in-label-prev-img");if(val<=0){$rows.css("display","none"),$prevImg.attr("src",$prevImg.attr("src").replace(/\/checked\.png$/,"/unchecked.png"))}else{if(val==1){$rows.css("display",""),$prevImg.attr("src",$prevImg.attr("src").replace(/\/unchecked\.png$/,"/checked.png"))}else{if(val==2){$rows.css("display",""),$prevImg.attr("src",$prevImg.attr("src").replace(/\/checked\.png$/,"/unchecked.png"))}}}});$('div.ws-plugin--s2member-opt-out-section input[type="checkbox"][name="ws_plugin__s2member_custom_reg_auto_opt_outs[]"]').change(function(){var thisChange=$(this).val(),checkedIndexes=[];$('div.ws-plugin--s2member-opt-out-section input[type="checkbox"][name="ws_plugin__s2member_custom_reg_auto_opt_outs[]"]').each(function(){var $this=$(this),val=$this.val(),checkboxes='input[type="checkbox"]';if(val==="removal-deletion"&&this.checked){$this.nextAll(checkboxes).slice(0,2).attr({checked:"checked",disabled:"disabled"})}else{if(val==="removal-deletion"&&!this.checked){$this.nextAll(checkboxes).slice(0,2).removeAttr("disabled");(thisChange==="removal-deletion")?$this.nextAll(checkboxes).slice(0,2).removeAttr("checked"):null}else{if(val==="modification"&&this.checked){$this.nextAll(checkboxes).slice(0,3).attr({checked:"checked",disabled:"disabled"})}else{if(val==="modification"&&!this.checked){(thisChange==="modification")?$this.nextAll(checkboxes).slice(0,3).removeAttr("checked"):null;$this.nextAll(checkboxes).slice(0,3).removeAttr("disabled")}}}}}).each(function(index){(this.checked)?checkedIndexes.push(index):null});$("select#ws-plugin--s2member-custom-reg-auto-opt-out-transitions").removeAttr("disabled");if($.inArray(3,checkedIndexes)===-1&&$.inArray(4,checkedIndexes)===-1&&$.inArray(5,checkedIndexes)===-1&&$.inArray(6,checkedIndexes)===-1){$("select#ws-plugin--s2member-custom-reg-auto-opt-out-transitions").attr("disabled","disabled")}}).last().trigger("change")}}); \ No newline at end of file +jQuery(document).ready(function($){var esc_attr=esc_html=function(string){if(/[&\<\>"']/.test(string=String(string))){string=string.replace(/&/g,"&").replace(//g,">"),string=string.replace(/"/g,""").replace(/'/g,"'")}return string};ws_plugin__s2member_generateSecurityKey=function(obj){if(!obj){obj="#ws-plugin--s2member-sec-encryption-key"}var mt_rand=function(min,max){min=(arguments.length<1)?0:min;max=(arguments.length<2)?2147483647:max;return Math.floor(Math.random()*(max-min+1))+min};var chars="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#%^&*()";for(var i=0,key="";i<64;i++){key+=chars.substr(mt_rand(0,chars.length-1),1)}$(obj).val(key);return false};if(location.href.match(/page\=ws-plugin--s2member/)){$("input.ws-plugin--s2member-update-roles-button, input.ws-plugin--s2member-reset-roles-button").click(function(){var $this=$(this);$this.val("one moment please ...");var levels='';var resetUpdate=($this.hasClass("ws-plugin--s2member-reset-roles-button"))?"Reset":"Update";$.post(ajaxurl,{action:"ws_plugin__s2member_update_roles_via_ajax",ws_plugin__s2member_update_roles_via_ajax:''},function(response){if(response==="1"){alert("s2Member's Roles/Capabilities "+((resetUpdate.toLowerCase()==="reset")?"have been successfully reset":"updated successfully")+".\nYour installation of s2Member has Membership Levels 0-"+levels+"."),$this.val(resetUpdate+" Roles/Capabilities")}else{if(response==="l"){alert("Sorry, your request failed.\ns2Member's Roles/Capabilities are locked by Filter:\nws_plugin__s2member_lock_roles_caps"),$this.val(resetUpdate+" Roles/Capabilities")}else{alert("Sorry, your request failed.\nAccess denied. Do you have the ability to `create_users`?"),$this.val(resetUpdate+" Roles/Capabilities")}}});return false});$("#ws-plugin--s2member-custom-reg-password").on("change",function(){$("#ws-plugin--s2member-custom-reg-password-settings").css("opacity",$(this).val()==="1"?"1":"0.9")}).trigger("change")}if(location.href.match(/page\=ws-plugin--s2member-logs/)){$("input#ws-plugin--s2member-gateway-debug-logs-extensive-1").click(function(){var $this=$(this),thisChecked=(this.checked)?true:false;if(thisChecked){$("input#ws-plugin--s2member-gateway-debug-logs-1").attr("checked","checked")}});var $toggles=$("a.ws-plugin--s2member-log-file-viewport-toggle");$toggles.click(function(){$("textarea#ws-plugin--s2member-log-file-viewer").each(function(){var $viewer=$(this);if($viewer.attr("data-state")!=="expanded"){$viewer.css({height:($viewer.prop("scrollHeight")+50)+"px","overflow-y":"auto"});$toggles.html("⇑ normalize viewport ❙");$viewer.attr("data-state","expanded")}else{$viewer.css({height:"auto","overflow-y":"scroll"});$toggles.html("⇓ expand viewport ⇓");$viewer.attr("data-state","scrolling")}});return false})}if(location.href.match(/page\=ws-plugin--s2member-mms-ops/)){$("select#ws-plugin--s2member-mms-registration-file").change(function(){if($(this).val()==="wp-signup"){var gv=$("select#ws-plugin--s2member-mms-registration-grants").val(),l0v=$("input#ws-plugin--s2member-mms-registration-blogs-level0").val();$("div#ws-plugin--s2member-mms-registration-support-package-details-wrapper").show(),$("div.ws-plugin--s2member-mms-registration-wp-login, table.ws-plugin--s2member-mms-registration-wp-login").hide(),$("div.ws-plugin--s2member-mms-registration-wp-signup, table.ws-plugin--s2member-mms-registration-wp-signup").show();$("div.ws-plugin--s2member-mms-registration-wp-signup-blogs-level0, table.ws-plugin--s2member-mms-registration-wp-signup-blogs-level0")[((gv==="all")?"show":"hide")]();$("input#ws-plugin--s2member-mms-registration-blogs-level0").val(((gv==="all")?((l0v>0)?l0v:"1"):"0"))}else{if($(this).val()==="wp-login"){var gv=$("select#ws-plugin--s2member-mms-registration-grants").val(),l0v=$("input#ws-plugin--s2member-mms-registration-blogs-level0").val();$("div#ws-plugin--s2member-mms-registration-support-package-details-wrapper").hide(),$("div.ws-plugin--s2member-mms-registration-wp-login, table.ws-plugin--s2member-mms-registration-wp-login").show(),$("div.ws-plugin--s2member-mms-registration-wp-signup, table.ws-plugin--s2member-mms-registration-wp-signup").hide();$("div.ws-plugin--s2member-mms-registration-wp-signup-blogs-level0, table.ws-plugin--s2member-mms-registration-wp-signup-blogs-level0").hide();$("input#ws-plugin--s2member-mms-registration-blogs-level0").val("0")}}}).trigger("change");$("select#ws-plugin--s2member-mms-registration-grants").change(function(){$("select#ws-plugin--s2member-mms-registration-file").trigger("change")})}if(location.href.match(/page\=ws-plugin--s2member-gen-ops/)){ws_plugin__s2member_enableSecurityKey=function(){if(confirm("Edit Key? Are you sure?\nThis could break your installation!\n\n*Note* If you've been testing s2Member, feel free to change this Key before you go live. Just don't go live, and then change it. You'll have unhappy Customers. Data corruption WILL occur! For your safety, s2Member keeps a history of the last 10 Keys that you've used. If you get yourself into a real situation, s2Member will let you revert back to a previous Key.")){$("input#ws-plugin--s2member-sec-encryption-key").removeAttr("disabled")}return false};ws_plugin__s2member_securityKeyHistory=function(){$("div#ws-plugin--s2member-sec-encryption-key-history").toggle();return false};$("select#ws-plugin--s2member-new-user-emails-enabled").change(function(){var $pluggable=$("input#ws-plugin--s2member-pluggables-wp-new-user-notification"),$this=$(this),$newUserEmails=$("div#ws-plugin--s2member-new-user-emails");if($pluggable.val()==="0"||$this.val()==="0"){($pluggable.val()==="0")?$this.attr("disabled","disabled"):$this.removeAttr("disabled");$(":input",$newUserEmails).attr("disabled","disabled"),$newUserEmails.css("opacity","0.5")}else{$this.removeAttr("disabled"),$(":input",$newUserEmails).removeAttr("disabled"),$newUserEmails.css("opacity","")}}).trigger("change");$("select#ws-plugin--s2member-login-reg-design-enabled").change(function(){var $this=$(this),$loginRegDesign=$("div#ws-plugin--s2member-login-reg-design");if($this.val()==="0"){$(":input",$loginRegDesign).attr("disabled","disabled"),$loginRegDesign.css("opacity","0.5"),$loginRegDesign.hide()}else{$(":input",$loginRegDesign).removeAttr("disabled"),$loginRegDesign.css("opacity",""),$loginRegDesign.show()}}).trigger("change");if($("input#ws-plugin--s2member-custom-reg-fields").length&&$("div#ws-plugin--s2member-custom-reg-field-configuration").length){(function(){var i,fieldDefaults,tools,table,$tools,$table;var $fields=$("input#ws-plugin--s2member-custom-reg-fields");var $configuration=$("div#ws-plugin--s2member-custom-reg-field-configuration");var fields=($fields.val())?$.JSON.parse($fields.val()):[];fields=(fields instanceof Array)?fields:[];fieldDefaults={section:"no",sectitle:"",id:"",label:"",type:"text",deflt:"",options:"",expected:"",required:"yes",levels:"all",editable:"yes",classes:"",styles:"",attrs:""};for(i=0;i
',table='
';$configuration.html(tools+table);$tools=$("div#ws-plugin--s2member-custom-reg-field-configuration-tools"),$table=$("table#ws-plugin--s2member-custom-reg-field-configuration-table");ws_plugin__s2member_customRegFieldSectionChange=function(select){var section=$(select).val();var sectitle_trs="tr.ws-plugin--s2member-custom-reg-field-configuration-tools-form-sectitle";(section==="yes")?$(sectitle_trs).css("display",""):$(sectitle_trs).css("display","none")};ws_plugin__s2member_customRegFieldTypeChange=function(select){var type=$(select).val();var deflt_trs="tr.ws-plugin--s2member-custom-reg-field-configuration-tools-form-deflt",options_trs="tr.ws-plugin--s2member-custom-reg-field-configuration-tools-form-options",expected_trs="tr.ws-plugin--s2member-custom-reg-field-configuration-tools-form-expected";(type.match(/^(text|textarea)$/))?$(deflt_trs).css("display",""):$(deflt_trs).css("display","none");(type.match(/^(select|selects|checkboxes|radios)$/))?$(options_trs).css("display",""):$(options_trs).css("display","none");(type.match(/^(text|textarea)$/))?$(expected_trs).css("display",""):$(expected_trs).css("display","none")};ws_plugin__s2member_customRegFieldDelete=function(index){var newFields=new Array();for(var i=0;i\<]/)){errors.push('CSS Styles:\nContains invalid characters. Please try again.\n(do NOT use these characters: = " < >)')}if(field.attrs&&field.attrs.match(/[\>\<]/)){errors.push("Other Attributes:\nContains invalid characters. Please try again.\n(do NOT use these characters: < >)")}if(errors.length>0){alert(errors.join("\n\n"));return false}else{return field}};var updateFields=function(){$fields.val(((fields.length>0)?$.JSON.stringify(fields):""))};var fieldId2Var=function(fieldId){return(typeof fieldId==="string")?$.trim(fieldId).toLowerCase().replace(/[^a-z0-9]/g,"_"):""};var fieldTypeDesc=function(type){var types={text:"Text (single line)",textarea:"Textarea (multi-line)",select:"Select Menu (drop-down)",selects:"Select Menu (multi-option)",checkbox:"Checkbox (single)",pre_checkbox:"Checkbox (pre-checked)",checkboxes:"Checkboxes (multi-option)",radios:"Radio Buttons (multi-option)"};if(typeof types[type]==="string"){return types[type]}return""};var fieldIdExists=function(fieldId){for(var i=0;iAdd New Field';tb_remove(),$("div#ws-plugin--s2member-custom-reg-field-configuration-thickbox-tools-form").remove();if(displayForm){form+='
';form+='';form+="";form+='';form+='";form+="";form+='';form+='";form+="";form+='';form+='";form+='";form+="";form+='';form+='';form+='";form+="";form+='';form+='";form+="";form+='';form+='';form+='";form+="";form+='';form+='";form+="";form+='';form+='';form+='";form+="";form+='';form+='";form+="";form+='';form+='';form+='";form+="";form+='';form+='";form+="";form+='';form+='";form+='";form+="";form+='";form+='";form+="";form+='';form+='";form+='";form+="";form+='";form+='";form+="";form+='';form+='";form+='";form+="";form+='";form+='";form+="";form+='';form+='';form+='";form+="";form+='';form+='";form+="";form+='';form+='';form+='";form+="";form+='';form+='";form+="";form+='';form+='';form+='";form+="";form+='';form+='";form+="";form+='';form+='';form+='";form+="";form+='';form+='";form+="";form+='';form+='';form+='";form+="";form+='';form+='";form+="";form+='';form+='';form+='";form+='";form+="";form+="";form+="
';form+='';form+="
';form+='
";form+="Optional. Allows Fields to be grouped into sections.";form+="
 
';form+='';form+="
';form+='
";form+="The options below may change, based on the Field Type you choose here.";form+="
 
';form+='';form+="
';form+='
';form+="Examples: Choose Country, Street Address";form+="
 
';form+='';form+="
';form+='
';form+="Examples: country_code, street_address
";form+='e.g., [s2Get user_field="country_code" /]';form+="
 
';form+='';form+="
';form+='
";form+='If yes, only Users/Members will be "required" to enter this field.
';form+="* Administrators are exempt from this requirement.";form+="
 
';form+='';form+="
';form+='
';form+="Please use comma-delimited Level #'s: 0,1,2,3,4 or type: all.
";form+="This allows you to enable this field - only at specific Membership Levels.";form+="
 
';form+='';form+="
';form+='
";form+="If No, this field will be un-editable after registration.
";form+="* Administrators are exempt from this.";form+="
 
';form+='';form+="
';form+='
';form+="Example: my-style-1 my-style-2";form+="
 
';form+='';form+="
';form+='
';form+="Example: color:#000000; background:#FFFFFF;";form+="
 
';form+='';form+="
';form+='
';form+='Example: onkeyup="" onblur=""';form+="
 
';form+='';form+="';form+='';form+="
";form+="
";$("body").append(form);tb_show(((editing)?"Editing Registration/Profile Field":"New Custom Registration/Profile Field"),"#TB_inline?inlineId=ws-plugin--s2member-custom-reg-field-configuration-thickbox-tools-form");$("table#ws-plugin--s2member-custom-reg-field-configuration-tools-form").show()}$tools.html(html)};var buildTable=function(){var l=fields.length,i=0,html="",eo="o";html+="";html+="";html+="Order";html+="Field Type";html+="Unique ID";html+="Required";html+="Levels";html+="- Tools -";html+="";if(fields.length>0){for(i=0;i';html+='';html+=''+esc_html(fieldTypeDesc(fields[i].type))+"";html+=''+esc_html(fields[i].id)+"";html+=''+esc_html(fields[i].required)+"";html+=''+esc_html(fields[i].levels)+"";html+='';html+=""}}else{html+="";html+='No Custom Fields are configured.';html+=""}html+="";$table.html(html)};buildTools(),buildTable()})()}}if(location.href.match(/page\=ws-plugin--s2member-res-ops/)){$("input#ws-plugin--s2member-brute-force-restrictions-reset-button").click(function(){var $this=$(this);$this.val("one moment please ...");$.post(ajaxurl,{action:"ws_plugin__s2member_delete_reset_all_ip_restrictions_via_ajax",ws_plugin__s2member_delete_reset_all_ip_restrictions_via_ajax:''},function(response){alert("s2Member's Brute Force Restriction Logs have all been reset."),$this.val("Reset Brute Force Logs")});return false});$("input#ws-plugin--s2member-ip-restrictions-reset-button").click(function(){var $this=$(this);$this.val("one moment please ...");$.post(ajaxurl,{action:"ws_plugin__s2member_delete_reset_all_ip_restrictions_via_ajax",ws_plugin__s2member_delete_reset_all_ip_restrictions_via_ajax:''},function(response){alert("s2Member's IP Restriction Logs have all been reset."),$this.val("Reset IP Restriction Logs")});return false});$('div.ws-plugin--s2member-query-level-access-section input[type="checkbox"][name="ws_plugin__s2member_filter_wp_query[]"]').change(function(){var thisChange=$(this).val();$('div.ws-plugin--s2member-query-level-access-section input[type="checkbox"][name="ws_plugin__s2member_filter_wp_query[]"]').each(function(){var $this=$(this),val=$this.val(),checkboxes='input[type="checkbox"]';if(val==="all"&&this.checked){$this.nextAll(checkboxes).attr({checked:"checked",disabled:"disabled"})}else{if(val==="all"&&!this.checked){$this.nextAll(checkboxes).removeAttr("disabled");(thisChange==="all")?$this.nextAll(checkboxes).removeAttr("checked"):null}}})}).last().trigger("change")}if(location.href.match(/page\=ws-plugin--s2member-down-ops/)){var updateCloudFrontPrivateKey=function(){var $hiddenPrivateKey=$("input#ws-plugin--s2member-amazon-cf-files-private-key");var $visiblePrivateKeyEntry=$("textarea#ws-plugin--s2member-amazon-cf-files-private-key-entry");var hiddenPrivateKeyValue=$.trim($hiddenPrivateKey.val()),visiblePrivateKeyEntryValue=$.trim($visiblePrivateKeyEntry.val());if((hiddenPrivateKeyValue&&!visiblePrivateKeyEntryValue)||visiblePrivateKeyEntryValue.match(/[^\r\n\u25CF]/)){$hiddenPrivateKey.val(visiblePrivateKeyEntryValue),$visiblePrivateKeyEntry.val(visiblePrivateKeyEntryValue.replace(/[^\r\n]/g,String.fromCharCode(9679)))}};$("form#ws-plugin--s2member-options-form").submit(updateCloudFrontPrivateKey);$("textarea#ws-plugin--s2member-amazon-cf-files-private-key-entry").change(updateCloudFrontPrivateKey).trigger("change");var updateCloudFrontDistroCfgs=function(){var $hiddenPrivateKey=$("input#ws-plugin--s2member-amazon-cf-files-private-key");var $visiblePrivateKeyId=$("input#ws-plugin--s2member-amazon-cf-files-private-key-id");var $autoConfigDistros=$("input#ws-plugin--s2member-amazon-cf-files-auto-configure-distros");var $autoConfigDistrosStatus=$("input#ws-plugin--s2member-amazon-cf-files-distros-auto-config-status");var autoConfigDistrosStatusValue=$.trim($autoConfigDistrosStatus.val());var hiddenPrivateKeyValue=$.trim($hiddenPrivateKey.val()),visiblePrivateKeyIdValue=$.trim($visiblePrivateKeyId.val());var hiddenPrivateKeyPrevConfigValue=$.trim($hiddenPrivateKey.attr("data-s-prev-config-value")),visiblePrivateKeyIdPrevConfigValue=$.trim($visiblePrivateKeyId.attr("data-s-prev-config-value"));if(autoConfigDistrosStatusValue==="configured"&&((visiblePrivateKeyIdPrevConfigValue&&visiblePrivateKeyIdValue!==visiblePrivateKeyIdPrevConfigValue)||(hiddenPrivateKeyPrevConfigValue&&hiddenPrivateKeyValue!==hiddenPrivateKeyPrevConfigValue))){alert("s2Member will need to delete and re-configure your Amazon CloudFront distributions if you change this. When you're done editing, click (Save All Changes) below.");$autoConfigDistros.attr("checked","checked")}else{if(autoConfigDistrosStatusValue!=="configured"&&visiblePrivateKeyIdValue&&hiddenPrivateKeyValue){alert("s2Member will need to auto-configure your Amazon CloudFront distributions for you. When you're done editing, click (Save All Changes) below.");$autoConfigDistros.attr("checked","checked")}}};$("input#ws-plugin--s2member-amazon-cf-files-private-key-id").change(updateCloudFrontDistroCfgs);$("textarea#ws-plugin--s2member-amazon-cf-files-private-key-entry").change(updateCloudFrontDistroCfgs);$("input#ws-plugin--s2member-amazon-cf-files-auto-configure-distros-w-cnames").change(function(){var $this=$(this),thisChecked=(this.checked)?true:false;var $autoConfigDistros=$("input#ws-plugin--s2member-amazon-cf-files-auto-configure-distros");var $autoConfigDistroCnames=$("div#ws-plugin--s2member-amazon-cf-files-auto-configure-distro-cnames");(thisChecked)?$autoConfigDistroCnames.show():$autoConfigDistroCnames.hide();(thisChecked)?$autoConfigDistros.attr("checked","checked"):null}).trigger("change")}if(location.href.match(/page\=ws-plugin--s2member-paypal-ops/)){$("select#ws-plugin--s2member-auto-eot-system-enabled").change(function(){var $this=$(this),val=$this.val();var $viaCron=$("p#ws-plugin--s2member-auto-eot-system-enabled-via-cron");if(val==2){$viaCron.show()}else{$viaCron.hide()}})}if(location.href.match(/page\=ws-plugin--s2member-paypal-buttons/)){$("div.ws-menu-page select[id]").filter(function(){return this.id.match(/^ws-plugin--s2member-(level[1-9][0-9]*|modification)-term$/)}).change(function(){var button=this.id.replace(/^ws-plugin--s2member-(.+?)-term$/g,"$1");var trialDisabled=($(this).val().split("-")[2].replace(/[^0-1BN]/g,"")==="BN")?1:0;$("p#ws-plugin--s2member-"+button+"-trial-line").css("display",(trialDisabled?"none":""));$("span#ws-plugin--s2member-"+button+"-trial-then").css("display",(trialDisabled?"none":""));$("span#ws-plugin--s2member-"+button+"-20p-rule").css("display",(trialDisabled?"none":""));(trialDisabled)?$("input#ws-plugin--s2member-"+button+"-trial-period").val(0):null;(trialDisabled)?$("input#ws-plugin--s2member-"+button+"-trial-amount").val("0.00"):null});$("div.ws-menu-page input[id]").filter(function(){return this.id.match(/^ws-plugin--s2member-(level[1-9][0-9]*|modification|ccap)-ccaps$/)}).keyup(function(){var value=this.value.replace(/^(-all|-al|-a|-)[;,]*/gi,""),_all=(this.value.match(/^(-all|-al|-a|-)[;,]*/i))?"-all,":"";if(value.match(/[^a-z_0-9,]/)){this.value=_all+$.trim($.trim(value).replace(/[ \-]/g,"_").replace(/[^a-z_0-9,]/gi,"").toLowerCase())}});ws_plugin__s2member_paypalButtonGenerate=function(button){var shortCodeTemplate='[s2Member-PayPal-Button %%attrs%% image="default" output="button" /]',shortCodeTemplateAttrs="",labels={};eval("");var shortCode=$("input#ws-plugin--s2member-"+button+"-shortcode");var code=$("textarea#ws-plugin--s2member-"+button+"-button");var modLevel=$("select#ws-plugin--s2member-modification-level");var level=(button==="modification")?modLevel.val().split(":",2)[1]:button.replace(/^level/,"");var label=labels["level"+level].replace(/"/g,"");var desc=$.trim($("input#ws-plugin--s2member-"+button+"-desc").val().replace(/"/g,""));var trialAmount=$("input#ws-plugin--s2member-"+button+"-trial-amount").val().replace(/[^0-9\.]/g,"");var trialPeriod=$("input#ws-plugin--s2member-"+button+"-trial-period").val().replace(/[^0-9]/g,"");var trialTerm=$("select#ws-plugin--s2member-"+button+"-trial-term").val().replace(/[^A-Z]/g,"");var regAmount=$("input#ws-plugin--s2member-"+button+"-amount").val().replace(/[^0-9\.]/g,"");var regPeriod=$("select#ws-plugin--s2member-"+button+"-term").val().split("-")[0].replace(/[^0-9]/g,"");var regTerm=$("select#ws-plugin--s2member-"+button+"-term").val().split("-")[1].replace(/[^A-Z]/g,"");var regRecur=$("select#ws-plugin--s2member-"+button+"-term").val().split("-")[2].replace(/[^0-1BN]/g,"");var regRecurTimes="",regRecurRetry="1";var localeCode="",digital="0",noShipping="1";var pageStyle=$.trim($("input#ws-plugin--s2member-"+button+"-page-style").val().replace(/"/g,""));var currencyCode=$("select#ws-plugin--s2member-"+button+"-currency").val().replace(/[^A-Z]/g,"");var cCaps=$.trim($.trim($("input#ws-plugin--s2member-"+button+"-ccaps").val()).replace(/^(-all|-al|-a|-)[;,]*/gi,"").replace(/[ \-]/g,"_").replace(/[^a-z_0-9,]/gi,"").toLowerCase());cCaps=($.trim($("input#ws-plugin--s2member-"+button+"-ccaps").val()).match(/^(-all|-al|-a|-)[;,]*/i))?((cCaps)?"-all,":"-all")+cCaps.toLowerCase():cCaps.toLowerCase();trialPeriod=(regRecur==="BN")?"0":trialPeriod;trialAmount=(!trialAmount||isNaN(trialAmount)||trialAmount<0.01||trialPeriod<=0)?"0":trialAmount;var levelCcapsPer=(regRecur==="BN"&®Term!=="L")?level+":"+cCaps+":"+regPeriod+" "+regTerm:level+":"+cCaps;levelCcapsPer=levelCcapsPer.replace(/\:+$/g,"");if(trialAmount!=="0"&&(isNaN(trialAmount)||trialAmount<0)){alert("— Oops, a slight problem: —\n\nWhen provided, Trial Amount must be >= 0.00");return false}else{if(trialAmount!=="0"&&trialAmount>10000&¤cyCode.toUpperCase()==="USD"){alert("— Oops, a slight problem: —\n\nMaximum Trial Amount is: 10000.00");return false}else{if(trialTerm==="D"&&trialPeriod>90){alert("— Oops, a slight problem: —\n\nMaximum Trial Days is: 90.\nIf you want to offer more than 90 days, please choose Weeks or Months from the drop-down.");return false}else{if(trialTerm==="W"&&trialPeriod>52){alert("— Oops, a slight problem: —\n\nMaximum Trial Weeks is: 52.\nIf you want to offer more than 52 weeks, please choose Months from the drop-down.");return false}else{if(trialTerm==="M"&&trialPeriod>24){alert("— Oops, a slight problem: —\n\nMaximum Trial Months is: 24.\nIf you want to offer more than 24 months, please choose Years from the drop-down.");return false}else{if(trialTerm==="Y"&&trialPeriod>5){alert("— Oops, a slight problem: —\n\nMax Trial Period Years is: 5.");return false}else{if(!regAmount||isNaN(regAmount)||regAmount<0.01){alert("— Oops, a slight problem: —\n\nAmount must be >= 0.01");return false}else{if(regAmount>10000&¤cyCode.toUpperCase()==="USD"){alert("— Oops, a slight problem: —\n\nMaximum Amount is: 10000.00");return false}else{if(!desc){alert("— Oops, a slight problem: —\n\nPlease type a Description for this Button.");return false}}}}}}}}}code.html(code.val().replace(/ \<\!--(\)--\>/g," $1"));(parseInt(trialPeriod)<=0)?code.html(code.val().replace(/ (\)/g," ")):null;(regRecur==="BN")?code.html(code.val().replace(/ (\)/g," $1_xclick$3")):null;(regRecur==="BN")?code.html(code.val().replace(/ (\)/g," ")):null;(regRecur!=="BN")?code.html(code.val().replace(/ (\)/g," $1_xclick-subscriptions$3")):null;(regRecur!=="BN")?code.html(code.val().replace(/ (\)/g," ")):null;shortCodeTemplateAttrs+=(button==="modification")?'modify="1" ':"";shortCodeTemplateAttrs+='level="'+esc_attr(level)+'" ccaps="'+esc_attr(cCaps)+'" desc="'+esc_attr(desc)+'" ps="'+esc_attr(pageStyle)+'" lc="'+esc_attr(localeCode)+'" cc="'+esc_attr(currencyCode)+'" dg="'+esc_attr(digital)+'" ns="'+esc_attr(noShipping)+'" custom=""';shortCodeTemplateAttrs+=' ta="'+esc_attr(trialAmount)+'" tp="'+esc_attr(trialPeriod)+'" tt="'+esc_attr(trialTerm)+'" ra="'+esc_attr(regAmount)+'" rp="'+esc_attr(regPeriod)+'" rt="'+esc_attr(regTerm)+'" rr="'+esc_attr(regRecur)+'" rrt="'+esc_attr(regRecurTimes)+'" rra="'+esc_attr(regRecurRetry)+'"';shortCode.val(shortCodeTemplate.replace(/%%attrs%%/,shortCodeTemplateAttrs));code.html(code.val().replace(/ name\="lc" value\="(.*?)"/,' name="lc" value="'+esc_attr(localeCode)+'"'));code.html(code.val().replace(/ name\="no_shipping" value\="(.*?)"/,' name="no_shipping" value="'+esc_attr(noShipping)+'"'));code.html(code.val().replace(/ name\="item_name" value\="(.*?)"/,' name="item_name" value="'+esc_attr(desc)+'"'));code.html(code.val().replace(/ name\="item_number" value\="(.*?)"/,' name="item_number" value="'+esc_attr(levelCcapsPer)+'"'));code.html(code.val().replace(/ name\="page_style" value\="(.*?)"/,' name="page_style" value="'+esc_attr(pageStyle)+'"'));code.html(code.val().replace(/ name\="currency_code" value\="(.*?)"/,' name="currency_code" value="'+esc_attr(currencyCode)+'"'));code.html(code.val().replace(/ name\="custom" value\="(.*?)"/,' name="custom" value=""'));code.html(code.val().replace(/ name\="modify" value\="(.*?)"/,' name="modify" value="'+((button==="modification")?"1":"0")+'"'));code.html(code.val().replace(/ name\="amount" value\="(.*?)"/,' name="amount" value="'+esc_attr(regAmount)+'"'));code.html(code.val().replace(/ name\="src" value\="(.*?)"/,' name="src" value="'+esc_attr(regRecur)+'"'));code.html(code.val().replace(/ name\="srt" value\="(.*?)"/,' name="srt" value="'+esc_attr(regRecurTimes)+'"'));code.html(code.val().replace(/ name\="sra" value\="(.*?)"/,' name="sra" value="'+esc_attr(regRecurRetry)+'"'));code.html(code.val().replace(/ name\="a1" value\="(.*?)"/,' name="a1" value="'+esc_attr(trialAmount)+'"'));code.html(code.val().replace(/ name\="p1" value\="(.*?)"/,' name="p1" value="'+esc_attr(trialPeriod)+'"'));code.html(code.val().replace(/ name\="t1" value\="(.*?)"/,' name="t1" value="'+esc_attr(trialTerm)+'"'));code.html(code.val().replace(/ name\="a3" value\="(.*?)"/,' name="a3" value="'+esc_attr(regAmount)+'"'));code.html(code.val().replace(/ name\="p3" value\="(.*?)"/,' name="p3" value="'+esc_attr(regPeriod)+'"'));code.html(code.val().replace(/ name\="t3" value\="(.*?)"/,' name="t3" value="'+esc_attr(regTerm)+'"'));$("div#ws-plugin--s2member-"+button+"-button-prev").html(code.val().replace(/\/g,Math.round(new Date().getTime())+'~').replace(/\<\?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_(ON0|OS0|ON1|OS1); \?\>/g,""));(button==="modification")?alert("Your Modification Button has been generated.\nPlease copy/paste the Shortcode into your Login Welcome Page, or wherever you feel it would be most appropriate.\n\n* Remember, Modification Buttons should be displayed to existing Users/Members, and they should be logged-in, BEFORE clicking this Button."):alert("Your Button has been generated.\nPlease copy/paste the Shortcode Format into your Membership Options Page.");shortCode.each(function(){this.focus(),this.select()});return false};ws_plugin__s2member_paypalCcapButtonGenerate=function(){var shortCodeTemplate='[s2Member-PayPal-Button %%attrs%% image="default" output="button" /]',shortCodeTemplateAttrs="";var shortCode=$("input#ws-plugin--s2member-ccap-shortcode");var code=$("textarea#ws-plugin--s2member-ccap-button");var desc=$.trim($("input#ws-plugin--s2member-ccap-desc").val().replace(/"/g,""));var regAmount=$("input#ws-plugin--s2member-ccap-amount").val().replace(/[^0-9\.]/g,"");var regPeriod=$("select#ws-plugin--s2member-ccap-term").val().split("-")[0].replace(/[^0-9]/g,"");var regTerm=$("select#ws-plugin--s2member-ccap-term").val().split("-")[1].replace(/[^A-Z]/g,"");var regRecur=$("select#ws-plugin--s2member-ccap-term").val().split("-")[2].replace(/[^0-1BN]/g,"");var localeCode="",digital="0",noShipping="1";var pageStyle=$.trim($("input#ws-plugin--s2member-ccap-page-style").val().replace(/"/g,""));var currencyCode=$("select#ws-plugin--s2member-ccap-currency").val().replace(/[^A-Z]/g,"");var cCaps=$.trim($.trim($("input#ws-plugin--s2member-ccap-ccaps").val()).replace(/^(-all|-al|-a|-)[;,]*/gi,"").replace(/[ \-]/g,"_").replace(/[^a-z_0-9,]/gi,"").toLowerCase());cCaps=($.trim($("input#ws-plugin--s2member-ccap-ccaps").val()).match(/^(-all|-al|-a|-)[;,]*/i))?((cCaps)?"-all,":"-all")+cCaps.toLowerCase():cCaps.toLowerCase();var levelCcapsPer=(regRecur==="BN"&®Term!=="L")?"*:"+cCaps+":"+regPeriod+" "+regTerm:"*:"+cCaps;levelCcapsPer=levelCcapsPer.replace(/\:+$/g,"");if(!cCaps||cCaps==="-all"){alert("— Oops, a slight problem: —\n\nPlease provide at least one Custom Capability.");return false}else{if(!regAmount||isNaN(regAmount)||regAmount<0.01){alert("— Oops, a slight problem: —\n\nAmount must be >= 0.01");return false}else{if(regAmount>10000&¤cyCode.toUpperCase()==="USD"){alert("— Oops, a slight problem: —\n\nMaximum Amount is: 10000.00");return false}else{if(!desc){alert("— Oops, a slight problem: —\n\nPlease type a Description for this Button.");return false}}}}shortCodeTemplateAttrs+='level="*" ccaps="'+esc_attr(cCaps)+'" desc="'+esc_attr(desc)+'" ps="'+esc_attr(pageStyle)+'" lc="'+esc_attr(localeCode)+'" cc="'+esc_attr(currencyCode)+'" dg="'+esc_attr(digital)+'" ns="'+esc_attr(noShipping)+'"';shortCodeTemplateAttrs+=' custom="" ra="'+esc_attr(regAmount)+'" rp="'+esc_attr(regPeriod)+'" rt="'+esc_attr(regTerm)+'" rr="'+esc_attr(regRecur)+'"';shortCode.val(shortCodeTemplate.replace(/%%attrs%%/,shortCodeTemplateAttrs));code.html(code.val().replace(/ name\="lc" value\="(.*?)"/,' name="lc" value="'+esc_attr(localeCode)+'"'));code.html(code.val().replace(/ name\="no_shipping" value\="(.*?)"/,' name="no_shipping" value="'+esc_attr(noShipping)+'"'));code.html(code.val().replace(/ name\="item_name" value\="(.*?)"/,' name="item_name" value="'+esc_attr(desc)+'"'));code.html(code.val().replace(/ name\="item_number" value\="(.*?)"/,' name="item_number" value="'+esc_attr(levelCcapsPer)+'"'));code.html(code.val().replace(/ name\="page_style" value\="(.*?)"/,' name="page_style" value="'+esc_attr(pageStyle)+'"'));code.html(code.val().replace(/ name\="currency_code" value\="(.*?)"/,' name="currency_code" value="'+esc_attr(currencyCode)+'"'));code.html(code.val().replace(/ name\="custom" value\="(.*?)"/,' name="custom" value=""'));code.html(code.val().replace(/ name\="amount" value\="(.*?)"/,' name="amount" value="'+esc_attr(regAmount)+'"'));$("div#ws-plugin--s2member-ccap-button-prev").html(code.val().replace(/\/g,Math.round(new Date().getTime())+'~').replace(/\<\?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_(ON0|OS0|ON1|OS1); \?\>/g,""));alert("Your Button has been generated.\nPlease copy/paste the Shortcode into your Login Welcome Page, or wherever you feel it would be most appropriate.\n\n* Remember, Independent Custom Capability Buttons should ONLY be displayed to existing Users/Members, and they MUST be logged-in, BEFORE clicking this Button.");shortCode.each(function(){this.focus(),this.select()});return false};ws_plugin__s2member_paypalSpButtonGenerate=function(){var shortCodeTemplate='[s2Member-PayPal-Button %%attrs%% image="default" output="button" /]',shortCodeTemplateAttrs="";var shortCode=$("input#ws-plugin--s2member-sp-shortcode");var code=$("textarea#ws-plugin--s2member-sp-button");var leading=$("select#ws-plugin--s2member-sp-leading-id").val().replace(/[^0-9]/g,"");var additionals=$("select#ws-plugin--s2member-sp-additional-ids").val()||[];var hours=$("select#ws-plugin--s2member-sp-hours").val().replace(/[^0-9]/g,"");var regAmount=$("input#ws-plugin--s2member-sp-amount").val().replace(/[^0-9\.]/g,"");var desc=$.trim($("input#ws-plugin--s2member-sp-desc").val().replace(/"/g,""));var localeCode="",digital="0",noShipping="1";var pageStyle=$.trim($("input#ws-plugin--s2member-sp-page-style").val().replace(/"/g,""));var currencyCode=$("select#ws-plugin--s2member-sp-currency").val().replace(/[^A-Z]/g,"");if(!leading){alert("— Oops, a slight problem: —\n\nPlease select a Leading Post/Page.\n\n*Tip* If there are no Posts/Pages in the menu, it's because you've not configured s2Member for Specific Post/Page Access yet. See: s2Member → Restriction Options → Specific Post/Page Access.");return false}else{if(!regAmount||isNaN(regAmount)||regAmount<0.01){alert("— Oops, a slight problem: —\n\nAmount must be >= 0.01");return false}else{if(regAmount>10000&¤cyCode.toUpperCase()==="USD"){alert("— Oops, a slight problem: —\n\nMaximum Amount is: 10000.00");return false}else{if(!desc){alert("— Oops, a slight problem: —\n\nPlease type a Description for this Button.");return false}}}}for(var i=0,ids=leading;i"'));code.html(code.val().replace(/ name\="amount" value\="(.*?)"/,' name="amount" value="'+esc_attr(regAmount)+'"'));$("div#ws-plugin--s2member-sp-button-prev").html(code.val().replace(/\/g,Math.round(new Date().getTime())+'~').replace(/\<\?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_(ON0|OS0|ON1|OS1); \?\>/g,""));alert("Your Button has been generated.\nPlease copy/paste the Shortcode into your WordPress Editor.");shortCode.each(function(){this.focus(),this.select()});return false};ws_plugin__s2member_paypalRegLinkGenerate=function(){var level=$("select#ws-plugin--s2member-reg-link-level").val().replace(/[^0-9]/g,"");var subscrID=$.trim($("input#ws-plugin--s2member-reg-link-subscr-id").val());var custom=$.trim($("input#ws-plugin--s2member-reg-link-custom").val());var cCaps=$.trim($.trim($("input#ws-plugin--s2member-reg-link-ccaps").val()).replace(/[ \-]/g,"_").replace(/[^a-z_0-9,]/gi,"").toLowerCase());var fixedTerm=$.trim($("input#ws-plugin--s2member-reg-link-fixed-term").val().replace(/[^A-Z 0-9]/gi,"").toUpperCase());var $link=$("p#ws-plugin--s2member-reg-link"),$loading=$("img#ws-plugin--s2member-reg-link-loading");var levelCcapsPer=(fixedTerm&&!fixedTerm.match(/L$/))?level+":"+cCaps+":"+fixedTerm:level+":"+cCaps;levelCcapsPer=levelCcapsPer.replace(/\:+$/g,"");if(!subscrID){alert("— Oops, a slight problem: —\n\nPaid Subscr. ID is a required value.");return false}else{if(!custom||custom.indexOf('')!==0){alert("— Oops, a slight problem: —\n\nThe Custom Value MUST start with your domain name.");return false}else{if(fixedTerm&&!fixedTerm.match(/^[1-9]+ (D|W|M|Y|L)$/)){alert("— Oops, a slight problem: —\n\nThe Fixed Term Length is not formatted properly.");return false}}}$link.hide(),$loading.show(),$.post(ajaxurl,{action:"ws_plugin__s2member_reg_access_link_via_ajax",ws_plugin__s2member_reg_access_link_via_ajax:'',s2member_reg_access_link_subscr_gateway:"paypal",s2member_reg_access_link_subscr_id:subscrID,s2member_reg_access_link_custom:custom,s2member_reg_access_link_item_number:levelCcapsPer},function(response){$link.show().html(''+esc_html(response)+""),$loading.hide()});return false};ws_plugin__s2member_paypalSpLinkGenerate=function(){var leading=$("select#ws-plugin--s2member-sp-link-leading-id").val().replace(/[^0-9]/g,"");var additionals=$("select#ws-plugin--s2member-sp-link-additional-ids").val()||[];var hours=$("select#ws-plugin--s2member-sp-link-hours").val().replace(/[^0-9]/g,"");var $link=$("p#ws-plugin--s2member-sp-link"),$loading=$("img#ws-plugin--s2member-sp-link-loading");if(!leading){alert("— Oops, a slight problem: —\n\nPlease select a Leading Post/Page.\n\n*Tip* If there are no Posts/Pages in the menu, it's because you've not configured s2Member for Specific Post/Page Access yet. See: s2Member → Restriction Options → Specific Post/Page Access.");return false}for(var i=0,ids=leading;i',s2member_sp_access_link_ids:ids,s2member_sp_access_link_hours:hours},function(response){$link.show().html(''+esc_html(response)+""),$loading.hide()});return false}}if(location.href.match(/page\=ws-plugin--s2member-els-ops/)){$("select#ws-plugin--s2member-custom-reg-opt-in").change(function(){var $this=$(this),val=$this.val();var $rows=$("tr.ws-plugin--s2member-custom-reg-opt-in-label-row");var $prevImg=$("img.ws-plugin--s2member-custom-reg-opt-in-label-prev-img");if(val<=0){$rows.css("display","none"),$prevImg.attr("src",$prevImg.attr("src").replace(/\/checked\.png$/,"/unchecked.png"))}else{if(val==1){$rows.css("display",""),$prevImg.attr("src",$prevImg.attr("src").replace(/\/unchecked\.png$/,"/checked.png"))}else{if(val==2){$rows.css("display",""),$prevImg.attr("src",$prevImg.attr("src").replace(/\/checked\.png$/,"/unchecked.png"))}}}});$('div.ws-plugin--s2member-opt-out-section input[type="checkbox"][name="ws_plugin__s2member_custom_reg_auto_opt_outs[]"]').change(function(){var thisChange=$(this).val(),checkedIndexes=[];$('div.ws-plugin--s2member-opt-out-section input[type="checkbox"][name="ws_plugin__s2member_custom_reg_auto_opt_outs[]"]').each(function(){var $this=$(this),val=$this.val(),checkboxes='input[type="checkbox"]';if(val==="removal-deletion"&&this.checked){$this.nextAll(checkboxes).slice(0,2).attr({checked:"checked",disabled:"disabled"})}else{if(val==="removal-deletion"&&!this.checked){$this.nextAll(checkboxes).slice(0,2).removeAttr("disabled");(thisChange==="removal-deletion")?$this.nextAll(checkboxes).slice(0,2).removeAttr("checked"):null}else{if(val==="modification"&&this.checked){$this.nextAll(checkboxes).slice(0,3).attr({checked:"checked",disabled:"disabled"})}else{if(val==="modification"&&!this.checked){(thisChange==="modification")?$this.nextAll(checkboxes).slice(0,3).removeAttr("checked"):null;$this.nextAll(checkboxes).slice(0,3).removeAttr("disabled")}}}}}).each(function(index){(this.checked)?checkedIndexes.push(index):null});$("select#ws-plugin--s2member-custom-reg-auto-opt-out-transitions").removeAttr("disabled");if($.inArray(3,checkedIndexes)===-1&&$.inArray(4,checkedIndexes)===-1&&$.inArray(5,checkedIndexes)===-1&&$.inArray(6,checkedIndexes)===-1){$("select#ws-plugin--s2member-custom-reg-auto-opt-out-transitions").attr("disabled","disabled")}}).last().trigger("change")}}); \ No newline at end of file diff --git a/s2member/includes/menu-pages/menu-pages-s.js b/s2member/includes/menu-pages/menu-pages-s.js index a5a4fedc..344ae5ab 100644 --- a/s2member/includes/menu-pages/menu-pages-s.js +++ b/s2member/includes/menu-pages/menu-pages-s.js @@ -65,6 +65,9 @@ jQuery(document).ready(function($) }); return false; }); + $('#ws-plugin--s2member-custom-reg-password').on('change', function(){ + $('#ws-plugin--s2member-custom-reg-password-settings').css('opacity', $(this).val() === '1' ? '1' : '0.9'); + }).trigger('change'); } if(location.href.match(/page\=ws-plugin--s2member-logs/)) { @@ -1313,4 +1316,4 @@ jQuery(document).ready(function($) }).last().trigger('change'); } - }); \ No newline at end of file + }); diff --git a/s2member/includes/menu-pages/menu-pages.css b/s2member/includes/menu-pages/menu-pages.css index 8329a9a4..8a4e7530 100644 --- a/s2member/includes/menu-pages/menu-pages.css +++ b/s2member/includes/menu-pages/menu-pages.css @@ -806,6 +806,10 @@ table.ws-menu-page-table div.ws-menu-page-group table.form-table > tbody > tr > width : auto; padding : 0 0.5em 0 0; } +table.ws-menu-page-table div.ws-menu-page-group table.form-table > tbody > tr:not(:first-child) > th +{ + padding-top: 0.5em; +} table.ws-menu-page-table div.ws-menu-page-group table.form-table > tbody > tr > td { width : auto; diff --git a/s2member/includes/s2member-min.js b/s2member/includes/s2member-min.js index 8903b624..9f8cd728 100644 --- a/s2member/includes/s2member-min.js +++ b/s2member/includes/s2member-min.js @@ -1 +1 @@ -jQuery(document).ready(function(d){window.ws_plugin__s2member_skip_all_file_confirmations=window.ws_plugin__s2member_skip_all_file_confirmations||false;var c='',a='',b=ws_plugin__s2member_skip_all_file_confirmations?true:false,e=[];if(!b&&S2MEMBER_CURRENT_USER_IS_LOGGED_IN&&S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY',S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY,((S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY===1)?'':''),((S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS===1)?'':d.sprintf('',S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS)))+"\n\n";f+=(S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED)?'':d.sprintf('',S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED,((S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED===1)?'':''),((S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS===1)?'':d.sprintf('',S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS)));if((/s2member[_\-]skip[_\-]confirmation/i.test(this.href)&&!/s2member[_\-]skip[_\-]confirmation[\=\-](0|no|false)/i.test(this.href))||confirm(f)){if(d.inArray(this.href,e)===-1){S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY++,e.push(this.href)}return true}return false}return true})}if(!/\/wp-admin([\/?#]|$)/i.test(location.href)){d("input#ws-plugin--s2member-profile-password1, input#ws-plugin--s2member-profile-password2").keyup(function(){ws_plugin__s2member_passwordStrength(d("input#ws-plugin--s2member-profile-login"),d("input#ws-plugin--s2member-profile-password1"),d("input#ws-plugin--s2member-profile-password2"),d("div#ws-plugin--s2member-profile-password-strength"))});d("form#ws-plugin--s2member-profile").submit(function(){var h=this,g="",f="",l="",j=d("input#ws-plugin--s2member-profile-password1",h),i=d("input#ws-plugin--s2member-profile-password2",h);var k=d("input#ws-plugin--s2member-profile-submit",h);d(":input",h).each(function(){var m=d.trim(d(this).attr("id")).replace(/---[0-9]+$/g,"");if(m&&(g=d.trim(d('label[for="'+m+'"]',h).first().children("strong").first().text().replace(/[\r\n\t]+/g," ")))){if(f=ws_plugin__s2member_validationErrors(g,this,h)){l+=f+"\n\n"}}});if(l=d.trim(l)){alert('\n\n'+l);return false}else{if(d.trim(j.val())&&d.trim(j.val())!==d.trim(i.val())){alert('\n\n');return false}else{if(d.trim(j.val())&&d.trim(j.val()).length<6){alert('\n\n');return false}}}ws_plugin__s2member_animateProcessing(k);return true})}if(/\/wp-signup\.php/i.test(location.href)){d("div#content > div.mu_register > form#setupform").submit(function(){var h=this,g="",f="",j="",i=d('p.submit input[type="submit"]',h);d("input#user_email",h).attr("data-expected","email");d("input#user_name, input#user_email, input#blogname, input#blog_title, input#captcha_code",h).attr({"aria-required":"true"});d(":input",h).each(function(){var k=d.trim(d(this).attr("id")).replace(/---[0-9]+$/g,"");if(k&&(g=d.trim(d('label[for="'+k+'"]',h).first().text().replace(/[\r\n\t]+/g," ")))){if(f=ws_plugin__s2member_validationErrors(g,this,h)){j+=f+"\n\n"}}});if(j=d.trim(j)){alert('\n\n'+j);return false}ws_plugin__s2member_animateProcessing(i);return true})}if(/\/wp-login\.php/i.test(location.href)){d("div#login > form#registerform input#user_login").attr("tabindex","10");d("div#login > form#registerform input#user_email").attr("tabindex","20");d("div#login > form#registerform input#wp-submit").attr("tabindex","1000");d("input#ws-plugin--s2member-custom-reg-field-user-pass1, input#ws-plugin--s2member-custom-reg-field-user-pass2").keyup(function(){ws_plugin__s2member_passwordStrength(d("input#user_login"),d("input#ws-plugin--s2member-custom-reg-field-user-pass1"),d("input#ws-plugin--s2member-custom-reg-field-user-pass2"),d("div#ws-plugin--s2member-custom-reg-field-user-pass-strength"))});d("div#login > form#registerform").submit(function(){var h=this,g="",f="",l="",k=d('input#ws-plugin--s2member-custom-reg-field-user-pass1[aria-required="true"]',h),i=d("input#ws-plugin--s2member-custom-reg-field-user-pass2",h),j=d("input#wp-submit",h);d("input#user_email",h).attr("data-expected","email");d("input#user_login, input#user_email, input#captcha_code",h).attr({"aria-required":"true"});d(":input",h).each(function(){var m=d.trim(d(this).attr("id")).replace(/---[0-9]+$/g,"");if(d.inArray(m,["user_login","user_email","captcha_code"])!==-1){if((g=d.trim(d(this).parent("label").text().replace(/[\r\n\t]+/g," ")))){if(f=ws_plugin__s2member_validationErrors(g,this,h)){l+=f+"\n\n"}}}else{if(m&&(g=d.trim(d('label[for="'+m+'"]',h).first().children("span").first().text().replace(/[\r\n\t]+/g," ")))){if(f=ws_plugin__s2member_validationErrors(g,this,h)){l+=f+"\n\n"}}}});if(l=d.trim(l)){alert('\n\n'+l);return false}else{if(k.length&&d.trim(k.val())!==d.trim(i.val())){alert('\n\n');return false}else{if(k.length&&d.trim(k.val()).length<6){alert('\n\n');return false}}}ws_plugin__s2member_animateProcessing(j);return true})}if(/\/wp-admin\/(?:user\/)?profile\.php/i.test(location.href)){d("form#your-profile").submit(function(){var h=this,g="",f="",i="";d("input#email",h).attr("data-expected","email");d(':input[id^="ws-plugin--s2member-profile-"]',h).each(function(){var j=d.trim(d(this).attr("id")).replace(/---[0-9]+$/g,"");if(j&&(g=d.trim(d('label[for="'+j+'"]',h).first().text().replace(/[\r\n\t]+/g," ")))){if(f=ws_plugin__s2member_validationErrors(g,this,h)){i+=f+"\n\n"}}});if(i=d.trim(i)){alert('\n\n'+i);return false}return true})}if(c){d("body.registration form div#ws-plugin--s2member-custom-reg-fields-4bp-section").closest("form").submit(function(){var h=this,g="",f="",i="";d("input#signup_email",h).attr("data-expected","email");d("input#signup_username, input#signup_email, input#signup_password, input#field_1",h).attr({"aria-required":"true"});d(":input",h).each(function(){var j=d.trim(d(this).attr("id")).replace(/---[0-9]+$/g,"");if(j&&(g=d.trim(d('label[for="'+j+'"]',h).first().text().replace(/[\r\n\t]+/g," ")))){if(f=ws_plugin__s2member_validationErrors(g,this,h)){i+=f+"\n\n"}}});if(i=d.trim(i)){alert('\n\n'+i);return false}return true});d("body.logged-in.profile.profile-edit :input.ws-plugin--s2member-profile-field-4bp").closest("form").submit(function(){var h=this,g="",f="",i="";d("input#field_1",h).attr({"aria-required":"true"});d(":input",h).each(function(){var j=d.trim(d(this).attr("id")).replace(/---[0-9]+$/g,"");if(j&&(g=d.trim(d('label[for="'+j+'"]',h).first().text().replace(/[\r\n\t]+/g," ")))){if(f=ws_plugin__s2member_validationErrors(g,this,h)){i+=f+"\n\n"}}});if(i=d.trim(i)){alert('\n\n'+i);return false}return true})}window.ws_plugin__s2member_passwordStrengthMeter=function(h,f){var g=0;if((h!=f)&&f.length>0){return"mismatch"}else{if(h.length<1){return"empty"}else{if(h.length<6){return"short"}}}if(h.match(/[0-9]/)){g+=10}if(h.match(/[a-z]/)){g+=10}if(h.match(/[A-Z]/)){g+=10}if(h.match(/[^0-9a-zA-Z]/)){g=(g===30)?g+20:g+10}if(g<30){return"bad"}if(g<50){return"good"}return"strong"};window.ws_plugin__s2member_passwordStrength=function(h,k,i,g){if(h instanceof jQuery&&k instanceof jQuery&&i instanceof jQuery&&g instanceof jQuery){var j={empty:'',"short":'',bad:'',good:'',strong:'',mismatch:''};g.removeClass("ws-plugin--s2member-password-strength-short");g.removeClass("ws-plugin--s2member-password-strength-bad");g.removeClass("ws-plugin--s2member-password-strength-good");g.removeClass("ws-plugin--s2member-password-strength-strong");g.removeClass("ws-plugin--s2member-password-strength-mismatch");g.removeClass("ws-plugin--s2member-password-strength-empty");var f=ws_plugin__s2member_passwordStrengthMeter(k.val(),i.val());g.addClass("ws-plugin--s2member-password-strength-"+f).html(j[f])}};window.ws_plugin__s2member_validationErrors=function(r,q,g,m,l){if(typeof r==="string"&&r&&typeof q==="object"&&typeof g==="object"){if(typeof q.tagName==="string"&&/^(input|textarea|select)$/i.test(q.tagName)&&!q.disabled){var t=q.tagName.toLowerCase(),p=d(q),o=d.trim(p.attr("type")).toLowerCase(),f=d.trim(p.attr("name")),s=p.val();m=(typeof m==="boolean")?m:(p.attr("aria-required")==="true"),l=(typeof l==="string")?l:d.trim(p.attr("data-expected"));var k=(''>0);var i=new RegExp('^()@',"i");if(t==="input"&&o==="checkbox"&&/\[\]$/.test(f)){if(typeof q.id==="string"&&/-0$/.test(q.id)){if(m&&!d('input[name="'+ws_plugin__s2member_escjQAttr(f)+'"]:checked',g).length){return r+'\n'}}}else{if(t==="input"&&o==="checkbox"){if(m&&!q.checked){return r+'\n'}}else{if(t==="input"&&o==="radio"){if(typeof q.id==="string"&&/-0$/.test(q.id)){if(m&&!d('input[name="'+ws_plugin__s2member_escjQAttr(f)+'"]:checked',g).length){return r+'\n'}}}else{if(t==="select"&&p.attr("multiple")){if(m&&(!(s instanceof Array)||!s.length)){return r+'\n'}}else{if(typeof s!=="string"||(m&&!(s=d.trim(s)).length)){return r+'\n'}else{if((s=d.trim(s)).length&&((t==="input"&&/^(text|password)$/i.test(o))||t==="textarea")&&typeof l==="string"&&l.length){if(l==="numeric-wp-commas"&&(!/^[0-9\.,]+$/.test(s)||isNaN(s.replace(/,/g,"")))){return r+'\n'}else{if(l==="numeric"&&(!/^[0-9\.]+$/.test(s)||isNaN(s))){return r+'\n'}else{if(l==="integer"&&(!/^[0-9]+$/.test(s)||isNaN(s))){return r+'\n'}else{if(l==="integer-gt-0"&&(!/^[0-9]+$/.test(s)||isNaN(s)||s<=0)){return r+'\n 0 (whole number, no decimals, greater than 0).", "s2member-front", "s2member")); ?>'}else{if(l==="float"&&(!/^[0-9\.]+$/.test(s)||!/[0-9]/.test(s)||!/\./.test(s)||isNaN(s))){return r+'\n'}else{if(l==="float-gt-0"&&(!/^[0-9\.]+$/.test(s)||!/[0-9]/.test(s)||!/\./.test(s)||isNaN(s)||s<=0)){return r+'\n 0 (floating point number, decimals required, greater than 0).", "s2member-front", "s2member")); ?>'}else{if(l==="date"&&!/^[0-9]{2}\/[0-9]{2}\/[0-9]{4}$/.test(s)){return r+'\n'}else{if(l==="email"&&!/^[a-zA-Z0-9_!#$%&*+=?`{}~|\/\^\'\-]+(?:\.?[a-zA-Z0-9_!#$%&*+=?`{}~|\/\^\'\-]+)*@[a-zA-Z0-9]+(?:\-*[a-zA-Z0-9]+)*(?:\.[a-zA-Z0-9]+(?:\-*[a-zA-Z0-9]+)*)*(?:\.[a-zA-Z][a-zA-Z0-9]+)?$/.test(s)){return r+'\n'}else{if(l==="email"&&k&&i.test(s)){return r+"\n"+d.sprintf(' are problematic.", "s2member-front", "s2member")); ?>',s.split("@")[0])}else{if(l==="url"&&!/^https?\:\/\/.+$/i.test(s)){return r+'\n'}else{if(l==="domain"&&!/^[a-zA-Z0-9]+(?:\-*[a-zA-Z0-9]+)*(?:\.[a-zA-Z0-9]+(?:\-*[a-zA-Z0-9]+)*)*(?:\.[a-zA-Z][a-zA-Z0-9]+)?$/.test(s)){return r+'\n'}else{if(l==="phone"&&(!/^[0-9 ()\-]+$/.test(s)||s.replace(/[^0-9]+/g,"").length!==10)){return r+'\n'}else{if(l==="uszip"&&!/^[0-9]{5}(?:\-[0-9]{4})?$/.test(s)){return r+'\n'}else{if(l==="cazip"&&!/^[0-9A-Z]{3} ?[0-9A-Z]{3}$/i.test(s)){return r+'\n'}else{if(l==="uczip"&&!/^[0-9]{5}(?:\-[0-9]{4})?$/.test(s)&&!/^[0-9A-Z]{3} ?[0-9A-Z]{3}$/i.test(s)){return r+'\n'}else{if(/^alphanumerics\-spaces\-punctuation\-[0-9]+(?:\-e)?$/.test(l)&&!/^[a-z 0-9\/\\\\,.?:;"\'{}[\]\^|+=_()*&%$#@!`~\-]+$/i.test(s)){return r+'\n'}else{if(/^alphanumerics\-spaces\-[0-9]+(?:\-e)?$/.test(l)&&!/^[a-z 0-9]+$/i.test(s)){return r+'\n'}else{if(/^alphanumerics\-punctuation\-[0-9]+(?:\-e)?$/.test(l)&&!/^[a-z0-9\/\\\\,.?:;"\'{}[\]\^|+=_()*&%$#@!`~\-]+$/i.test(s)){return r+'\n'}else{if(/^alphanumerics\-[0-9]+(?:\-e)?$/.test(l)&&!/^[a-z0-9]+$/i.test(s)){return r+'\n'}else{if(/^alphabetics\-[0-9]+(?:\-e)?$/.test(l)&&!/^[a-z]+$/i.test(s)){return r+'\n'}else{if(/^numerics\-[0-9]+(?:\-e)?$/.test(l)&&!/^[0-9]+$/i.test(s)){return r+'\n'}else{if(/^(?:any|alphanumerics\-spaces\-punctuation|alphanumerics\-spaces|alphanumerics\-punctuation|alphanumerics|alphabetics|numerics)\-[0-9]+(?:\-e)?$/.test(l)){var n=l.split("-"),h=Number(n[1]),j=(n.length>2&&n[2]==="e");if(j&&s.length!==h){return r+"\n"+d.sprintf('',h,((n[0]==="numerics")?((h===1)?'':''):((h===1)?'':'')))}else{if(s.length',h,((n[0]==="numerics")?((h===1)?'':''):((h===1)?'':'')))}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}return""};window.ws_plugin__s2member_animateProcessing=function(g,f){if(f){d(g).removeClass("ws-plugin--s2member-animate-processing")}else{d(g).addClass("ws-plugin--s2member-animate-processing")}};window.ws_plugin__s2member_escAttr=window.ws_plugin__s2member_escHtml=function(f){if(/[&\<\>"']/.test(f=String(f))){f=f.replace(/&/g,"&").replace(//g,">"),f=f.replace(/"/g,""").replace(/'/g,"'")}return f};window.ws_plugin__s2member_escjQAttr=function(f){return String(f).replace(/([.:\[\]])/g,"\\$1")}}); \ No newline at end of file +jQuery(document).ready(function(d){window.ws_plugin__s2member_skip_all_file_confirmations=window.ws_plugin__s2member_skip_all_file_confirmations||false;var c='',a='',b=ws_plugin__s2member_skip_all_file_confirmations?true:false,e=[];window.ws_plugin__s2member_passwordMinLength=function(){return parseInt("")};window.ws_plugin__s2member_passwordMinStrengthCode=function(){return""};window.ws_plugin__s2member_passwordMinStrengthLabel=function(){return""};window.ws_plugin__s2member_passwordMinStrengthScore=function(){return parseInt("")};window.ws_plugin__s2member_passwordStrengthMeter=function(j,g,i){var h=0,f=ws_plugin__s2member_passwordMinLength();j=String(j);g=String(g);if(j!=g&&g.length>0){return"mismatch"}else{if(j.length<1){return"empty"}else{if(j.length',"short":'',weak:'',good:'',strong:'',mismatch:''};g.removeClass("ws-plugin--s2member-password-strength-short");g.removeClass("ws-plugin--s2member-password-strength-weak");g.removeClass("ws-plugin--s2member-password-strength-good");g.removeClass("ws-plugin--s2member-password-strength-strong");g.removeClass("ws-plugin--s2member-password-strength-mismatch");g.removeClass("ws-plugin--s2member-password-strength-empty");var f=ws_plugin__s2member_passwordStrengthMeter(k.val(),i.val());g.addClass("ws-plugin--s2member-password-strength-"+f).html(j[f])}};window.ws_plugin__s2member_validationErrors=function(r,q,g,m,l){if(typeof r==="string"&&r&&typeof q==="object"&&typeof g==="object"){if(typeof q.tagName==="string"&&/^(input|textarea|select)$/i.test(q.tagName)&&!q.disabled){var t=q.tagName.toLowerCase(),p=d(q),o=d.trim(p.attr("type")).toLowerCase(),f=d.trim(p.attr("name")),s=p.val();m=(typeof m==="boolean")?m:(p.attr("aria-required")==="true"),l=(typeof l==="string")?l:d.trim(p.attr("data-expected"));var k=(''>0);var i=new RegExp('^()@',"i");if(t==="input"&&o==="checkbox"&&/\[\]$/.test(f)){if(typeof q.id==="string"&&/-0$/.test(q.id)){if(m&&!d('input[name="'+ws_plugin__s2member_escjQAttr(f)+'"]:checked',g).length){return r+'\n'}}}else{if(t==="input"&&o==="checkbox"){if(m&&!q.checked){return r+'\n'}}else{if(t==="input"&&o==="radio"){if(typeof q.id==="string"&&/-0$/.test(q.id)){if(m&&!d('input[name="'+ws_plugin__s2member_escjQAttr(f)+'"]:checked',g).length){return r+'\n'}}}else{if(t==="select"&&p.attr("multiple")){if(m&&(!(s instanceof Array)||!s.length)){return r+'\n'}}else{if(typeof s!=="string"||(m&&!(s=d.trim(s)).length)){return r+'\n'}else{if((s=d.trim(s)).length&&((t==="input"&&/^(text|password)$/i.test(o))||t==="textarea")&&typeof l==="string"&&l.length){if(l==="numeric-wp-commas"&&(!/^[0-9\.,]+$/.test(s)||isNaN(s.replace(/,/g,"")))){return r+'\n'}else{if(l==="numeric"&&(!/^[0-9\.]+$/.test(s)||isNaN(s))){return r+'\n'}else{if(l==="integer"&&(!/^[0-9]+$/.test(s)||isNaN(s))){return r+'\n'}else{if(l==="integer-gt-0"&&(!/^[0-9]+$/.test(s)||isNaN(s)||s<=0)){return r+'\n 0 (whole number, no decimals, greater than 0).", "s2member-front", "s2member")); ?>'}else{if(l==="float"&&(!/^[0-9\.]+$/.test(s)||!/[0-9]/.test(s)||!/\./.test(s)||isNaN(s))){return r+'\n'}else{if(l==="float-gt-0"&&(!/^[0-9\.]+$/.test(s)||!/[0-9]/.test(s)||!/\./.test(s)||isNaN(s)||s<=0)){return r+'\n 0 (floating point number, decimals required, greater than 0).", "s2member-front", "s2member")); ?>'}else{if(l==="date"&&!/^[0-9]{2}\/[0-9]{2}\/[0-9]{4}$/.test(s)){return r+'\n'}else{if(l==="email"&&!/^[a-zA-Z0-9_!#$%&*+=?`{}~|\/\^\'\-]+(?:\.?[a-zA-Z0-9_!#$%&*+=?`{}~|\/\^\'\-]+)*@[a-zA-Z0-9]+(?:\-*[a-zA-Z0-9]+)*(?:\.[a-zA-Z0-9]+(?:\-*[a-zA-Z0-9]+)*)*(?:\.[a-zA-Z][a-zA-Z0-9]+)?$/.test(s)){return r+'\n'}else{if(l==="email"&&k&&i.test(s)){return r+"\n"+d.sprintf(' are problematic.", "s2member-front", "s2member")); ?>',s.split("@")[0])}else{if(l==="url"&&!/^https?\:\/\/.+$/i.test(s)){return r+'\n'}else{if(l==="domain"&&!/^[a-zA-Z0-9]+(?:\-*[a-zA-Z0-9]+)*(?:\.[a-zA-Z0-9]+(?:\-*[a-zA-Z0-9]+)*)*(?:\.[a-zA-Z][a-zA-Z0-9]+)?$/.test(s)){return r+'\n'}else{if(l==="phone"&&(!/^[0-9 ()\-]+$/.test(s)||s.replace(/[^0-9]+/g,"").length!==10)){return r+'\n'}else{if(l==="uszip"&&!/^[0-9]{5}(?:\-[0-9]{4})?$/.test(s)){return r+'\n'}else{if(l==="cazip"&&!/^[0-9A-Z]{3} ?[0-9A-Z]{3}$/i.test(s)){return r+'\n'}else{if(l==="uczip"&&!/^[0-9]{5}(?:\-[0-9]{4})?$/.test(s)&&!/^[0-9A-Z]{3} ?[0-9A-Z]{3}$/i.test(s)){return r+'\n'}else{if(/^alphanumerics\-spaces\-punctuation\-[0-9]+(?:\-e)?$/.test(l)&&!/^[a-z 0-9\/\\\\,.?:;"\'{}[\]\^|+=_()*&%$#@!`~\-]+$/i.test(s)){return r+'\n'}else{if(/^alphanumerics\-spaces\-[0-9]+(?:\-e)?$/.test(l)&&!/^[a-z 0-9]+$/i.test(s)){return r+'\n'}else{if(/^alphanumerics\-punctuation\-[0-9]+(?:\-e)?$/.test(l)&&!/^[a-z0-9\/\\\\,.?:;"\'{}[\]\^|+=_()*&%$#@!`~\-]+$/i.test(s)){return r+'\n'}else{if(/^alphanumerics\-[0-9]+(?:\-e)?$/.test(l)&&!/^[a-z0-9]+$/i.test(s)){return r+'\n'}else{if(/^alphabetics\-[0-9]+(?:\-e)?$/.test(l)&&!/^[a-z]+$/i.test(s)){return r+'\n'}else{if(/^numerics\-[0-9]+(?:\-e)?$/.test(l)&&!/^[0-9]+$/i.test(s)){return r+'\n'}else{if(/^(?:any|alphanumerics\-spaces\-punctuation|alphanumerics\-spaces|alphanumerics\-punctuation|alphanumerics|alphabetics|numerics)\-[0-9]+(?:\-e)?$/.test(l)){var n=l.split("-"),h=Number(n[1]),j=(n.length>2&&n[2]==="e");if(j&&s.length!==h){return r+"\n"+d.sprintf('',h,((n[0]==="numerics")?((h===1)?'':''):((h===1)?'':'')))}else{if(s.length',h,((n[0]==="numerics")?((h===1)?'':''):((h===1)?'':'')))}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}return""};window.ws_plugin__s2member_animateProcessing=function(g,f){if(f){d(g).removeClass("ws-plugin--s2member-animate-processing")}else{d(g).addClass("ws-plugin--s2member-animate-processing")}};window.ws_plugin__s2member_escAttr=window.ws_plugin__s2member_escHtml=function(f){if(/[&\<\>"']/.test(f=String(f))){f=f.replace(/&/g,"&").replace(//g,">"),f=f.replace(/"/g,""").replace(/'/g,"'")}return f};window.ws_plugin__s2member_escjQAttr=function(f){return String(f).replace(/([.:\[\]])/g,"\\$1")};if(!b&&S2MEMBER_CURRENT_USER_IS_LOGGED_IN&&S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY',S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY,((S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY===1)?'':''),((S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS===1)?'':d.sprintf('',S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS)))+"\n\n";f+=(S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED)?'':d.sprintf('',S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED,((S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED===1)?'':''),((S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS===1)?'':d.sprintf('',S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS)));if((/s2member[_\-]skip[_\-]confirmation/i.test(this.href)&&!/s2member[_\-]skip[_\-]confirmation[\=\-](0|no|false)/i.test(this.href))||confirm(f)){if(d.inArray(this.href,e)===-1){S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY++,e.push(this.href)}return true}return false}return true})}if(!/\/wp-admin([\/?#]|$)/i.test(location.href)){d("input#ws-plugin--s2member-profile-password1, input#ws-plugin--s2member-profile-password2").on("keyup initialize.s2",function(){ws_plugin__s2member_passwordStrength(d("input#ws-plugin--s2member-profile-login"),d("input#ws-plugin--s2member-profile-password1"),d("input#ws-plugin--s2member-profile-password2"),d("div#ws-plugin--s2member-profile-password-strength"))}).trigger("initialize.s2");d("form#ws-plugin--s2member-profile").submit(function(){var h=this,g="",f="",l="",j=d("input#ws-plugin--s2member-profile-password1",h),i=d("input#ws-plugin--s2member-profile-password2",h);var k=d("input#ws-plugin--s2member-profile-submit",h);d(":input",h).each(function(){var m=d.trim(d(this).attr("id")).replace(/---[0-9]+$/g,"");if(m&&(g=d.trim(d('label[for="'+m+'"]',h).first().children("strong").first().text().replace(/[\r\n\t]+/g," ")))){if(f=ws_plugin__s2member_validationErrors(g,this,h)){l+=f+"\n\n"}}});if(l=d.trim(l)){alert('\n\n'+l);return false}else{if(d.trim(j.val())&&d.trim(j.val())!==d.trim(i.val())){alert('\n\n');return false}else{if(d.trim(j.val())&&d.trim(j.val()).length\n\n');return false}else{if(d.trim(j.val())&&ws_plugin__s2member_passwordStrengthMeter(d.trim(j.val()),d.trim(i.val()),true)\n\n');return false}}}}ws_plugin__s2member_animateProcessing(k);return true})}if(/\/wp-signup\.php/i.test(location.href)){d("div#content > div.mu_register > form#setupform").submit(function(){var h=this,g="",f="",j="",i=d('p.submit input[type="submit"]',h);d("input#user_email",h).attr("data-expected","email");d("input#user_name, input#user_email, input#blogname, input#blog_title, input#captcha_code",h).attr({"aria-required":"true"});d(":input",h).each(function(){var k=d.trim(d(this).attr("id")).replace(/---[0-9]+$/g,"");if(k&&(g=d.trim(d('label[for="'+k+'"]',h).first().text().replace(/[\r\n\t]+/g," ")))){if(f=ws_plugin__s2member_validationErrors(g,this,h)){j+=f+"\n\n"}}});if(j=d.trim(j)){alert('\n\n'+j);return false}ws_plugin__s2member_animateProcessing(i);return true})}if(/\/wp-login\.php/i.test(location.href)){d("div#login > form#registerform input#user_login").attr("tabindex","10");d("div#login > form#registerform input#user_email").attr("tabindex","20");d("div#login > form#registerform input#wp-submit").attr("tabindex","1000");d("input#ws-plugin--s2member-custom-reg-field-user-pass1, input#ws-plugin--s2member-custom-reg-field-user-pass2").on("keyup initialize.s2",function(){ws_plugin__s2member_passwordStrength(d("input#user_login"),d("input#ws-plugin--s2member-custom-reg-field-user-pass1"),d("input#ws-plugin--s2member-custom-reg-field-user-pass2"),d("div#ws-plugin--s2member-custom-reg-field-user-pass-strength"))}).trigger("initialize.s2");d("div#login > form#registerform").submit(function(){var h=this,g="",f="",l="",k=d('input#ws-plugin--s2member-custom-reg-field-user-pass1[aria-required="true"]',h),i=d("input#ws-plugin--s2member-custom-reg-field-user-pass2",h),j=d("input#wp-submit",h);d("input#user_email",h).attr("data-expected","email");d("input#user_login, input#user_email, input#captcha_code",h).attr({"aria-required":"true"});d(":input",h).each(function(){var m=d.trim(d(this).attr("id")).replace(/---[0-9]+$/g,"");if(d.inArray(m,["user_login","user_email","captcha_code"])!==-1){if((g=d.trim(d(this).parent("label").text().replace(/[\r\n\t]+/g," ")))){if(f=ws_plugin__s2member_validationErrors(g,this,h)){l+=f+"\n\n"}}}else{if(m&&(g=d.trim(d('label[for="'+m+'"]',h).first().children("span").first().text().replace(/[\r\n\t]+/g," ")))){if(f=ws_plugin__s2member_validationErrors(g,this,h)){l+=f+"\n\n"}}}});if(l=d.trim(l)){alert('\n\n'+l);return false}else{if(k.length&&d.trim(k.val())!==d.trim(i.val())){alert('\n\n');return false}else{if(k.length&&d.trim(k.val()).length\n\n');return false}else{if(k.length&&ws_plugin__s2member_passwordStrengthMeter(d.trim(k.val()),d.trim(i.val()),true)\n\n');return false}}}}ws_plugin__s2member_animateProcessing(j);return true})}if(/\/wp-admin\/(?:user\/)?profile\.php/i.test(location.href)){d("form#your-profile").submit(function(){var h=this,g="",f="",i="";d("input#email",h).attr("data-expected","email");d(':input[id^="ws-plugin--s2member-profile-"]',h).each(function(){var j=d.trim(d(this).attr("id")).replace(/---[0-9]+$/g,"");if(j&&(g=d.trim(d('label[for="'+j+'"]',h).first().text().replace(/[\r\n\t]+/g," ")))){if(f=ws_plugin__s2member_validationErrors(g,this,h)){i+=f+"\n\n"}}});if(i=d.trim(i)){alert('\n\n'+i);return false}return true})}if(c){d("body.registration form div#ws-plugin--s2member-custom-reg-fields-4bp-section").closest("form").submit(function(){var h=this,g="",f="",i="";d("input#signup_email",h).attr("data-expected","email");d("input#signup_username, input#signup_email, input#signup_password, input#field_1",h).attr({"aria-required":"true"});d(":input",h).each(function(){var j=d.trim(d(this).attr("id")).replace(/---[0-9]+$/g,"");if(j&&(g=d.trim(d('label[for="'+j+'"]',h).first().text().replace(/[\r\n\t]+/g," ")))){if(f=ws_plugin__s2member_validationErrors(g,this,h)){i+=f+"\n\n"}}});if(i=d.trim(i)){alert('\n\n'+i);return false}return true});d("body.logged-in.profile.profile-edit :input.ws-plugin--s2member-profile-field-4bp").closest("form").submit(function(){var h=this,g="",f="",i="";d("input#field_1",h).attr({"aria-required":"true"});d(":input",h).each(function(){var j=d.trim(d(this).attr("id")).replace(/---[0-9]+$/g,"");if(j&&(g=d.trim(d('label[for="'+j+'"]',h).first().text().replace(/[\r\n\t]+/g," ")))){if(f=ws_plugin__s2member_validationErrors(g,this,h)){i+=f+"\n\n"}}});if(i=d.trim(i)){alert('\n\n'+i);return false}return true})}}); \ No newline at end of file diff --git a/s2member/includes/s2member.css b/s2member/includes/s2member.css index d10de680..ad5136aa 100644 --- a/s2member/includes/s2member.css +++ b/s2member/includes/s2member.css @@ -112,7 +112,7 @@ div.ws-plugin--s2member-password-strength-short { background-color : #FFA0A0; } -div.ws-plugin--s2member-password-strength-bad +div.ws-plugin--s2member-password-strength-weak { background-color : #FFB78C; } @@ -475,4 +475,4 @@ body.logged-in.profile.profile-edit form div.ws-plugin--s2member-profile-field-4 margin : 10px 0 10px 0; border-width : 0 0 1px 0; padding : 0 0 7px 0; -} \ No newline at end of file +} diff --git a/s2member/includes/s2member.js b/s2member/includes/s2member.js index 4b0f285b..83e695ee 100644 --- a/s2member/includes/s2member.js +++ b/s2member/includes/s2member.js @@ -25,6 +25,233 @@ jQuery(document) skipAllFileConfirmations = ws_plugin__s2member_skip_all_file_confirmations ? true : false, uniqueFilesDownloadedInPage = [/* Real-time counts in a single page/instance. */]; + window.ws_plugin__s2member_passwordMinLength = function() + { + return parseInt(''); + }; + window.ws_plugin__s2member_passwordMinStrengthCode = function() + { + return ''; + }; + window.ws_plugin__s2member_passwordMinStrengthLabel = function() + { + return ''; + }; + window.ws_plugin__s2member_passwordMinStrengthScore = function() + { + return parseInt(''); + }; + window.ws_plugin__s2member_passwordStrengthMeter = function(password1, password2, scoreOnly) + { + var score = 0, // Initialize score. + minLength = ws_plugin__s2member_passwordMinLength(); + + password1 = String(password1); + password2 = String(password2); + + if(password1 != password2 && password2.length > 0) + return 'mismatch'; + + else if(password1.length < 1) + return 'empty'; + + else if(password1.length < minLength) + return 'short'; + + if(password1.match(/[0-9]/)) + score += 10; + + if(password1.match(/[a-z]/)) + score += 10; + + if(password1.match(/[A-Z]/)) + score += 10; + + if(password1.match(/[^0-9a-zA-Z]/)) + score = score === 30 ? score + 20 : score + 10; + + if(scoreOnly) return score; + if(score < 30) return 'weak'; + if(score < 50) return 'good'; + return 'strong'; // Default return value. + }; + window.ws_plugin__s2member_passwordStrength = function($username, $pass1, $pass2, $result) + { + if($username instanceof jQuery && $pass1 instanceof jQuery && $pass2 instanceof jQuery && $result instanceof jQuery) + { + var pwsL10n = { // Password strength meter translations. + 'empty' : '', + 'short' : '', + 'weak' : '', + 'good' : '', + 'strong' : '', + 'mismatch': '' + }; + $result.removeClass('ws-plugin--s2member-password-strength-short'); + $result.removeClass('ws-plugin--s2member-password-strength-weak'); + $result.removeClass('ws-plugin--s2member-password-strength-good'); + $result.removeClass('ws-plugin--s2member-password-strength-strong'); + $result.removeClass('ws-plugin--s2member-password-strength-mismatch'); + $result.removeClass('ws-plugin--s2member-password-strength-empty'); + + var meterSays = ws_plugin__s2member_passwordStrengthMeter($pass1.val(), $pass2.val()); + $result.addClass('ws-plugin--s2member-password-strength-' + meterSays).html(pwsL10n[meterSays]); + } + }; + window.ws_plugin__s2member_validationErrors = function(label, field, context, required, expected) + { + if(typeof label === 'string' && label && typeof field === 'object' && typeof context === 'object') + if(typeof field.tagName === 'string' && /^(input|textarea|select)$/i.test(field.tagName) && !field.disabled) + { + var tag = field.tagName.toLowerCase(), $field = $(field), type = $.trim($field.attr('type')).toLowerCase(), name = $.trim($field.attr('name')), value = $field.val(); + required = ( typeof required === 'boolean') ? required : ($field.attr('aria-required') === 'true'), expected = ( typeof expected === 'string') ? expected : $.trim($field.attr('data-expected')); + + var forcePersonalEmails = ('' > 0); + var nonPersonalEmailUsers = new RegExp('^()@', 'i'); + + if(tag === 'input' && type === 'checkbox' && /\[\]$/.test(name)) + { + if(typeof field.id === 'string' && /-0$/.test(field.id)) + if(required && !$('input[name="' + ws_plugin__s2member_escjQAttr(name) + '"]:checked', context).length) + return label + '\n' + ''; + } + else if(tag === 'input' && type === 'checkbox') + { + if(required && !field.checked) + return label + '\n' + ''; + } + else if(tag === 'input' && type === 'radio') + { + if(typeof field.id === 'string' && /-0$/.test(field.id)) + if(required && !$('input[name="' + ws_plugin__s2member_escjQAttr(name) + '"]:checked', context).length) + return label + '\n' + ''; + } + else if(tag === 'select' && $field.attr('multiple')) + { + if(required && (!(value instanceof Array) || !value.length)) + return label + '\n' + ''; + } + else if(typeof value !== 'string' || (required && !(value = $.trim(value)).length)) + { + return label + '\n' + ''; + } + else if((value = $.trim(value)).length && ((tag === 'input' && /^(text|password)$/i.test(type)) || tag === 'textarea') && typeof expected === 'string' && expected.length) + { + if(expected === 'numeric-wp-commas' && (!/^[0-9\.,]+$/.test(value) || isNaN(value.replace(/,/g, '')))) + { + return label + '\n' + ''; + } + else if(expected === 'numeric' && (!/^[0-9\.]+$/.test(value) || isNaN(value))) + { + return label + '\n' + ''; + } + else if(expected === 'integer' && (!/^[0-9]+$/.test(value) || isNaN(value))) + { + return label + '\n' + ''; + } + else if(expected === 'integer-gt-0' && (!/^[0-9]+$/.test(value) || isNaN(value) || value <= 0)) + { + return label + '\n' + ' 0 (whole number, no decimals, greater than 0).", "s2member-front", "s2member")); ?>'; + } + else if(expected === 'float' && (!/^[0-9\.]+$/.test(value) || !/[0-9]/.test(value) || !/\./.test(value) || isNaN(value))) + { + return label + '\n' + ''; + } + else if(expected === 'float-gt-0' && (!/^[0-9\.]+$/.test(value) || !/[0-9]/.test(value) || !/\./.test(value) || isNaN(value) || value <= 0)) + { + return label + '\n' + ' 0 (floating point number, decimals required, greater than 0).", "s2member-front", "s2member")); ?>'; + } + else if(expected === 'date' && !/^[0-9]{2}\/[0-9]{2}\/[0-9]{4}$/.test(value)) + { + return label + '\n' + ''; + } + else if(expected === 'email' && !/^[a-zA-Z0-9_!#$%&*+=?`{}~|\/\^\'\-]+(?:\.?[a-zA-Z0-9_!#$%&*+=?`{}~|\/\^\'\-]+)*@[a-zA-Z0-9]+(?:\-*[a-zA-Z0-9]+)*(?:\.[a-zA-Z0-9]+(?:\-*[a-zA-Z0-9]+)*)*(?:\.[a-zA-Z][a-zA-Z0-9]+)?$/.test(value)) + { + return label + '\n' + ''; + } + else if(expected === 'email' && forcePersonalEmails && nonPersonalEmailUsers.test(value)) + { + return label + '\n' + $.sprintf(' are problematic.", "s2member-front", "s2member")); ?>', value.split('@')[0]); + } + else if(expected === 'url' && !/^https?\:\/\/.+$/i.test(value)) + { + return label + '\n' + ''; + } + else if(expected === 'domain' && !/^[a-zA-Z0-9]+(?:\-*[a-zA-Z0-9]+)*(?:\.[a-zA-Z0-9]+(?:\-*[a-zA-Z0-9]+)*)*(?:\.[a-zA-Z][a-zA-Z0-9]+)?$/.test(value)) + { + return label + '\n' + ''; + } + else if(expected === 'phone' && (!/^[0-9 ()\-]+$/.test(value) || value.replace(/[^0-9]+/g, '').length !== 10)) + { + return label + '\n' + ''; + } + else if(expected === 'uszip' && !/^[0-9]{5}(?:\-[0-9]{4})?$/.test(value)) + { + return label + '\n' + ''; + } + else if(expected === 'cazip' && !/^[0-9A-Z]{3} ?[0-9A-Z]{3}$/i.test(value)) + { + return label + '\n' + ''; + } + else if(expected === 'uczip' && !/^[0-9]{5}(?:\-[0-9]{4})?$/.test(value) && !/^[0-9A-Z]{3} ?[0-9A-Z]{3}$/i.test(value)) + { + return label + '\n' + ''; + } + else if(/^alphanumerics\-spaces\-punctuation\-[0-9]+(?:\-e)?$/.test(expected) && !/^[a-z 0-9\/\\\\,.?:;"\'{}[\]\^|+=_()*&%$#@!`~\-]+$/i.test(value)) + { + return label + '\n' + ''; + } + else if(/^alphanumerics\-spaces\-[0-9]+(?:\-e)?$/.test(expected) && !/^[a-z 0-9]+$/i.test(value)) + { + return label + '\n' + ''; + } + else if(/^alphanumerics\-punctuation\-[0-9]+(?:\-e)?$/.test(expected) && !/^[a-z0-9\/\\\\,.?:;"\'{}[\]\^|+=_()*&%$#@!`~\-]+$/i.test(value)) + { + return label + '\n' + ''; + } + else if(/^alphanumerics\-[0-9]+(?:\-e)?$/.test(expected) && !/^[a-z0-9]+$/i.test(value)) + { + return label + '\n' + ''; + } + else if(/^alphabetics\-[0-9]+(?:\-e)?$/.test(expected) && !/^[a-z]+$/i.test(value)) + { + return label + '\n' + ''; + } + else if(/^numerics\-[0-9]+(?:\-e)?$/.test(expected) && !/^[0-9]+$/i.test(value)) + { + return label + '\n' + ''; + } + else if(/^(?:any|alphanumerics\-spaces\-punctuation|alphanumerics\-spaces|alphanumerics\-punctuation|alphanumerics|alphabetics|numerics)\-[0-9]+(?:\-e)?$/.test(expected)) + { + var split = expected.split('-'), length = Number(split[1]), exactLength = (split.length > 2 && split[2] === 'e'); + + if(exactLength && value.length !== length/* An exact length is required? */) + return label + '\n' + $.sprintf('', length, ((split[0] === 'numerics') ? ((length === 1) ? '' : '') : ((length === 1) ? '' : ''))); + + else if(value.length < length/* Otherwise, we interpret as the minimum length. */) + return label + '\n' + $.sprintf('', length, ((split[0] === 'numerics') ? ((length === 1) ? '' : '') : ((length === 1) ? '' : ''))); + } + } + } + return ''; // No errors in this case. + }; + window.ws_plugin__s2member_animateProcessing = function($obj, reset) + { + if(reset) + $($obj).removeClass('ws-plugin--s2member-animate-processing'); + else $($obj).addClass('ws-plugin--s2member-animate-processing'); + }; + window.ws_plugin__s2member_escAttr = window.ws_plugin__s2member_escHtml = function(string) + { + if(/[&\<\>"']/.test(string = String(string))) + string = string.replace(/&/g, '&').replace(//g, '>'), + string = string.replace(/"/g, '"').replace(/'/g, '''); + return string; + }; + window.ws_plugin__s2member_escjQAttr = function(string) + { + return String(string).replace(/([.:\[\]])/g, '\\$1'); + }; if(!skipAllFileConfirmations && S2MEMBER_CURRENT_USER_IS_LOGGED_IN && S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY < S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED) { $('a[href*="s2member_file_download="], a[href*="/s2member-files/"], a[href^="s2member-files/"], a[href*="/' + filesBaseDir.replace(/([\:\.\[\]])/g, '\\$1') + '/"], a[href^="' + filesBaseDir.replace(/([\:\.\[\]])/g, '\\$1') + '/"]') @@ -50,7 +277,7 @@ jQuery(document) if(!/\/wp-admin([\/?#]|$)/i.test(location.href)) { $('input#ws-plugin--s2member-profile-password1, input#ws-plugin--s2member-profile-password2') - .keyup(function() + .on('keyup initialize.s2', function() { ws_plugin__s2member_passwordStrength( $('input#ws-plugin--s2member-profile-login'), @@ -58,7 +285,7 @@ jQuery(document) $('input#ws-plugin--s2member-profile-password2'), $('div#ws-plugin--s2member-profile-password-strength') ); - }); + }).trigger('initialize.s2'); $('form#ws-plugin--s2member-profile') .submit(function(/* Validate Profile. */) { @@ -66,7 +293,7 @@ jQuery(document) $password1 = $('input#ws-plugin--s2member-profile-password1', context), $password2 = $('input#ws-plugin--s2member-profile-password2', context); - var $submissionButton = $('input#ws-plugin--s2member-profile-submit', context); + var $submissionButton = $('input#ws-plugin--s2member-profile-submit', context); $(':input', context) .each(function(/* Go through them all together. */) @@ -89,9 +316,14 @@ jQuery(document) alert('' + '\n\n' + ''); return false; } - else if($.trim($password1.val()) && /* Enforce minimum length requirement here. */ $.trim($password1.val()).length < 6) + else if($.trim($password1.val()) && $.trim($password1.val()).length < ws_plugin__s2member_passwordMinLength()) + { + alert('' + '\n\n' + ''); + return false; + } + else if($.trim($password1.val()) && ws_plugin__s2member_passwordStrengthMeter($.trim($password1.val()), $.trim($password2.val()), true) < ws_plugin__s2member_passwordMinStrengthScore()) { - alert('' + '\n\n' + ''); + alert('' + '\n\n' + ''); return false; } ws_plugin__s2member_animateProcessing($submissionButton); @@ -136,7 +368,7 @@ jQuery(document) $('div#login > form#registerform input#wp-submit').attr('tabindex', '1000'); $('input#ws-plugin--s2member-custom-reg-field-user-pass1, input#ws-plugin--s2member-custom-reg-field-user-pass2') - .keyup(function() + .on('keyup initialize.s2', function() { ws_plugin__s2member_passwordStrength( $('input#user_login'), @@ -144,7 +376,7 @@ jQuery(document) $('input#ws-plugin--s2member-custom-reg-field-user-pass2'), $('div#ws-plugin--s2member-custom-reg-field-user-pass-strength') ); - }); + }).trigger('initialize.s2'); $('div#login > form#registerform') .submit(function() { @@ -185,9 +417,14 @@ jQuery(document) alert('' + '\n\n' + ''); return false; } - else if($pass1.length && $.trim($pass1.val()).length < 6/* Enforce minimum length requirement here. */) + else if($pass1.length && $.trim($pass1.val()).length < ws_plugin__s2member_passwordMinLength()) { - alert('' + '\n\n' + ''); + alert('' + '\n\n' + ''); + return false; + } + else if($pass1.length && ws_plugin__s2member_passwordStrengthMeter($.trim($pass1.val()), $.trim($pass2.val()), true) < ws_plugin__s2member_passwordMinStrengthScore()) + { + alert('' + '\n\n' + ''); return false; } ws_plugin__s2member_animateProcessing($submissionButton); @@ -276,210 +513,4 @@ jQuery(document) return true; }); } - window.ws_plugin__s2member_passwordStrengthMeter = function(password1, password2) - { - var score = 0; // Initialize score. - - if((password1 != password2) && password2.length > 0) - return 'mismatch'; - - else if(password1.length < 1) - return 'empty'; - - else if(password1.length < 6) - return 'short'; - - if(password1.match(/[0-9]/)) - score += 10; - - if(password1.match(/[a-z]/)) - score += 10; - - if(password1.match(/[A-Z]/)) - score += 10; - - if(password1.match(/[^0-9a-zA-Z]/)) - score = (score === 30) ? score + 20 : score + 10; - - if(score < 30) return 'bad'; - if(score < 50) return 'good'; - return 'strong'; // Default return value. - }; - window.ws_plugin__s2member_passwordStrength = function($username, $pass1, $pass2, $result) - { - if($username instanceof jQuery && $pass1 instanceof jQuery && $pass2 instanceof jQuery && $result instanceof jQuery) - { - var pwsL10n = { // Password strength meter translations. - 'empty' : '', - 'short' : '', - 'bad' : '', - 'good' : '', - 'strong' : '', - 'mismatch': '' - }; - $result.removeClass('ws-plugin--s2member-password-strength-short'); - $result.removeClass('ws-plugin--s2member-password-strength-bad'); - $result.removeClass('ws-plugin--s2member-password-strength-good'); - $result.removeClass('ws-plugin--s2member-password-strength-strong'); - $result.removeClass('ws-plugin--s2member-password-strength-mismatch'); - $result.removeClass('ws-plugin--s2member-password-strength-empty'); - - var meterSays = ws_plugin__s2member_passwordStrengthMeter($pass1.val(), $pass2.val()); - $result.addClass('ws-plugin--s2member-password-strength-' + meterSays).html(pwsL10n[meterSays]); - } - }; - window.ws_plugin__s2member_validationErrors = function(label, field, context, required, expected) - { - if(typeof label === 'string' && label && typeof field === 'object' && typeof context === 'object') - if(typeof field.tagName === 'string' && /^(input|textarea|select)$/i.test(field.tagName) && !field.disabled) - { - var tag = field.tagName.toLowerCase(), $field = $(field), type = $.trim($field.attr('type')).toLowerCase(), name = $.trim($field.attr('name')), value = $field.val(); - required = ( typeof required === 'boolean') ? required : ($field.attr('aria-required') === 'true'), expected = ( typeof expected === 'string') ? expected : $.trim($field.attr('data-expected')); - - var forcePersonalEmails = ('' > 0); - var nonPersonalEmailUsers = new RegExp('^()@', 'i'); - - if(tag === 'input' && type === 'checkbox' && /\[\]$/.test(name)) - { - if(typeof field.id === 'string' && /-0$/.test(field.id)) - if(required && !$('input[name="' + ws_plugin__s2member_escjQAttr(name) + '"]:checked', context).length) - return label + '\n' + ''; - } - else if(tag === 'input' && type === 'checkbox') - { - if(required && !field.checked) - return label + '\n' + ''; - } - else if(tag === 'input' && type === 'radio') - { - if(typeof field.id === 'string' && /-0$/.test(field.id)) - if(required && !$('input[name="' + ws_plugin__s2member_escjQAttr(name) + '"]:checked', context).length) - return label + '\n' + ''; - } - else if(tag === 'select' && $field.attr('multiple')) - { - if(required && (!(value instanceof Array) || !value.length)) - return label + '\n' + ''; - } - else if(typeof value !== 'string' || (required && !(value = $.trim(value)).length)) - { - return label + '\n' + ''; - } - else if((value = $.trim(value)).length && ((tag === 'input' && /^(text|password)$/i.test(type)) || tag === 'textarea') && typeof expected === 'string' && expected.length) - { - if(expected === 'numeric-wp-commas' && (!/^[0-9\.,]+$/.test(value) || isNaN(value.replace(/,/g, '')))) - { - return label + '\n' + ''; - } - else if(expected === 'numeric' && (!/^[0-9\.]+$/.test(value) || isNaN(value))) - { - return label + '\n' + ''; - } - else if(expected === 'integer' && (!/^[0-9]+$/.test(value) || isNaN(value))) - { - return label + '\n' + ''; - } - else if(expected === 'integer-gt-0' && (!/^[0-9]+$/.test(value) || isNaN(value) || value <= 0)) - { - return label + '\n' + ' 0 (whole number, no decimals, greater than 0).", "s2member-front", "s2member")); ?>'; - } - else if(expected === 'float' && (!/^[0-9\.]+$/.test(value) || !/[0-9]/.test(value) || !/\./.test(value) || isNaN(value))) - { - return label + '\n' + ''; - } - else if(expected === 'float-gt-0' && (!/^[0-9\.]+$/.test(value) || !/[0-9]/.test(value) || !/\./.test(value) || isNaN(value) || value <= 0)) - { - return label + '\n' + ' 0 (floating point number, decimals required, greater than 0).", "s2member-front", "s2member")); ?>'; - } - else if(expected === 'date' && !/^[0-9]{2}\/[0-9]{2}\/[0-9]{4}$/.test(value)) - { - return label + '\n' + ''; - } - else if(expected === 'email' && !/^[a-zA-Z0-9_!#$%&*+=?`{}~|\/\^\'\-]+(?:\.?[a-zA-Z0-9_!#$%&*+=?`{}~|\/\^\'\-]+)*@[a-zA-Z0-9]+(?:\-*[a-zA-Z0-9]+)*(?:\.[a-zA-Z0-9]+(?:\-*[a-zA-Z0-9]+)*)*(?:\.[a-zA-Z][a-zA-Z0-9]+)?$/.test(value)) - { - return label + '\n' + ''; - } - else if(expected === 'email' && forcePersonalEmails && nonPersonalEmailUsers.test(value)) - { - return label + '\n' + $.sprintf(' are problematic.", "s2member-front", "s2member")); ?>', value.split('@')[0]); - } - else if(expected === 'url' && !/^https?\:\/\/.+$/i.test(value)) - { - return label + '\n' + ''; - } - else if(expected === 'domain' && !/^[a-zA-Z0-9]+(?:\-*[a-zA-Z0-9]+)*(?:\.[a-zA-Z0-9]+(?:\-*[a-zA-Z0-9]+)*)*(?:\.[a-zA-Z][a-zA-Z0-9]+)?$/.test(value)) - { - return label + '\n' + ''; - } - else if(expected === 'phone' && (!/^[0-9 ()\-]+$/.test(value) || value.replace(/[^0-9]+/g, '').length !== 10)) - { - return label + '\n' + ''; - } - else if(expected === 'uszip' && !/^[0-9]{5}(?:\-[0-9]{4})?$/.test(value)) - { - return label + '\n' + ''; - } - else if(expected === 'cazip' && !/^[0-9A-Z]{3} ?[0-9A-Z]{3}$/i.test(value)) - { - return label + '\n' + ''; - } - else if(expected === 'uczip' && !/^[0-9]{5}(?:\-[0-9]{4})?$/.test(value) && !/^[0-9A-Z]{3} ?[0-9A-Z]{3}$/i.test(value)) - { - return label + '\n' + ''; - } - else if(/^alphanumerics\-spaces\-punctuation\-[0-9]+(?:\-e)?$/.test(expected) && !/^[a-z 0-9\/\\\\,.?:;"\'{}[\]\^|+=_()*&%$#@!`~\-]+$/i.test(value)) - { - return label + '\n' + ''; - } - else if(/^alphanumerics\-spaces\-[0-9]+(?:\-e)?$/.test(expected) && !/^[a-z 0-9]+$/i.test(value)) - { - return label + '\n' + ''; - } - else if(/^alphanumerics\-punctuation\-[0-9]+(?:\-e)?$/.test(expected) && !/^[a-z0-9\/\\\\,.?:;"\'{}[\]\^|+=_()*&%$#@!`~\-]+$/i.test(value)) - { - return label + '\n' + ''; - } - else if(/^alphanumerics\-[0-9]+(?:\-e)?$/.test(expected) && !/^[a-z0-9]+$/i.test(value)) - { - return label + '\n' + ''; - } - else if(/^alphabetics\-[0-9]+(?:\-e)?$/.test(expected) && !/^[a-z]+$/i.test(value)) - { - return label + '\n' + ''; - } - else if(/^numerics\-[0-9]+(?:\-e)?$/.test(expected) && !/^[0-9]+$/i.test(value)) - { - return label + '\n' + ''; - } - else if(/^(?:any|alphanumerics\-spaces\-punctuation|alphanumerics\-spaces|alphanumerics\-punctuation|alphanumerics|alphabetics|numerics)\-[0-9]+(?:\-e)?$/.test(expected)) - { - var split = expected.split('-'), length = Number(split[1]), exactLength = (split.length > 2 && split[2] === 'e'); - - if(exactLength && value.length !== length/* An exact length is required? */) - return label + '\n' + $.sprintf('', length, ((split[0] === 'numerics') ? ((length === 1) ? '' : '') : ((length === 1) ? '' : ''))); - - else if(value.length < length/* Otherwise, we interpret as the minimum length. */) - return label + '\n' + $.sprintf('', length, ((split[0] === 'numerics') ? ((length === 1) ? '' : '') : ((length === 1) ? '' : ''))); - } - } - } - return ''; // No errors in this case. - }; - window.ws_plugin__s2member_animateProcessing = function($obj, reset) - { - if(reset) - $($obj).removeClass('ws-plugin--s2member-animate-processing'); - else $($obj).addClass('ws-plugin--s2member-animate-processing'); - }; - window.ws_plugin__s2member_escAttr = window.ws_plugin__s2member_escHtml = function(string) - { - if(/[&\<\>"']/.test(string = String(string))) - string = string.replace(/&/g, '&').replace(//g, '>'), - string = string.replace(/"/g, '"').replace(/'/g, '''); - return string; - }; - window.ws_plugin__s2member_escjQAttr = function(string) - { - return String(string).replace(/([.:\[\]])/g, '\\$1'); - }; - }); \ No newline at end of file + }); diff --git a/s2member/includes/syscon.inc.php b/s2member/includes/syscon.inc.php index 45ff3194..9484db8b 100644 --- a/s2member/includes/syscon.inc.php +++ b/s2member/includes/syscon.inc.php @@ -145,10 +145,12 @@ function ws_plugin__s2member_configure_options_and_their_defaults($options = FAL $default_options['run_uninstall_routines'] = '0'; - $default_options['custom_reg_fields'] = ''; - $default_options['custom_reg_names'] = '1'; - $default_options['custom_reg_display_name'] = 'full'; - $default_options['custom_reg_password'] = '0'; + $default_options['custom_reg_fields'] = ''; + $default_options['custom_reg_names'] = '1'; + $default_options['custom_reg_display_name'] = 'full'; + $default_options['custom_reg_password'] = '0'; + $default_options['custom_reg_password_min_length'] = '8'; // Minimum characters. + $default_options['custom_reg_password_min_strength'] = 'good'; // `weak`, `good` or `strong`. $default_options['custom_reg_opt_in'] = '1'; $default_options['custom_reg_opt_in_label'] = _x('Yes, I want to receive updates via email.', 's2member-front', 's2member'); @@ -292,9 +294,11 @@ function ws_plugin__s2member_configure_options_and_their_defaults($options = FAL $default_options['apply_label_translations'] = '0'; - for($n = 0; $n <= $GLOBALS['WS_PLUGIN__']['s2member']['c']['levels']; $n++) $default_options['level'.$n.'_file_downloads_allowed'] = ''; + for($n = 0; $n <= $GLOBALS['WS_PLUGIN__']['s2member']['c']['levels']; $n++) + $default_options['level'.$n.'_file_downloads_allowed'] = ''; - for($n = 0; $n <= $GLOBALS['WS_PLUGIN__']['s2member']['c']['levels']; $n++) $default_options['level'.$n.'_file_downloads_allowed_days'] = ''; + for($n = 0; $n <= $GLOBALS['WS_PLUGIN__']['s2member']['c']['levels']; $n++) + $default_options['level'.$n.'_file_downloads_allowed_days'] = ''; $default_options['file_download_limit_exceeded_page'] = ''; $default_options['file_download_inline_extensions'] = ''; @@ -412,7 +416,10 @@ function ws_plugin__s2member_configure_options_and_their_defaults($options = FAL else if($key === 'custom_reg_fields' && (!is_string($value) || !strlen($value))) $value = $default_options[$key]; - else if(preg_match('/^custom_reg_(?:names|password|opt_in|auto_opt_out_transitions)$/', $key) && (!is_string($value) || !is_numeric($value))) + else if(preg_match('/^custom_reg_(?:names|password|password_min_length|opt_in|auto_opt_out_transitions)$/', $key) && (!is_string($value) || !is_numeric($value))) + $value = $default_options[$key]; + + else if($key === 'custom_reg_password_min_strength' && (!is_string($value) || !strlen($value))) $value = $default_options[$key]; else if($key === 'custom_reg_display_name' && (!is_string($value) || !preg_match('/^(?:full|first|last|login|0)$/', $value)))