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

Version Description

= v120304 = Two bug fixes. Upgrade immediately.

Download this release

Release Info

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

Code changes from version 120301 to 120304

includes/classes/custom-reg-fields.inc.php CHANGED
@@ -70,7 +70,7 @@ if(!class_exists("c_ws_plugin__s2member_custom_reg_fields"))
70
$common .= ((!empty($field["required"]) && $field["required"] === "yes") ? ' aria-required="true"' : '');
71
$common .= ((strlen($_tabindex)) ? ' tabindex="'.esc_attr($_tabindex).'"' : /* No tabindex if empty. */ '');
72
$common .= (( /* Certain data expected? */!empty($field["expected"])) ? ' data-expected="'.esc_attr($field["expected"]).'"' : '');
73
- $common .= (($_editable_context === "profile-view" || (!empty($field["editable"]) && strpos($field["editable"], "no") === 0 && $_editable_context === "profile")) ? ' disabled="disabled"' : '');
74
$common .= (($_classes || !empty($field["classes"])) ? ' class="'.esc_attr(trim($_classes.((!empty($field["classes"])) ? ' '.$field["classes"] : ''))).'"' : '');
75
$common .= (($_styles || !empty($field["styles"])) ? ' style="'.esc_attr(trim($_styles.((!empty($field["styles"])) ? ' '.$field["styles"] : ''))).'"' : '');
76
$common .= (($_attrs || !empty($field["attrs"])) ? ' '.trim($_attrs.((!empty($field["attrs"])) ? ' '.$field["attrs"] : '')) : '');
@@ -293,8 +293,8 @@ if(!class_exists("c_ws_plugin__s2member_custom_reg_fields"))
293
{
294
foreach(json_decode($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
295
if($level === "any" || $field["levels"] === "all" || in_array($level, preg_split("/[;,]+/", preg_replace("/[^0-9;,]/", "", $field["levels"]))))
296
- if(empty($_editable_context) || $_editable_context === "administrative" || ($_editable_context === "registration" && $field["editable"] !== "yes-invisible") || (($_editable_context === "profile" || $_editable_context === "profile-view") && $field["editable"] !== "no-invisible"))
297
- $configured[] = $field["id"]; /* Add this to the array. */
298
}
299
/**/
300
return apply_filters("ws_plugin__s2member_custom_fields_configured_at_level", ((!empty($configured)) ? $configured : array()), get_defined_vars());
70
$common .= ((!empty($field["required"]) && $field["required"] === "yes") ? ' aria-required="true"' : '');
71
$common .= ((strlen($_tabindex)) ? ' tabindex="'.esc_attr($_tabindex).'"' : /* No tabindex if empty. */ '');
72
$common .= (( /* Certain data expected? */!empty($field["expected"])) ? ' data-expected="'.esc_attr($field["expected"]).'"' : '');
73
+ $common .= (($_editable_context === "profile-view" || ($_editable_context === "profile" && !empty($field["editable"]) && strpos($field["editable"], "no") === 0)) ? ' disabled="disabled"' : '');
74
$common .= (($_classes || !empty($field["classes"])) ? ' class="'.esc_attr(trim($_classes.((!empty($field["classes"])) ? ' '.$field["classes"] : ''))).'"' : '');
75
$common .= (($_styles || !empty($field["styles"])) ? ' style="'.esc_attr(trim($_styles.((!empty($field["styles"])) ? ' '.$field["styles"] : ''))).'"' : '');
76
$common .= (($_attrs || !empty($field["attrs"])) ? ' '.trim($_attrs.((!empty($field["attrs"])) ? ' '.$field["attrs"] : '')) : '');
293
{
294
foreach(json_decode($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
295
if($level === "any" || $field["levels"] === "all" || in_array($level, preg_split("/[;,]+/", preg_replace("/[^0-9;,]/", "", $field["levels"]))))
296
+ if(empty($_editable_context) || $_editable_context === "administrative" || ($_editable_context === "registration" && $field["editable"] !== "no-always-invisible" && $field["editable"] !== "yes-invisible") || (($_editable_context === "profile" || $_editable_context === "profile-view") && $field["editable"] !== "no-invisible" && $field["editable"] !== "no-always-invisible"))
297
+ $configured[] = /* Add this to the array. */ $field["id"];
298
}
299
/**/
300
return apply_filters("ws_plugin__s2member_custom_fields_configured_at_level", ((!empty($configured)) ? $configured : array()), get_defined_vars());
includes/menu-pages/menu-pages-s-min.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function($){var esc_attr=esc_html=function(str){return String(str).replace(/"/g,"&quot;").replace(/\</g,"&lt;").replace(/\>/g,"&gt;")};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='<?php echo (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["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:'<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (wp_create_nonce ("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-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_generateSecurityKey=function(){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)}$("input#ws-plugin--s2member-sec-encryption-key").val(key);return false};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");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<fields.length;i++){fields[i]=$.extend(true,{},fieldDefaults,fields[i])}tools='<div id="ws-plugin--s2member-custom-reg-field-configuration-tools"></div>',table='<table id="ws-plugin--s2member-custom-reg-field-configuration-table"></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)#x2F;))?$(deflt_trs).css("display",""):$(deflt_trs).css("display","none");(type.match(/^(select|selects|checkboxes|radios)#x2F;))?$(options_trs).css("display",""):$(options_trs).css("display","none");(type.match(/^(text|textarea)#x2F;))?$(expected_trs).css("display",""):$(expected_trs).css("display","none")};ws_plugin__s2member_customRegFieldDelete=function(index){var newFields=new Array();for(var i=0;i<fields.length;i++){if(i!==index){newFields.push(fields[i])}}fields=newFields,updateFields(),buildTable()};ws_plugin__s2member_customRegFieldMoveUp=function(index){if(typeof fields[index]==="object"&&typeof fields[index-1]==="object"){var prevFieldObj=fields[index-1],thisFieldObj=fields[index];fields[index-1]=thisFieldObj,fields[index]=prevFieldObj;updateFields(),buildTable()}};ws_plugin__s2member_customRegFieldMoveDown=function(index){if(typeof fields[index]==="object"&&typeof fields[index+1]==="object"){var nextFieldObj=fields[index+1],thisFieldObj=fields[index];fields[index+1]=thisFieldObj,fields[index]=nextFieldObj;updateFields(),buildTable()}};ws_plugin__s2member_customRegFieldCreate=function(){var $table=$("table#ws-plugin--s2member-custom-reg-field-configuration-tools-form"),field={};$(":input[property]",$table).each(function(){var $this=$(this),property=$this.attr("property"),val=$.trim($this.val());field[property]=val});if((field=validateField(field))){fields.push(field),updateFields(),buildTools(),buildTable(),scrollReset();setTimeout(function(){var row="tr.ws-plugin--s2member-custom-reg-field-configuration-table-row-"+(fields.length-1);alert('Field created successfully.\n* Remember to "Save All Changes".');$(row).effect("highlight",1500)},500)}};ws_plugin__s2member_customRegFieldUpdate=function(index){var $table=$("table#ws-plugin--s2member-custom-reg-field-configuration-tools-form"),field={};$(":input[property]",$table).each(function(){var $this=$(this),property=$this.attr("property"),val=$.trim($this.val());field[property]=val});if((field=validateField(field,index))){fields[index]=field,updateFields(),buildTools(),buildTable(),scrollReset();setTimeout(function(){var row="tr.ws-plugin--s2member-custom-reg-field-configuration-table-row-"+index;alert('Field updated successfully.\n* Remember to "Save All Changes".');$(row).effect("highlight",1500)},500)}};ws_plugin__s2member_customRegFieldAdd=function(){buildTools(true)};ws_plugin__s2member_customRegFieldEdit=function(index){buildTools(false,index),scrollReset()};ws_plugin__s2member_customRegFieldCancel=function(){buildTools(),scrollReset()};var validateField=function(field,index){var editing=(typeof index==="number"&&typeof fields[index]==="object")?true:false,errors=[],options,i;if(typeof field!=="object"||typeof(field=$.extend(true,{},fieldDefaults,field))!=="object"){alert("Invalid field object. Please try again.");return false}field.sectitle=(field.section==="yes")?field.sectitle:"";field.deflt=(field.type.match(/^(text|textarea)#x2F;))?field.deflt:"";field.deflt=(field.type.match(/^(text)#x2F;))?field.deflt.replace(/[\r\n\t ]+/g," "):field.deflt;field.options=(field.type.match(/^(select|selects|checkboxes|radios)#x2F;))?field.options:"";field.expected=(field.type.match(/^(text|textarea)#x2F;))?field.expected:"";if(!field.id){errors.push("Unique Field ID:\nThis is required. Please try again.")}else{if(fieldIdExists(field.id)&&(!editing||field.id!==fields[index].id)){errors.push("Unique Field ID:\nThat Field ID already exists. Please try again.")}}if(!field.label){errors.push("Field Label/Description:\nThis is required. Please try again.")}if(field.type.match(/^(select|selects|checkboxes|radios)#x2F;)&&!field.options){errors.push("Option Configuration File:\nThis is required. Please try again.")}else{if(field.type.match(/^(select|selects|checkboxes|radios)#x2F;)){for(i=0;i<(options=field.options.split(/[\r\n]+/)).length;i++){if(!(options[i]=$.trim(options[i])).match(/^([^\|]*)(\|)([^\|]*)(\|default)?#x2F;)){errors.push("Option Configuration File:\nInvalid configuration at line #"+(i+1)+".");break}}field.options=$.trim(options.join("\n"))}}if(!(field.levels=field.levels.replace(/ /g,""))){errors.push("Applicable Levels:\nThis is required. Please try again.")}else{if(!field.levels.match(/^(all|[0-9,]+)#x2F;)){errors.push("Applicable Levels:\nShould be comma-delimited Levels, or just type: all.\n( examples: 0,1,2,3,4 or type the word: all )")}}if(field.classes&&field.classes.match(/[^a-z 0-9 _ \-]/i)){errors.push("CSS Classes:\nContains invalid characters. Please try again.\n( only: alphanumerics, underscores, hyphens, spaces )")}if(field.styles&&field.styles.match(/["\=\>\<]/)){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;i<fields.length;i++){if(fields[i].id===fieldId){return true}}};var scrollReset=function(){scrollTo(0,$("div.ws-plugin--s2member-custom-reg-fields-section").offset()["top"]-100)};var buildTools=function(adding,index){var i=0,html="",form="",w=0,h=0,editing=(typeof index==="number"&&typeof fields[index]==="object")?true:false,displayForm=(adding||editing)?true:false,field=(editing)?$.extend(true,{},fieldDefaults,fields[index]):fieldDefaults;html+='<a href="#" onclick="ws_plugin__s2member_customRegFieldAdd(); return false;">Add New Field</a>';tb_remove(),$("div#ws-plugin--s2member-custom-reg-field-configuration-thickbox-tools-form").remove();if(displayForm){form+='<div id="ws-plugin--s2member-custom-reg-field-configuration-thickbox-tools-form">';form+='<table id="ws-plugin--s2member-custom-reg-field-configuration-tools-form">';form+="<tbody>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-section">';form+='<td colspan="2">';form+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-section">Starts A New Section?</label>';form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-section">';form+='<td colspan="2">';form+='<select property="section" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-section" onchange="ws_plugin__s2member_customRegFieldSectionChange(this);">';form+='<option value="no"'+((field.section==="no")?' selected="selected"':"")+'">No ( this Field flows normally )</option>';form+='<option value="yes"'+((field.section==="yes")?' selected="selected"':"")+'">Yes ( this Field begins a new section )</option>';form+="</select><br />";form+="<small>Optional. Allows Fields to be grouped into sections.</small>";form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer ws-plugin--s2member-custom-reg-field-configuration-tools-form-sectitle ws-plugin--s2member-custom-reg-field-configuration-tools-form-section"'+((field.section==="yes")?"":' style="display:none;"')+'><td colspan="2"><hr /></td></tr>';form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-sectitle ws-plugin--s2member-custom-reg-field-configuration-tools-form-section"'+((field.section==="yes")?"":' style="display:none;"')+">";form+='<td colspan="2">';form+="Title for this new section? ( optional )<br />";form+='<input type="text" property="sectitle" autocomplete="off" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-sectitle" value="'+esc_attr(field.sectitle)+'" /><br />';form+="<small>If empty, a simple divider will be used by default.</small>";form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer ws-plugin--s2member-custom-reg-field-configuration-tools-form-type"><td colspan="2">&nbsp;</td></tr>';form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-type">';form+='<td colspan="2">';form+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-type">Form Field Type: *</label>';form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-type">';form+='<td colspan="2">';form+='<select property="type" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-type" onchange="ws_plugin__s2member_customRegFieldTypeChange(this);">';form+='<option value="text"'+((field.type==="text")?' selected="selected"':"")+'">'+esc_html(fieldTypeDesc("text"))+"</option>";form+='<option value="textarea"'+((field.type==="textarea")?' selected="selected"':"")+'">'+esc_html(fieldTypeDesc("textarea"))+"</option>";form+='<option value="select"'+((field.type==="select")?' selected="selected"':"")+'">'+esc_html(fieldTypeDesc("select"))+"</option>";form+='<option value="selects"'+((field.type==="selects")?' selected="selected"':"")+'">'+esc_html(fieldTypeDesc("selects"))+"</option>";form+='<option value="checkbox"'+((field.type==="checkbox")?' selected="selected"':"")+'">'+esc_html(fieldTypeDesc("checkbox"))+"</option>";form+='<option value="pre_checkbox"'+((field.type==="pre_checkbox")?' selected="selected"':"")+'">'+esc_html(fieldTypeDesc("pre_checkbox"))+"</option>";form+='<option value="checkboxes"'+((field.type==="checkboxes")?' selected="selected"':"")+'">'+esc_html(fieldTypeDesc("checkboxes"))+"</option>";form+='<option value="radios"'+((field.type==="radios")?' selected="selected"':"")+'">'+esc_html(fieldTypeDesc("radios"))+"</option>";form+="</select><br />";form+="<small>The options below may change, based on the Field Type you choose here.</small>";form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer ws-plugin--s2member-custom-reg-field-configuration-tools-form-label"><td colspan="2">&nbsp;</td></tr>';form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-label">';form+='<td colspan="2">';form+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-label">Field Label/Desc: *</label>';form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-label">';form+='<td colspan="2">';form+='<input type="text" property="label" autocomplete="off" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-label" value="'+esc_attr(field.label)+'" /><br />';form+="<small>Examples: <code>Choose Country</code>, <code>Street Address</code></small>";form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer ws-plugin--s2member-custom-reg-field-configuration-tools-form-id"><td colspan="2">&nbsp;</td></tr>';form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-id">';form+='<td colspan="2">';form+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-id">Unique Field ID: *</label></label>';form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-id">';form+='<td colspan="2">';form+='<input type="text" property="id" maxlength="25" autocomplete="off" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-id" value="'+esc_attr(field.id)+'" /><br />';form+="<small>Examples: <code>country_code</code>, <code>street_address</code></small><br />";form+='<small>e.g. <code>[s2Get user_field="country_code" /]</code></small>';form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer ws-plugin--s2member-custom-reg-field-configuration-tools-form-required"><td colspan="2">&nbsp;</td></tr>';form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-required">';form+='<td colspan="2">';form+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-required">Field Required: *</label>';form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-required">';form+='<td colspan="2">';form+='<select property="required" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-required">';form+='<option value="yes"'+((field.required==="yes")?' selected="selected"':"")+'">Yes ( required )</option>';form+='<option value="no"'+((field.required==="no")?' selected="selected"':"")+'">No ( optional )</option>';form+="</select><br />";form+='<small>If <code>yes</code>, only Users/Members will be "required" to enter this field.</small><br />';form+="<small>* Administrators are exempt from this requirement.</small>";form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer ws-plugin--s2member-custom-reg-field-configuration-tools-form-deflt"'+((field.type.match(/^(text|textarea)#x2F;))?"":' style="display:none;"')+'><td colspan="2">&nbsp;</td></tr>';form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-deflt"'+((field.type.match(/^(text|textarea)#x2F;))?"":' style="display:none;"')+">";form+='<td colspan="2">';form+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-deflt">Default Text Value: ( optional )</label>';form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-deflt"'+((field.type.match(/^(text|textarea)#x2F;))?"":' style="display:none;"')+">";form+='<td colspan="2">';form+='<textarea property="deflt" wrap="off" spellcheck="false" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-deflt" rows="1">'+esc_html(field.deflt)+"</textarea><br />";form+="<small>Default value before user input is received.</small>";form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer ws-plugin--s2member-custom-reg-field-configuration-tools-form-options"'+((field.type.match(/^(select|selects|checkboxes|radios)#x2F;))?"":' style="display:none;"')+'><td colspan="2">&nbsp;</td></tr>';form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-options"'+((field.type.match(/^(select|selects|checkboxes|radios)#x2F;))?"":' style="display:none;"')+">";form+='<td colspan="2">';form+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-options">Option Configuration File: * ( one option per line )</label><br />';form+="<small>Use a pipe <code>|</code> delimited format: <code>option value|option label</code></small>";form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-options"'+((field.type.match(/^(select|selects|checkboxes|radios)#x2F;))?"":' style="display:none;"')+">";form+='<td colspan="2">';form+='<textarea property="options" wrap="off" spellcheck="false" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-options" rows="3">'+esc_html(field.options)+"</textarea><br />";form+="Here is a quick example:<br />";form+="<small>You can also specify a <em>default</em> option:</small><br />";form+="<code>US|United States|default</code><br />";form+="<code>CA|Canada</code><br />";form+="<code>VI|Virgin Islands (U.S.)</code>";form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer ws-plugin--s2member-custom-reg-field-configuration-tools-form-expected"'+((field.type.match(/^(text|textarea)#x2F;))?"":' style="display:none;"')+'><td colspan="2">&nbsp;</td></tr>';form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-expected"'+((field.type.match(/^(text|textarea)#x2F;))?"":' style="display:none;"')+">";form+='<td colspan="2">';form+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-expected">Expected Format: *</label>';form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-expected"'+((field.type.match(/^(text|textarea)#x2F;))?"":' style="display:none;"')+">";form+='<td colspan="2">';form+='<select property="expected" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-expected">';form+='<option value=""'+((field.expected==="")?' selected="selected"':"")+'">Anything Goes</option>';form+='<option disabled="disabled"></option>';form+='<optgroup label="Specific Input Types">';form+='<option value="numeric-wp-commas"'+((field.expected==="numeric-wp-commas")?' selected="selected"':"")+'">Numeric ( with or without decimals, commas allowed )</option>';form+='<option value="numeric"'+((field.expected==="numeric")?' selected="selected"':"")+'">Numeric ( with or without decimals, no commas )</option>';form+='<option value="integer"'+((field.expected==="integer")?' selected="selected"':"")+'">Integer ( whole number, without any decimals )</option>';form+='<option value="integer-gt-0"'+((field.expected==="integer-gt-0")?' selected="selected"':"")+'">Integer > 0 ( whole number, no decimals, greater than 0 )</option>';form+='<option value="float"'+((field.expected==="float")?' selected="selected"':"")+'">Float ( floating point number, decimals required )</option>';form+='<option value="float-gt-0"'+((field.expected==="float-gt-0")?' selected="selected"':"")+'">Float > 0 ( floating point number, decimals required, greater than 0 )</option>';form+='<option value="date"'+((field.expected==="date")?' selected="selected"':"")+'">Date ( required date format: dd/mm/yyyy )</option>';form+='<option value="email"'+((field.expected==="email")?' selected="selected"':"")+'">Email ( require valid email )</option>';form+='<option value="url"'+((field.expected==="url")?' selected="selected"':"")+'">Full URL ( starting with http or https )</option>';form+='<option value="domain"'+((field.expected==="domain")?' selected="selected"':"")+'">Domain Name ( domain name only, without http )</option>';form+='<option value="phone"'+((field.expected==="phone")?' selected="selected"':"")+'">Phone # ( 10 digits w/possible hyphens,spaces,brackets )</option>';form+='<option value="uszip"'+((field.expected==="uszip")?' selected="selected"':"")+'">US Zipcode ( 5-9 digits w/possible hyphen )</option>';form+='<option value="cazip"'+((field.expected==="cazip")?' selected="selected"':"")+'">Canadian Zipcode ( 6 alpha-numerics w/possible space )</option>';form+='<option value="uczip"'+((field.expected==="uczip")?' selected="selected"':"")+'">US/Canadian Zipcode ( either a US or Canadian zipcode )</option>';form+="</optgroup>";form+='<option disabled="disabled"></option>';form+='<optgroup label="Any Character Combination">';for(i=1;i<=25;i++){form+='<option value="any-'+i+'"'+((field.expected==="any-"+i)?' selected="selected"':"")+'">Any Character Combination ( '+i+" character minimum )</option>";form+='<option value="any-'+i+'-e"'+((field.expected==="any-"+i+"-e")?' selected="selected"':"")+'">Any Character Combination ( exactly '+i+" character"+((i>1)?"s":"")+" )</option>"}form+="</optgroup>";form+='<option disabled="disabled"></option>';form+='<optgroup label="Alphanumerics, Spaces &amp; Punctuation Only">';for(i=1;i<=25;i++){form+='<option value="alphanumerics-spaces-punctuation-'+i+'"'+((field.expected==="alphanumerics-spaces-punctuation-"+i)?' selected="selected"':"")+'">Alphanumerics, Spaces &amp; Punctuation ( '+i+" character minimum )</option>";form+='<option value="alphanumerics-spaces-punctuation-'+i+'-e"'+((field.expected==="alphanumerics-spaces-punctuation-"+i+"-e")?' selected="selected"':"")+'">Alphanumerics, Spaces &amp; Punctuation ( exactly '+i+" character"+((i>1)?"s":"")+" )</option>"}form+="</optgroup>";form+='<option disabled="disabled"></option>';form+='<optgroup label="Alphanumerics &amp; Spaces Only">';for(i=1;i<=25;i++){form+='<option value="alphanumerics-spaces-'+i+'"'+((field.expected==="alphanumerics-spaces-"+i)?' selected="selected"':"")+'">Alphanumerics &amp; Spaces ( '+i+" character minimum )</option>";form+='<option value="alphanumerics-spaces-'+i+'-e"'+((field.expected==="alphanumerics-spaces-"+i+"-e")?' selected="selected"':"")+'">Alphanumerics &amp; Spaces ( exactly '+i+" character"+((i>1)?"s":"")+" )</option>"}form+="</optgroup>";form+='<option disabled="disabled"></option>';form+='<optgroup label="Alphanumerics &amp; Punctuation Only">';for(i=1;i<=25;i++){form+='<option value="alphanumerics-punctuation-'+i+'"'+((field.expected==="alphanumerics-punctuation-"+i)?' selected="selected"':"")+'">Alphanumerics &amp; Punctuation ( '+i+" character minimum )</option>";form+='<option value="alphanumerics-punctuation-'+i+'-e"'+((field.expected==="alphanumerics-punctuation-"+i+"-e")?' selected="selected"':"")+'">Alphanumerics &amp; Punctuation ( exactly '+i+" character"+((i>1)?"s":"")+" )</option>"}form+="</optgroup>";form+='<option disabled="disabled"></option>';form+='<optgroup label="Alphanumerics Only">';for(i=1;i<=25;i++){form+='<option value="alphanumerics-'+i+'"'+((field.expected==="alphanumerics-"+i)?' selected="selected"':"")+'">Alphanumerics ( '+i+" character minimum )</option>";form+='<option value="alphanumerics-'+i+'-e"'+((field.expected==="alphanumerics-"+i+"-e")?' selected="selected"':"")+'">Alphanumerics ( exactly '+i+" character"+((i>1)?"s":"")+" )</option>"}form+="</optgroup>";form+='<option disabled="disabled"></option>';form+='<optgroup label="Alphabetics Only">';for(i=1;i<=25;i++){form+='<option value="alphabetics-'+i+'"'+((field.expected==="alphabetics-"+i)?' selected="selected"':"")+'">Alphabetics ( '+i+" character minimum )</option>";form+='<option value="alphabetics-'+i+'-e"'+((field.expected==="alphabetics-"+i+"-e")?' selected="selected"':"")+'">Alphabetics ( exactly '+i+" character"+((i>1)?"s":"")+" )</option>"}form+="</optgroup>";form+='<option disabled="disabled"></option>';form+='<optgroup label="Numeric Digits Only">';for(i=1;i<=25;i++){form+='<option value="numerics-'+i+'"'+((field.expected==="numerics-"+i)?' selected="selected"':"")+'">Numeric Digits ( '+i+" digit minimum )</option>";form+='<option value="numerics-'+i+'-e"'+((field.expected==="numerics-"+i+"-e")?' selected="selected"':"")+'">Numeric Digits ( exactly '+i+" digit"+((i>1)?"s":"")+" )</option>"}form+="</optgroup>";form+="</select><br />";form+="<small>Only Users/Members will be required to meet this criteria.</small><br />";form+="<small>* Administrators are exempt from this.</small>";form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer ws-plugin--s2member-custom-reg-field-configuration-tools-form-levels"><td colspan="2">&nbsp;</td></tr>';form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-levels">';form+='<td colspan="2">';form+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-levels">Applicable Membership Levels: *</label>';form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-levels">';form+='<td colspan="2">';form+='<input type="text" property="levels" autocomplete="off" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-levels" value="'+esc_attr(field.levels)+'" /><br />';form+="<small>Please use comma-delimited Level #'s: <code>0,1,2,3,4</code> or type: <code>all</code>.</small><br />";form+="<small>This allows you to enable this field - only at specific Membership Levels.</small>";form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer ws-plugin--s2member-custom-reg-field-configuration-tools-form-editable"><td colspan="2">&nbsp;</td></tr>';form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-editable">';form+='<td colspan="2">';form+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-editable">Allow Profile Edits: *</label>';form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-editable">';form+='<td colspan="2">';form+='<select property="editable" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-editable">';form+='<option value="yes"'+((field.editable==="yes")?' selected="selected"':"")+'">Yes ( editable )</option>';form+='<option value="no"'+((field.editable==="no")?' selected="selected"':"")+'">No ( uneditable after registration )</option>';form+='<option value="no-invisible"'+((field.editable==="no-invisible")?' selected="selected"':"")+'">No ( uneditable &amp; totally invisible after registration )</option>';form+='<option value="yes-invisible"'+((field.editable==="yes-invisible")?' selected="selected"':"")+'">Yes ( editable after registration / invisible during registration )</option>';form+="</select><br />";form+="<small>If <code>No</code>, this field will be un-editable after registration.</small><br />";form+="<small>* Administrators are exempt from this.</small>";form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer ws-plugin--s2member-custom-reg-field-configuration-tools-form-classes"><td colspan="2">&nbsp;</td></tr>';form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-classes">';form+='<td colspan="2">';form+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-classes">CSS Classes: ( optional )</label>';form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-classes">';form+='<td colspan="2">';form+='<input type="text" property="classes" autocomplete="off" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-classes" value="'+esc_attr(field.classes)+'" /><br />';form+="<small>Example: <code>my-style-1 my-style-2</code></small>";form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer ws-plugin--s2member-custom-reg-field-configuration-tools-form-styles"><td colspan="2">&nbsp;</td></tr>';form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-styles">';form+='<td colspan="2">';form+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-styles">CSS Styles: ( optional )</label>';form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-styles">';form+='<td colspan="2">';form+='<input type="text" property="styles" autocomplete="off" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-styles" value="'+esc_attr(field.styles)+'" /><br />';form+="<small>Example: <code>color:#000000; background:#FFFFFF;</code></small>";form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer ws-plugin--s2member-custom-reg-field-configuration-tools-form-attrs"><td colspan="2">&nbsp;</td></tr>';form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-attrs">';form+='<td colspan="2">';form+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-attrs">Other Attributes: ( optional )</label>';form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-attrs">';form+='<td colspan="2">';form+='<input type="text" property="attrs" autocomplete="off" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-attrs" value="'+esc_attr(field.attrs)+'" /><br />';form+='<small>Example: <code>onkeyup="" onblur=""</code></small>';form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer ws-plugin--s2member-custom-reg-field-configuration-tools-form-buttons"><td colspan="2">&nbsp;</td></tr>';form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-buttons">';form+='<td align="left">';form+='<input type="button" value="Cancel" onclick="ws_plugin__s2member_customRegFieldCancel();" />';form+="</td>";form+='<td align="right">';form+='<input type="button" value="'+((editing)?"Update This Field":"Create Registration Field")+'" onclick="'+((editing)?"ws_plugin__s2member_customRegFieldUpdate("+index+");":"ws_plugin__s2member_customRegFieldCreate();")+'" />';form+="</td>";form+="</tr>";form+="</tbody>";form+="</table>";form+="<div>";$("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+="<tbody>";html+="<tr>";html+="<th>Order</th>";html+="<th>Field Type</th>";html+="<th>Unique ID</th>";html+="<th>Required</th>";html+="<th>Levels</th>";html+="<th>- Tools -</th>";html+="</tr>";if(fields.length>0){for(i=0;i<fields.length;i++){html+='<tr class="'+esc_attr((eo=(eo==="o")?"e":"o"))+((fields[i].section==="yes")?" s":"")+" ws-plugin--s2member-custom-reg-field-configuration-table-row-"+i+'">';html+='<td nowrap="nowrap"><a class="ws-plugin--s2member-custom-reg-field-configuration-move-up" href="#" onclick="ws_plugin__s2member_customRegFieldMoveUp('+i+'); return false;"></a><a class="ws-plugin--s2member-custom-reg-field-configuration-move-down" href="#" onclick="ws_plugin__s2member_customRegFieldMoveDown('+i+'); return false;"></a></td>';html+='<td nowrap="nowrap">'+esc_html(fieldTypeDesc(fields[i].type))+"</td>";html+='<td nowrap="nowrap">'+esc_html(fields[i].id)+"</td>";html+='<td nowrap="nowrap">'+esc_html(fields[i].required)+"</td>";html+='<td nowrap="nowrap">'+esc_html(fields[i].levels)+"</td>";html+='<td nowrap="nowrap"><a class="ws-plugin--s2member-custom-reg-field-configuration-edit" href="#" onclick="ws_plugin__s2member_customRegFieldEdit('+i+'); return false;"></a><a class="ws-plugin--s2member-custom-reg-field-configuration-delete" href="#" onclick="ws_plugin__s2member_customRegFieldDelete('+i+'); return false;"></a></td>';html+="</tr>"}}else{html+="<tr>";html+='<td colspan="6">No Custom Fields are configured.</td>';html+="</tr>"}html+="</tbody>";$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:'<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (wp_create_nonce ("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:'<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (wp_create_nonce ("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#x2F;)}).change(function(){var button=this.id.replace(/^ws-plugin--s2member-(.+?)-term#x2F;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#x2F;)}).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("<?php echo c_ws_plugin__s2member_utils_strings::esc_dq($labels); ?>");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"&&regTerm!=="L")?level+":"+cCaps+":"+regPeriod+" "+regTerm:level+":"+cCaps;levelCcapsPer=levelCcapsPer.replace(/\:+#x2F;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){alert("— Oops, a slight problem: —\n\nMaximum Trial Amount is: 10000.00");return false}else{if(trialTerm==="D"&&trialPeriod>7){alert("— Oops, a slight problem: —\n\nMaximum Trial Days is: 7.\nIf you want to offer more than 7 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>12){alert("— Oops, a slight problem: —\n\nMaximum Trial Months is: 12.\nIf you want to offer more than 12 months, please choose Years from the drop-down.");return false}else{if(trialTerm==="Y"&&trialPeriod>1){alert("— Oops, a slight problem: —\n\nMax Trial Period Years is: 1.");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){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(/ \<\!--(\<input type\="hidden" name\="(amount|src|srt|sra|a1|p1|t1|a3|p3|t3)" value\="(.*?)" \/\>)--\>/g," $1"));(parseInt(trialPeriod)<=0)?code.html(code.val().replace(/ (\<input type\="hidden" name\="(a1|p1|t1)" value\="(.*?)" \/\>)/g," <!--$1-->")):null;(regRecur==="BN")?code.html(code.val().replace(/ (\<input type\="hidden" name\="cmd" value\=")(.*?)(" \/\>)/g," $1_xclick$3")):null;(regRecur==="BN")?code.html(code.val().replace(/ (\<input type\="hidden" name\="(src|srt|sra|a1|p1|t1|a3|p3|t3)" value\="(.*?)" \/\>)/g," <!--$1-->")):null;(regRecur!=="BN")?code.html(code.val().replace(/ (\<input type\="hidden" name\="cmd" value\=")(.*?)(" \/\>)/g," $1_xclick-subscriptions$3")):null;(regRecur!=="BN")?code.html(code.val().replace(/ (\<input type\="hidden" name\="amount" value\="(.*?)" \/\>)/g," <!--$1-->")):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="<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (esc_attr ($_SERVER["HTTP_HOST"])); ?>"';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="<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (esc_attr ($_SERVER["HTTP_HOST"])); ?>"'));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(/\<form/,'<form target="_blank"').replace(/\<\?php echo S2MEMBER_VALUE_FOR_PP_INV\(\); \?\>/g,Math.round(new Date().getTime())+'~<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (esc_attr ($_SERVER["REMOTE_ADDR"])); ?>').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"&&regTerm!=="L")?"*:"+cCaps+":"+regPeriod+" "+regTerm:"*:"+cCaps;levelCcapsPer=levelCcapsPer.replace(/\:+#x2F;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){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="<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (esc_attr ($_SERVER["HTTP_HOST"])); ?>" 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="<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (esc_attr ($_SERVER["HTTP_HOST"])); ?>"'));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(/\<form/,'<form target="_blank"').replace(/\<\?php echo S2MEMBER_VALUE_FOR_PP_INV\(\); \?\>/g,Math.round(new Date().getTime())+'~<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (esc_attr ($_SERVER["REMOTE_ADDR"])); ?>').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){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<additionals.length;i++){if(additionals[i]&&additionals[i]!==leading){ids+=","+additionals[i]}}var spIdsHours="sp:"+ids+":"+hours;shortCodeTemplateAttrs+='sp="1" ids="'+esc_attr(ids)+'" exp="'+esc_attr(hours)+'" 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="<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (esc_attr ($_SERVER["HTTP_HOST"])); ?>" ra="'+esc_attr(regAmount)+'"';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(spIdsHours)+'"'));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="<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (esc_attr ($_SERVER["HTTP_HOST"])); ?>"'));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(/\<form/,'<form target="_blank"').replace(/\<\?php echo S2MEMBER_VALUE_FOR_PP_INV\(\); \?\>/g,Math.round(new Date().getTime())+'~<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (esc_attr ($_SERVER["REMOTE_ADDR"])); ?>').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#x2F;))?level+":"+cCaps+":"+fixedTerm:level+":"+cCaps;levelCcapsPer=levelCcapsPer.replace(/\:+#x2F;g,"");if(!subscrID){alert("— Oops, a slight problem: —\n\nPaid Subscr. ID is a required value.");return false}else{if(!custom||custom.indexOf('<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq ($_SERVER["HTTP_HOST"]); ?>')!==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)#x2F;)){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:'<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (wp_create_nonce ("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('<a href="'+esc_attr(response)+'" target="_blank" rel="external">'+esc_html(response)+"</a>"),$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<additionals.length;i++){if(additionals[i]&&additionals[i]!==leading){ids+=","+additionals[i]}}$link.hide(),$loading.show(),$.post(ajaxurl,{action:"ws_plugin__s2member_sp_access_link_via_ajax",ws_plugin__s2member_sp_access_link_via_ajax:'<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (wp_create_nonce ("ws-plugin--s2member-sp-access-link-via-ajax")); ?>',s2member_sp_access_link_ids:ids,s2member_sp_access_link_hours:hours},function(response){$link.show().html('<a href="'+esc_attr(response)+'" target="_blank" rel="external">'+esc_html(response)+"</a>"),$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#x2F;,"/unchecked.png"))}else{if(val==1){$rows.css("display",""),$prevImg.attr("src",$prevImg.attr("src").replace(/\/unchecked\.png#x2F;,"/checked.png"))}else{if(val==2){$rows.css("display",""),$prevImg.attr("src",$prevImg.attr("src").replace(/\/checked\.png#x2F;,"/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")}});
1
+ jQuery(document).ready(function($){var esc_attr=esc_html=function(str){return String(str).replace(/"/g,"&quot;").replace(/\</g,"&lt;").replace(/\>/g,"&gt;")};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='<?php echo (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["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:'<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (wp_create_nonce ("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-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_generateSecurityKey=function(){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)}$("input#ws-plugin--s2member-sec-encryption-key").val(key);return false};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");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<fields.length;i++){fields[i]=$.extend(true,{},fieldDefaults,fields[i])}tools='<div id="ws-plugin--s2member-custom-reg-field-configuration-tools"></div>',table='<table id="ws-plugin--s2member-custom-reg-field-configuration-table"></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)#x2F;))?$(deflt_trs).css("display",""):$(deflt_trs).css("display","none");(type.match(/^(select|selects|checkboxes|radios)#x2F;))?$(options_trs).css("display",""):$(options_trs).css("display","none");(type.match(/^(text|textarea)#x2F;))?$(expected_trs).css("display",""):$(expected_trs).css("display","none")};ws_plugin__s2member_customRegFieldDelete=function(index){var newFields=new Array();for(var i=0;i<fields.length;i++){if(i!==index){newFields.push(fields[i])}}fields=newFields,updateFields(),buildTable()};ws_plugin__s2member_customRegFieldMoveUp=function(index){if(typeof fields[index]==="object"&&typeof fields[index-1]==="object"){var prevFieldObj=fields[index-1],thisFieldObj=fields[index];fields[index-1]=thisFieldObj,fields[index]=prevFieldObj;updateFields(),buildTable()}};ws_plugin__s2member_customRegFieldMoveDown=function(index){if(typeof fields[index]==="object"&&typeof fields[index+1]==="object"){var nextFieldObj=fields[index+1],thisFieldObj=fields[index];fields[index+1]=thisFieldObj,fields[index]=nextFieldObj;updateFields(),buildTable()}};ws_plugin__s2member_customRegFieldCreate=function(){var $table=$("table#ws-plugin--s2member-custom-reg-field-configuration-tools-form"),field={};$(":input[property]",$table).each(function(){var $this=$(this),property=$this.attr("property"),val=$.trim($this.val());field[property]=val});if((field=validateField(field))){fields.push(field),updateFields(),buildTools(),buildTable(),scrollReset();setTimeout(function(){var row="tr.ws-plugin--s2member-custom-reg-field-configuration-table-row-"+(fields.length-1);alert('Field created successfully.\n* Remember to "Save All Changes".');$(row).effect("highlight",1500)},500)}};ws_plugin__s2member_customRegFieldUpdate=function(index){var $table=$("table#ws-plugin--s2member-custom-reg-field-configuration-tools-form"),field={};$(":input[property]",$table).each(function(){var $this=$(this),property=$this.attr("property"),val=$.trim($this.val());field[property]=val});if((field=validateField(field,index))){fields[index]=field,updateFields(),buildTools(),buildTable(),scrollReset();setTimeout(function(){var row="tr.ws-plugin--s2member-custom-reg-field-configuration-table-row-"+index;alert('Field updated successfully.\n* Remember to "Save All Changes".');$(row).effect("highlight",1500)},500)}};ws_plugin__s2member_customRegFieldAdd=function(){buildTools(true)};ws_plugin__s2member_customRegFieldEdit=function(index){buildTools(false,index),scrollReset()};ws_plugin__s2member_customRegFieldCancel=function(){buildTools(),scrollReset()};var validateField=function(field,index){var editing=(typeof index==="number"&&typeof fields[index]==="object")?true:false,errors=[],options,i;if(typeof field!=="object"||typeof(field=$.extend(true,{},fieldDefaults,field))!=="object"){alert("Invalid field object. Please try again.");return false}field.sectitle=(field.section==="yes")?field.sectitle:"";field.deflt=(field.type.match(/^(text|textarea)#x2F;))?field.deflt:"";field.deflt=(field.type.match(/^(text)#x2F;))?field.deflt.replace(/[\r\n\t ]+/g," "):field.deflt;field.options=(field.type.match(/^(select|selects|checkboxes|radios)#x2F;))?field.options:"";field.expected=(field.type.match(/^(text|textarea)#x2F;))?field.expected:"";if(!field.id){errors.push("Unique Field ID:\nThis is required. Please try again.")}else{if(fieldIdExists(field.id)&&(!editing||field.id!==fields[index].id)){errors.push("Unique Field ID:\nThat Field ID already exists. Please try again.")}}if(!field.label){errors.push("Field Label/Description:\nThis is required. Please try again.")}if(field.type.match(/^(select|selects|checkboxes|radios)#x2F;)&&!field.options){errors.push("Option Configuration File:\nThis is required. Please try again.")}else{if(field.type.match(/^(select|selects|checkboxes|radios)#x2F;)){for(i=0;i<(options=field.options.split(/[\r\n]+/)).length;i++){if(!(options[i]=$.trim(options[i])).match(/^([^\|]*)(\|)([^\|]*)(\|default)?#x2F;)){errors.push("Option Configuration File:\nInvalid configuration at line #"+(i+1)+".");break}}field.options=$.trim(options.join("\n"))}}if(!(field.levels=field.levels.replace(/ /g,""))){errors.push("Applicable Levels:\nThis is required. Please try again.")}else{if(!field.levels.match(/^(all|[0-9,]+)#x2F;)){errors.push("Applicable Levels:\nShould be comma-delimited Levels, or just type: all.\n( examples: 0,1,2,3,4 or type the word: all )")}}if(field.classes&&field.classes.match(/[^a-z 0-9 _ \-]/i)){errors.push("CSS Classes:\nContains invalid characters. Please try again.\n( only: alphanumerics, underscores, hyphens, spaces )")}if(field.styles&&field.styles.match(/["\=\>\<]/)){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;i<fields.length;i++){if(fields[i].id===fieldId){return true}}};var scrollReset=function(){scrollTo(0,$("div.ws-plugin--s2member-custom-reg-fields-section").offset()["top"]-100)};var buildTools=function(adding,index){var i=0,html="",form="",w=0,h=0,editing=(typeof index==="number"&&typeof fields[index]==="object")?true:false,displayForm=(adding||editing)?true:false,field=(editing)?$.extend(true,{},fieldDefaults,fields[index]):fieldDefaults;html+='<a href="#" onclick="ws_plugin__s2member_customRegFieldAdd(); return false;">Add New Field</a>';tb_remove(),$("div#ws-plugin--s2member-custom-reg-field-configuration-thickbox-tools-form").remove();if(displayForm){form+='<div id="ws-plugin--s2member-custom-reg-field-configuration-thickbox-tools-form">';form+='<table id="ws-plugin--s2member-custom-reg-field-configuration-tools-form">';form+="<tbody>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-section">';form+='<td colspan="2">';form+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-section">Starts A New Section?</label>';form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-section">';form+='<td colspan="2">';form+='<select property="section" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-section" onchange="ws_plugin__s2member_customRegFieldSectionChange(this);">';form+='<option value="no"'+((field.section==="no")?' selected="selected"':"")+'">No ( this Field flows normally )</option>';form+='<option value="yes"'+((field.section==="yes")?' selected="selected"':"")+'">Yes ( this Field begins a new section )</option>';form+="</select><br />";form+="<small>Optional. Allows Fields to be grouped into sections.</small>";form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer ws-plugin--s2member-custom-reg-field-configuration-tools-form-sectitle ws-plugin--s2member-custom-reg-field-configuration-tools-form-section"'+((field.section==="yes")?"":' style="display:none;"')+'><td colspan="2"><hr /></td></tr>';form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-sectitle ws-plugin--s2member-custom-reg-field-configuration-tools-form-section"'+((field.section==="yes")?"":' style="display:none;"')+">";form+='<td colspan="2">';form+="Title for this new section? ( optional )<br />";form+='<input type="text" property="sectitle" autocomplete="off" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-sectitle" value="'+esc_attr(field.sectitle)+'" /><br />';form+="<small>If empty, a simple divider will be used by default.</small>";form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer ws-plugin--s2member-custom-reg-field-configuration-tools-form-type"><td colspan="2">&nbsp;</td></tr>';form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-type">';form+='<td colspan="2">';form+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-type">Form Field Type: *</label>';form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-type">';form+='<td colspan="2">';form+='<select property="type" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-type" onchange="ws_plugin__s2member_customRegFieldTypeChange(this);">';form+='<option value="text"'+((field.type==="text")?' selected="selected"':"")+'">'+esc_html(fieldTypeDesc("text"))+"</option>";form+='<option value="textarea"'+((field.type==="textarea")?' selected="selected"':"")+'">'+esc_html(fieldTypeDesc("textarea"))+"</option>";form+='<option value="select"'+((field.type==="select")?' selected="selected"':"")+'">'+esc_html(fieldTypeDesc("select"))+"</option>";form+='<option value="selects"'+((field.type==="selects")?' selected="selected"':"")+'">'+esc_html(fieldTypeDesc("selects"))+"</option>";form+='<option value="checkbox"'+((field.type==="checkbox")?' selected="selected"':"")+'">'+esc_html(fieldTypeDesc("checkbox"))+"</option>";form+='<option value="pre_checkbox"'+((field.type==="pre_checkbox")?' selected="selected"':"")+'">'+esc_html(fieldTypeDesc("pre_checkbox"))+"</option>";form+='<option value="checkboxes"'+((field.type==="checkboxes")?' selected="selected"':"")+'">'+esc_html(fieldTypeDesc("checkboxes"))+"</option>";form+='<option value="radios"'+((field.type==="radios")?' selected="selected"':"")+'">'+esc_html(fieldTypeDesc("radios"))+"</option>";form+="</select><br />";form+="<small>The options below may change, based on the Field Type you choose here.</small>";form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer ws-plugin--s2member-custom-reg-field-configuration-tools-form-label"><td colspan="2">&nbsp;</td></tr>';form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-label">';form+='<td colspan="2">';form+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-label">Field Label/Desc: *</label>';form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-label">';form+='<td colspan="2">';form+='<input type="text" property="label" autocomplete="off" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-label" value="'+esc_attr(field.label)+'" /><br />';form+="<small>Examples: <code>Choose Country</code>, <code>Street Address</code></small>";form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer ws-plugin--s2member-custom-reg-field-configuration-tools-form-id"><td colspan="2">&nbsp;</td></tr>';form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-id">';form+='<td colspan="2">';form+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-id">Unique Field ID: *</label></label>';form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-id">';form+='<td colspan="2">';form+='<input type="text" property="id" maxlength="25" autocomplete="off" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-id" value="'+esc_attr(field.id)+'" /><br />';form+="<small>Examples: <code>country_code</code>, <code>street_address</code></small><br />";form+='<small>e.g. <code>[s2Get user_field="country_code" /]</code></small>';form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer ws-plugin--s2member-custom-reg-field-configuration-tools-form-required"><td colspan="2">&nbsp;</td></tr>';form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-required">';form+='<td colspan="2">';form+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-required">Field Required: *</label>';form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-required">';form+='<td colspan="2">';form+='<select property="required" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-required">';form+='<option value="yes"'+((field.required==="yes")?' selected="selected"':"")+'">Yes ( required )</option>';form+='<option value="no"'+((field.required==="no")?' selected="selected"':"")+'">No ( optional )</option>';form+="</select><br />";form+='<small>If <code>yes</code>, only Users/Members will be "required" to enter this field.</small><br />';form+="<small>* Administrators are exempt from this requirement.</small>";form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer ws-plugin--s2member-custom-reg-field-configuration-tools-form-deflt"'+((field.type.match(/^(text|textarea)#x2F;))?"":' style="display:none;"')+'><td colspan="2">&nbsp;</td></tr>';form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-deflt"'+((field.type.match(/^(text|textarea)#x2F;))?"":' style="display:none;"')+">";form+='<td colspan="2">';form+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-deflt">Default Text Value: ( optional )</label>';form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-deflt"'+((field.type.match(/^(text|textarea)#x2F;))?"":' style="display:none;"')+">";form+='<td colspan="2">';form+='<textarea property="deflt" wrap="off" spellcheck="false" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-deflt" rows="1">'+esc_html(field.deflt)+"</textarea><br />";form+="<small>Default value before user input is received.</small>";form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer ws-plugin--s2member-custom-reg-field-configuration-tools-form-options"'+((field.type.match(/^(select|selects|checkboxes|radios)#x2F;))?"":' style="display:none;"')+'><td colspan="2">&nbsp;</td></tr>';form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-options"'+((field.type.match(/^(select|selects|checkboxes|radios)#x2F;))?"":' style="display:none;"')+">";form+='<td colspan="2">';form+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-options">Option Configuration File: * ( one option per line )</label><br />';form+="<small>Use a pipe <code>|</code> delimited format: <code>option value|option label</code></small>";form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-options"'+((field.type.match(/^(select|selects|checkboxes|radios)#x2F;))?"":' style="display:none;"')+">";form+='<td colspan="2">';form+='<textarea property="options" wrap="off" spellcheck="false" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-options" rows="3">'+esc_html(field.options)+"</textarea><br />";form+="Here is a quick example:<br />";form+="<small>You can also specify a <em>default</em> option:</small><br />";form+="<code>US|United States|default</code><br />";form+="<code>CA|Canada</code><br />";form+="<code>VI|Virgin Islands (U.S.)</code>";form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer ws-plugin--s2member-custom-reg-field-configuration-tools-form-expected"'+((field.type.match(/^(text|textarea)#x2F;))?"":' style="display:none;"')+'><td colspan="2">&nbsp;</td></tr>';form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-expected"'+((field.type.match(/^(text|textarea)#x2F;))?"":' style="display:none;"')+">";form+='<td colspan="2">';form+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-expected">Expected Format: *</label>';form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-expected"'+((field.type.match(/^(text|textarea)#x2F;))?"":' style="display:none;"')+">";form+='<td colspan="2">';form+='<select property="expected" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-expected">';form+='<option value=""'+((field.expected==="")?' selected="selected"':"")+'">Anything Goes</option>';form+='<option disabled="disabled"></option>';form+='<optgroup label="Specific Input Types">';form+='<option value="numeric-wp-commas"'+((field.expected==="numeric-wp-commas")?' selected="selected"':"")+'">Numeric ( with or without decimals, commas allowed )</option>';form+='<option value="numeric"'+((field.expected==="numeric")?' selected="selected"':"")+'">Numeric ( with or without decimals, no commas )</option>';form+='<option value="integer"'+((field.expected==="integer")?' selected="selected"':"")+'">Integer ( whole number, without any decimals )</option>';form+='<option value="integer-gt-0"'+((field.expected==="integer-gt-0")?' selected="selected"':"")+'">Integer > 0 ( whole number, no decimals, greater than 0 )</option>';form+='<option value="float"'+((field.expected==="float")?' selected="selected"':"")+'">Float ( floating point number, decimals required )</option>';form+='<option value="float-gt-0"'+((field.expected==="float-gt-0")?' selected="selected"':"")+'">Float > 0 ( floating point number, decimals required, greater than 0 )</option>';form+='<option value="date"'+((field.expected==="date")?' selected="selected"':"")+'">Date ( required date format: dd/mm/yyyy )</option>';form+='<option value="email"'+((field.expected==="email")?' selected="selected"':"")+'">Email ( require valid email )</option>';form+='<option value="url"'+((field.expected==="url")?' selected="selected"':"")+'">Full URL ( starting with http or https )</option>';form+='<option value="domain"'+((field.expected==="domain")?' selected="selected"':"")+'">Domain Name ( domain name only, without http )</option>';form+='<option value="phone"'+((field.expected==="phone")?' selected="selected"':"")+'">Phone # ( 10 digits w/possible hyphens,spaces,brackets )</option>';form+='<option value="uszip"'+((field.expected==="uszip")?' selected="selected"':"")+'">US Zipcode ( 5-9 digits w/possible hyphen )</option>';form+='<option value="cazip"'+((field.expected==="cazip")?' selected="selected"':"")+'">Canadian Zipcode ( 6 alpha-numerics w/possible space )</option>';form+='<option value="uczip"'+((field.expected==="uczip")?' selected="selected"':"")+'">US/Canadian Zipcode ( either a US or Canadian zipcode )</option>';form+="</optgroup>";form+='<option disabled="disabled"></option>';form+='<optgroup label="Any Character Combination">';for(i=1;i<=25;i++){form+='<option value="any-'+i+'"'+((field.expected==="any-"+i)?' selected="selected"':"")+'">Any Character Combination ( '+i+" character minimum )</option>";form+='<option value="any-'+i+'-e"'+((field.expected==="any-"+i+"-e")?' selected="selected"':"")+'">Any Character Combination ( exactly '+i+" character"+((i>1)?"s":"")+" )</option>"}form+="</optgroup>";form+='<option disabled="disabled"></option>';form+='<optgroup label="Alphanumerics, Spaces &amp; Punctuation Only">';for(i=1;i<=25;i++){form+='<option value="alphanumerics-spaces-punctuation-'+i+'"'+((field.expected==="alphanumerics-spaces-punctuation-"+i)?' selected="selected"':"")+'">Alphanumerics, Spaces &amp; Punctuation ( '+i+" character minimum )</option>";form+='<option value="alphanumerics-spaces-punctuation-'+i+'-e"'+((field.expected==="alphanumerics-spaces-punctuation-"+i+"-e")?' selected="selected"':"")+'">Alphanumerics, Spaces &amp; Punctuation ( exactly '+i+" character"+((i>1)?"s":"")+" )</option>"}form+="</optgroup>";form+='<option disabled="disabled"></option>';form+='<optgroup label="Alphanumerics &amp; Spaces Only">';for(i=1;i<=25;i++){form+='<option value="alphanumerics-spaces-'+i+'"'+((field.expected==="alphanumerics-spaces-"+i)?' selected="selected"':"")+'">Alphanumerics &amp; Spaces ( '+i+" character minimum )</option>";form+='<option value="alphanumerics-spaces-'+i+'-e"'+((field.expected==="alphanumerics-spaces-"+i+"-e")?' selected="selected"':"")+'">Alphanumerics &amp; Spaces ( exactly '+i+" character"+((i>1)?"s":"")+" )</option>"}form+="</optgroup>";form+='<option disabled="disabled"></option>';form+='<optgroup label="Alphanumerics &amp; Punctuation Only">';for(i=1;i<=25;i++){form+='<option value="alphanumerics-punctuation-'+i+'"'+((field.expected==="alphanumerics-punctuation-"+i)?' selected="selected"':"")+'">Alphanumerics &amp; Punctuation ( '+i+" character minimum )</option>";form+='<option value="alphanumerics-punctuation-'+i+'-e"'+((field.expected==="alphanumerics-punctuation-"+i+"-e")?' selected="selected"':"")+'">Alphanumerics &amp; Punctuation ( exactly '+i+" character"+((i>1)?"s":"")+" )</option>"}form+="</optgroup>";form+='<option disabled="disabled"></option>';form+='<optgroup label="Alphanumerics Only">';for(i=1;i<=25;i++){form+='<option value="alphanumerics-'+i+'"'+((field.expected==="alphanumerics-"+i)?' selected="selected"':"")+'">Alphanumerics ( '+i+" character minimum )</option>";form+='<option value="alphanumerics-'+i+'-e"'+((field.expected==="alphanumerics-"+i+"-e")?' selected="selected"':"")+'">Alphanumerics ( exactly '+i+" character"+((i>1)?"s":"")+" )</option>"}form+="</optgroup>";form+='<option disabled="disabled"></option>';form+='<optgroup label="Alphabetics Only">';for(i=1;i<=25;i++){form+='<option value="alphabetics-'+i+'"'+((field.expected==="alphabetics-"+i)?' selected="selected"':"")+'">Alphabetics ( '+i+" character minimum )</option>";form+='<option value="alphabetics-'+i+'-e"'+((field.expected==="alphabetics-"+i+"-e")?' selected="selected"':"")+'">Alphabetics ( exactly '+i+" character"+((i>1)?"s":"")+" )</option>"}form+="</optgroup>";form+='<option disabled="disabled"></option>';form+='<optgroup label="Numeric Digits Only">';for(i=1;i<=25;i++){form+='<option value="numerics-'+i+'"'+((field.expected==="numerics-"+i)?' selected="selected"':"")+'">Numeric Digits ( '+i+" digit minimum )</option>";form+='<option value="numerics-'+i+'-e"'+((field.expected==="numerics-"+i+"-e")?' selected="selected"':"")+'">Numeric Digits ( exactly '+i+" digit"+((i>1)?"s":"")+" )</option>"}form+="</optgroup>";form+="</select><br />";form+="<small>Only Users/Members will be required to meet this criteria.</small><br />";form+="<small>* Administrators are exempt from this.</small>";form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer ws-plugin--s2member-custom-reg-field-configuration-tools-form-levels"><td colspan="2">&nbsp;</td></tr>';form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-levels">';form+='<td colspan="2">';form+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-levels">Applicable Membership Levels: *</label>';form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-levels">';form+='<td colspan="2">';form+='<input type="text" property="levels" autocomplete="off" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-levels" value="'+esc_attr(field.levels)+'" /><br />';form+="<small>Please use comma-delimited Level #'s: <code>0,1,2,3,4</code> or type: <code>all</code>.</small><br />";form+="<small>This allows you to enable this field - only at specific Membership Levels.</small>";form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer ws-plugin--s2member-custom-reg-field-configuration-tools-form-editable"><td colspan="2">&nbsp;</td></tr>';form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-editable">';form+='<td colspan="2">';form+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-editable">Allow Profile Edits: *</label>';form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-editable">';form+='<td colspan="2">';form+='<select property="editable" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-editable">';form+='<option value="yes"'+((field.editable==="yes")?' selected="selected"':"")+'">Yes ( editable )</option>';form+='<option value="no"'+((field.editable==="no")?' selected="selected"':"")+'">No ( uneditable after registration )</option>';form+='<option value="no-invisible"'+((field.editable==="no-invisible")?' selected="selected"':"")+'">No ( uneditable &amp; totally invisible after registration )</option>';form+='<option value="no-always-invisible"'+((field.editable==="no-always-invisible")?' selected="selected"':"")+'">No ( uneditable &amp; totally invisible, both during &amp; after registration )</option>';form+='<option value="yes-invisible"'+((field.editable==="yes-invisible")?' selected="selected"':"")+'">Yes ( editable after registration / invisible during registration )</option>';form+="</select><br />";form+="<small>If <code>No</code>, this field will be un-editable after registration.</small><br />";form+="<small>* Administrators are exempt from this.</small>";form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer ws-plugin--s2member-custom-reg-field-configuration-tools-form-classes"><td colspan="2">&nbsp;</td></tr>';form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-classes">';form+='<td colspan="2">';form+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-classes">CSS Classes: ( optional )</label>';form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-classes">';form+='<td colspan="2">';form+='<input type="text" property="classes" autocomplete="off" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-classes" value="'+esc_attr(field.classes)+'" /><br />';form+="<small>Example: <code>my-style-1 my-style-2</code></small>";form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer ws-plugin--s2member-custom-reg-field-configuration-tools-form-styles"><td colspan="2">&nbsp;</td></tr>';form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-styles">';form+='<td colspan="2">';form+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-styles">CSS Styles: ( optional )</label>';form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-styles">';form+='<td colspan="2">';form+='<input type="text" property="styles" autocomplete="off" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-styles" value="'+esc_attr(field.styles)+'" /><br />';form+="<small>Example: <code>color:#000000; background:#FFFFFF;</code></small>";form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer ws-plugin--s2member-custom-reg-field-configuration-tools-form-attrs"><td colspan="2">&nbsp;</td></tr>';form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-attrs">';form+='<td colspan="2">';form+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-attrs">Other Attributes: ( optional )</label>';form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-attrs">';form+='<td colspan="2">';form+='<input type="text" property="attrs" autocomplete="off" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-attrs" value="'+esc_attr(field.attrs)+'" /><br />';form+='<small>Example: <code>onkeyup="" onblur=""</code></small>';form+="</td>";form+="</tr>";form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer ws-plugin--s2member-custom-reg-field-configuration-tools-form-buttons"><td colspan="2">&nbsp;</td></tr>';form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-buttons">';form+='<td align="left">';form+='<input type="button" value="Cancel" onclick="ws_plugin__s2member_customRegFieldCancel();" />';form+="</td>";form+='<td align="right">';form+='<input type="button" value="'+((editing)?"Update This Field":"Create Registration Field")+'" onclick="'+((editing)?"ws_plugin__s2member_customRegFieldUpdate("+index+");":"ws_plugin__s2member_customRegFieldCreate();")+'" />';form+="</td>";form+="</tr>";form+="</tbody>";form+="</table>";form+="<div>";$("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+="<tbody>";html+="<tr>";html+="<th>Order</th>";html+="<th>Field Type</th>";html+="<th>Unique ID</th>";html+="<th>Required</th>";html+="<th>Levels</th>";html+="<th>- Tools -</th>";html+="</tr>";if(fields.length>0){for(i=0;i<fields.length;i++){html+='<tr class="'+esc_attr((eo=(eo==="o")?"e":"o"))+((fields[i].section==="yes")?" s":"")+" ws-plugin--s2member-custom-reg-field-configuration-table-row-"+i+'">';html+='<td nowrap="nowrap"><a class="ws-plugin--s2member-custom-reg-field-configuration-move-up" href="#" onclick="ws_plugin__s2member_customRegFieldMoveUp('+i+'); return false;"></a><a class="ws-plugin--s2member-custom-reg-field-configuration-move-down" href="#" onclick="ws_plugin__s2member_customRegFieldMoveDown('+i+'); return false;"></a></td>';html+='<td nowrap="nowrap">'+esc_html(fieldTypeDesc(fields[i].type))+"</td>";html+='<td nowrap="nowrap">'+esc_html(fields[i].id)+"</td>";html+='<td nowrap="nowrap">'+esc_html(fields[i].required)+"</td>";html+='<td nowrap="nowrap">'+esc_html(fields[i].levels)+"</td>";html+='<td nowrap="nowrap"><a class="ws-plugin--s2member-custom-reg-field-configuration-edit" href="#" onclick="ws_plugin__s2member_customRegFieldEdit('+i+'); return false;"></a><a class="ws-plugin--s2member-custom-reg-field-configuration-delete" href="#" onclick="ws_plugin__s2member_customRegFieldDelete('+i+'); return false;"></a></td>';html+="</tr>"}}else{html+="<tr>";html+='<td colspan="6">No Custom Fields are configured.</td>';html+="</tr>"}html+="</tbody>";$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:'<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (wp_create_nonce ("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:'<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (wp_create_nonce ("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#x2F;)}).change(function(){var button=this.id.replace(/^ws-plugin--s2member-(.+?)-term#x2F;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#x2F;)}).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("<?php echo c_ws_plugin__s2member_utils_strings::esc_dq($labels); ?>");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"&&regTerm!=="L")?level+":"+cCaps+":"+regPeriod+" "+regTerm:level+":"+cCaps;levelCcapsPer=levelCcapsPer.replace(/\:+#x2F;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){alert("— Oops, a slight problem: —\n\nMaximum Trial Amount is: 10000.00");return false}else{if(trialTerm==="D"&&trialPeriod>7){alert("— Oops, a slight problem: —\n\nMaximum Trial Days is: 7.\nIf you want to offer more than 7 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>12){alert("— Oops, a slight problem: —\n\nMaximum Trial Months is: 12.\nIf you want to offer more than 12 months, please choose Years from the drop-down.");return false}else{if(trialTerm==="Y"&&trialPeriod>1){alert("— Oops, a slight problem: —\n\nMax Trial Period Years is: 1.");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){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(/ \<\!--(\<input type\="hidden" name\="(amount|src|srt|sra|a1|p1|t1|a3|p3|t3)" value\="(.*?)" \/\>)--\>/g," $1"));(parseInt(trialPeriod)<=0)?code.html(code.val().replace(/ (\<input type\="hidden" name\="(a1|p1|t1)" value\="(.*?)" \/\>)/g," <!--$1-->")):null;(regRecur==="BN")?code.html(code.val().replace(/ (\<input type\="hidden" name\="cmd" value\=")(.*?)(" \/\>)/g," $1_xclick$3")):null;(regRecur==="BN")?code.html(code.val().replace(/ (\<input type\="hidden" name\="(src|srt|sra|a1|p1|t1|a3|p3|t3)" value\="(.*?)" \/\>)/g," <!--$1-->")):null;(regRecur!=="BN")?code.html(code.val().replace(/ (\<input type\="hidden" name\="cmd" value\=")(.*?)(" \/\>)/g," $1_xclick-subscriptions$3")):null;(regRecur!=="BN")?code.html(code.val().replace(/ (\<input type\="hidden" name\="amount" value\="(.*?)" \/\>)/g," <!--$1-->")):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="<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (esc_attr ($_SERVER["HTTP_HOST"])); ?>"';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="<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (esc_attr ($_SERVER["HTTP_HOST"])); ?>"'));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(/\<form/,'<form target="_blank"').replace(/\<\?php echo S2MEMBER_VALUE_FOR_PP_INV\(\); \?\>/g,Math.round(new Date().getTime())+'~<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (esc_attr ($_SERVER["REMOTE_ADDR"])); ?>').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"&&regTerm!=="L")?"*:"+cCaps+":"+regPeriod+" "+regTerm:"*:"+cCaps;levelCcapsPer=levelCcapsPer.replace(/\:+#x2F;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){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="<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (esc_attr ($_SERVER["HTTP_HOST"])); ?>" 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="<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (esc_attr ($_SERVER["HTTP_HOST"])); ?>"'));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(/\<form/,'<form target="_blank"').replace(/\<\?php echo S2MEMBER_VALUE_FOR_PP_INV\(\); \?\>/g,Math.round(new Date().getTime())+'~<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (esc_attr ($_SERVER["REMOTE_ADDR"])); ?>').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){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<additionals.length;i++){if(additionals[i]&&additionals[i]!==leading){ids+=","+additionals[i]}}var spIdsHours="sp:"+ids+":"+hours;shortCodeTemplateAttrs+='sp="1" ids="'+esc_attr(ids)+'" exp="'+esc_attr(hours)+'" 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="<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (esc_attr ($_SERVER["HTTP_HOST"])); ?>" ra="'+esc_attr(regAmount)+'"';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(spIdsHours)+'"'));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="<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (esc_attr ($_SERVER["HTTP_HOST"])); ?>"'));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(/\<form/,'<form target="_blank"').replace(/\<\?php echo S2MEMBER_VALUE_FOR_PP_INV\(\); \?\>/g,Math.round(new Date().getTime())+'~<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (esc_attr ($_SERVER["REMOTE_ADDR"])); ?>').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#x2F;))?level+":"+cCaps+":"+fixedTerm:level+":"+cCaps;levelCcapsPer=levelCcapsPer.replace(/\:+#x2F;g,"");if(!subscrID){alert("— Oops, a slight problem: —\n\nPaid Subscr. ID is a required value.");return false}else{if(!custom||custom.indexOf('<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq ($_SERVER["HTTP_HOST"]); ?>')!==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)#x2F;)){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:'<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (wp_create_nonce ("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('<a href="'+esc_attr(response)+'" target="_blank" rel="external">'+esc_html(response)+"</a>"),$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<additionals.length;i++){if(additionals[i]&&additionals[i]!==leading){ids+=","+additionals[i]}}$link.hide(),$loading.show(),$.post(ajaxurl,{action:"ws_plugin__s2member_sp_access_link_via_ajax",ws_plugin__s2member_sp_access_link_via_ajax:'<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (wp_create_nonce ("ws-plugin--s2member-sp-access-link-via-ajax")); ?>',s2member_sp_access_link_ids:ids,s2member_sp_access_link_hours:hours},function(response){$link.show().html('<a href="'+esc_attr(response)+'" target="_blank" rel="external">'+esc_html(response)+"</a>"),$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#x2F;,"/unchecked.png"))}else{if(val==1){$rows.css("display",""),$prevImg.attr("src",$prevImg.attr("src").replace(/\/unchecked\.png#x2F;,"/checked.png"))}else{if(val==2){$rows.css("display",""),$prevImg.attr("src",$prevImg.attr("src").replace(/\/checked\.png#x2F;,"/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")}});
includes/menu-pages/menu-pages-s.js CHANGED
@@ -13,67 +13,67 @@
13
* @package s2Member\Menu_Pages
14
* @since 3.0
15
*/
16
- jQuery(document).ready (function($)
17
{
18
var esc_attr = esc_html = /* Convert special characters. */ function(str)
19
{
20
- return String(str).replace (/"/g, '&quot;').replace (/\</g, '&lt;').replace (/\>/g, '&gt;');
21
};
22
/**/
23
- if (location.href.match /* Any & all s2Member® pages. */ (/page\=ws-plugin--s2member/))
24
{
25
- $('input.ws-plugin--s2member-update-roles-button, input.ws-plugin--s2member-reset-roles-button').click (function()
26
{
27
var $this = /* Save $(this) into $this. */ $(this);
28
- $this.val /* Indicate loading status ( please wait ). */ ('one moment please ...');
29
/**/
30
var levels = '<?php echo (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; ?>';
31
- var resetUpdate = ($this.hasClass ('ws-plugin--s2member-reset-roles-button')) ? 'Reset' : 'Update';
32
/**/
33
- $.post (ajaxurl, {action: 'ws_plugin__s2member_update_roles_via_ajax', ws_plugin__s2member_update_roles_via_ajax: '<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (wp_create_nonce ("ws-plugin--s2member-update-roles-via-ajax")); ?>'}, function(response)
34
{
35
- if (response === '1')
36
- 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');
37
/**/
38
- else if (response === 'l' /* Locked? */)
39
- alert('Sorry, your request failed.\ns2Member\'s Roles/Capabilities are locked by Filter:\nws_plugin__s2member_lock_roles_caps'), $this.val (resetUpdate + ' Roles/Capabilities');
40
/**/
41
else /* Default response message here. */
42
- alert('Sorry, your request failed.\nAccess denied. Do you have the ability to `create_users`?'), $this.val (resetUpdate + ' Roles/Capabilities');
43
});
44
/**/
45
return false;
46
});
47
}
48
/**/
49
- if (location.href.match (/page\=ws-plugin--s2member-mms-ops/))
50
{
51
- $('select#ws-plugin--s2member-mms-registration-file').change (function()
52
{
53
- if /* Expand/collapse relevant options; based on file selection. */ ($(this).val () === 'wp-signup')
54
{
55
- var gv = $('select#ws-plugin--s2member-mms-registration-grants').val (), l0v = $('input#ws-plugin--s2member-mms-registration-blogs-level0').val ();
56
- $('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 ();
57
- $('div.ws-plugin--s2member-mms-registration-wp-signup-blogs-level0, table.ws-plugin--s2member-mms-registration-wp-signup-blogs-level0')[((gv === 'all') ? 'show' : 'hide')] ();
58
- $('input#ws-plugin--s2member-mms-registration-blogs-level0').val (((gv === 'all') ? ((l0v > 0) ? l0v : '1') : '0'));
59
}
60
- else if /* Expand/collapse relevant options. */ ($(this).val () === 'wp-login')
61
{
62
- var gv = $('select#ws-plugin--s2member-mms-registration-grants').val (), l0v = $('input#ws-plugin--s2member-mms-registration-blogs-level0').val ();
63
- $('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 ();
64
- $('div.ws-plugin--s2member-mms-registration-wp-signup-blogs-level0, table.ws-plugin--s2member-mms-registration-wp-signup-blogs-level0').hide ();
65
- $('input#ws-plugin--s2member-mms-registration-blogs-level0').val ('0');
66
}
67
/**/
68
- }).trigger /* Fire on ready too. */ ('change');
69
/**/
70
- $('select#ws-plugin--s2member-mms-registration-grants').change (function()
71
{
72
- $('select#ws-plugin--s2member-mms-registration-file').trigger ('change');
73
});
74
}
75
/**/
76
- if (location.href.match (/page\=ws-plugin--s2member-gen-ops/))
77
{
78
ws_plugin__s2member_generateSecurityKey = /* Generates a unique Security Key. */ function()
79
{
@@ -82,166 +82,171 @@ jQuery(document).ready (function($)
82
min = (arguments.length < 1) ? 0 : min;
83
max = (arguments.length < 2) ? 2147483647 : max;
84
/**/
85
- return Math.floor (Math.random () * (max - min + 1)) + min;
86
};
87
/**/
88
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()';
89
- for (var i = 0, key = ''; i < 64; i++) key += chars.substr (mt_rand(0, chars.length - 1), 1);
90
/**/
91
- $('input#ws-plugin--s2member-sec-encryption-key').val (key);
92
/**/
93
return false;
94
};
95
/**/
96
ws_plugin__s2member_enableSecurityKey = /* Allow Security Key editing?? */ function()
97
{
98
- 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.'))
99
- $('input#ws-plugin--s2member-sec-encryption-key').removeAttr ('disabled');
100
/**/
101
return false;
102
};
103
/**/
104
ws_plugin__s2member_securityKeyHistory = /* Displays history of Keys. */ function()
105
{
106
- $('div#ws-plugin--s2member-sec-encryption-key-history').toggle ();
107
/**/
108
return false;
109
};
110
/**/
111
- $('select#ws-plugin--s2member-new-user-emails-enabled').change (function()
112
{
113
var $pluggable = $('input#ws-plugin--s2member-pluggables-wp-new-user-notification'), $this = $(this), $newUserEmails = $('div#ws-plugin--s2member-new-user-emails');
114
/**/
115
- if ($pluggable.val () === '0' || $this.val () === '0')
116
{
117
- ($pluggable.val () === '0') ? $this.attr ('disabled', 'disabled') : $this.removeAttr ('disabled');
118
- $(':input', $newUserEmails).attr ('disabled', 'disabled'), $newUserEmails.css ('opacity', '0.5');
119
}
120
else /* Else we allow the emails to be customized. */
121
- $this.removeAttr ('disabled'), $(':input', $newUserEmails).removeAttr ('disabled'), $newUserEmails.css ('opacity', '');
122
/**/
123
- }).trigger /* Fire on ready too. */ ('change');
124
/**/
125
- if ($('input#ws-plugin--s2member-custom-reg-fields').length && $('div#ws-plugin--s2member-custom-reg-field-configuration').length)
126
{
127
( /* Wrap these routines inside a function to keep variables within relative scope. */function()
128
{
129
var i, fieldDefaults, tools, table, $tools, $table;
130
var $fields = $('input#ws-plugin--s2member-custom-reg-fields');
131
var $configuration = $('div#ws-plugin--s2member-custom-reg-field-configuration');
132
- var fields = ($fields.val ()) ? $.JSON.parse ($fields.val ()) : [];
133
/**/
134
fields = /* Force fields to an array. */ (fields instanceof Array) ? fields : [];
135
/**/
136
fieldDefaults = {section: 'no', sectitle: '', id: '', label: '', type: 'text', deflt: '', options: '', expected: '', required: 'yes', levels: 'all', editable: 'yes', classes: '', styles: '', attrs: ''};
137
/**/
138
- for (i = 0; i < fields.length; i++) fields[i] = /* Extend, based on defaults ( for future proofing ). */ $.extend (true, {}, fieldDefaults, fields[i]);
139
/**/
140
tools = '<div id="ws-plugin--s2member-custom-reg-field-configuration-tools"></div>', table = '<table id="ws-plugin--s2member-custom-reg-field-configuration-table"></table>';
141
/**/
142
- $configuration.html /* Add tools div & table div to configuration div ( i.e. div#ws-plugin--s2member-custom-reg-field-configuration ). */ (tools + table);
143
/**/
144
$tools = $('div#ws-plugin--s2member-custom-reg-field-configuration-tools'), $table = $('table#ws-plugin--s2member-custom-reg-field-configuration-table');
145
/**/
146
ws_plugin__s2member_customRegFieldSectionChange = function(select)
147
{
148
- var section = /* Current selection ( no|yes, selected by site owner ). */ $(select).val ();
149
/**/
150
var sectitle_trs = 'tr.ws-plugin--s2member-custom-reg-field-configuration-tools-form-sectitle';
151
/**/
152
- (section === 'yes') ? $(sectitle_trs).css ('display', '') : $(sectitle_trs).css ('display', 'none');
153
};
154
/**/
155
ws_plugin__s2member_customRegFieldTypeChange = /* Handle change events here. */ function(select)
156
{
157
- var type = /* Current selection ( type of Field, selected by site owner ). */ $(select).val ();
158
/**/
159
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';
160
/**/
161
- (type.match (/^(text|textarea)#x2F;)) ? $(deflt_trs).css ('display', '') : $(deflt_trs).css ('display', 'none');
162
- (type.match (/^(select|selects|checkboxes|radios)#x2F;)) ? $(options_trs).css ('display', '') : $(options_trs).css ('display', 'none');
163
- (type.match (/^(text|textarea)#x2F;)) ? $(expected_trs).css ('display', '') : $(expected_trs).css ('display', 'none');
164
};
165
/**/
166
ws_plugin__s2member_customRegFieldDelete = function(index)
167
{
168
- var newFields = /* Build array. */ new Array ();
169
/**/
170
- for (var i = 0; i < fields.length; i++)
171
- if /* Omit index. */ (i !== index)
172
- newFields.push (fields[i]);
173
/**/
174
- fields = newFields, updateFields (), buildTable ();
175
};
176
/**/
177
ws_plugin__s2member_customRegFieldMoveUp = function(index)
178
{
179
- if (typeof fields[index] === 'object' && typeof fields[index - 1] === 'object')
180
{
181
- var prevFieldObj = fields[index - 1], thisFieldObj = fields[index];
182
/**/
183
- fields[index - 1] = thisFieldObj, fields[index] = prevFieldObj;
184
/**/
185
- updateFields (), buildTable ();
186
}
187
};
188
/**/
189
ws_plugin__s2member_customRegFieldMoveDown = function(index)
190
{
191
- if (typeof fields[index] === 'object' && typeof fields[index + 1] === 'object')
192
{
193
- var nextFieldObj = fields[index + 1], thisFieldObj = fields[index];
194
/**/
195
- fields[index + 1] = thisFieldObj, fields[index] = nextFieldObj;
196
/**/
197
- updateFields (), buildTable ();
198
}
199
};
200
/**/
201
ws_plugin__s2member_customRegFieldCreate = function()
202
{
203
- var $table = $('table#ws-plugin--s2member-custom-reg-field-configuration-tools-form'), field = {};
204
/**/
205
- $(':input[property]', $table).each ( /* Go through each property value. */function()
206
{
207
- var $this = $(this), property = $this.attr ('property'), val = $.trim ($this.val ());
208
/**/
209
field[property] = val;
210
});
211
/**/
212
- if /* If it can be validated. */ ((field = validateField(field)))
213
{
214
- fields.push (field), updateFields (), buildTools (), buildTable (), scrollReset ();
215
/**/
216
setTimeout( /* A momentary delay here for usability. */function()
217
{
218
- var row = 'tr.ws-plugin--s2member-custom-reg-field-configuration-table-row-' + (fields.length - 1);
219
alert('Field created successfully.\n* Remember to "Save All Changes".');
220
- $(row).effect ('highlight', 1500);
221
}, 500);
222
}
223
};
224
/**/
225
ws_plugin__s2member_customRegFieldUpdate = function(index)
226
{
227
- var $table = $('table#ws-plugin--s2member-custom-reg-field-configuration-tools-form'), field = {};
228
/**/
229
- $(':input[property]', $table).each ( /* Go through each property value. */function()
230
{
231
- var $this = $(this), property = $this.attr ('property'), val = $.trim ($this.val ());
232
/**/
233
field[property] = val;
234
});
235
/**/
236
- if /* If it validates. */ ((field = validateField(field, index)))
237
{
238
- fields[index] = field, updateFields (), buildTools (), buildTable (), scrollReset ();
239
/**/
240
setTimeout( /* A momentary delay here for usability. */function()
241
{
242
- var row = 'tr.ws-plugin--s2member-custom-reg-field-configuration-table-row-' + index;
243
alert('Field updated successfully.\n* Remember to "Save All Changes".');
244
- $(row).effect ('highlight', 1500);
245
}, 500);
246
}
247
};
@@ -253,89 +258,90 @@ jQuery(document).ready (function($)
253
/**/
254
ws_plugin__s2member_customRegFieldEdit = /* Edit links. */ function(index)
255
{
256
- buildTools(false, index), scrollReset ();
257
};
258
/**/
259
ws_plugin__s2member_customRegFieldCancel = /* Cancel form. */ function()
260
{
261
- buildTools (), scrollReset ();
262
};
263
/**/
264
var validateField = function(field, index)
265
{
266
var editing = ( typeof index === 'number' && typeof fields[index] === 'object') ? true : false, errors = [], options, i;
267
/**/
268
- if (typeof field !== 'object' || typeof (field = $.extend (true, {}, fieldDefaults, field)) !== 'object')
269
{
270
alert('Invalid field object. Please try again.');
271
return false;
272
}
273
/**/
274
field.sectitle = (field.section === 'yes') ? field.sectitle : '';
275
- field.deflt = (field.type.match (/^(text|textarea)#x2F;)) ? field.deflt : '';
276
- field.deflt = (field.type.match (/^(text)#x2F;)) ? field.deflt.replace (/[\r\n\t ]+/g, ' ') : field.deflt;
277
- field.options = (field.type.match (/^(select|selects|checkboxes|radios)#x2F;)) ? field.options : '';
278
- field.expected = (field.type.match (/^(text|textarea)#x2F;)) ? field.expected : '';
279
/**/
280
- if /* Every Field must have a unique ID. */ (!field.id)
281
{
282
- errors.push ('Unique Field ID:\nThis is required. Please try again.');
283
}
284
- else if (fieldIdExists(field.id) && (!editing || field.id !== fields[index].id))
285
{
286
- errors.push ('Unique Field ID:\nThat Field ID already exists. Please try again.');
287
}
288
/**/
289
- if /* Every Field must have a label. */ (!field.label)
290
{
291
- errors.push ('Field Label/Description:\nThis is required. Please try again.');
292
}
293
/**/
294
- if (field.type.match (/^(select|selects|checkboxes|radios)#x2F;) && !field.options)
295
{
296
- errors.push ('Option Configuration File:\nThis is required. Please try again.');
297
}
298
- else if (field.type.match (/^(select|selects|checkboxes|radios)#x2F;))
299
{
300
- for (i = 0; i < (options = field.options.split (/[\r\n]+/)).length; i++)
301
{
302
- if (!(options[i] = $.trim (options[i])).match (/^([^\|]*)(\|)([^\|]*)(\|default)?#x2F;))
303
{
304
- errors.push ('Option Configuration File:\nInvalid configuration at line #' + (i + 1) + '.');
305
break; /* Break now. There could potentially be lots of lines with errors. */
306
}
307
}
308
/**/
309
- field.options = /* Clean up. */ $.trim (options.join ('\n'));
310
}
311
/**/
312
- if (!(field.levels = field.levels.replace (/ /g, '')))
313
{
314
- errors.push ('Applicable Levels:\nThis is required. Please try again.');
315
}
316
- else if (!field.levels.match (/^(all|[0-9,]+)#x2F;))
317
{
318
- errors.push ('Applicable Levels:\nShould be comma-delimited Levels, or just type: all.\n( examples: 0,1,2,3,4 or type the word: all )');
319
}
320
/**/
321
- if (field.classes && field.classes.match (/[^a-z 0-9 _ \-]/i))
322
{
323
- errors.push ('CSS Classes:\nContains invalid characters. Please try again.\n( only: alphanumerics, underscores, hyphens, spaces )');
324
}
325
/**/
326
- if (field.styles && field.styles.match (/["\=\>\<]/))
327
{
328
- errors.push ('CSS Styles:\nContains invalid characters. Please try again.\n( do NOT use these characters: = " < > )');
329
}
330
/**/
331
- if (field.attrs && field.attrs.match (/[\>\<]/))
332
{
333
- errors.push ('Other Attributes:\nContains invalid characters. Please try again.\n( do NOT use these characters: < > )');
334
}
335
/**/
336
- if /* Errors? */ (errors.length > 0)
337
{
338
- alert(errors.join ('\n\n'));
339
return false;
340
}
341
else /* Return. */
@@ -344,19 +350,19 @@ jQuery(document).ready (function($)
344
/**/
345
var updateFields = /* Update hidden input value. */ function()
346
{
347
- $fields.val (((fields.length > 0) ? $.JSON.stringify (fields) : ''));
348
};
349
/**/
350
var fieldId2Var = /* Convert ids to variables. */ function(fieldId)
351
{
352
- return ( typeof fieldId === 'string') ? $.trim (fieldId).toLowerCase ().replace (/[^a-z0-9]/g, '_') : '';
353
};
354
/**/
355
var fieldTypeDesc = function(type)
356
{
357
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 )'};
358
/**/
359
- if (typeof types[type] === 'string')
360
return types[type];
361
/**/
362
return /* Default. */ '';
@@ -364,25 +370,26 @@ jQuery(document).ready (function($)
364
/**/
365
var fieldIdExists = /* Already exists? */ function(fieldId)
366
{
367
- for (var i = 0; i < fields.length; i++)
368
- if (fields[i].id === fieldId)
369
return true;
370
};
371
/**/
372
var scrollReset = /* Return to Custom Fields section. */ function()
373
{
374
- scrollTo(0, $('div.ws-plugin--s2member-custom-reg-fields-section').offset ()['top'] - 100);
375
};
376
/**/
377
var buildTools = /* This builds tools into the configuration. */ function(adding, index)
378
{
379
- var i = 0, html = '', form = '', w = 0, h = 0, editing = ( typeof index === 'number' && typeof fields[index] === 'object') ? true : false, displayForm = (adding || editing) ? true : false, field = (editing) ? $.extend (true, {}, fieldDefaults, fields[index]) : fieldDefaults;
380
/**/
381
html += /* Click to add a new Custom Registration/Profile Field. */ '<a href="#" onclick="ws_plugin__s2member_customRegFieldAdd(); return false;">Add New Field</a>';
382
/**/
383
- tb_remove /* Remove an existing thickbox. */ (), $('div#ws-plugin--s2member-custom-reg-field-configuration-thickbox-tools-form').remove ();
384
/**/
385
- if /* Do we need to display the adding/editing form at all? */ (displayForm)
386
{
387
form += '<div id="ws-plugin--s2member-custom-reg-field-configuration-thickbox-tools-form">';
388
/**/
@@ -398,19 +405,19 @@ jQuery(document).ready (function($)
398
form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-section">';
399
form += '<td colspan="2">';
400
form += '<select property="section" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-section" onchange="ws_plugin__s2member_customRegFieldSectionChange(this);">';
401
- form += '<option value="no"' + ((field.section === 'no') ? ' selected="selected"' : '') + '">No ( this Field flows normally )</option>';
402
- form += '<option value="yes"' + ((field.section === 'yes') ? ' selected="selected"' : '') + '">Yes ( this Field begins a new section )</option>';
403
form += '</select><br />';
404
form += '<small>Optional. Allows Fields to be grouped into sections.</small>';
405
form += '</td>';
406
form += '</tr>';
407
/**/
408
- form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer ws-plugin--s2member-custom-reg-field-configuration-tools-form-sectitle ws-plugin--s2member-custom-reg-field-configuration-tools-form-section"' + ((field.section === 'yes') ? '' : ' style="display:none;"') + '><td colspan="2"><hr /></td></tr>';
409
/**/
410
- form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-sectitle ws-plugin--s2member-custom-reg-field-configuration-tools-form-section"' + ((field.section === 'yes') ? '' : ' style="display:none;"') + '>';
411
form += '<td colspan="2">';
412
form += 'Title for this new section? ( optional )<br />';
413
- form += '<input type="text" property="sectitle" autocomplete="off" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-sectitle" value="' + esc_attr(field.sectitle) + '" /><br />';
414
form += '<small>If empty, a simple divider will be used by default.</small>';
415
form += '</td>';
416
form += '</tr>';
@@ -426,14 +433,14 @@ jQuery(document).ready (function($)
426
form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-type">';
427
form += '<td colspan="2">';
428
form += '<select property="type" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-type" onchange="ws_plugin__s2member_customRegFieldTypeChange(this);">';
429
- form += '<option value="text"' + ((field.type === 'text') ? ' selected="selected"' : '') + '">' + esc_html(fieldTypeDesc('text')) + '</option>';
430
- form += '<option value="textarea"' + ((field.type === 'textarea') ? ' selected="selected"' : '') + '">' + esc_html(fieldTypeDesc('textarea')) + '</option>';
431
- form += '<option value="select"' + ((field.type === 'select') ? ' selected="selected"' : '') + '">' + esc_html(fieldTypeDesc('select')) + '</option>';
432
- form += '<option value="selects"' + ((field.type === 'selects') ? ' selected="selected"' : '') + '">' + esc_html(fieldTypeDesc('selects')) + '</option>';
433
- form += '<option value="checkbox"' + ((field.type === 'checkbox') ? ' selected="selected"' : '') + '">' + esc_html(fieldTypeDesc('checkbox')) + '</option>';
434
- form += '<option value="pre_checkbox"' + ((field.type === 'pre_checkbox') ? ' selected="selected"' : '') + '">' + esc_html(fieldTypeDesc('pre_checkbox')) + '</option>';
435
- form += '<option value="checkboxes"' + ((field.type === 'checkboxes') ? ' selected="selected"' : '') + '">' + esc_html(fieldTypeDesc('checkboxes')) + '</option>';
436
- form += '<option value="radios"' + ((field.type === 'radios') ? ' selected="selected"' : '') + '">' + esc_html(fieldTypeDesc('radios')) + '</option>';
437
form += '</select><br />';
438
form += '<small>The options below may change, based on the Field Type you choose here.</small>';
439
form += '</td>';
@@ -449,7 +456,7 @@ jQuery(document).ready (function($)
449
/**/
450
form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-label">';
451
form += '<td colspan="2">';
452
- form += '<input type="text" property="label" autocomplete="off" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-label" value="' + esc_attr(field.label) + '" /><br />';
453
form += '<small>Examples: <code>Choose Country</code>, <code>Street Address</code></small>';
454
form += '</td>';
455
form += '</tr>';
@@ -464,7 +471,7 @@ jQuery(document).ready (function($)
464
/**/
465
form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-id">';
466
form += '<td colspan="2">';
467
- form += '<input type="text" property="id" maxlength="25" autocomplete="off" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-id" value="' + esc_attr(field.id) + '" /><br />';
468
form += '<small>Examples: <code>country_code</code>, <code>street_address</code></small><br />';
469
form += '<small>e.g. <code>[s2Get user_field="country_code" /]</code></small>';
470
form += '</td>';
@@ -481,41 +488,41 @@ jQuery(document).ready (function($)
481
form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-required">';
482
form += '<td colspan="2">';
483
form += '<select property="required" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-required">';
484
- form += '<option value="yes"' + ((field.required === 'yes') ? ' selected="selected"' : '') + '">Yes ( required )</option>';
485
- form += '<option value="no"' + ((field.required === 'no') ? ' selected="selected"' : '') + '">No ( optional )</option>';
486
form += '</select><br />';
487
form += '<small>If <code>yes</code>, only Users/Members will be "required" to enter this field.</small><br />';
488
form += '<small>* Administrators are exempt from this requirement.</small>';
489
form += '</td>';
490
form += '</tr>';
491
/**/
492
- form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer ws-plugin--s2member-custom-reg-field-configuration-tools-form-deflt"' + ((field.type.match (/^(text|textarea)#x2F;)) ? '' : ' style="display:none;"') + '><td colspan="2">&nbsp;</td></tr>';
493
/**/
494
- form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-deflt"' + ((field.type.match (/^(text|textarea)#x2F;)) ? '' : ' style="display:none;"') + '>';
495
form += '<td colspan="2">';
496
form += '<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-deflt">Default Text Value: ( optional )</label>';
497
form += '</td>';
498
form += '</tr>';
499
/**/
500
- form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-deflt"' + ((field.type.match (/^(text|textarea)#x2F;)) ? '' : ' style="display:none;"') + '>';
501
form += '<td colspan="2">';
502
- form += '<textarea property="deflt" wrap="off" spellcheck="false" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-deflt" rows="1">' + esc_html(field.deflt) + '</textarea><br />';
503
form += '<small>Default value before user input is received.</small>';
504
form += '</td>';
505
form += '</tr>';
506
/**/
507
- form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer ws-plugin--s2member-custom-reg-field-configuration-tools-form-options"' + ((field.type.match (/^(select|selects|checkboxes|radios)#x2F;)) ? '' : ' style="display:none;"') + '><td colspan="2">&nbsp;</td></tr>';
508
/**/
509
- form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-options"' + ((field.type.match (/^(select|selects|checkboxes|radios)#x2F;)) ? '' : ' style="display:none;"') + '>';
510
form += '<td colspan="2">';
511
form += '<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-options">Option Configuration File: * ( one option per line )</label><br />';
512
form += '<small>Use a pipe <code>|</code> delimited format: <code>option value|option label</code></small>';
513
form += '</td>';
514
form += '</tr>';
515
/**/
516
- form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-options"' + ((field.type.match (/^(select|selects|checkboxes|radios)#x2F;)) ? '' : ' style="display:none;"') + '>';
517
form += '<td colspan="2">';
518
- form += '<textarea property="options" wrap="off" spellcheck="false" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-options" rows="3">' + esc_html(field.options) + '</textarea><br />';
519
form += 'Here is a quick example:<br />';
520
form += '<small>You can also specify a <em>default</em> option:</small><br />';
521
form += '<code>US|United States|default</code><br />';
@@ -524,105 +531,105 @@ jQuery(document).ready (function($)
524
form += '</td>';
525
form += '</tr>';
526
/**/
527
- form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer ws-plugin--s2member-custom-reg-field-configuration-tools-form-expected"' + ((field.type.match (/^(text|textarea)#x2F;)) ? '' : ' style="display:none;"') + '><td colspan="2">&nbsp;</td></tr>';
528
/**/
529
- form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-expected"' + ((field.type.match (/^(text|textarea)#x2F;)) ? '' : ' style="display:none;"') + '>';
530
form += '<td colspan="2">';
531
form += '<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-expected">Expected Format: *</label>';
532
form += '</td>';
533
form += '</tr>';
534
/**/
535
- form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-expected"' + ((field.type.match (/^(text|textarea)#x2F;)) ? '' : ' style="display:none;"') + '>';
536
form += '<td colspan="2">';
537
form += '<select property="expected" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-expected">';
538
/**/
539
- form += '<option value=""' + ((field.expected === '') ? ' selected="selected"' : '') + '">Anything Goes</option>';
540
form += '<option disabled="disabled"></option>';
541
/**/
542
form += '<optgroup label="Specific Input Types">';
543
- form += '<option value="numeric-wp-commas"' + ((field.expected === 'numeric-wp-commas') ? ' selected="selected"' : '') + '">Numeric ( with or without decimals, commas allowed )</option>';
544
- form += '<option value="numeric"' + ((field.expected === 'numeric') ? ' selected="selected"' : '') + '">Numeric ( with or without decimals, no commas )</option>';
545
- form += '<option value="integer"' + ((field.expected === 'integer') ? ' selected="selected"' : '') + '">Integer ( whole number, without any decimals )</option>';
546
- form += '<option value="integer-gt-0"' + ((field.expected === 'integer-gt-0') ? ' selected="selected"' : '') + '">Integer > 0 ( whole number, no decimals, greater than 0 )</option>';
547
- form += '<option value="float"' + ((field.expected === 'float') ? ' selected="selected"' : '') + '">Float ( floating point number, decimals required )</option>';
548
- form += '<option value="float-gt-0"' + ((field.expected === 'float-gt-0') ? ' selected="selected"' : '') + '">Float > 0 ( floating point number, decimals required, greater than 0 )</option>';
549
- form += '<option value="date"' + ((field.expected === 'date') ? ' selected="selected"' : '') + '">Date ( required date format: dd/mm/yyyy )</option>';
550
- form += '<option value="email"' + ((field.expected === 'email') ? ' selected="selected"' : '') + '">Email ( require valid email )</option>';
551
- form += '<option value="url"' + ((field.expected === 'url') ? ' selected="selected"' : '') + '">Full URL ( starting with http or https )</option>';
552
- form += '<option value="domain"' + ((field.expected === 'domain') ? ' selected="selected"' : '') + '">Domain Name ( domain name only, without http )</option>';
553
- form += '<option value="phone"' + ((field.expected === 'phone') ? ' selected="selected"' : '') + '">Phone # ( 10 digits w/possible hyphens,spaces,brackets )</option>';
554
- form += '<option value="uszip"' + ((field.expected === 'uszip') ? ' selected="selected"' : '') + '">US Zipcode ( 5-9 digits w/possible hyphen )</option>';
555
- form += '<option value="cazip"' + ((field.expected === 'cazip') ? ' selected="selected"' : '') + '">Canadian Zipcode ( 6 alpha-numerics w/possible space )</option>';
556
- form += '<option value="uczip"' + ((field.expected === 'uczip') ? ' selected="selected"' : '') + '">US/Canadian Zipcode ( either a US or Canadian zipcode )</option>';
557
form += '</optgroup>';
558
/**/
559
form += '<option disabled="disabled"></option>';
560
/**/
561
form += '<optgroup label="Any Character Combination">';
562
- for (i = 1; i <= 25; i++)
563
{
564
- form += '<option value="any-' + i + '"' + ((field.expected === 'any-' + i) ? ' selected="selected"' : '') + '">Any Character Combination ( ' + i + ' character minimum )</option>';
565
- form += '<option value="any-' + i + '-e"' + ((field.expected === 'any-' + i + '-e') ? ' selected="selected"' : '') + '">Any Character Combination ( exactly ' + i + ' character' + ((i > 1) ? 's' : '') + ' )</option>';
566
}
567
form += '</optgroup>';
568
/**/
569
form += '<option disabled="disabled"></option>';
570
/**/
571
form += '<optgroup label="Alphanumerics, Spaces &amp; Punctuation Only">';
572
- for (i = 1; i <= 25; i++)
573
{
574
- form += '<option value="alphanumerics-spaces-punctuation-' + i + '"' + ((field.expected === 'alphanumerics-spaces-punctuation-' + i) ? ' selected="selected"' : '') + '">Alphanumerics, Spaces &amp; Punctuation ( ' + i + ' character minimum )</option>';
575
- form += '<option value="alphanumerics-spaces-punctuation-' + i + '-e"' + ((field.expected === 'alphanumerics-spaces-punctuation-' + i + '-e') ? ' selected="selected"' : '') + '">Alphanumerics, Spaces &amp; Punctuation ( exactly ' + i + ' character' + ((i > 1) ? 's' : '') + ' )</option>';
576
}
577
form += '</optgroup>';
578
/**/
579
form += '<option disabled="disabled"></option>';
580
/**/
581
form += '<optgroup label="Alphanumerics &amp; Spaces Only">';
582
- for (i = 1; i <= 25; i++)
583
{
584
- form += '<option value="alphanumerics-spaces-' + i + '"' + ((field.expected === 'alphanumerics-spaces-' + i) ? ' selected="selected"' : '') + '">Alphanumerics &amp; Spaces ( ' + i + ' character minimum )</option>';
585
- form += '<option value="alphanumerics-spaces-' + i + '-e"' + ((field.expected === 'alphanumerics-spaces-' + i + '-e') ? ' selected="selected"' : '') + '">Alphanumerics &amp; Spaces ( exactly ' + i + ' character' + ((i > 1) ? 's' : '') + ' )</option>';
586
}
587
form += '</optgroup>';
588
/**/
589
form += '<option disabled="disabled"></option>';
590
/**/
591
form += '<optgroup label="Alphanumerics &amp; Punctuation Only">';
592
- for (i = 1; i <= 25; i++)
593
{
594
- form += '<option value="alphanumerics-punctuation-' + i + '"' + ((field.expected === 'alphanumerics-punctuation-' + i) ? ' selected="selected"' : '') + '">Alphanumerics &amp; Punctuation ( ' + i + ' character minimum )</option>';
595
- form += '<option value="alphanumerics-punctuation-' + i + '-e"' + ((field.expected === 'alphanumerics-punctuation-' + i + '-e') ? ' selected="selected"' : '') + '">Alphanumerics &amp; Punctuation ( exactly ' + i + ' character' + ((i > 1) ? 's' : '') + ' )</option>';
596
}
597
form += '</optgroup>';
598
/**/
599
form += '<option disabled="disabled"></option>';
600
/**/
601
form += '<optgroup label="Alphanumerics Only">';
602
- for (i = 1; i <= 25; i++)
603
{
604
- form += '<option value="alphanumerics-' + i + '"' + ((field.expected === 'alphanumerics-' + i) ? ' selected="selected"' : '') + '">Alphanumerics ( ' + i + ' character minimum )</option>';
605
- form += '<option value="alphanumerics-' + i + '-e"' + ((field.expected === 'alphanumerics-' + i + '-e') ? ' selected="selected"' : '') + '">Alphanumerics ( exactly ' + i + ' character' + ((i > 1) ? 's' : '') + ' )</option>';
606
}
607
form += '</optgroup>';
608
/**/
609
form += '<option disabled="disabled"></option>';
610
/**/
611
form += '<optgroup label="Alphabetics Only">';
612
- for (i = 1; i <= 25; i++)
613
{
614
- form += '<option value="alphabetics-' + i + '"' + ((field.expected === 'alphabetics-' + i) ? ' selected="selected"' : '') + '">Alphabetics ( ' + i + ' character minimum )</option>';
615
- form += '<option value="alphabetics-' + i + '-e"' + ((field.expected === 'alphabetics-' + i + '-e') ? ' selected="selected"' : '') + '">Alphabetics ( exactly ' + i + ' character' + ((i > 1) ? 's' : '') + ' )</option>';
616
}
617
form += '</optgroup>';
618
/**/
619
form += '<option disabled="disabled"></option>';
620
/**/
621
form += '<optgroup label="Numeric Digits Only">';
622
- for (i = 1; i <= 25; i++)
623
{
624
- form += '<option value="numerics-' + i + '"' + ((field.expected === 'numerics-' + i) ? ' selected="selected"' : '') + '">Numeric Digits ( ' + i + ' digit minimum )</option>';
625
- form += '<option value="numerics-' + i + '-e"' + ((field.expected === 'numerics-' + i + '-e') ? ' selected="selected"' : '') + '">Numeric Digits ( exactly ' + i + ' digit' + ((i > 1) ? 's' : '') + ' )</option>';
626
}
627
form += '</optgroup>';
628
/**/
@@ -642,7 +649,7 @@ jQuery(document).ready (function($)
642
/**/
643
form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-levels">';
644
form += '<td colspan="2">';
645
- form += '<input type="text" property="levels" autocomplete="off" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-levels" value="' + esc_attr(field.levels) + '" /><br />';
646
form += '<small>Please use comma-delimited Level #\'s: <code>0,1,2,3,4</code> or type: <code>all</code>.</small><br />';
647
form += '<small>This allows you to enable this field - only at specific Membership Levels.</small>';
648
form += '</td>';
@@ -659,10 +666,11 @@ jQuery(document).ready (function($)
659
form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-editable">';
660
form += '<td colspan="2">';
661
form += '<select property="editable" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-editable">';
662
- form += '<option value="yes"' + ((field.editable === 'yes') ? ' selected="selected"' : '') + '">Yes ( editable )</option>';
663
- form += '<option value="no"' + ((field.editable === 'no') ? ' selected="selected"' : '') + '">No ( uneditable after registration )</option>';
664
- form += '<option value="no-invisible"' + ((field.editable === 'no-invisible') ? ' selected="selected"' : '') + '">No ( uneditable &amp; totally invisible after registration )</option>';
665
- form += '<option value="yes-invisible"' + ((field.editable === 'yes-invisible') ? ' selected="selected"' : '') + '">Yes ( editable after registration / invisible during registration )</option>';
666
form += '</select><br />';
667
form += '<small>If <code>No</code>, this field will be un-editable after registration.</small><br />';
668
form += '<small>* Administrators are exempt from this.</small>';
@@ -679,7 +687,7 @@ jQuery(document).ready (function($)
679
/**/
680
form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-classes">';
681
form += '<td colspan="2">';
682
- form += '<input type="text" property="classes" autocomplete="off" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-classes" value="' + esc_attr(field.classes) + '" /><br />';
683
form += '<small>Example: <code>my-style-1 my-style-2</code></small>';
684
form += '</td>';
685
form += '</tr>';
@@ -694,7 +702,7 @@ jQuery(document).ready (function($)
694
/**/
695
form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-styles">';
696
form += '<td colspan="2">';
697
- form += '<input type="text" property="styles" autocomplete="off" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-styles" value="' + esc_attr(field.styles) + '" /><br />';
698
form += '<small>Example: <code>color:#000000; background:#FFFFFF;</code></small>';
699
form += '</td>';
700
form += '</tr>';
@@ -709,7 +717,7 @@ jQuery(document).ready (function($)
709
/**/
710
form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-attrs">';
711
form += '<td colspan="2">';
712
- form += '<input type="text" property="attrs" autocomplete="off" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-attrs" value="' + esc_attr(field.attrs) + '" /><br />';
713
form += '<small>Example: <code>onkeyup="" onblur=""</code></small>';
714
form += '</td>';
715
form += '</tr>';
@@ -721,7 +729,7 @@ jQuery(document).ready (function($)
721
form += '<input type="button" value="Cancel" onclick="ws_plugin__s2member_customRegFieldCancel();" />';
722
form += '</td>';
723
form += '<td align="right">';
724
- form += '<input type="button" value="' + ((editing) ? 'Update This Field' : 'Create Registration Field') + '" onclick="' + ((editing) ? 'ws_plugin__s2member_customRegFieldUpdate(' + index + ');' : 'ws_plugin__s2member_customRegFieldCreate();') + '" />';
725
form += '</td>';
726
form += '</tr>';
727
/**/
@@ -730,14 +738,14 @@ jQuery(document).ready (function($)
730
/**/
731
form += '<div>';
732
/**/
733
- $('body').append (form);
734
/**/
735
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');
736
/**/
737
- $('table#ws-plugin--s2member-custom-reg-field-configuration-tools-form').show ();
738
}
739
/**/
740
- $tools.html (html);
741
};
742
/**/
743
var buildTable = /* This builds the table of existing fields. */ function()
@@ -755,17 +763,17 @@ jQuery(document).ready (function($)
755
html += '<th>- Tools -</th>';
756
html += '</tr>';
757
/**/
758
- if /* Any fields? */ (fields.length > 0)
759
{
760
- for (i = 0; i < fields.length; i++)
761
{
762
- html += '<tr class="' + esc_attr((eo = (eo === 'o') ? 'e' : 'o')) + ((fields[i].section === 'yes') ? ' s' : '') + ' ws-plugin--s2member-custom-reg-field-configuration-table-row-' + i + '">'; /* Odd/even + row identifier. */
763
- html += '<td nowrap="nowrap"><a class="ws-plugin--s2member-custom-reg-field-configuration-move-up" href="#" onclick="ws_plugin__s2member_customRegFieldMoveUp(' + i + '); return false;"></a><a class="ws-plugin--s2member-custom-reg-field-configuration-move-down" href="#" onclick="ws_plugin__s2member_customRegFieldMoveDown(' + i + '); return false;"></a></td>';
764
- html += '<td nowrap="nowrap">' + esc_html(fieldTypeDesc(fields[i].type)) + '</td>';
765
- html += '<td nowrap="nowrap">' + esc_html(fields[i].id) + '</td>';
766
- html += '<td nowrap="nowrap">' + esc_html(fields[i].required) + '</td>';
767
- html += '<td nowrap="nowrap">' + esc_html(fields[i].levels) + '</td>';
768
- html += '<td nowrap="nowrap"><a class="ws-plugin--s2member-custom-reg-field-configuration-edit" href="#" onclick="ws_plugin__s2member_customRegFieldEdit(' + i + '); return false;"></a><a class="ws-plugin--s2member-custom-reg-field-configuration-delete" href="#" onclick="ws_plugin__s2member_customRegFieldDelete(' + i + '); return false;"></a></td>';
769
html += '</tr>';
770
}
771
}
@@ -778,78 +786,78 @@ jQuery(document).ready (function($)
778
/**/
779
html += '</tbody>';
780
/**/
781
- $table.html (html);
782
};
783
/* Initialize config. */
784
- buildTools (), buildTable ();
785
/**/
786
- }) ();
787
}
788
}
789
/**/
790
- if (location.href.match (/page\=ws-plugin--s2member-res-ops/))
791
{
792
- $('input#ws-plugin--s2member-brute-force-restrictions-reset-button').click (function()
793
{
794
var $this = /* Save $(this) into $this. */ $(this);
795
- $this.val /* Indicate loading status ( please wait ). */ ('one moment please ...');
796
/**/
797
- $.post (ajaxurl, {action: 'ws_plugin__s2member_delete_reset_all_ip_restrictions_via_ajax', ws_plugin__s2member_delete_reset_all_ip_restrictions_via_ajax: '<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (wp_create_nonce ("ws-plugin--s2member-delete-reset-all-ip-restrictions-via-ajax")); ?>'}, function(response)
798
{
799
- alert('s2Member\'s Brute Force Restriction Logs have all been reset.'), $this.val ('Reset Brute Force Logs');
800
});
801
/**/
802
return false;
803
});
804
/**/
805
- $('input#ws-plugin--s2member-ip-restrictions-reset-button').click (function()
806
{
807
var $this = /* Save $(this) into $this. */ $(this);
808
- $this.val /* Indicate loading status ( please wait ). */ ('one moment please ...');
809
/**/
810
- $.post (ajaxurl, {action: 'ws_plugin__s2member_delete_reset_all_ip_restrictions_via_ajax', ws_plugin__s2member_delete_reset_all_ip_restrictions_via_ajax: '<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (wp_create_nonce ("ws-plugin--s2member-delete-reset-all-ip-restrictions-via-ajax")); ?>'}, function(response)
811
{
812
- alert('s2Member\'s IP Restriction Logs have all been reset.'), $this.val ('Reset IP Restriction Logs');
813
});
814
/**/
815
return false;
816
});
817
/**/
818
- $('div.ws-plugin--s2member-query-level-access-section input[type="checkbox"][name="ws_plugin__s2member_filter_wp_query\[\]"]').change (function()
819
{
820
- var thisChange = /* Record value associated with change event. Allows for intutitive unchecking. */ $(this).val ();
821
/**/
822
- $('div.ws-plugin--s2member-query-level-access-section input[type="checkbox"][name="ws_plugin__s2member_filter_wp_query\[\]"]').each (function()
823
{
824
- var $this = $(this), val = $this.val (), checkboxes = 'input[type="checkbox"]';
825
/**/
826
- if /* All sub-items get checked/disabled. */ (val === 'all' && this.checked)
827
- $this.nextAll (checkboxes).attr ({'checked': 'checked', 'disabled': 'disabled'});
828
/**/
829
- else if (val === 'all' && !this.checked)
830
{
831
- $this.nextAll (checkboxes).removeAttr ('disabled');
832
- (thisChange === 'all') ? $this.nextAll (checkboxes).removeAttr ('checked') : null;
833
}
834
});
835
/**/
836
- }).last ().trigger ('change');
837
}
838
/**/
839
- if (location.href.match (/page\=ws-plugin--s2member-down-ops/))
840
{
841
var updateCloudFrontPrivateKey = /* Attaches to events below. */ function()
842
{
843
var $hiddenPrivateKey = $('input#ws-plugin--s2member-amazon-cf-files-private-key');
844
var $visiblePrivateKeyEntry = $('textarea#ws-plugin--s2member-amazon-cf-files-private-key-entry');
845
- var hiddenPrivateKeyValue = $.trim ($hiddenPrivateKey.val ()), visiblePrivateKeyEntryValue = $.trim ($visiblePrivateKeyEntry.val ());
846
/**/
847
- if ((hiddenPrivateKeyValue && !visiblePrivateKeyEntryValue) || visiblePrivateKeyEntryValue.match /* 9679.toString(16).toUpperCase() = 25CF. */ (/[^\r\n\u25CF]/))
848
- $hiddenPrivateKey.val (visiblePrivateKeyEntryValue), $visiblePrivateKeyEntry.val (visiblePrivateKeyEntryValue.replace (/[^\r\n]/g, String.fromCharCode (9679)));
849
};
850
/**/
851
- $('form#ws-plugin--s2member-options-form').submit (updateCloudFrontPrivateKey);
852
- $('textarea#ws-plugin--s2member-amazon-cf-files-private-key-entry').change (updateCloudFrontPrivateKey).trigger ('change');
853
/**/
854
var updateCloudFrontDistroCfgs = /* Attaches to events below. */ function()
855
{
@@ -859,204 +867,205 @@ jQuery(document).ready (function($)
859
var $autoConfigDistros = $('input#ws-plugin--s2member-amazon-cf-files-auto-configure-distros');
860
var $autoConfigDistrosStatus = $('input#ws-plugin--s2member-amazon-cf-files-distros-auto-config-status');
861
/**/
862
- var autoConfigDistrosStatusValue = $.trim ($autoConfigDistrosStatus.val ());
863
- var hiddenPrivateKeyValue = $.trim ($hiddenPrivateKey.val ()), visiblePrivateKeyIdValue = $.trim ($visiblePrivateKeyId.val ());
864
- var hiddenPrivateKeyPrevConfigValue = $.trim ($hiddenPrivateKey.attr ('data-s-prev-config-value')), visiblePrivateKeyIdPrevConfigValue = $.trim ($visiblePrivateKeyId.attr ('data-s-prev-config-value'));
865
/**/
866
- if (autoConfigDistrosStatusValue === 'configured' && ((visiblePrivateKeyIdPrevConfigValue && visiblePrivateKeyIdValue !== visiblePrivateKeyIdPrevConfigValue) || (hiddenPrivateKeyPrevConfigValue && hiddenPrivateKeyValue !== hiddenPrivateKeyPrevConfigValue)))
867
{
868
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.');
869
- $autoConfigDistros.attr /* Forcibly check. */ ('checked', 'checked');
870
}
871
- else if (autoConfigDistrosStatusValue !== 'configured' && visiblePrivateKeyIdValue && hiddenPrivateKeyValue)
872
{
873
alert('s2Member will need to auto-configure your Amazon® CloudFront distributions for you. When you\'re done editing, click (Save All Changes) below.');
874
- $autoConfigDistros.attr /* Forcibly check. */ ('checked', 'checked');
875
}
876
};
877
/**/
878
- $('input#ws-plugin--s2member-amazon-cf-files-private-key-id').change (updateCloudFrontDistroCfgs);
879
- $('textarea#ws-plugin--s2member-amazon-cf-files-private-key-entry').change (updateCloudFrontDistroCfgs);
880
/**/
881
- $('input#ws-plugin--s2member-amazon-cf-files-auto-configure-distros-w-cnames').change (function()
882
{
883
var $this = $(this), thisChecked = (this.checked) ? true : false;
884
var $autoConfigDistros = $('input#ws-plugin--s2member-amazon-cf-files-auto-configure-distros');
885
var $autoConfigDistroCnames = $('div#ws-plugin--s2member-amazon-cf-files-auto-configure-distro-cnames');
886
/**/
887
- (thisChecked) ? $autoConfigDistroCnames.show () : $autoConfigDistroCnames.hide ();
888
- (thisChecked) ? $autoConfigDistros.attr ('checked', 'checked') : null;
889
/**/
890
- }).trigger ('change');
891
}
892
/**/
893
- if (location.href.match (/page\=ws-plugin--s2member-paypal-ops/))
894
{
895
- $('select#ws-plugin--s2member-auto-eot-system-enabled').change (function()
896
{
897
- var $this = $(this), val = $this.val ();
898
var $viaCron = $('p#ws-plugin--s2member-auto-eot-system-enabled-via-cron');
899
/**/
900
- if /* Display Cron instructions. */ (val == 2)
901
- $viaCron.show ()
902
else /* Hide instructions. */
903
- $viaCron.hide ();
904
});
905
}
906
/**/
907
- if (location.href.match (/page\=ws-plugin--s2member-paypal-buttons/))
908
{
909
- $('div.ws-menu-page select[id]').filter ( /* Filter all select elements with an id. */function()
910
{
911
- return this.id.match (/^ws-plugin--s2member-(level[1-9][0-9]*|modification)-term#x2F;);
912
- }).change (function()
913
{
914
- var button = this.id.replace (/^ws-plugin--s2member-(.+?)-term#x2F;g, '$1');
915
- var trialDisabled = ($(this).val ().split ('-')[2].replace (/[^0-1BN]/g, '') === 'BN') ? 1 : 0;
916
/**/
917
- $('p#ws-plugin--s2member-' + button + '-trial-line').css ('display', (trialDisabled ? 'none' : ''));
918
- $('span#ws-plugin--s2member-' + button + '-trial-then').css ('display', (trialDisabled ? 'none' : ''));
919
- $('span#ws-plugin--s2member-' + button + '-20p-rule').css ('display', (trialDisabled ? 'none' : ''));
920
/**/
921
- (trialDisabled) ? $('input#ws-plugin--s2member-' + button + '-trial-period').val (0) : null;
922
- (trialDisabled) ? $('input#ws-plugin--s2member-' + button + '-trial-amount').val ('0.00') : null;
923
});
924
/**/
925
- $('div.ws-menu-page input[id]').filter ( /* Filter all input elements with an id. */function()
926
{
927
- return this.id.match (/^ws-plugin--s2member-(level[1-9][0-9]*|modification|ccap)-ccaps#x2F;);
928
- }).keyup (function()
929
{
930
- var value = this.value.replace (/^(-all|-al|-a|-)[;,]*/gi, ''), _all = (this.value.match (/^(-all|-al|-a|-)[;,]*/i)) ? '-all,' : '';
931
- if /* Only if there is a problem with the actual values; because this causes interruptions. */ (value.match (/[^a-z_0-9,]/))
932
- this.value = _all + $.trim ($.trim (value).replace (/[ \-]/g, '_').replace (/[^a-z_0-9,]/gi, '').toLowerCase ());
933
});
934
/**/
935
ws_plugin__s2member_paypalButtonGenerate = /* Handles PayPal® Button Generation. */ function(button)
936
{
937
- var shortCodeTemplate = '[s2Member-PayPal-Button %%attrs%% image="default" output="button" /]', shortCodeTemplateAttrs = '', labels = {};
938
/**/
939
eval("<?php echo c_ws_plugin__s2member_utils_strings::esc_dq($labels); ?>");
940
/**/
941
- var shortCode = $('input#ws-plugin--s2member-' + button + '-shortcode');
942
- var code = $('textarea#ws-plugin--s2member-' + button + '-button');
943
var modLevel = $('select#ws-plugin--s2member-modification-level');
944
/**/
945
- var level = (button === 'modification') ? modLevel.val ().split (':', 2)[1] : button.replace (/^level/, '');
946
- var label = /* Labels may NOT contain double-quotes. */ labels['level' + level].replace (/"/g, '');
947
- var desc = $.trim ($('input#ws-plugin--s2member-' + button + '-desc').val ().replace (/"/g, ""));
948
/**/
949
- var trialAmount = $('input#ws-plugin--s2member-' + button + '-trial-amount').val ().replace (/[^0-9\.]/g, '');
950
- var trialPeriod = $('input#ws-plugin--s2member-' + button + '-trial-period').val ().replace (/[^0-9]/g, '');
951
- var trialTerm = $('select#ws-plugin--s2member-' + button + '-trial-term').val ().replace (/[^A-Z]/g, '');
952
/**/
953
- var regAmount = $('input#ws-plugin--s2member-' + button + '-amount').val ().replace (/[^0-9\.]/g, '');
954
- var regPeriod = $('select#ws-plugin--s2member-' + button + '-term').val ().split ('-')[0].replace (/[^0-9]/g, '');
955
- var regTerm = $('select#ws-plugin--s2member-' + button + '-term').val ().split ('-')[1].replace (/[^A-Z]/g, '');
956
- var regRecur = $('select#ws-plugin--s2member-' + button + '-term').val ().split ('-')[2].replace (/[^0-1BN]/g, '');
957
var /* These options are NOT yet configurable. */ regRecurTimes = '', regRecurRetry = '1';
958
/**/
959
var /* NOT yet configurable. */ localeCode = '', digital = '0', noShipping = '1';
960
- var pageStyle = $.trim ($('input#ws-plugin--s2member-' + button + '-page-style').val ().replace (/"/g, ''));
961
- var currencyCode = $('select#ws-plugin--s2member-' + button + '-currency').val ().replace (/[^A-Z]/g, '');
962
/**/
963
- 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 ());
964
- cCaps = ($.trim ($('input#ws-plugin--s2member-' + button + '-ccaps').val ()).match (/^(-all|-al|-a|-)[;,]*/i)) ? ((cCaps) ? '-all,' : '-all') + cCaps.toLowerCase () : cCaps.toLowerCase ();
965
/**/
966
trialPeriod = /* Lifetime ( 1-L-BN ) and Buy Now ( BN ) access is absolutely NOT compatible w/ Trial Periods. */ (regRecur === 'BN') ? '0' : trialPeriod;
967
trialAmount = /* Validate Trial Amount. */ (!trialAmount || isNaN(trialAmount) || trialAmount < 0.01 || trialPeriod <= 0) ? '0' : trialAmount;
968
/**/
969
- var levelCcapsPer = (regRecur === 'BN' && regTerm !== 'L') ? level + ':' + cCaps + ':' + regPeriod + ' ' + regTerm : level + ':' + cCaps;
970
- levelCcapsPer = /* Clean any trailing separators from this string. */ levelCcapsPer.replace (/\:+#x2F;g, '');
971
/**/
972
- if (trialAmount !== '0' && (isNaN(trialAmount) || trialAmount < 0.00))
973
{
974
alert('— Oops, a slight problem: —\n\nWhen provided, Trial Amount must be >= 0.00');
975
return false;
976
}
977
- else if (trialAmount !== '0' && /* Maximum. */ trialAmount > 10000.00)
978
{
979
alert('— Oops, a slight problem: —\n\nMaximum Trial Amount is: 10000.00');
980
return false;
981
}
982
- else if (trialTerm === 'D' && /* Some validation on the Trial Period. Max days: 7. */ trialPeriod > 7)
983
{
984
alert('— Oops, a slight problem: —\n\nMaximum Trial Days is: 7.\nIf you want to offer more than 7 days, please choose Weeks or Months from the drop-down.');
985
return false;
986
}
987
- else if (trialTerm === 'W' && /* Some validation on the Trial Period. 52 max. */ trialPeriod > 52)
988
{
989
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.');
990
return false;
991
}
992
- else if (trialTerm === 'M' && /* Some validation on the Trial Period. 12 max. */ trialPeriod > 12)
993
{
994
alert('— Oops, a slight problem: —\n\nMaximum Trial Months is: 12.\nIf you want to offer more than 12 months, please choose Years from the drop-down.');
995
return false;
996
}
997
- else if (trialTerm === 'Y' && /* 1 year max. */ trialPeriod > 1)
998
{
999
alert('— Oops, a slight problem: —\n\nMax Trial Period Years is: 1.');
1000
return false;
1001
}
1002
- else if (!regAmount || isNaN(regAmount) || regAmount < 0.01)
1003
{
1004
alert('— Oops, a slight problem: —\n\nAmount must be >= 0.01');
1005
return false;
1006
}
1007
- else if (regAmount > /* $10,000.00 maximum. */ 10000.00)
1008
{
1009
alert('— Oops, a slight problem: —\n\nMaximum Amount is: 10000.00');
1010
return false;
1011
}
1012
- else if /* Each Button should have a Description. */ (!desc)
1013
{
1014
alert('— Oops, a slight problem: —\n\nPlease type a Description for this Button.');
1015
return false;
1016
}
1017
/**/
1018
- code.html (code.val ().replace (/ \<\!--(\<input type\="hidden" name\="(amount|src|srt|sra|a1|p1|t1|a3|p3|t3)" value\="(.*?)" \/\>)--\>/g, " $1"));
1019
- (parseInt(trialPeriod) <= 0) ? code.html (code.val ().replace (/ (\<input type\="hidden" name\="(a1|p1|t1)" value\="(.*?)" \/\>)/g, " <!--$1-->")) : null;
1020
- (regRecur === 'BN') ? code.html (code.val ().replace (/ (\<input type\="hidden" name\="cmd" value\=")(.*?)(" \/\>)/g, " $1_xclick$3")) : null;
1021
- (regRecur === 'BN') ? code.html (code.val ().replace (/ (\<input type\="hidden" name\="(src|srt|sra|a1|p1|t1|a3|p3|t3)" value\="(.*?)" \/\>)/g, " <!--$1-->")) : null;
1022
- (regRecur !== 'BN') ? code.html (code.val ().replace (/ (\<input type\="hidden" name\="cmd" value\=")(.*?)(" \/\>)/g, " $1_xclick-subscriptions$3")) : null;
1023
- (regRecur !== 'BN') ? code.html (code.val ().replace (/ (\<input type\="hidden" name\="amount" value\="(.*?)" \/\>)/g, " <!--$1-->")) : null;
1024
/**/
1025
shortCodeTemplateAttrs += /* For Modification Buttons. */ (button === 'modification') ? 'modify="1" ' : '';
1026
- 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="<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (esc_attr ($_SERVER["HTTP_HOST"])); ?>"';
1027
- 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) + '"';
1028
- shortCode.val (shortCodeTemplate.replace (/%%attrs%%/, shortCodeTemplateAttrs));
1029
/**/
1030
- code.html (code.val ().replace (/ name\="lc" value\="(.*?)"/, ' name="lc" value="' + esc_attr(localeCode) + '"'));
1031
- code.html (code.val ().replace (/ name\="no_shipping" value\="(.*?)"/, ' name="no_shipping" value="' + esc_attr(noShipping) + '"'));
1032
- code.html (code.val ().replace (/ name\="item_name" value\="(.*?)"/, ' name="item_name" value="' + esc_attr(desc) + '"'));
1033
- code.html (code.val ().replace (/ name\="item_number" value\="(.*?)"/, ' name="item_number" value="' + esc_attr(levelCcapsPer) + '"'));
1034
- code.html (code.val ().replace (/ name\="page_style" value\="(.*?)"/, ' name="page_style" value="' + esc_attr(pageStyle) + '"'));
1035
- code.html (code.val ().replace (/ name\="currency_code" value\="(.*?)"/, ' name="currency_code" value="' + esc_attr(currencyCode) + '"'));
1036
- code.html (code.val ().replace (/ name\="custom" value\="(.*?)"/, ' name="custom" value="<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (esc_attr ($_SERVER["HTTP_HOST"])); ?>"'));
1037
/**/
1038
- code.html (code.val ().replace (/ name\="modify" value\="(.*?)"/, ' name="modify" value="' + ((button === 'modification') ? '1' : '0') + '"'));
1039
/**/
1040
- code.html (code.val ().replace (/ name\="amount" value\="(.*?)"/, ' name="amount" value="' + esc_attr(regAmount) + '"'));
1041
/**/
1042
- code.html (code.val ().replace (/ name\="src" value\="(.*?)"/, ' name="src" value="' + esc_attr(regRecur) + '"'));
1043
- code.html (code.val ().replace (/ name\="srt" value\="(.*?)"/, ' name="srt" value="' + esc_attr(regRecurTimes) + '"'));
1044
- code.html (code.val ().replace (/ name\="sra" value\="(.*?)"/, ' name="sra" value="' + esc_attr(regRecurRetry) + '"'));
1045
/**/
1046
- code.html (code.val ().replace (/ name\="a1" value\="(.*?)"/, ' name="a1" value="' + esc_attr(trialAmount) + '"'));
1047
- code.html (code.val ().replace (/ name\="p1" value\="(.*?)"/, ' name="p1" value="' + esc_attr(trialPeriod) + '"'));
1048
- code.html (code.val ().replace (/ name\="t1" value\="(.*?)"/, ' name="t1" value="' + esc_attr(trialTerm) + '"'));
1049
- code.html (code.val ().replace (/ name\="a3" value\="(.*?)"/, ' name="a3" value="' + esc_attr(regAmount) + '"'));
1050
- code.html (code.val ().replace (/ name\="p3" value\="(.*?)"/, ' name="p3" value="' + esc_attr(regPeriod) + '"'));
1051
- code.html (code.val ().replace (/ name\="t3" value\="(.*?)"/, ' name="t3" value="' + esc_attr(regTerm) + '"'));
1052
/**/
1053
- $('div#ws-plugin--s2member-' + button + '-button-prev').html (code.val ().replace (/\<form/, '<form target="_blank"').replace (/\<\?php echo S2MEMBER_VALUE_FOR_PP_INV\(\); \?\>/g, Math.round (new Date ().getTime ()) + '~<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (esc_attr ($_SERVER["REMOTE_ADDR"])); ?>').replace (/\<\?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_(ON0|OS0|ON1|OS1); \?\>/g, ''));
1054
/**/
1055
(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.');
1056
/**/
1057
- shortCode.each ( /* Focus and select the Shortcode. */function()
1058
{
1059
- this.focus (), this.select ();
1060
});
1061
/**/
1062
return false;
@@ -1069,65 +1078,65 @@ jQuery(document).ready (function($)
1069
var shortCode = $('input#ws-plugin--s2member-ccap-shortcode');
1070
var code = $('textarea#ws-plugin--s2member-ccap-button');
1071
/**/
1072
- var desc = $.trim ($('input#ws-plugin--s2member-ccap-desc').val ().replace (/"/g, ''));
1073
/**/
1074
- var regAmount = $('input#ws-plugin--s2member-ccap-amount').val ().replace (/[^0-9\.]/g, '');
1075
- var regPeriod = $('select#ws-plugin--s2member-ccap-term').val ().split ('-')[0].replace (/[^0-9]/g, '');
1076
- var regTerm = $('select#ws-plugin--s2member-ccap-term').val ().split ('-')[1].replace (/[^A-Z]/g, '');
1077
- var regRecur = $('select#ws-plugin--s2member-ccap-term').val ().split ('-')[2].replace (/[^0-1BN]/g, '');
1078
/**/
1079
var /* NOT yet configurable. */ localeCode = '', digital = '0', noShipping = '1';
1080
- var pageStyle = $.trim ($('input#ws-plugin--s2member-ccap-page-style').val ().replace (/"/g, ''));
1081
- var currencyCode = $('select#ws-plugin--s2member-ccap-currency').val ().replace (/[^A-Z]/g, '');
1082
/**/
1083
- 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 ());
1084
- cCaps = ($.trim ($('input#ws-plugin--s2member-ccap-ccaps').val ()).match (/^(-all|-al|-a|-)[;,]*/i)) ? ((cCaps) ? '-all,' : '-all') + cCaps.toLowerCase () : cCaps.toLowerCase ();
1085
/**/
1086
- var levelCcapsPer = (regRecur === 'BN' && regTerm !== 'L') ? '*:' + cCaps + ':' + regPeriod + ' ' + regTerm : '*:' + cCaps;
1087
- levelCcapsPer = /* Clean any trailing separators from this string. */ levelCcapsPer.replace (/\:+#x2F;g, '');
1088
/**/
1089
- if /* Must have some Independent Custom Capabilities. */ (!cCaps || cCaps === '-all')
1090
{
1091
alert('— Oops, a slight problem: —\n\nPlease provide at least one Custom Capability.');
1092
return false;
1093
}
1094
- else if (!regAmount || isNaN(regAmount) || regAmount < 0.01)
1095
{
1096
alert('— Oops, a slight problem: —\n\nAmount must be >= 0.01');
1097
return false;
1098
}
1099
- else if /* $10,000.00 maximum. */ (regAmount > 10000.00)
1100
{
1101
alert('— Oops, a slight problem: —\n\nMaximum Amount is: 10000.00');
1102
return false;
1103
}
1104
- else if /* Each Button should have a Description. */ (!desc)
1105
{
1106
alert('— Oops, a slight problem: —\n\nPlease type a Description for this Button.');
1107
return false;
1108
}
1109
/**/
1110
- 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) + '"';
1111
- shortCodeTemplateAttrs += ' custom="<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (esc_attr ($_SERVER["HTTP_HOST"])); ?>" ra="' + esc_attr(regAmount) + '" rp="' + esc_attr(regPeriod) + '" rt="' + esc_attr(regTerm) + '" rr="' + esc_attr(regRecur) + '"';
1112
- shortCode.val (shortCodeTemplate.replace (/%%attrs%%/, shortCodeTemplateAttrs));
1113
/**/
1114
- code.html (code.val ().replace (/ name\="lc" value\="(.*?)"/, ' name="lc" value="' + esc_attr(localeCode) + '"'));
1115
- code.html (code.val ().replace (/ name\="no_shipping" value\="(.*?)"/, ' name="no_shipping" value="' + esc_attr(noShipping) + '"'));
1116
- code.html (code.val ().replace (/ name\="item_name" value\="(.*?)"/, ' name="item_name" value="' + esc_attr(desc) + '"'));
1117
- code.html (code.val ().replace (/ name\="item_number" value\="(.*?)"/, ' name="item_number" value="' + esc_attr(levelCcapsPer) + '"'));
1118
- code.html (code.val ().replace (/ name\="page_style" value\="(.*?)"/, ' name="page_style" value="' + esc_attr(pageStyle) + '"'));
1119
- code.html (code.val ().replace (/ name\="currency_code" value\="(.*?)"/, ' name="currency_code" value="' + esc_attr(currencyCode) + '"'));
1120
- code.html (code.val ().replace (/ name\="custom" value\="(.*?)"/, ' name="custom" value="<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (esc_attr ($_SERVER["HTTP_HOST"])); ?>"'));
1121
/**/
1122
- code.html (code.val ().replace (/ name\="amount" value\="(.*?)"/, ' name="amount" value="' + esc_attr(regAmount) + '"'));
1123
/**/
1124
- $('div#ws-plugin--s2member-ccap-button-prev').html (code.val ().replace (/\<form/, '<form target="_blank"').replace (/\<\?php echo S2MEMBER_VALUE_FOR_PP_INV\(\); \?\>/g, Math.round (new Date ().getTime ()) + '~<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (esc_attr ($_SERVER["REMOTE_ADDR"])); ?>').replace (/\<\?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_(ON0|OS0|ON1|OS1); \?\>/g, ''));
1125
/**/
1126
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.');
1127
/**/
1128
- shortCode.each /* Focus and select the Shortcode. */ (function()
1129
{
1130
- this.focus (), this.select ();
1131
});
1132
/**/
1133
return false;
@@ -1140,65 +1149,65 @@ jQuery(document).ready (function($)
1140
var shortCode = $('input#ws-plugin--s2member-sp-shortcode');
1141
var code = $('textarea#ws-plugin--s2member-sp-button');
1142
/**/
1143
- var leading = $('select#ws-plugin--s2member-sp-leading-id').val ().replace (/[^0-9]/g, '');
1144
- var additionals = $('select#ws-plugin--s2member-sp-additional-ids').val () || [];
1145
- var hours = $('select#ws-plugin--s2member-sp-hours').val ().replace (/[^0-9]/g, '');
1146
/**/
1147
- var regAmount = $('input#ws-plugin--s2member-sp-amount').val ().replace (/[^0-9\.]/g, '');
1148
- var desc = $.trim ($('input#ws-plugin--s2member-sp-desc').val ().replace (/"/g, ''));
1149
/**/
1150
var /* NOT yet configurable. */ localeCode = '', digital = '0', noShipping = '1';
1151
- var pageStyle = $.trim ($('input#ws-plugin--s2member-sp-page-style').val ().replace (/"/g, ''));
1152
- var currencyCode = $('select#ws-plugin--s2member-sp-currency').val ().replace (/[^A-Z]/g, '');
1153
/**/
1154
- if /* Must have a Leading Post/Page ID to work with. Otherwise, Link generation will fail. */ (!leading)
1155
{
1156
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.');
1157
return false;
1158
}
1159
- else if (!regAmount || isNaN(regAmount) || regAmount < 0.01)
1160
{
1161
alert('— Oops, a slight problem: —\n\nAmount must be >= 0.01');
1162
return false;
1163
}
1164
- else if /* $10,000.00 maximum. */ (regAmount > 10000.00)
1165
{
1166
alert('— Oops, a slight problem: —\n\nMaximum Amount is: 10000.00');
1167
return false;
1168
}
1169
- else if /* Each Button should have a Description. */ (!desc)
1170
{
1171
alert('— Oops, a slight problem: —\n\nPlease type a Description for this Button.');
1172
return false;
1173
}
1174
/**/
1175
- for (var i = 0, ids = leading; i < additionals.length; i++)
1176
- if (additionals[i] && additionals[i] !== leading)
1177
- ids += ',' + additionals[i];
1178
/**/
1179
- var /* Combined sp:ids:expiration hours. */ spIdsHours = 'sp:' + ids + ':' + hours;
1180
/**/
1181
- shortCodeTemplateAttrs += 'sp="1" ids="' + esc_attr(ids) + '" exp="' + esc_attr(hours) + '" desc="' + esc_attr(desc) + '" ps="' + esc_attr(pageStyle) + '" lc="' + esc_attr(localeCode) + '" cc="' + esc_attr(currencyCode) + '" dg="' + esc_attr(digital) + '" ns="' + esc_attr(noShipping) + '"';
1182
- shortCodeTemplateAttrs += ' custom="<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (esc_attr ($_SERVER["HTTP_HOST"])); ?>" ra="' + esc_attr(regAmount) + '"';
1183
- shortCode.val (shortCodeTemplate.replace (/%%attrs%%/, shortCodeTemplateAttrs));
1184
/**/
1185
- code.html (code.val ().replace (/ name\="lc" value\="(.*?)"/, ' name="lc" value="' + esc_attr(localeCode) + '"'));
1186
- code.html (code.val ().replace (/ name\="no_shipping" value\="(.*?)"/, ' name="no_shipping" value="' + esc_attr(noShipping) + '"'));
1187
- code.html (code.val ().replace (/ name\="item_name" value\="(.*?)"/, ' name="item_name" value="' + esc_attr(desc) + '"'));
1188
- code.html (code.val ().replace (/ name\="item_number" value\="(.*?)"/, ' name="item_number" value="' + esc_attr(spIdsHours) + '"'));
1189
- code.html (code.val ().replace (/ name\="page_style" value\="(.*?)"/, ' name="page_style" value="' + esc_attr(pageStyle) + '"'));
1190
- code.html (code.val ().replace (/ name\="currency_code" value\="(.*?)"/, ' name="currency_code" value="' + esc_attr(currencyCode) + '"'));
1191
- code.html (code.val ().replace (/ name\="custom" value\="(.*?)"/, ' name="custom" value="<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (esc_attr ($_SERVER["HTTP_HOST"])); ?>"'));
1192
/**/
1193
- code.html (code.val ().replace (/ name\="amount" value\="(.*?)"/, ' name="amount" value="' + esc_attr(regAmount) + '"'));
1194
/**/
1195
- $('div#ws-plugin--s2member-sp-button-prev').html (code.val ().replace (/\<form/, '<form target="_blank"').replace (/\<\?php echo S2MEMBER_VALUE_FOR_PP_INV\(\); \?\>/g, Math.round (new Date ().getTime ()) + '~<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (esc_attr ($_SERVER["REMOTE_ADDR"])); ?>').replace (/\<\?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_(ON0|OS0|ON1|OS1); \?\>/g, ''));
1196
/**/
1197
alert('Your Button has been generated.\nPlease copy/paste the Shortcode into your WordPress® Editor.');
1198
/**/
1199
- shortCode.each ( /* Focus and select the Shortcode. */function()
1200
{
1201
- this.focus (), this.select ();
1202
});
1203
/**/
1204
return false;
@@ -1206,35 +1215,35 @@ jQuery(document).ready (function($)
1206
/**/
1207
ws_plugin__s2member_paypalRegLinkGenerate = /* Handles PayPal® Link Generation. */ function()
1208
{
1209
- var level = $('select#ws-plugin--s2member-reg-link-level').val ().replace (/[^0-9]/g, '');
1210
- var subscrID = $.trim ($('input#ws-plugin--s2member-reg-link-subscr-id').val ());
1211
- var custom = $.trim ($('input#ws-plugin--s2member-reg-link-custom').val ());
1212
- var cCaps = $.trim ($.trim ($('input#ws-plugin--s2member-reg-link-ccaps').val ()).replace (/[ \-]/g, '_').replace (/[^a-z_0-9,]/gi, '').toLowerCase ());
1213
- var fixedTerm = $.trim ($('input#ws-plugin--s2member-reg-link-fixed-term').val ().replace (/[^A-Z 0-9]/gi, '').toUpperCase ());
1214
var $link = $('p#ws-plugin--s2member-reg-link'), $loading = $('img#ws-plugin--s2member-reg-link-loading');
1215
/**/
1216
- var levelCcapsPer = (fixedTerm && !fixedTerm.match (/L#x2F;)) ? level + ':' + cCaps + ':' + fixedTerm : level + ':' + cCaps;
1217
- levelCcapsPer = /* Clean any trailing separators from this string. */ levelCcapsPer.replace (/\:+#x2F;g, '');
1218
/**/
1219
- if /* We must have a Paid Subscr. ID value. */ (!subscrID)
1220
{
1221
alert('— Oops, a slight problem: —\n\nPaid Subscr. ID is a required value.');
1222
return false;
1223
}
1224
- else if (!custom || custom.indexOf ('<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq ($_SERVER["HTTP_HOST"]); ?>') !== 0)
1225
{
1226
alert('— Oops, a slight problem: —\n\nThe Custom Value MUST start with your domain name.');
1227
return false;
1228
}
1229
- else if /* Check format. */ (fixedTerm && !fixedTerm.match (/^[1-9]+ (D|W|M|Y|L)#x2F;))
1230
{
1231
alert('— Oops, a slight problem: —\n\nThe Fixed Term Length is not formatted properly.');
1232
return false;
1233
}
1234
/**/
1235
- $link.hide (), $loading.show (), $.post (ajaxurl, {action: 'ws_plugin__s2member_reg_access_link_via_ajax', ws_plugin__s2member_reg_access_link_via_ajax: '<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (wp_create_nonce ("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)
1236
{
1237
- $link.show ().html ('<a href="' + esc_attr(response) + '" target="_blank" rel="external">' + esc_html(response) + '</a>'), $loading.hide ();
1238
});
1239
/**/
1240
return false;
@@ -1242,84 +1251,84 @@ jQuery(document).ready (function($)
1242
/**/
1243
ws_plugin__s2member_paypalSpLinkGenerate = /* Handles PayPal® Link Generation. */ function()
1244
{
1245
- var leading = $('select#ws-plugin--s2member-sp-link-leading-id').val ().replace (/[^0-9]/g, '');
1246
- var additionals = $('select#ws-plugin--s2member-sp-link-additional-ids').val () || [];
1247
- var hours = $('select#ws-plugin--s2member-sp-link-hours').val ().replace (/[^0-9]/g, '');
1248
var $link = $('p#ws-plugin--s2member-sp-link'), $loading = $('img#ws-plugin--s2member-sp-link-loading');
1249
/**/
1250
- if /* Must have a Leading Post/Page ID to work with. Otherwise, Link generation will fail. */ (!leading)
1251
{
1252
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.');
1253
return false;
1254
}
1255
/**/
1256
- for (var i = 0, ids = leading; i < additionals.length; i++)
1257
- if (additionals[i] && additionals[i] !== leading)
1258
- ids += ',' + additionals[i];
1259
/**/
1260
- $link.hide (), $loading.show (), $.post (ajaxurl, {action: 'ws_plugin__s2member_sp_access_link_via_ajax', ws_plugin__s2member_sp_access_link_via_ajax: '<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (wp_create_nonce ("ws-plugin--s2member-sp-access-link-via-ajax")); ?>', s2member_sp_access_link_ids: ids, s2member_sp_access_link_hours: hours}, function(response)
1261
{
1262
- $link.show ().html ('<a href="' + esc_attr(response) + '" target="_blank" rel="external">' + esc_html(response) + '</a>'), $loading.hide ();
1263
});
1264
/**/
1265
return false;
1266
};
1267
}
1268
/**/
1269
- if (location.href.match (/page\=ws-plugin--s2member-els-ops/))
1270
{
1271
- $('select#ws-plugin--s2member-custom-reg-opt-in').change (function()
1272
{
1273
- var $this = $(this), val = $this.val ();
1274
var $rows = $('tr.ws-plugin--s2member-custom-reg-opt-in-label-row');
1275
var $prevImg = $('img.ws-plugin--s2member-custom-reg-opt-in-label-prev-img');
1276
/**/
1277
- if /* Checkbox disabled. */ (val <= 0)
1278
- $rows.css ('display', 'none'), $prevImg.attr ('src', $prevImg.attr ('src').replace (/\/checked\.png#x2F;, '/unchecked.png'));
1279
/**/
1280
- else if /* Enabled, checked by default. */ (val == 1)
1281
- $rows.css ('display', ''), $prevImg.attr ('src', $prevImg.attr ('src').replace (/\/unchecked\.png#x2F;, '/checked.png'));
1282
/**/
1283
- else if /* Enabled, unchecked by default. */ (val == 2)
1284
- $rows.css ('display', ''), $prevImg.attr ('src', $prevImg.attr ('src').replace (/\/checked\.png#x2F;, '/unchecked.png'));
1285
});
1286
/**/
1287
- $('div.ws-plugin--s2member-opt-out-section input[type="checkbox"][name="ws_plugin__s2member_custom_reg_auto_opt_outs\[\]"]').change (function()
1288
{
1289
- var /* Record value associated with change event. Also initialize checkedIndexes array. */ thisChange = $(this).val (), checkedIndexes = [];
1290
/**/
1291
- $('div.ws-plugin--s2member-opt-out-section input[type="checkbox"][name="ws_plugin__s2member_custom_reg_auto_opt_outs\[\]"]').each (function()
1292
{
1293
- var $this = $(this), val = $this.val (), checkboxes = 'input[type="checkbox"]';
1294
/**/
1295
- if /* All sub-items get checked/disabled too. */ (val === 'removal-deletion' && this.checked)
1296
- $this.nextAll (checkboxes).slice (0, 2).attr ({'checked': 'checked', 'disabled': 'disabled'});
1297
/**/
1298
- else if (val === 'removal-deletion' && !this.checked)
1299
{
1300
- $this.nextAll (checkboxes).slice (0, 2).removeAttr ('disabled');
1301
- (thisChange === 'removal-deletion') ? $this.nextAll (checkboxes).slice (0, 2).removeAttr ('checked') : null;
1302
}
1303
/**/
1304
- else if /* All sub-items get checked/disabled too. */ (val === 'modification' && this.checked)
1305
- $this.nextAll (checkboxes).slice (0, 3).attr ({'checked': 'checked', 'disabled': 'disabled'});
1306
/**/
1307
- else if (val === 'modification' && !this.checked)
1308
{
1309
- (thisChange === 'modification') ? $this.nextAll (checkboxes).slice (0, 3).removeAttr ('checked') : null;
1310
- $this.nextAll (checkboxes).slice (0, 3).removeAttr ('disabled');
1311
}
1312
})
1313
/**/
1314
- .each ( /* Now, which ones are checked? */function(index)
1315
{
1316
- (this.checked) ? checkedIndexes.push (index) : null;
1317
});
1318
/**/
1319
- $('select#ws-plugin--s2member-custom-reg-auto-opt-out-transitions').removeAttr ('disabled');
1320
- if ($.inArray (3, checkedIndexes) === -1 && $.inArray (4, checkedIndexes) === -1 && $.inArray (5, checkedIndexes) === -1 && $.inArray (6, checkedIndexes) === -1)
1321
- $('select#ws-plugin--s2member-custom-reg-auto-opt-out-transitions').attr ('disabled', 'disabled');
1322
/**/
1323
- }).last ().trigger ('change');
1324
}
1325
});
13
* @package s2Member\Menu_Pages
14
* @since 3.0
15
*/
16
+ jQuery(document).ready(function($)
17
{
18
var esc_attr = esc_html = /* Convert special characters. */ function(str)
19
{
20
+ return String(str).replace(/"/g, '&quot;').replace(/\</g, '&lt;').replace(/\>/g, '&gt;');
21
};
22
/**/
23
+ if(location.href.match /* Any & all s2Member® pages. */(/page\=ws-plugin--s2member/))
24
{
25
+ $('input.ws-plugin--s2member-update-roles-button, input.ws-plugin--s2member-reset-roles-button').click(function()
26
{
27
var $this = /* Save $(this) into $this. */ $(this);
28
+ $this.val /* Indicate loading status ( please wait ). */('one moment please ...');
29
/**/
30
var levels = '<?php echo (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; ?>';
31
+ var resetUpdate = ($this.hasClass('ws-plugin--s2member-reset-roles-button')) ? 'Reset' : 'Update';
32
/**/
33
+ $.post(ajaxurl, {action: 'ws_plugin__s2member_update_roles_via_ajax', ws_plugin__s2member_update_roles_via_ajax: '<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (wp_create_nonce ("ws-plugin--s2member-update-roles-via-ajax")); ?>'}, function(response)
34
{
35
+ if(response === '1')
36
+ 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');
37
/**/
38
+ else if(response === 'l' /* Locked? */)
39
+ alert('Sorry, your request failed.\ns2Member\'s Roles/Capabilities are locked by Filter:\nws_plugin__s2member_lock_roles_caps'), $this.val(resetUpdate+' Roles/Capabilities');
40
/**/
41
else /* Default response message here. */
42
+ alert('Sorry, your request failed.\nAccess denied. Do you have the ability to `create_users`?'), $this.val(resetUpdate+' Roles/Capabilities');
43
});
44
/**/
45
return false;
46
});
47
}
48
/**/
49
+ if(location.href.match(/page\=ws-plugin--s2member-mms-ops/))
50
{
51
+ $('select#ws-plugin--s2member-mms-registration-file').change(function()
52
{
53
+ if /* Expand/collapse relevant options; based on file selection. */($(this).val() === 'wp-signup')
54
{
55
+ var gv = $('select#ws-plugin--s2member-mms-registration-grants').val(), l0v = $('input#ws-plugin--s2member-mms-registration-blogs-level0').val();
56
+ $('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();
57
+ $('div.ws-plugin--s2member-mms-registration-wp-signup-blogs-level0, table.ws-plugin--s2member-mms-registration-wp-signup-blogs-level0')[((gv === 'all') ? 'show' : 'hide')]();
58
+ $('input#ws-plugin--s2member-mms-registration-blogs-level0').val(((gv === 'all') ? ((l0v > 0) ? l0v : '1') : '0'));
59
}
60
+ else if /* Expand/collapse relevant options. */($(this).val() === 'wp-login')
61
{
62
+ var gv = $('select#ws-plugin--s2member-mms-registration-grants').val(), l0v = $('input#ws-plugin--s2member-mms-registration-blogs-level0').val();
63
+ $('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();
64
+ $('div.ws-plugin--s2member-mms-registration-wp-signup-blogs-level0, table.ws-plugin--s2member-mms-registration-wp-signup-blogs-level0').hide();
65
+ $('input#ws-plugin--s2member-mms-registration-blogs-level0').val('0');
66
}
67
/**/
68
+ }).trigger /* Fire on ready too. */('change');
69
/**/
70
+ $('select#ws-plugin--s2member-mms-registration-grants').change(function()
71
{
72
+ $('select#ws-plugin--s2member-mms-registration-file').trigger('change');
73
});
74
}
75
/**/
76
+ if(location.href.match(/page\=ws-plugin--s2member-gen-ops/))
77
{
78
ws_plugin__s2member_generateSecurityKey = /* Generates a unique Security Key. */ function()
79
{
82
min = (arguments.length < 1) ? 0 : min;
83
max = (arguments.length < 2) ? 2147483647 : max;
84
/**/
85
+ return Math.floor(Math.random() * (max-min+1))+min;
86
};
87
/**/
88
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()';
89
+ for(var i = 0, key = ''; i < 64; i++)
90
+ key += chars.substr(mt_rand(0, chars.length-1), 1);
91
/**/
92
+ $('input#ws-plugin--s2member-sec-encryption-key').val(key);
93
/**/
94
return false;
95
};
96
/**/
97
ws_plugin__s2member_enableSecurityKey = /* Allow Security Key editing?? */ function()
98
{
99
+ 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.'))
100
+ $('input#ws-plugin--s2member-sec-encryption-key').removeAttr('disabled');
101
/**/
102
return false;
103
};
104
/**/
105
ws_plugin__s2member_securityKeyHistory = /* Displays history of Keys. */ function()
106
{
107
+ $('div#ws-plugin--s2member-sec-encryption-key-history').toggle();
108
/**/
109
return false;
110
};
111
/**/
112
+ $('select#ws-plugin--s2member-new-user-emails-enabled').change(function()
113
{
114
var $pluggable = $('input#ws-plugin--s2member-pluggables-wp-new-user-notification'), $this = $(this), $newUserEmails = $('div#ws-plugin--s2member-new-user-emails');
115
/**/
116
+ if($pluggable.val() === '0' || $this.val() === '0')
117
{
118
+ ($pluggable.val() === '0') ? $this.attr('disabled', 'disabled') : $this.removeAttr('disabled');
119
+ $(':input', $newUserEmails).attr('disabled', 'disabled'), $newUserEmails.css('opacity', '0.5');
120
}
121
else /* Else we allow the emails to be customized. */
122
+ $this.removeAttr('disabled'), $(':input', $newUserEmails).removeAttr('disabled'), $newUserEmails.css('opacity', '');
123
/**/
124
+ }).trigger /* Fire on ready too. */('change');
125
/**/
126
+ if($('input#ws-plugin--s2member-custom-reg-fields').length && $('div#ws-plugin--s2member-custom-reg-field-configuration').length)
127
{
128
( /* Wrap these routines inside a function to keep variables within relative scope. */function()
129
{
130
var i, fieldDefaults, tools, table, $tools, $table;
131
var $fields = $('input#ws-plugin--s2member-custom-reg-fields');
132
var $configuration = $('div#ws-plugin--s2member-custom-reg-field-configuration');
133
+ var fields = ($fields.val()) ? $.JSON.parse($fields.val()) : [];
134
/**/
135
fields = /* Force fields to an array. */ (fields instanceof Array) ? fields : [];
136
/**/
137
fieldDefaults = {section: 'no', sectitle: '', id: '', label: '', type: 'text', deflt: '', options: '', expected: '', required: 'yes', levels: 'all', editable: 'yes', classes: '', styles: '', attrs: ''};
138
/**/
139
+ for(i = 0; i < fields.length; i++)
140
+ fields[i] = /* Extend, based on defaults ( for future proofing ). */ $.extend(true, {
141
+ }, fieldDefaults, fields[i]);
142
/**/
143
tools = '<div id="ws-plugin--s2member-custom-reg-field-configuration-tools"></div>', table = '<table id="ws-plugin--s2member-custom-reg-field-configuration-table"></table>';
144
/**/
145
+ $configuration.html /* Add tools div & table div to configuration div ( i.e. div#ws-plugin--s2member-custom-reg-field-configuration ). */(tools+table);
146
/**/
147
$tools = $('div#ws-plugin--s2member-custom-reg-field-configuration-tools'), $table = $('table#ws-plugin--s2member-custom-reg-field-configuration-table');
148
/**/
149
ws_plugin__s2member_customRegFieldSectionChange = function(select)
150
{
151
+ var section = /* Current selection ( no|yes, selected by site owner ). */ $(select).val();
152
/**/
153
var sectitle_trs = 'tr.ws-plugin--s2member-custom-reg-field-configuration-tools-form-sectitle';
154
/**/
155
+ (section === 'yes') ? $(sectitle_trs).css('display', '') : $(sectitle_trs).css('display', 'none');
156
};
157
/**/
158
ws_plugin__s2member_customRegFieldTypeChange = /* Handle change events here. */ function(select)
159
{
160
+ var type = /* Current selection ( type of Field, selected by site owner ). */ $(select).val();
161
/**/
162
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';
163
/**/
164
+ (type.match(/^(text|textarea)#x2F;)) ? $(deflt_trs).css('display', '') : $(deflt_trs).css('display', 'none');
165
+ (type.match(/^(select|selects|checkboxes|radios)#x2F;)) ? $(options_trs).css('display', '') : $(options_trs).css('display', 'none');
166
+ (type.match(/^(text|textarea)#x2F;)) ? $(expected_trs).css('display', '') : $(expected_trs).css('display', 'none');
167
};
168
/**/
169
ws_plugin__s2member_customRegFieldDelete = function(index)
170
{
171
+ var newFields = /* Build array. */ new Array();
172
/**/
173
+ for(var i = 0; i < fields.length; i++)
174
+ if /* Omit index. */(i !== index)
175
+ newFields.push(fields[i]);
176
/**/
177
+ fields = newFields, updateFields(), buildTable();
178
};
179
/**/
180
ws_plugin__s2member_customRegFieldMoveUp = function(index)
181
{
182
+ if(typeof fields[index] === 'object' && typeof fields[index-1] === 'object')
183
{
184
+ var prevFieldObj = fields[index-1], thisFieldObj = fields[index];
185
/**/
186
+ fields[index-1] = thisFieldObj, fields[index] = prevFieldObj;
187
/**/
188
+ updateFields(), buildTable();
189
}
190
};
191
/**/
192
ws_plugin__s2member_customRegFieldMoveDown = function(index)
193
{
194
+ if(typeof fields[index] === 'object' && typeof fields[index+1] === 'object')
195
{
196
+ var nextFieldObj = fields[index+1], thisFieldObj = fields[index];
197
/**/
198
+ fields[index+1] = thisFieldObj, fields[index] = nextFieldObj;
199
/**/
200
+ updateFields(), buildTable();
201
}
202
};
203
/**/
204
ws_plugin__s2member_customRegFieldCreate = function()
205
{
206
+ var $table = $('table#ws-plugin--s2member-custom-reg-field-configuration-tools-form'), field = {
207
+ };
208
/**/
209
+ $(':input[property]', $table).each( /* Go through each property value. */function()
210
{
211
+ var $this = $(this), property = $this.attr('property'), val = $.trim($this.val());
212
/**/
213
field[property] = val;
214
});
215
/**/
216
+ if /* If it can be validated. */((field = validateField(field)))
217
{
218
+ fields.push(field), updateFields(), buildTools(), buildTable(), scrollReset();
219
/**/
220
setTimeout( /* A momentary delay here for usability. */function()
221
{
222
+ var row = 'tr.ws-plugin--s2member-custom-reg-field-configuration-table-row-'+(fields.length-1);
223
alert('Field created successfully.\n* Remember to "Save All Changes".');
224
+ $(row).effect('highlight', 1500);
225
}, 500);
226
}
227
};
228
/**/
229
ws_plugin__s2member_customRegFieldUpdate = function(index)
230
{
231
+ var $table = $('table#ws-plugin--s2member-custom-reg-field-configuration-tools-form'), field = {
232
+ };
233
/**/
234
+ $(':input[property]', $table).each( /* Go through each property value. */function()
235
{
236
+ var $this = $(this), property = $this.attr('property'), val = $.trim($this.val());
237
/**/
238
field[property] = val;
239
});
240
/**/
241
+ if /* If it validates. */((field = validateField(field, index)))
242
{
243
+ fields[index] = field, updateFields(), buildTools(), buildTable(), scrollReset();
244
/**/
245
setTimeout( /* A momentary delay here for usability. */function()
246
{
247
+ var row = 'tr.ws-plugin--s2member-custom-reg-field-configuration-table-row-'+index;
248
alert('Field updated successfully.\n* Remember to "Save All Changes".');
249
+ $(row).effect('highlight', 1500);
250
}, 500);
251
}
252
};
258
/**/
259
ws_plugin__s2member_customRegFieldEdit = /* Edit links. */ function(index)
260
{
261
+ buildTools(false, index), scrollReset();
262
};
263
/**/
264
ws_plugin__s2member_customRegFieldCancel = /* Cancel form. */ function()
265
{
266
+ buildTools(), scrollReset();
267
};
268
/**/
269
var validateField = function(field, index)
270
{
271
var editing = ( typeof index === 'number' && typeof fields[index] === 'object') ? true : false, errors = [], options, i;
272
/**/
273
+ if(typeof field !== 'object' || typeof (field = $.extend(true, {
274
+ }, fieldDefaults, field)) !== 'object')
275
{
276
alert('Invalid field object. Please try again.');
277
return false;
278
}
279
/**/
280
field.sectitle = (field.section === 'yes') ? field.sectitle : '';
281
+ field.deflt = (field.type.match(/^(text|textarea)#x2F;)) ? field.deflt : '';
282
+ field.deflt = (field.type.match(/^(text)#x2F;)) ? field.deflt.replace(/[\r\n\t ]+/g, ' ') : field.deflt;
283
+ field.options = (field.type.match(/^(select|selects|checkboxes|radios)#x2F;)) ? field.options : '';
284
+ field.expected = (field.type.match(/^(text|textarea)#x2F;)) ? field.expected : '';
285
/**/
286
+ if /* Every Field must have a unique ID. */(!field.id)
287
{
288
+ errors.push('Unique Field ID:\nThis is required. Please try again.');
289
}
290
+ else if(fieldIdExists(field.id) && (!editing || field.id !== fields[index].id))
291
{
292
+ errors.push('Unique Field ID:\nThat Field ID already exists. Please try again.');
293
}
294
/**/
295
+ if /* Every Field must have a label. */(!field.label)
296
{
297
+ errors.push('Field Label/Description:\nThis is required. Please try again.');
298
}
299
/**/
300
+ if(field.type.match(/^(select|selects|checkboxes|radios)#x2F;) && !field.options)
301
{
302
+ errors.push('Option Configuration File:\nThis is required. Please try again.');
303
}
304
+ else if(field.type.match(/^(select|selects|checkboxes|radios)#x2F;))
305
{
306
+ for(i = 0; i < (options = field.options.split(/[\r\n]+/)).length; i++)
307
{
308
+ if(!(options[i] = $.trim(options[i])).match(/^([^\|]*)(\|)([^\|]*)(\|default)?#x2F;))
309
{
310
+ errors.push('Option Configuration File:\nInvalid configuration at line #'+(i+1)+'.');
311
break; /* Break now. There could potentially be lots of lines with errors. */
312
}
313
}
314
/**/
315
+ field.options = /* Clean up. */ $.trim(options.join('\n'));
316
}
317
/**/
318
+ if(!(field.levels = field.levels.replace(/ /g, '')))
319
{
320
+ errors.push('Applicable Levels:\nThis is required. Please try again.');
321
}
322
+ else if(!field.levels.match(/^(all|[0-9,]+)#x2F;))
323
{
324
+ errors.push('Applicable Levels:\nShould be comma-delimited Levels, or just type: all.\n( examples: 0,1,2,3,4 or type the word: all )');
325
}
326
/**/
327
+ if(field.classes && field.classes.match(/[^a-z 0-9 _ \-]/i))
328
{
329
+ errors.push('CSS Classes:\nContains invalid characters. Please try again.\n( only: alphanumerics, underscores, hyphens, spaces )');
330
}
331
/**/
332
+ if(field.styles && field.styles.match(/["\=\>\<]/))
333
{
334
+ errors.push('CSS Styles:\nContains invalid characters. Please try again.\n( do NOT use these characters: = " < > )');
335
}
336
/**/
337
+ if(field.attrs && field.attrs.match(/[\>\<]/))
338
{
339
+ errors.push('Other Attributes:\nContains invalid characters. Please try again.\n( do NOT use these characters: < > )');
340
}
341
/**/
342
+ if /* Errors? */(errors.length > 0)
343
{
344
+ alert(errors.join('\n\n'));
345
return false;
346
}
347
else /* Return. */
350
/**/
351
var updateFields = /* Update hidden input value. */ function()
352
{
353
+ $fields.val(((fields.length > 0) ? $.JSON.stringify(fields) : ''));
354
};
355
/**/
356
var fieldId2Var = /* Convert ids to variables. */ function(fieldId)
357
{
358
+ return( typeof fieldId === 'string') ? $.trim(fieldId).toLowerCase().replace(/[^a-z0-9]/g, '_') : '';
359
};
360
/**/
361
var fieldTypeDesc = function(type)
362
{
363
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 )'};
364
/**/
365
+ if(typeof types[type] === 'string')
366
return types[type];
367
/**/
368
return /* Default. */ '';
370
/**/
371
var fieldIdExists = /* Already exists? */ function(fieldId)
372
{
373
+ for(var i = 0; i < fields.length; i++)
374
+ if(fields[i].id === fieldId)
375
return true;
376
};
377
/**/
378
var scrollReset = /* Return to Custom Fields section. */ function()
379
{
380
+ scrollTo(0, $('div.ws-plugin--s2member-custom-reg-fields-section').offset()['top']-100);
381
};
382
/**/
383
var buildTools = /* This builds tools into the configuration. */ function(adding, index)
384
{
385
+ var i = 0, html = '', form = '', w = 0, h = 0, editing = ( typeof index === 'number' && typeof fields[index] === 'object') ? true : false, displayForm = (adding || editing) ? true : false, field = (editing) ? $.extend(true, {
386
+ }, fieldDefaults, fields[index]) : fieldDefaults;
387
/**/
388
html += /* Click to add a new Custom Registration/Profile Field. */ '<a href="#" onclick="ws_plugin__s2member_customRegFieldAdd(); return false;">Add New Field</a>';
389
/**/
390
+ tb_remove /* Remove an existing thickbox. */(), $('div#ws-plugin--s2member-custom-reg-field-configuration-thickbox-tools-form').remove();
391
/**/
392
+ if /* Do we need to display the adding/editing form at all? */(displayForm)
393
{
394
form += '<div id="ws-plugin--s2member-custom-reg-field-configuration-thickbox-tools-form">';
395
/**/
405
form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-section">';
406
form += '<td colspan="2">';
407
form += '<select property="section" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-section" onchange="ws_plugin__s2member_customRegFieldSectionChange(this);">';
408
+ form += '<option value="no"'+((field.section === 'no') ? ' selected="selected"' : '')+'">No ( this Field flows normally )</option>';
409
+ form += '<option value="yes"'+((field.section === 'yes') ? ' selected="selected"' : '')+'">Yes ( this Field begins a new section )</option>';
410
form += '</select><br />';
411
form += '<small>Optional. Allows Fields to be grouped into sections.</small>';
412
form += '</td>';
413
form += '</tr>';
414
/**/
415
+ form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer ws-plugin--s2member-custom-reg-field-configuration-tools-form-sectitle ws-plugin--s2member-custom-reg-field-configuration-tools-form-section"'+((field.section === 'yes') ? '' : ' style="display:none;"')+'><td colspan="2"><hr /></td></tr>';
416
/**/
417
+ form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-sectitle ws-plugin--s2member-custom-reg-field-configuration-tools-form-section"'+((field.section === 'yes') ? '' : ' style="display:none;"')+'>';
418
form += '<td colspan="2">';
419
form += 'Title for this new section? ( optional )<br />';
420
+ form += '<input type="text" property="sectitle" autocomplete="off" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-sectitle" value="'+esc_attr(field.sectitle)+'" /><br />';
421
form += '<small>If empty, a simple divider will be used by default.</small>';
422
form += '</td>';
423
form += '</tr>';
433
form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-type">';
434
form += '<td colspan="2">';
435
form += '<select property="type" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-type" onchange="ws_plugin__s2member_customRegFieldTypeChange(this);">';
436
+ form += '<option value="text"'+((field.type === 'text') ? ' selected="selected"' : '')+'">'+esc_html(fieldTypeDesc('text'))+'</option>';
437
+ form += '<option value="textarea"'+((field.type === 'textarea') ? ' selected="selected"' : '')+'">'+esc_html(fieldTypeDesc('textarea'))+'</option>';
438
+ form += '<option value="select"'+((field.type === 'select') ? ' selected="selected"' : '')+'">'+esc_html(fieldTypeDesc('select'))+'</option>';
439
+ form += '<option value="selects"'+((field.type === 'selects') ? ' selected="selected"' : '')+'">'+esc_html(fieldTypeDesc('selects'))+'</option>';
440
+ form += '<option value="checkbox"'+((field.type === 'checkbox') ? ' selected="selected"' : '')+'">'+esc_html(fieldTypeDesc('checkbox'))+'</option>';
441
+ form += '<option value="pre_checkbox"'+((field.type === 'pre_checkbox') ? ' selected="selected"' : '')+'">'+esc_html(fieldTypeDesc('pre_checkbox'))+'</option>';
442
+ form += '<option value="checkboxes"'+((field.type === 'checkboxes') ? ' selected="selected"' : '')+'">'+esc_html(fieldTypeDesc('checkboxes'))+'</option>';
443
+ form += '<option value="radios"'+((field.type === 'radios') ? ' selected="selected"' : '')+'">'+esc_html(fieldTypeDesc('radios'))+'</option>';
444
form += '</select><br />';
445
form += '<small>The options below may change, based on the Field Type you choose here.</small>';
446
form += '</td>';
456
/**/
457
form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-label">';
458
form += '<td colspan="2">';
459
+ form += '<input type="text" property="label" autocomplete="off" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-label" value="'+esc_attr(field.label)+'" /><br />';
460
form += '<small>Examples: <code>Choose Country</code>, <code>Street Address</code></small>';
461
form += '</td>';
462
form += '</tr>';
471
/**/
472
form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-id">';
473
form += '<td colspan="2">';
474
+ form += '<input type="text" property="id" maxlength="25" autocomplete="off" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-id" value="'+esc_attr(field.id)+'" /><br />';
475
form += '<small>Examples: <code>country_code</code>, <code>street_address</code></small><br />';
476
form += '<small>e.g. <code>[s2Get user_field="country_code" /]</code></small>';
477
form += '</td>';
488
form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-required">';
489
form += '<td colspan="2">';
490
form += '<select property="required" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-required">';
491
+ form += '<option value="yes"'+((field.required === 'yes') ? ' selected="selected"' : '')+'">Yes ( required )</option>';
492
+ form += '<option value="no"'+((field.required === 'no') ? ' selected="selected"' : '')+'">No ( optional )</option>';
493
form += '</select><br />';
494
form += '<small>If <code>yes</code>, only Users/Members will be "required" to enter this field.</small><br />';
495
form += '<small>* Administrators are exempt from this requirement.</small>';
496
form += '</td>';
497
form += '</tr>';
498
/**/
499
+ form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer ws-plugin--s2member-custom-reg-field-configuration-tools-form-deflt"'+((field.type.match(/^(text|textarea)#x2F;)) ? '' : ' style="display:none;"')+'><td colspan="2">&nbsp;</td></tr>';
500
/**/
501
+ form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-deflt"'+((field.type.match(/^(text|textarea)#x2F;)) ? '' : ' style="display:none;"')+'>';
502
form += '<td colspan="2">';
503
form += '<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-deflt">Default Text Value: ( optional )</label>';
504
form += '</td>';
505
form += '</tr>';
506
/**/
507
+ form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-deflt"'+((field.type.match(/^(text|textarea)#x2F;)) ? '' : ' style="display:none;"')+'>';
508
form += '<td colspan="2">';
509
+ form += '<textarea property="deflt" wrap="off" spellcheck="false" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-deflt" rows="1">'+esc_html(field.deflt)+'</textarea><br />';
510
form += '<small>Default value before user input is received.</small>';
511
form += '</td>';
512
form += '</tr>';
513
/**/
514
+ form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer ws-plugin--s2member-custom-reg-field-configuration-tools-form-options"'+((field.type.match(/^(select|selects|checkboxes|radios)#x2F;)) ? '' : ' style="display:none;"')+'><td colspan="2">&nbsp;</td></tr>';
515
/**/
516
+ form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-options"'+((field.type.match(/^(select|selects|checkboxes|radios)#x2F;)) ? '' : ' style="display:none;"')+'>';
517
form += '<td colspan="2">';
518
form += '<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-options">Option Configuration File: * ( one option per line )</label><br />';
519
form += '<small>Use a pipe <code>|</code> delimited format: <code>option value|option label</code></small>';
520
form += '</td>';
521
form += '</tr>';
522
/**/
523
+ form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-options"'+((field.type.match(/^(select|selects|checkboxes|radios)#x2F;)) ? '' : ' style="display:none;"')+'>';
524
form += '<td colspan="2">';
525
+ form += '<textarea property="options" wrap="off" spellcheck="false" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-options" rows="3">'+esc_html(field.options)+'</textarea><br />';
526
form += 'Here is a quick example:<br />';
527
form += '<small>You can also specify a <em>default</em> option:</small><br />';
528
form += '<code>US|United States|default</code><br />';
531
form += '</td>';
532
form += '</tr>';
533
/**/
534
+ form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer ws-plugin--s2member-custom-reg-field-configuration-tools-form-expected"'+((field.type.match(/^(text|textarea)#x2F;)) ? '' : ' style="display:none;"')+'><td colspan="2">&nbsp;</td></tr>';
535
/**/
536
+ form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-expected"'+((field.type.match(/^(text|textarea)#x2F;)) ? '' : ' style="display:none;"')+'>';
537
form += '<td colspan="2">';
538
form += '<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-expected">Expected Format: *</label>';
539
form += '</td>';
540
form += '</tr>';
541
/**/
542
+ form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-expected"'+((field.type.match(/^(text|textarea)#x2F;)) ? '' : ' style="display:none;"')+'>';
543
form += '<td colspan="2">';
544
form += '<select property="expected" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-expected">';
545
/**/
546
+ form += '<option value=""'+((field.expected === '') ? ' selected="selected"' : '')+'">Anything Goes</option>';
547
form += '<option disabled="disabled"></option>';
548
/**/
549
form += '<optgroup label="Specific Input Types">';
550
+ form += '<option value="numeric-wp-commas"'+((field.expected === 'numeric-wp-commas') ? ' selected="selected"' : '')+'">Numeric ( with or without decimals, commas allowed )</option>';
551
+ form += '<option value="numeric"'+((field.expected === 'numeric') ? ' selected="selected"' : '')+'">Numeric ( with or without decimals, no commas )</option>';
552
+ form += '<option value="integer"'+((field.expected === 'integer') ? ' selected="selected"' : '')+'">Integer ( whole number, without any decimals )</option>';
553
+ form += '<option value="integer-gt-0"'+((field.expected === 'integer-gt-0') ? ' selected="selected"' : '')+'">Integer > 0 ( whole number, no decimals, greater than 0 )</option>';
554
+ form += '<option value="float"'+((field.expected === 'float') ? ' selected="selected"' : '')+'">Float ( floating point number, decimals required )</option>';
555
+ form += '<option value="float-gt-0"'+((field.expected === 'float-gt-0') ? ' selected="selected"' : '')+'">Float > 0 ( floating point number, decimals required, greater than 0 )</option>';
556
+ form += '<option value="date"'+((field.expected === 'date') ? ' selected="selected"' : '')+'">Date ( required date format: dd/mm/yyyy )</option>';
557
+ form += '<option value="email"'+((field.expected === 'email') ? ' selected="selected"' : '')+'">Email ( require valid email )</option>';
558
+ form += '<option value="url"'+((field.expected === 'url') ? ' selected="selected"' : '')+'">Full URL ( starting with http or https )</option>';
559
+ form += '<option value="domain"'+((field.expected === 'domain') ? ' selected="selected"' : '')+'">Domain Name ( domain name only, without http )</option>';
560
+ form += '<option value="phone"'+((field.expected === 'phone') ? ' selected="selected"' : '')+'">Phone # ( 10 digits w/possible hyphens,spaces,brackets )</option>';
561
+ form += '<option value="uszip"'+((field.expected === 'uszip') ? ' selected="selected"' : '')+'">US Zipcode ( 5-9 digits w/possible hyphen )</option>';
562
+ form += '<option value="cazip"'+((field.expected === 'cazip') ? ' selected="selected"' : '')+'">Canadian Zipcode ( 6 alpha-numerics w/possible space )</option>';
563
+ form += '<option value="uczip"'+((field.expected === 'uczip') ? ' selected="selected"' : '')+'">US/Canadian Zipcode ( either a US or Canadian zipcode )</option>';
564
form += '</optgroup>';
565
/**/
566
form += '<option disabled="disabled"></option>';
567
/**/
568
form += '<optgroup label="Any Character Combination">';
569
+ for(i = 1; i <= 25; i++)
570
{
571
+ form += '<option value="any-'+i+'"'+((field.expected === 'any-'+i) ? ' selected="selected"' : '')+'">Any Character Combination ( '+i+' character minimum )</option>';
572
+ form += '<option value="any-'+i+'-e"'+((field.expected === 'any-'+i+'-e') ? ' selected="selected"' : '')+'">Any Character Combination ( exactly '+i+' character'+((i > 1) ? 's' : '')+' )</option>';
573
}
574
form += '</optgroup>';
575
/**/
576
form += '<option disabled="disabled"></option>';
577
/**/
578
form += '<optgroup label="Alphanumerics, Spaces &amp; Punctuation Only">';
579
+ for(i = 1; i <= 25; i++)
580
{
581
+ form += '<option value="alphanumerics-spaces-punctuation-'+i+'"'+((field.expected === 'alphanumerics-spaces-punctuation-'+i) ? ' selected="selected"' : '')+'">Alphanumerics, Spaces &amp; Punctuation ( '+i+' character minimum )</option>';
582
+ form += '<option value="alphanumerics-spaces-punctuation-'+i+'-e"'+((field.expected === 'alphanumerics-spaces-punctuation-'+i+'-e') ? ' selected="selected"' : '')+'">Alphanumerics, Spaces &amp; Punctuation ( exactly '+i+' character'+((i > 1) ? 's' : '')+' )</option>';
583
}
584
form += '</optgroup>';
585
/**/
586
form += '<option disabled="disabled"></option>';
587
/**/
588
form += '<optgroup label="Alphanumerics &amp; Spaces Only">';
589
+ for(i = 1; i <= 25; i++)
590
{
591
+ form += '<option value="alphanumerics-spaces-'+i+'"'+((field.expected === 'alphanumerics-spaces-'+i) ? ' selected="selected"' : '')+'">Alphanumerics &amp; Spaces ( '+i+' character minimum )</option>';
592
+ form += '<option value="alphanumerics-spaces-'+i+'-e"'+((field.expected === 'alphanumerics-spaces-'+i+'-e') ? ' selected="selected"' : '')+'">Alphanumerics &amp; Spaces ( exactly '+i+' character'+((i > 1) ? 's' : '')+' )</option>';
593
}
594
form += '</optgroup>';
595
/**/
596
form += '<option disabled="disabled"></option>';
597
/**/
598
form += '<optgroup label="Alphanumerics &amp; Punctuation Only">';
599
+ for(i = 1; i <= 25; i++)
600
{
601
+ form += '<option value="alphanumerics-punctuation-'+i+'"'+((field.expected === 'alphanumerics-punctuation-'+i) ? ' selected="selected"' : '')+'">Alphanumerics &amp; Punctuation ( '+i+' character minimum )</option>';
602
+ form += '<option value="alphanumerics-punctuation-'+i+'-e"'+((field.expected === 'alphanumerics-punctuation-'+i+'-e') ? ' selected="selected"' : '')+'">Alphanumerics &amp; Punctuation ( exactly '+i+' character'+((i > 1) ? 's' : '')+' )</option>';
603
}
604
form += '</optgroup>';
605
/**/
606
form += '<option disabled="disabled"></option>';
607
/**/
608
form += '<optgroup label="Alphanumerics Only">';
609
+ for(i = 1; i <= 25; i++)
610
{
611
+ form += '<option value="alphanumerics-'+i+'"'+((field.expected === 'alphanumerics-'+i) ? ' selected="selected"' : '')+'">Alphanumerics ( '+i+' character minimum )</option>';
612
+ form += '<option value="alphanumerics-'+i+'-e"'+((field.expected === 'alphanumerics-'+i+'-e') ? ' selected="selected"' : '')+'">Alphanumerics ( exactly '+i+' character'+((i > 1) ? 's' : '')+' )</option>';
613
}
614
form += '</optgroup>';
615
/**/
616
form += '<option disabled="disabled"></option>';
617
/**/
618
form += '<optgroup label="Alphabetics Only">';
619
+ for(i = 1; i <= 25; i++)
620
{
621
+ form += '<option value="alphabetics-'+i+'"'+((field.expected === 'alphabetics-'+i) ? ' selected="selected"' : '')+'">Alphabetics ( '+i+' character minimum )</option>';
622
+ form += '<option value="alphabetics-'+i+'-e"'+((field.expected === 'alphabetics-'+i+'-e') ? ' selected="selected"' : '')+'">Alphabetics ( exactly '+i+' character'+((i > 1) ? 's' : '')+' )</option>';
623
}
624
form += '</optgroup>';
625
/**/
626
form += '<option disabled="disabled"></option>';
627
/**/
628
form += '<optgroup label="Numeric Digits Only">';
629
+ for(i = 1; i <= 25; i++)
630
{
631
+ form += '<option value="numerics-'+i+'"'+((field.expected === 'numerics-'+i) ? ' selected="selected"' : '')+'">Numeric Digits ( '+i+' digit minimum )</option>';
632
+ form += '<option value="numerics-'+i+'-e"'+((field.expected === 'numerics-'+i+'-e') ? ' selected="selected"' : '')+'">Numeric Digits ( exactly '+i+' digit'+((i > 1) ? 's' : '')+' )</option>';
633
}
634
form += '</optgroup>';
635
/**/
649
/**/
650
form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-levels">';
651
form += '<td colspan="2">';
652
+ form += '<input type="text" property="levels" autocomplete="off" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-levels" value="'+esc_attr(field.levels)+'" /><br />';
653
form += '<small>Please use comma-delimited Level #\'s: <code>0,1,2,3,4</code> or type: <code>all</code>.</small><br />';
654
form += '<small>This allows you to enable this field - only at specific Membership Levels.</small>';
655
form += '</td>';
666
form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-editable">';
667
form += '<td colspan="2">';
668
form += '<select property="editable" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-editable">';
669
+ form += '<option value="yes"'+((field.editable === 'yes') ? ' selected="selected"' : '')+'">Yes ( editable )</option>';
670
+ form += '<option value="no"'+((field.editable === 'no') ? ' selected="selected"' : '')+'">No ( uneditable after registration )</option>';
671
+ form += '<option value="no-invisible"'+((field.editable === 'no-invisible') ? ' selected="selected"' : '')+'">No ( uneditable &amp; totally invisible after registration )</option>';
672
+ form += '<option value="no-always-invisible"'+((field.editable === 'no-always-invisible') ? ' selected="selected"' : '')+'">No ( uneditable &amp; totally invisible, both during &amp; after registration )</option>';
673
+ form += '<option value="yes-invisible"'+((field.editable === 'yes-invisible') ? ' selected="selected"' : '')+'">Yes ( editable after registration / invisible during registration )</option>';
674
form += '</select><br />';
675
form += '<small>If <code>No</code>, this field will be un-editable after registration.</small><br />';
676
form += '<small>* Administrators are exempt from this.</small>';
687
/**/
688
form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-classes">';
689
form += '<td colspan="2">';
690
+ form += '<input type="text" property="classes" autocomplete="off" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-classes" value="'+esc_attr(field.classes)+'" /><br />';
691
form += '<small>Example: <code>my-style-1 my-style-2</code></small>';
692
form += '</td>';
693
form += '</tr>';
702
/**/
703
form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-styles">';
704
form += '<td colspan="2">';
705
+ form += '<input type="text" property="styles" autocomplete="off" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-styles" value="'+esc_attr(field.styles)+'" /><br />';
706
form += '<small>Example: <code>color:#000000; background:#FFFFFF;</code></small>';
707
form += '</td>';
708
form += '</tr>';
717
/**/
718
form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-attrs">';
719
form += '<td colspan="2">';
720
+ form += '<input type="text" property="attrs" autocomplete="off" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-attrs" value="'+esc_attr(field.attrs)+'" /><br />';
721
form += '<small>Example: <code>onkeyup="" onblur=""</code></small>';
722
form += '</td>';
723
form += '</tr>';
729
form += '<input type="button" value="Cancel" onclick="ws_plugin__s2member_customRegFieldCancel();" />';
730
form += '</td>';
731
form += '<td align="right">';
732
+ form += '<input type="button" value="'+((editing) ? 'Update This Field' : 'Create Registration Field')+'" onclick="'+((editing) ? 'ws_plugin__s2member_customRegFieldUpdate('+index+');' : 'ws_plugin__s2member_customRegFieldCreate();')+'" />';
733
form += '</td>';
734
form += '</tr>';
735
/**/
738
/**/
739
form += '<div>';
740
/**/
741
+ $('body').append(form);
742
/**/
743
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');
744
/**/
745
+ $('table#ws-plugin--s2member-custom-reg-field-configuration-tools-form').show();
746
}
747
/**/
748
+ $tools.html(html);
749
};
750
/**/
751
var buildTable = /* This builds the table of existing fields. */ function()
763
html += '<th>- Tools -</th>';
764
html += '</tr>';
765
/**/
766
+ if /* Any fields? */(fields.length > 0)
767
{
768
+ for(i = 0; i < fields.length; i++)
769
{
770
+ html += '<tr class="'+esc_attr((eo = (eo === 'o') ? 'e' : 'o'))+((fields[i].section === 'yes') ? ' s' : '')+' ws-plugin--s2member-custom-reg-field-configuration-table-row-'+i+'">'; /* Odd/even + row identifier. */
771
+ html += '<td nowrap="nowrap"><a class="ws-plugin--s2member-custom-reg-field-configuration-move-up" href="#" onclick="ws_plugin__s2member_customRegFieldMoveUp('+i+'); return false;"></a><a class="ws-plugin--s2member-custom-reg-field-configuration-move-down" href="#" onclick="ws_plugin__s2member_customRegFieldMoveDown('+i+'); return false;"></a></td>';
772
+ html += '<td nowrap="nowrap">'+esc_html(fieldTypeDesc(fields[i].type))+'</td>';
773
+ html += '<td nowrap="nowrap">'+esc_html(fields[i].id)+'</td>';
774
+ html += '<td nowrap="nowrap">'+esc_html(fields[i].required)+'</td>';
775
+ html += '<td nowrap="nowrap">'+esc_html(fields[i].levels)+'</td>';
776
+ html += '<td nowrap="nowrap"><a class="ws-plugin--s2member-custom-reg-field-configuration-edit" href="#" onclick="ws_plugin__s2member_customRegFieldEdit('+i+'); return false;"></a><a class="ws-plugin--s2member-custom-reg-field-configuration-delete" href="#" onclick="ws_plugin__s2member_customRegFieldDelete('+i+'); return false;"></a></td>';
777
html += '</tr>';
778
}
779
}
786
/**/
787
html += '</tbody>';
788
/**/
789
+ $table.html(html);
790
};
791
/* Initialize config. */
792
+ buildTools(), buildTable();
793
/**/
794
+ })();
795
}
796
}
797
/**/
798
+ if(location.href.match(/page\=ws-plugin--s2member-res-ops/))
799
{
800
+ $('input#ws-plugin--s2member-brute-force-restrictions-reset-button').click(function()
801
{
802
var $this = /* Save $(this) into $this. */ $(this);
803
+ $this.val /* Indicate loading status ( please wait ). */('one moment please ...');
804
/**/
805
+ $.post(ajaxurl, {action: 'ws_plugin__s2member_delete_reset_all_ip_restrictions_via_ajax', ws_plugin__s2member_delete_reset_all_ip_restrictions_via_ajax: '<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (wp_create_nonce ("ws-plugin--s2member-delete-reset-all-ip-restrictions-via-ajax")); ?>'}, function(response)
806
{
807
+ alert('s2Member\'s Brute Force Restriction Logs have all been reset.'), $this.val('Reset Brute Force Logs');
808
});
809
/**/
810
return false;
811
});
812
/**/
813
+ $('input#ws-plugin--s2member-ip-restrictions-reset-button').click(function()
814
{
815
var $this = /* Save $(this) into $this. */ $(this);
816
+ $this.val /* Indicate loading status ( please wait ). */('one moment please ...');
817
/**/
818
+ $.post(ajaxurl, {action: 'ws_plugin__s2member_delete_reset_all_ip_restrictions_via_ajax', ws_plugin__s2member_delete_reset_all_ip_restrictions_via_ajax: '<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (wp_create_nonce ("ws-plugin--s2member-delete-reset-all-ip-restrictions-via-ajax")); ?>'}, function(response)
819
{
820
+ alert('s2Member\'s IP Restriction Logs have all been reset.'), $this.val('Reset IP Restriction Logs');
821
});
822
/**/
823
return false;
824
});
825
/**/
826
+ $('div.ws-plugin--s2member-query-level-access-section input[type="checkbox"][name="ws_plugin__s2member_filter_wp_query\[\]"]').change(function()
827
{
828
+ var thisChange = /* Record value associated with change event. Allows for intutitive unchecking. */ $(this).val();
829
/**/
830
+ $('div.ws-plugin--s2member-query-level-access-section input[type="checkbox"][name="ws_plugin__s2member_filter_wp_query\[\]"]').each(function()
831
{
832
+ var $this = $(this), val = $this.val(), checkboxes = 'input[type="checkbox"]';
833
/**/
834
+ if /* All sub-items get checked/disabled. */(val === 'all' && this.checked)
835
+ $this.nextAll(checkboxes).attr({'checked': 'checked', 'disabled': 'disabled'});
836
/**/
837
+ else if(val === 'all' && !this.checked)
838
{
839
+ $this.nextAll(checkboxes).removeAttr('disabled');
840
+ (thisChange === 'all') ? $this.nextAll(checkboxes).removeAttr('checked') : null;
841
}
842
});
843
/**/
844
+ }).last().trigger('change');
845
}
846
/**/
847
+ if(location.href.match(/page\=ws-plugin--s2member-down-ops/))
848
{
849
var updateCloudFrontPrivateKey = /* Attaches to events below. */ function()
850
{
851
var $hiddenPrivateKey = $('input#ws-plugin--s2member-amazon-cf-files-private-key');
852
var $visiblePrivateKeyEntry = $('textarea#ws-plugin--s2member-amazon-cf-files-private-key-entry');
853
+ var hiddenPrivateKeyValue = $.trim($hiddenPrivateKey.val()), visiblePrivateKeyEntryValue = $.trim($visiblePrivateKeyEntry.val());
854
/**/
855
+ if((hiddenPrivateKeyValue && !visiblePrivateKeyEntryValue) || visiblePrivateKeyEntryValue.match /* 9679.toString(16).toUpperCase() = 25CF. */(/[^\r\n\u25CF]/))
856
+ $hiddenPrivateKey.val(visiblePrivateKeyEntryValue), $visiblePrivateKeyEntry.val(visiblePrivateKeyEntryValue.replace(/[^\r\n]/g, String.fromCharCode(9679)));
857
};
858
/**/
859
+ $('form#ws-plugin--s2member-options-form').submit(updateCloudFrontPrivateKey);
860
+ $('textarea#ws-plugin--s2member-amazon-cf-files-private-key-entry').change(updateCloudFrontPrivateKey).trigger('change');
861
/**/
862
var updateCloudFrontDistroCfgs = /* Attaches to events below. */ function()
863
{
867
var $autoConfigDistros = $('input#ws-plugin--s2member-amazon-cf-files-auto-configure-distros');
868
var $autoConfigDistrosStatus = $('input#ws-plugin--s2member-amazon-cf-files-distros-auto-config-status');
869
/**/
870
+ var autoConfigDistrosStatusValue = $.trim($autoConfigDistrosStatus.val());
871
+ var hiddenPrivateKeyValue = $.trim($hiddenPrivateKey.val()), visiblePrivateKeyIdValue = $.trim($visiblePrivateKeyId.val());
872
+ var hiddenPrivateKeyPrevConfigValue = $.trim($hiddenPrivateKey.attr('data-s-prev-config-value')), visiblePrivateKeyIdPrevConfigValue = $.trim($visiblePrivateKeyId.attr('data-s-prev-config-value'));
873
/**/
874
+ if(autoConfigDistrosStatusValue === 'configured' && ((visiblePrivateKeyIdPrevConfigValue && visiblePrivateKeyIdValue !== visiblePrivateKeyIdPrevConfigValue) || (hiddenPrivateKeyPrevConfigValue && hiddenPrivateKeyValue !== hiddenPrivateKeyPrevConfigValue)))
875
{
876
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.');
877
+ $autoConfigDistros.attr /* Forcibly check. */('checked', 'checked');
878
}
879
+ else if(autoConfigDistrosStatusValue !== 'configured' && visiblePrivateKeyIdValue && hiddenPrivateKeyValue)
880
{
881
alert('s2Member will need to auto-configure your Amazon® CloudFront distributions for you. When you\'re done editing, click (Save All Changes) below.');
882
+ $autoConfigDistros.attr /* Forcibly check. */('checked', 'checked');
883
}
884
};
885
/**/
886
+ $('input#ws-plugin--s2member-amazon-cf-files-private-key-id').change(updateCloudFrontDistroCfgs);
887
+ $('textarea#ws-plugin--s2member-amazon-cf-files-private-key-entry').change(updateCloudFrontDistroCfgs);
888
/**/
889
+ $('input#ws-plugin--s2member-amazon-cf-files-auto-configure-distros-w-cnames').change(function()
890
{
891
var $this = $(this), thisChecked = (this.checked) ? true : false;
892
var $autoConfigDistros = $('input#ws-plugin--s2member-amazon-cf-files-auto-configure-distros');
893
var $autoConfigDistroCnames = $('div#ws-plugin--s2member-amazon-cf-files-auto-configure-distro-cnames');
894
/**/
895
+ (thisChecked) ? $autoConfigDistroCnames.show() : $autoConfigDistroCnames.hide();
896
+ (thisChecked) ? $autoConfigDistros.attr('checked', 'checked') : null;
897
/**/
898
+ }).trigger('change');
899
}
900
/**/
901
+ if(location.href.match(/page\=ws-plugin--s2member-paypal-ops/))
902
{
903
+ $('select#ws-plugin--s2member-auto-eot-system-enabled').change(function()
904
{
905
+ var $this = $(this), val = $this.val();
906
var $viaCron = $('p#ws-plugin--s2member-auto-eot-system-enabled-via-cron');
907
/**/
908
+ if /* Display Cron instructions. */(val == 2)
909
+ $viaCron.show()
910
else /* Hide instructions. */
911
+ $viaCron.hide();
912
});
913
}
914
/**/
915
+ if(location.href.match(/page\=ws-plugin--s2member-paypal-buttons/))
916
{
917
+ $('div.ws-menu-page select[id]').filter( /* Filter all select elements with an id. */function()
918
{
919
+ return this.id.match(/^ws-plugin--s2member-(level[1-9][0-9]*|modification)-term#x2F;);
920
+ }).change(function()
921
{
922
+ var button = this.id.replace(/^ws-plugin--s2member-(.+?)-term#x2F;g, '$1');
923
+ var trialDisabled = ($(this).val().split('-')[2].replace(/[^0-1BN]/g, '') === 'BN') ? 1 : 0;
924
/**/
925
+ $('p#ws-plugin--s2member-'+button+'-trial-line').css('display', (trialDisabled ? 'none' : ''));
926
+ $('span#ws-plugin--s2member-'+button+'-trial-then').css('display', (trialDisabled ? 'none' : ''));
927
+ $('span#ws-plugin--s2member-'+button+'-20p-rule').css('display', (trialDisabled ? 'none' : ''));
928
/**/
929
+ (trialDisabled) ? $('input#ws-plugin--s2member-'+button+'-trial-period').val(0) : null;
930
+ (trialDisabled) ? $('input#ws-plugin--s2member-'+button+'-trial-amount').val('0.00') : null;
931
});
932
/**/
933
+ $('div.ws-menu-page input[id]').filter( /* Filter all input elements with an id. */function()
934
{
935
+ return this.id.match(/^ws-plugin--s2member-(level[1-9][0-9]*|modification|ccap)-ccaps#x2F;);
936
+ }).keyup(function()
937
{
938
+ var value = this.value.replace(/^(-all|-al|-a|-)[;,]*/gi, ''), _all = (this.value.match(/^(-all|-al|-a|-)[;,]*/i)) ? '-all,' : '';
939
+ if /* Only if there is a problem with the actual values; because this causes interruptions. */(value.match(/[^a-z_0-9,]/))
940
+ this.value = _all+$.trim($.trim(value).replace(/[ \-]/g, '_').replace(/[^a-z_0-9,]/gi, '').toLowerCase());
941
});
942
/**/
943
ws_plugin__s2member_paypalButtonGenerate = /* Handles PayPal® Button Generation. */ function(button)
944
{
945
+ var shortCodeTemplate = '[s2Member-PayPal-Button %%attrs%% image="default" output="button" /]', shortCodeTemplateAttrs = '', labels = {
946
+ };
947
/**/
948
eval("<?php echo c_ws_plugin__s2member_utils_strings::esc_dq($labels); ?>");
949
/**/
950
+ var shortCode = $('input#ws-plugin--s2member-'+button+'-shortcode');
951
+ var code = $('textarea#ws-plugin--s2member-'+button+'-button');
952
var modLevel = $('select#ws-plugin--s2member-modification-level');
953
/**/
954
+ var level = (button === 'modification') ? modLevel.val().split(':', 2)[1] : button.replace(/^level/, '');
955
+ var label = /* Labels may NOT contain double-quotes. */ labels['level'+level].replace(/"/g, '');
956
+ var desc = $.trim($('input#ws-plugin--s2member-'+button+'-desc').val().replace(/"/g, ""));
957
/**/
958
+ var trialAmount = $('input#ws-plugin--s2member-'+button+'-trial-amount').val().replace(/[^0-9\.]/g, '');
959
+ var trialPeriod = $('input#ws-plugin--s2member-'+button+'-trial-period').val().replace(/[^0-9]/g, '');
960
+ var trialTerm = $('select#ws-plugin--s2member-'+button+'-trial-term').val().replace(/[^A-Z]/g, '');
961
/**/
962
+ var regAmount = $('input#ws-plugin--s2member-'+button+'-amount').val().replace(/[^0-9\.]/g, '');
963
+ var regPeriod = $('select#ws-plugin--s2member-'+button+'-term').val().split('-')[0].replace(/[^0-9]/g, '');
964
+ var regTerm = $('select#ws-plugin--s2member-'+button+'-term').val().split('-')[1].replace(/[^A-Z]/g, '');
965
+ var regRecur = $('select#ws-plugin--s2member-'+button+'-term').val().split('-')[2].replace(/[^0-1BN]/g, '');
966
var /* These options are NOT yet configurable. */ regRecurTimes = '', regRecurRetry = '1';
967
/**/
968
var /* NOT yet configurable. */ localeCode = '', digital = '0', noShipping = '1';
969
+ var pageStyle = $.trim($('input#ws-plugin--s2member-'+button+'-page-style').val().replace(/"/g, ''));
970
+ var currencyCode = $('select#ws-plugin--s2member-'+button+'-currency').val().replace(/[^A-Z]/g, '');
971
/**/
972
+ 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());
973
+ cCaps = ($.trim($('input#ws-plugin--s2member-'+button+'-ccaps').val()).match(/^(-all|-al|-a|-)[;,]*/i)) ? ((cCaps) ? '-all,' : '-all')+cCaps.toLowerCase() : cCaps.toLowerCase();
974
/**/
975
trialPeriod = /* Lifetime ( 1-L-BN ) and Buy Now ( BN ) access is absolutely NOT compatible w/ Trial Periods. */ (regRecur === 'BN') ? '0' : trialPeriod;
976
trialAmount = /* Validate Trial Amount. */ (!trialAmount || isNaN(trialAmount) || trialAmount < 0.01 || trialPeriod <= 0) ? '0' : trialAmount;
977
/**/
978
+ var levelCcapsPer = (regRecur === 'BN' && regTerm !== 'L') ? level+':'+cCaps+':'+regPeriod+' '+regTerm : level+':'+cCaps;
979
+ levelCcapsPer = /* Clean any trailing separators from this string. */ levelCcapsPer.replace(/\:+#x2F;g, '');
980
/**/
981
+ if(trialAmount !== '0' && (isNaN(trialAmount) || trialAmount < 0.00))
982
{
983
alert('— Oops, a slight problem: —\n\nWhen provided, Trial Amount must be >= 0.00');
984
return false;
985
}
986
+ else if(trialAmount !== '0' && /* Maximum. */ trialAmount > 10000.00)
987
{
988
alert('— Oops, a slight problem: —\n\nMaximum Trial Amount is: 10000.00');
989
return false;
990
}
991
+ else if(trialTerm === 'D' && /* Some validation on the Trial Period. Max days: 7. */ trialPeriod > 7)
992
{
993
alert('— Oops, a slight problem: —\n\nMaximum Trial Days is: 7.\nIf you want to offer more than 7 days, please choose Weeks or Months from the drop-down.');
994
return false;
995
}
996
+ else if(trialTerm === 'W' && /* Some validation on the Trial Period. 52 max. */ trialPeriod > 52)
997
{
998
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.');
999
return false;
1000
}
1001
+ else if(trialTerm === 'M' && /* Some validation on the Trial Period. 12 max. */ trialPeriod > 12)
1002
{
1003
alert('— Oops, a slight problem: —\n\nMaximum Trial Months is: 12.\nIf you want to offer more than 12 months, please choose Years from the drop-down.');
1004
return false;
1005
}
1006
+ else if(trialTerm === 'Y' && /* 1 year max. */ trialPeriod > 1)
1007
{
1008
alert('— Oops, a slight problem: —\n\nMax Trial Period Years is: 1.');
1009
return false;
1010
}
1011
+ else if(!regAmount || isNaN(regAmount) || regAmount < 0.01)
1012
{
1013
alert('— Oops, a slight problem: —\n\nAmount must be >= 0.01');
1014
return false;
1015
}
1016
+ else if(regAmount > /* $10,000.00 maximum. */ 10000.00)
1017
{
1018
alert('— Oops, a slight problem: —\n\nMaximum Amount is: 10000.00');
1019
return false;
1020
}
1021
+ else if /* Each Button should have a Description. */(!desc)
1022
{
1023
alert('— Oops, a slight problem: —\n\nPlease type a Description for this Button.');
1024
return false;
1025
}
1026
/**/
1027
+ code.html(code.val().replace(/ \<\!--(\<input type\="hidden" name\="(amount|src|srt|sra|a1|p1|t1|a3|p3|t3)" value\="(.*?)" \/\>)--\>/g, " $1"));
1028
+ (parseInt(trialPeriod) <= 0) ? code.html(code.val().replace(/ (\<input type\="hidden" name\="(a1|p1|t1)" value\="(.*?)" \/\>)/g, " <!--$1-->")) : null;
1029
+ (regRecur === 'BN') ? code.html(code.val().replace(/ (\<input type\="hidden" name\="cmd" value\=")(.*?)(" \/\>)/g, " $1_xclick$3")) : null;
1030
+ (regRecur === 'BN') ? code.html(code.val().replace(/ (\<input type\="hidden" name\="(src|srt|sra|a1|p1|t1|a3|p3|t3)" value\="(.*?)" \/\>)/g, " <!--$1-->")) : null;
1031
+ (regRecur !== 'BN') ? code.html(code.val().replace(/ (\<input type\="hidden" name\="cmd" value\=")(.*?)(" \/\>)/g, " $1_xclick-subscriptions$3")) : null;
1032
+ (regRecur !== 'BN') ? code.html(code.val().replace(/ (\<input type\="hidden" name\="amount" value\="(.*?)" \/\>)/g, " <!--$1-->")) : null;
1033
/**/
1034
shortCodeTemplateAttrs += /* For Modification Buttons. */ (button === 'modification') ? 'modify="1" ' : '';
1035
+ 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="<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (esc_attr ($_SERVER["HTTP_HOST"])); ?>"';
1036
+ 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)+'"';
1037
+ shortCode.val(shortCodeTemplate.replace(/%%attrs%%/, shortCodeTemplateAttrs));
1038
/**/
1039
+ code.html(code.val().replace(/ name\="lc" value\="(.*?)"/, ' name="lc" value="'+esc_attr(localeCode)+'"'));
1040
+ code.html(code.val().replace(/ name\="no_shipping" value\="(.*?)"/, ' name="no_shipping" value="'+esc_attr(noShipping)+'"'));
1041
+ code.html(code.val().replace(/ name\="item_name" value\="(.*?)"/, ' name="item_name" value="'+esc_attr(desc)+'"'));
1042
+ code.html(code.val().replace(/ name\="item_number" value\="(.*?)"/, ' name="item_number" value="'+esc_attr(levelCcapsPer)+'"'));
1043
+ code.html(code.val().replace(/ name\="page_style" value\="(.*?)"/, ' name="page_style" value="'+esc_attr(pageStyle)+'"'));
1044
+ code.html(code.val().replace(/ name\="currency_code" value\="(.*?)"/, ' name="currency_code" value="'+esc_attr(currencyCode)+'"'));
1045
+ code.html(code.val().replace(/ name\="custom" value\="(.*?)"/, ' name="custom" value="<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (esc_attr ($_SERVER["HTTP_HOST"])); ?>"'));
1046
/**/
1047
+ code.html(code.val().replace(/ name\="modify" value\="(.*?)"/, ' name="modify" value="'+((button === 'modification') ? '1' : '0')+'"'));
1048
/**/
1049
+ code.html(code.val().replace(/ name\="amount" value\="(.*?)"/, ' name="amount" value="'+esc_attr(regAmount)+'"'));
1050
/**/
1051
+ code.html(code.val().replace(/ name\="src" value\="(.*?)"/, ' name="src" value="'+esc_attr(regRecur)+'"'));
1052
+ code.html(code.val().replace(/ name\="srt" value\="(.*?)"/, ' name="srt" value="'+esc_attr(regRecurTimes)+'"'));
1053
+ code.html(code.val().replace(/ name\="sra" value\="(.*?)"/, ' name="sra" value="'+esc_attr(regRecurRetry)+'"'));
1054
/**/
1055
+ code.html(code.val().replace(/ name\="a1" value\="(.*?)"/, ' name="a1" value="'+esc_attr(trialAmount)+'"'));
1056
+ code.html(code.val().replace(/ name\="p1" value\="(.*?)"/, ' name="p1" value="'+esc_attr(trialPeriod)+'"'));
1057
+ code.html(code.val().replace(/ name\="t1" value\="(.*?)"/, ' name="t1" value="'+esc_attr(trialTerm)+'"'));
1058
+ code.html(code.val().replace(/ name\="a3" value\="(.*?)"/, ' name="a3" value="'+esc_attr(regAmount)+'"'));
1059
+ code.html(code.val().replace(/ name\="p3" value\="(.*?)"/, ' name="p3" value="'+esc_attr(regPeriod)+'"'));
1060
+ code.html(code.val().replace(/ name\="t3" value\="(.*?)"/, ' name="t3" value="'+esc_attr(regTerm)+'"'));
1061
/**/
1062
+ $('div#ws-plugin--s2member-'+button+'-button-prev').html(code.val().replace(/\<form/, '<form target="_blank"').replace(/\<\?php echo S2MEMBER_VALUE_FOR_PP_INV\(\); \?\>/g, Math.round(new Date().getTime())+'~<?php echo c_ws_plugin__s2member_utils_strings::esc_js_sq (esc_attr ($_SERVER["REMOTE_ADDR"])); ?>').replace(/\<\?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_(ON0|OS0|ON1|OS1); \?\>/g, ''));
1063
/**/
1064
(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.');
1065
/**/
1066
+ shortCode.each( /* Focus and select the Shortcode. */function()
1067
{
1068
+ this.focus(), this.select();
1069
});
1070
/**/
1071
return false;
1078
var shortCode = $('input#ws-plugin--s2member-ccap-shortcode');
1079
var code = $('textarea#ws-plugin--s2member-ccap-button');
1080
/**/
1081
+ var desc = $.trim($('input#ws-plugin--s2member-ccap-desc').val().replace(/"/g, ''));
1082
/**/
1083
+ var regAmount = $('input#ws-plugin--s2member-ccap-amount').val().replace(/[^0-9\.]/g, '');
1084
+ var regPeriod = $('select#ws-plugin--s2member-ccap-term').val().split('-')[0].replace(/[^0-9]/g, '');
1085
+ var regTerm = $('select#ws-plugin--s2member-ccap-term').val().split('-')[1].replace(/[^A-Z]/g, '');
1086
+ var regRecur = $('select#ws-plugin--s2member-ccap-term').val().split('-')[2].replace(/[^0-1BN]/g, '');
1087