Version Description
= v120514 = Maintenance release. Upgrade immediately.
Download this release
Release Info
Developer | PriMoThemes |
Plugin | ![]() |
Version | 120514 |
Comparing to | |
See all releases |
Code changes from version 120309 to 120514
- includes/classes/paypal-utilities.inc.php +324 -181
- includes/classes/utils-urls.inc.php +103 -99
- includes/functions/api-functions.inc.php +2 -2
- includes/hooks.inc.php +131 -130
- includes/menu-pages/code-samples/jwplayer-standard-mp4.x-php +15 -8
- includes/menu-pages/code-samples/jwplayer-streaming-mp4-sca.x-php +10 -3
- includes/menu-pages/code-samples/jwplayer-streaming-mp4-webm.x-php +12 -4
- includes/menu-pages/code-samples/jwplayer-streaming-mp4.x-php +10 -3
- includes/menu-pages/code-samples/s2member-paid-registration-time-examples.x-php +5 -2
- includes/menu-pages/down-ops.inc.php +3 -2
- includes/menu-pages/menu-pages-s-min.js +1 -1
- includes/menu-pages/menu-pages-s.js +10 -13
- includes/menu-pages/paypal-ops.inc.php +633 -539
- includes/syscon.inc.php +19 -22
- includes/translations/s2member.pot +402 -344
- readme.txt +14 -5
- s2member.php +6 -6
includes/classes/paypal-utilities.inc.php
CHANGED
@@ -14,10 +14,10 @@
|
|
14 |
* @package s2Member\PayPal
|
15 |
* @since 3.5
|
16 |
*/
|
17 |
-
if
|
18 |
-
exit
|
19 |
/**/
|
20 |
-
if
|
21 |
{
|
22 |
/**
|
23 |
* PayPal® utilities.
|
@@ -35,20 +35,20 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_utilities"))
|
|
35 |
*
|
36 |
* @return array|bool An array of verified ``$_POST`` or ``$_REQUEST`` variables, else false.
|
37 |
*/
|
38 |
-
public static function paypal_postvars
|
39 |
{
|
40 |
-
eval
|
41 |
-
do_action
|
42 |
-
unset
|
43 |
/*
|
44 |
Custom conditionals can be applied by filters.
|
45 |
*/
|
46 |
-
eval
|
47 |
-
if
|
48 |
{
|
49 |
-
unset
|
50 |
/**/
|
51 |
-
if
|
52 |
{
|
53 |
$postback["tx"] = $_GET["tx"];
|
54 |
$postback["cmd"] = "_notify-synch";
|
@@ -56,53 +56,53 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_utilities"))
|
|
56 |
/**/
|
57 |
$endpoint = ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "www.sandbox.paypal.com" : "www.paypal.com";
|
58 |
/**/
|
59 |
-
if
|
60 |
{
|
61 |
-
foreach
|
62 |
{
|
63 |
-
list
|
64 |
-
if
|
65 |
-
$postvars[$key] = trim
|
66 |
}
|
67 |
/**/
|
68 |
-
return apply_filters
|
69 |
}
|
70 |
else /* Nope. */
|
71 |
-
|
72 |
}
|
73 |
-
else if
|
74 |
{
|
75 |
-
foreach
|
76 |
-
if
|
77 |
-
unset
|
78 |
/**/
|
79 |
$postback = $postvars; /* Copy. */
|
80 |
$postback["cmd"] = "_notify-validate";
|
81 |
/**/
|
82 |
-
$postvars = c_ws_plugin__s2member_utils_strings::trim_deep
|
83 |
/**/
|
84 |
$endpoint = ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "www.sandbox.paypal.com" : "www.paypal.com";
|
85 |
/**/
|
86 |
-
if
|
87 |
-
return apply_filters
|
88 |
/**/
|
89 |
-
else if
|
90 |
-
return apply_filters
|
91 |
/**/
|
92 |
-
else if
|
93 |
-
return apply_filters
|
94 |
/**/
|
95 |
else /* Nope. */
|
96 |
-
|
97 |
}
|
98 |
else /* Nope. */
|
99 |
-
|
100 |
}
|
101 |
else /* Else a custom conditional has been applied by Filters. */
|
102 |
{
|
103 |
-
unset
|
104 |
/**/
|
105 |
-
return apply_filters
|
106 |
}
|
107 |
}
|
108 |
/**
|
@@ -113,21 +113,21 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_utilities"))
|
|
113 |
*
|
114 |
* @return str A Proxy Key. It's an MD5 Hash, 32 chars, URL-safe.
|
115 |
*/
|
116 |
-
public static function paypal_proxy_key_gen
|
117 |
{
|
118 |
global $current_site, $current_blog; /* Multisite Networking. */
|
119 |
/**/
|
120 |
-
eval
|
121 |
-
do_action
|
122 |
-
unset
|
123 |
/**/
|
124 |
-
if
|
125 |
-
$key = md5
|
126 |
/**/
|
127 |
else /* Else it's a standard Proxy Key; not on a Multisite Network, or not on the Main Site anyway. */
|
128 |
-
|
129 |
/**/
|
130 |
-
return apply_filters
|
131 |
}
|
132 |
/**
|
133 |
* Calls upon the PayPal® API, and returns the response.
|
@@ -141,60 +141,60 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_utilities"))
|
|
141 |
* @todo Optimize this routine with ``empty()`` and ``isset()``.
|
142 |
* @todo Possibly integrate this API: {@link http://msdn.microsoft.com/en-us/library/ff512417.aspx}.
|
143 |
*/
|
144 |
-
public static function paypal_api_response
|
145 |
{
|
146 |
global /* For Multisite support. */ $current_site, $current_blog;
|
147 |
/**/
|
148 |
-
eval
|
149 |
-
do_action
|
150 |
-
unset /* Unset defined __refs, __v. */
|
151 |
/**/
|
152 |
-
$url = "https://"
|
153 |
/**/
|
154 |
-
$post_vars = apply_filters
|
155 |
-
$post_vars = (is_array
|
156 |
/**/
|
157 |
$post_vars["VERSION"] = /* Configure the PayPal® API version. */ "71.0";
|
158 |
$post_vars["USER"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_api_username"];
|
159 |
$post_vars["PWD"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_api_password"];
|
160 |
$post_vars["SIGNATURE"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_api_signature"];
|
161 |
/**/
|
162 |
-
$input_time = /* Record input/nvp for logging. */ date
|
163 |
/**/
|
164 |
-
$nvp = trim
|
165 |
/**/
|
166 |
-
$output_time = /* Now record after output time. */ date
|
167 |
/**/
|
168 |
-
wp_parse_str /* Parse NVP response. */
|
169 |
-
$response = c_ws_plugin__s2member_utils_strings::trim_deep
|
170 |
/**/
|
171 |
-
if
|
172 |
{
|
173 |
-
if
|
174 |
/* translators: Exclude `%2$s` and `%3$s`. These are English details returned by PayPal®. Replace `%2$s` and `%3$s` with: `Unable to process, please try again`, or something to that affect. Or, if you prefer, you could Filter ``$response["__error"]`` with `ws_plugin__s2member_paypal_api_response`. */
|
175 |
-
$response["__error"] = sprintf
|
176 |
/**/
|
177 |
else /* Else, generate an error messsage - so something is reported back to the Customer. */
|
178 |
-
|
179 |
}
|
180 |
/**/
|
181 |
-
$logv = c_ws_plugin__s2member_utilities::ver_details
|
182 |
-
$logm = c_ws_plugin__s2member_utilities::mem_details
|
183 |
-
$log4 = $_SERVER["HTTP_HOST"]
|
184 |
-
$log4 = (is_multisite
|
185 |
-
$log2 = (is_multisite
|
186 |
/**/
|
187 |
-
if
|
188 |
-
$post_vars["ACCT"] = str_repeat
|
189 |
/**/
|
190 |
-
if
|
191 |
-
if
|
192 |
-
if
|
193 |
-
if
|
194 |
-
if
|
195 |
-
file_put_contents
|
196 |
/**/
|
197 |
-
return apply_filters
|
198 |
}
|
199 |
/**
|
200 |
* A sort of callback function that Filters PayPal® responses.
|
@@ -207,27 +207,130 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_utilities"))
|
|
207 |
* @param array $response Expects an array of response variables returned by the PayPal® API.
|
208 |
* @return array An array of variables returned by the PayPal® API, after ``$response["__error"]`` is Filtered.
|
209 |
*/
|
210 |
-
public static function _paypal_api_response_filters
|
211 |
{
|
212 |
-
eval
|
213 |
-
do_action
|
214 |
-
unset
|
215 |
/**/
|
216 |
-
if
|
217 |
{
|
218 |
-
if
|
219 |
-
$response["__error"] = sprintf
|
220 |
/**/
|
221 |
-
else if
|
222 |
-
$response["__error"] = sprintf
|
223 |
/**/
|
224 |
-
else if
|
225 |
-
$response["__error"] = sprintf
|
226 |
}
|
227 |
/**/
|
228 |
return $response; /* Filters already applied with: ``ws_plugin__s2member_paypal_api_response``. */
|
229 |
}
|
230 |
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
231 |
* Converts a term `D|W|M|Y` into PayPal® Pro format.
|
232 |
*
|
233 |
* @package s2Member\PayPal
|
@@ -236,17 +339,48 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_utilities"))
|
|
236 |
* @param str $term Expects one of `D|W|M|Y`.
|
237 |
* @return bool|str A full singular description of the term *( i.e. `Day|Week|Month|Year` )*, else false.
|
238 |
*/
|
239 |
-
public static function paypal_pro_term
|
240 |
{
|
241 |
-
eval
|
242 |
-
do_action
|
243 |
-
unset
|
244 |
/**/
|
245 |
-
$paypal_pro_terms = array
|
246 |
/**/
|
247 |
-
$pro_term = (!empty
|
248 |
/**/
|
249 |
-
return apply_filters
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
250 |
}
|
251 |
/**
|
252 |
* Converts a term `Day|Week|Month|Year` into PayPal® Standard format.
|
@@ -257,17 +391,17 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_utilities"))
|
|
257 |
* @param str $term Expects one of `Day|Week|Month|Year`.
|
258 |
* @return bool|str A term code *( i.e. `D|W|M|Y` )*, else false.
|
259 |
*/
|
260 |
-
public static function paypal_std_term
|
261 |
{
|
262 |
-
eval
|
263 |
-
do_action
|
264 |
-
unset
|
265 |
/**/
|
266 |
-
$paypal_std_terms = array
|
267 |
/**/
|
268 |
-
$std_term = (!empty
|
269 |
/**/
|
270 |
-
return apply_filters
|
271 |
}
|
272 |
/**
|
273 |
* Get `subscr_id` from either an array with `recurring_payment_id|subscr_id`, or use an existing string.
|
@@ -278,22 +412,22 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_utilities"))
|
|
278 |
* @param str|array $array_or_string Either an array of PayPal® post vars, or a string.
|
279 |
* @return str|bool A `subscr_id` string if non-empty, else false.
|
280 |
*/
|
281 |
-
public static function paypal_pro_subscr_id
|
282 |
{
|
283 |
-
eval
|
284 |
-
do_action
|
285 |
-
unset
|
286 |
/**/
|
287 |
-
if
|
288 |
-
$subscr_id = trim
|
289 |
/**/
|
290 |
-
else if
|
291 |
-
$subscr_id = trim
|
292 |
/**/
|
293 |
-
else if
|
294 |
-
$subscr_id = trim
|
295 |
/**/
|
296 |
-
return apply_filters
|
297 |
}
|
298 |
/**
|
299 |
* Get `item_number` from either an array with `PROFILEREFERENCE|rp_invoice_id|item_number1|item_number`, or use an existing string.
|
@@ -305,31 +439,34 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_utilities"))
|
|
305 |
* If it's a string, we make sure it is a valid `level:ccaps:eotper` or `sp:ids:expiration` combination.
|
306 |
* @return str|bool An `item_number` string if non-empty, else false.
|
307 |
*/
|
308 |
-
public static function paypal_pro_item_number
|
309 |
{
|
310 |
-
eval
|
311 |
-
do_action
|
312 |
-
unset
|
313 |
/**/
|
314 |
-
if
|
315 |
-
|
316 |
/**/
|
317 |
-
|
318 |
-
$_item_number = trim ($array["
|
319 |
/**/
|
320 |
-
else if
|
321 |
-
$_item_number = trim
|
322 |
/**/
|
323 |
-
else if
|
324 |
-
$_item_number = trim
|
325 |
/**/
|
326 |
-
if
|
|
|
|
|
|
|
327 |
$item_number = $_item_number;
|
328 |
/**/
|
329 |
-
else if
|
330 |
$item_number = $_item_number;
|
331 |
/**/
|
332 |
-
return apply_filters
|
333 |
}
|
334 |
/**
|
335 |
* Get `item_name` from either an array with `product_name|item_name1|item_name`, or use an existing string.
|
@@ -340,25 +477,25 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_utilities"))
|
|
340 |
* @param str|array $array_or_string Either an array of PayPal® post vars, or a string.
|
341 |
* @return str|bool An `item_name` string if non-empty, else false.
|
342 |
*/
|
343 |
-
public static function paypal_pro_item_name
|
344 |
{
|
345 |
-
eval
|
346 |
-
do_action
|
347 |
-
unset
|
348 |
/**/
|
349 |
-
if
|
350 |
-
$item_name = trim
|
351 |
/**/
|
352 |
-
else if
|
353 |
-
$item_name = trim
|
354 |
/**/
|
355 |
-
else if
|
356 |
-
$item_name = trim
|
357 |
/**/
|
358 |
-
else if
|
359 |
-
$item_name = trim
|
360 |
/**/
|
361 |
-
return apply_filters
|
362 |
}
|
363 |
/**
|
364 |
* Get `period1` from either an array with `PROFILEREFERENCE|rp_invoice_id|period1`, or use an existing string.
|
@@ -374,43 +511,46 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_utilities"))
|
|
374 |
* @param str $default Optional. Value if unavailable. Defaults to `0 D`.
|
375 |
* @return str A `period1` string if possible, or defaults to `0 D`.
|
376 |
*/
|
377 |
-
public static function paypal_pro_period1
|
378 |
{
|
379 |
-
eval
|
380 |
-
do_action
|
381 |
-
unset
|
|
|
|
|
|
|
382 |
/**/
|
383 |
-
if
|
384 |
{
|
385 |
-
list
|
386 |
-
list
|
387 |
}
|
388 |
-
else if
|
389 |
-
$_period1 = trim
|
390 |
/**/
|
391 |
-
else if
|
392 |
-
$_period1 = trim
|
393 |
/**/
|
394 |
-
if
|
395 |
{
|
396 |
-
list
|
397 |
/**/
|
398 |
-
if
|
399 |
-
if
|
400 |
-
eval
|
401 |
/**/
|
402 |
-
if
|
403 |
-
$span = c_ws_plugin__s2member_paypal_utilities::paypal_std_term
|
404 |
/**/
|
405 |
-
$span = (preg_match
|
406 |
-
$num = ($span && is_numeric
|
407 |
/**/
|
408 |
-
$period1 = ($num && $span) ? $num
|
409 |
/**/
|
410 |
-
return apply_filters
|
411 |
}
|
412 |
else /* Default. */
|
413 |
-
|
414 |
}
|
415 |
/**
|
416 |
* Get `period3` from either an array with `PROFILEREFERENCE|rp_invoice_id|period3`, or use an existing string.
|
@@ -427,43 +567,46 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_utilities"))
|
|
427 |
* @param str $default Optional. Value if unavailable. Defaults to `1 D`.
|
428 |
* @return str A `period3` string if possible, or defaults to `1 D`.
|
429 |
*/
|
430 |
-
public static function paypal_pro_period3
|
431 |
{
|
432 |
-
eval
|
433 |
-
do_action
|
434 |
-
unset
|
|
|
|
|
|
|
435 |
/**/
|
436 |
-
if
|
437 |
{
|
438 |
-
list
|
439 |
-
list
|
440 |
}
|
441 |
-
else if
|
442 |
-
$_period3 = trim
|
443 |
/**/
|
444 |
-
else if
|
445 |
-
$_period3 = trim
|
446 |
/**/
|
447 |
-
if
|
448 |
{
|
449 |
-
list
|
450 |
/**/
|
451 |
-
if
|
452 |
-
if
|
453 |
-
eval
|
454 |
/**/
|
455 |
-
if
|
456 |
-
$span = c_ws_plugin__s2member_paypal_utilities::paypal_std_term
|
457 |
/**/
|
458 |
-
$span = (preg_match
|
459 |
-
$num = ($span && is_numeric
|
460 |
/**/
|
461 |
-
$period3 = ($num && $span) ? $num
|
462 |
/**/
|
463 |
-
return apply_filters
|
464 |
}
|
465 |
else /* Default. */
|
466 |
-
|
467 |
}
|
468 |
}
|
469 |
}
|
14 |
* @package s2Member\PayPal
|
15 |
* @since 3.5
|
16 |
*/
|
17 |
+
if(realpath(__FILE__) === realpath($_SERVER["SCRIPT_FILENAME"]))
|
18 |
+
exit("Do not access this file directly.");
|
19 |
/**/
|
20 |
+
if(!class_exists("c_ws_plugin__s2member_paypal_utilities"))
|
21 |
{
|
22 |
/**
|
23 |
* PayPal® utilities.
|
35 |
*
|
36 |
* @return array|bool An array of verified ``$_POST`` or ``$_REQUEST`` variables, else false.
|
37 |
*/
|
38 |
+
public static function paypal_postvars()
|
39 |
{
|
40 |
+
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
|
41 |
+
do_action("ws_plugin__s2member_before_paypal_postvars", get_defined_vars());
|
42 |
+
unset($__refs, $__v); /* Unset defined __refs, __v. */
|
43 |
/*
|
44 |
Custom conditionals can be applied by filters.
|
45 |
*/
|
46 |
+
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
|
47 |
+
if(!($postvars = apply_filters("ws_plugin__s2member_during_paypal_postvars_conditionals", array(), get_defined_vars())))
|
48 |
{
|
49 |
+
unset($__refs, $__v); /* Unset defined __refs, __v. */
|
50 |
/**/
|
51 |
+
if(!empty($_GET["tx"]) && empty($_GET["s2member_paypal_proxy"]))
|
52 |
{
|
53 |
$postback["tx"] = $_GET["tx"];
|
54 |
$postback["cmd"] = "_notify-synch";
|
56 |
/**/
|
57 |
$endpoint = ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "www.sandbox.paypal.com" : "www.paypal.com";
|
58 |
/**/
|
59 |
+
if(preg_match("/^SUCCESS/i", ($response = trim(c_ws_plugin__s2member_utils_urls::remote("https://".$endpoint."/cgi-bin/webscr", $postback, array("timeout" => 20))))))
|
60 |
{
|
61 |
+
foreach(preg_split("/[\r\n]+/", preg_replace("/^SUCCESS/i", "", $response)) as $varline)
|
62 |
{
|
63 |
+
list($key, $value) = preg_split("/\=/", $varline, 2);
|
64 |
+
if(strlen($key = trim($key)) && strlen($value = trim($value)))
|
65 |
+
$postvars[$key] = trim(stripslashes(urldecode($value)));
|
66 |
}
|
67 |
/**/
|
68 |
+
return apply_filters("ws_plugin__s2member_paypal_postvars", $postvars, get_defined_vars());
|
69 |
}
|
70 |
else /* Nope. */
|
71 |
+
return false;
|
72 |
}
|
73 |
+
else if(!empty($_REQUEST) && is_array($postvars = stripslashes_deep($_REQUEST)))
|
74 |
{
|
75 |
+
foreach($postvars as $key => $value)
|
76 |
+
if(preg_match("/^s2member_/", $key))
|
77 |
+
unset($postvars[$key]);
|
78 |
/**/
|
79 |
$postback = $postvars; /* Copy. */
|
80 |
$postback["cmd"] = "_notify-validate";
|
81 |
/**/
|
82 |
+
$postvars = c_ws_plugin__s2member_utils_strings::trim_deep($postvars);
|
83 |
/**/
|
84 |
$endpoint = ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "www.sandbox.paypal.com" : "www.paypal.com";
|
85 |
/**/
|
86 |
+
if(!empty($_GET["s2member_paypal_proxy"]) && !empty($_GET["s2member_paypal_proxy_verification"]) && $_GET["s2member_paypal_proxy_verification"] === c_ws_plugin__s2member_paypal_utilities::paypal_proxy_key_gen())
|
87 |
+
return apply_filters("ws_plugin__s2member_paypal_postvars", array_merge($postvars, array("proxy_verified" => $_GET["s2member_paypal_proxy"])), get_defined_vars());
|
88 |
/**/
|
89 |
+
else if(empty($_POST) && !empty($_GET["s2member_paypal_proxy"]) && !empty($_GET["s2member_paypal_proxy_verification"]) && c_ws_plugin__s2member_utils_urls::s2member_sig_ok($_SERVER["REQUEST_URI"], false, false, "s2member_paypal_proxy_verification"))
|
90 |
+
return apply_filters("ws_plugin__s2member_paypal_postvars", array_merge($postvars, array("proxy_verified" => $_GET["s2member_paypal_proxy"])), get_defined_vars());
|
91 |
/**/
|
92 |
+
else if(trim(strtolower(c_ws_plugin__s2member_utils_urls::remote("https://".$endpoint."/cgi-bin/webscr", $postback, array("timeout" => 20)))) === "verified")
|
93 |
+
return apply_filters("ws_plugin__s2member_paypal_postvars", $postvars, get_defined_vars());
|
94 |
/**/
|
95 |
else /* Nope. */
|
96 |
+
return false;
|
97 |
}
|
98 |
else /* Nope. */
|
99 |
+
return false;
|
100 |
}
|
101 |
else /* Else a custom conditional has been applied by Filters. */
|
102 |
{
|
103 |
+
unset($__refs, $__v); /* Unset defined __refs, __v. */
|
104 |
/**/
|
105 |
+
return apply_filters("ws_plugin__s2member_paypal_postvars", $postvars, get_defined_vars());
|
106 |
}
|
107 |
}
|
108 |
/**
|
113 |
*
|
114 |
* @return str A Proxy Key. It's an MD5 Hash, 32 chars, URL-safe.
|
115 |
*/
|
116 |
+
public static function paypal_proxy_key_gen() /* Generate Key. */
|
117 |
{
|
118 |
global $current_site, $current_blog; /* Multisite Networking. */
|
119 |
/**/
|
120 |
+
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
|
121 |
+
do_action("ws_plugin__s2member_before_paypal_proxy_key_gen", get_defined_vars());
|
122 |
+
unset($__refs, $__v); /* Unset defined __refs, __v. */
|
123 |
/**/
|
124 |
+
if(is_multisite() && !is_main_site())
|
125 |
+
$key = md5(c_ws_plugin__s2member_utils_encryption::xencrypt($current_blog->domain.$current_blog->path, false, false));
|
126 |
/**/
|
127 |
else /* Else it's a standard Proxy Key; not on a Multisite Network, or not on the Main Site anyway. */
|
128 |
+
$key = md5(c_ws_plugin__s2member_utils_encryption::xencrypt(preg_replace("/\:[0-9]+$/", "", $_SERVER["HTTP_HOST"]), false, false));
|
129 |
/**/
|
130 |
+
return apply_filters("ws_plugin__s2member_paypal_proxy_key_gen", $key, get_defined_vars());
|
131 |
}
|
132 |
/**
|
133 |
* Calls upon the PayPal® API, and returns the response.
|
141 |
* @todo Optimize this routine with ``empty()`` and ``isset()``.
|
142 |
* @todo Possibly integrate this API: {@link http://msdn.microsoft.com/en-us/library/ff512417.aspx}.
|
143 |
*/
|
144 |
+
public static function paypal_api_response($post_vars = FALSE)
|
145 |
{
|
146 |
global /* For Multisite support. */ $current_site, $current_blog;
|
147 |
/**/
|
148 |
+
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
|
149 |
+
do_action("ws_plugin__s2member_before_paypal_api_response", get_defined_vars());
|
150 |
+
unset /* Unset defined __refs, __v. */($__refs, $__v);
|
151 |
/**/
|
152 |
+
$url = "https://".(($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "api-3t.sandbox.paypal.com" : "api-3t.paypal.com")."/nvp";
|
153 |
/**/
|
154 |
+
$post_vars = apply_filters("ws_plugin__s2member_paypal_api_post_vars", $post_vars, get_defined_vars());
|
155 |
+
$post_vars = (is_array($post_vars)) ? $post_vars : array();
|
156 |
/**/
|
157 |
$post_vars["VERSION"] = /* Configure the PayPal® API version. */ "71.0";
|
158 |
$post_vars["USER"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_api_username"];
|
159 |
$post_vars["PWD"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_api_password"];
|
160 |
$post_vars["SIGNATURE"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_api_signature"];
|
161 |
/**/
|
162 |
+
$input_time = /* Record input/nvp for logging. */ date("D M j, Y g:i:s a T");
|
163 |
/**/
|
164 |
+
$nvp = trim(c_ws_plugin__s2member_utils_urls::remote($url, $post_vars, array("timeout" => 20)));
|
165 |
/**/
|
166 |
+
$output_time = /* Now record after output time. */ date("D M j, Y g:i:s a T");
|
167 |
/**/
|
168 |
+
wp_parse_str /* Parse NVP response. */($nvp, $response);
|
169 |
+
$response = c_ws_plugin__s2member_utils_strings::trim_deep($response);
|
170 |
/**/
|
171 |
+
if(!$response["ACK"] || !preg_match("/^(Success|SuccessWithWarning)$/i", $response["ACK"]))
|
172 |
{
|
173 |
+
if(strlen($response["L_ERRORCODE0"]) || $response["L_SHORTMESSAGE0"] || $response["L_LONGMESSAGE0"])
|
174 |
/* translators: Exclude `%2$s` and `%3$s`. These are English details returned by PayPal®. Replace `%2$s` and `%3$s` with: `Unable to process, please try again`, or something to that affect. Or, if you prefer, you could Filter ``$response["__error"]`` with `ws_plugin__s2member_paypal_api_response`. */
|
175 |
+
$response["__error"] = sprintf(_x('Error #%1$s. %2$s. %3$s.', "s2member-front", "s2member"), $response["L_ERRORCODE0"], rtrim($response["L_SHORTMESSAGE0"], "."), rtrim($response["L_LONGMESSAGE0"], "."));
|
176 |
/**/
|
177 |
else /* Else, generate an error messsage - so something is reported back to the Customer. */
|
178 |
+
$response["__error"] = _x("Error. Please contact Support for assistance.", "s2member-front", "s2member");
|
179 |
}
|
180 |
/**/
|
181 |
+
$logv = c_ws_plugin__s2member_utilities::ver_details();
|
182 |
+
$logm = c_ws_plugin__s2member_utilities::mem_details();
|
183 |
+
$log4 = $_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]."\nUser-Agent: ".$_SERVER["HTTP_USER_AGENT"];
|
184 |
+
$log4 = (is_multisite() && !is_main_site()) ? ($_log4 = $current_blog->domain.$current_blog->path)."\n".$log4 : $log4;
|
185 |
+
$log2 = (is_multisite() && !is_main_site()) ? "paypal-api-4-".trim(preg_replace("/[^a-z0-9]/i", "-", $_log4), "-").".log" : "paypal-api.log";
|
186 |
/**/
|
187 |
+
if(isset($post_vars["ACCT"]) && strlen($post_vars["ACCT"]) > 4)
|
188 |
+
$post_vars["ACCT"] = str_repeat("*", strlen($post_vars["ACCT"]) - 4).substr($post_vars["ACCT"], -4);
|
189 |
/**/
|
190 |
+
if($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["gateway_debug_logs"])
|
191 |
+
if(is_dir($logs_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"]))
|
192 |
+
if(is_writable($logs_dir) && c_ws_plugin__s2member_utils_logs::archive_oversize_log_files())
|
193 |
+
if(($log = "-------- Input vars: ( ".$input_time." ) --------\n".var_export($post_vars, true)."\n"))
|
194 |
+
if(($log .= "-------- Output string/vars: ( ".$output_time." ) --------\n".$nvp."\n".var_export($response, true)))
|
195 |
+
file_put_contents($logs_dir."/".$log2, $logv."\n".$logm."\n".$log4."\n".$log."\n\n", FILE_APPEND);
|
196 |
/**/
|
197 |
+
return apply_filters("ws_plugin__s2member_paypal_api_response", c_ws_plugin__s2member_paypal_utilities::_paypal_api_response_filters($response), get_defined_vars());
|
198 |
}
|
199 |
/**
|
200 |
* A sort of callback function that Filters PayPal® responses.
|
207 |
* @param array $response Expects an array of response variables returned by the PayPal® API.
|
208 |
* @return array An array of variables returned by the PayPal® API, after ``$response["__error"]`` is Filtered.
|
209 |
*/
|
210 |
+
public static function _paypal_api_response_filters($response = FALSE)
|
211 |
{
|
212 |
+
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
|
213 |
+
do_action("_ws_plugin__s2member_before_paypal_api_response_filters", get_defined_vars());
|
214 |
+
unset($__refs, $__v); /* Unset defined __refs, __v. */
|
215 |
/**/
|
216 |
+
if(!empty($response["__error"]) && !empty($response["L_ERRORCODE0"]))
|
217 |
{
|
218 |
+
if((int)$response["L_ERRORCODE0"] === 10422)
|
219 |
+
$response["__error"] = sprintf(_x("Error #%s. Transaction declined. Please use an alternate funding source.", "s2member-front", "s2member"), $response["L_ERRORCODE0"]);
|
220 |
/**/
|
221 |
+
else if((int)$response["L_ERRORCODE0"] === 10435)
|
222 |
+
$response["__error"] = sprintf(_x("Error #%s. Transaction declined. Express Checkout was NOT confirmed.", "s2member-front", "s2member"), $response["L_ERRORCODE0"]);
|
223 |
/**/
|
224 |
+
else if((int)$response["L_ERRORCODE0"] === 10417)
|
225 |
+
$response["__error"] = sprintf(_x("Error #%s. Transaction declined. Please use an alternate funding source.", "s2member-front", "s2member"), $response["L_ERRORCODE0"]);
|
226 |
}
|
227 |
/**/
|
228 |
return $response; /* Filters already applied with: ``ws_plugin__s2member_paypal_api_response``. */
|
229 |
}
|
230 |
/**
|
231 |
+
* Calls upon the PayPal® PayFlow API, and returns the response.
|
232 |
+
*
|
233 |
+
* @package s2Member\PayPal
|
234 |
+
* @since 120514
|
235 |
+
*
|
236 |
+
* @param array $post_vars An array of variables to send through the PayPal® PayFlow API call.
|
237 |
+
* @return array An array of variables returned by the PayPal® PayFlow API.
|
238 |
+
*/
|
239 |
+
public static function paypal_payflow_api_response($post_vars = FALSE)
|
240 |
+
{
|
241 |
+
global /* For Multisite support. */ $current_site, $current_blog;
|
242 |
+
/**/
|
243 |
+
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
|
244 |
+
do_action("ws_plugin__s2member_before_paypal_payflow_api_response", get_defined_vars());
|
245 |
+
unset /* Unset defined __refs, __v. */($__refs, $__v);
|
246 |
+
/**/
|
247 |
+
$url = "https://".(($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "pilot-payflowpro.paypal.com" : "payflowpro.paypal.com");
|
248 |
+
/**/
|
249 |
+
$post_vars = apply_filters("ws_plugin__s2member_paypal_payflow_api_post_vars", $post_vars, get_defined_vars());
|
250 |
+
$post_vars = (is_array($post_vars)) ? $post_vars : array();
|
251 |
+
/**/
|
252 |
+
$post_vars["VERBOSITY"] = "HIGH";
|
253 |
+
$post_vars["USER"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_payflow_api_username"];
|
254 |
+
$post_vars["PARTNER"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_payflow_api_partner"];
|
255 |
+
$post_vars["VENDOR"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_payflow_api_vendor"];
|
256 |
+
$post_vars["PWD"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_payflow_api_password"];
|
257 |
+
/**/
|
258 |
+
$input_time = /* Record input/nvp for logging. */ date("D M j, Y g:i:s a T");
|
259 |
+
/**/
|
260 |
+
$nvp = trim(c_ws_plugin__s2member_utils_urls::remote($url, $post_vars, array("timeout" => 20)));
|
261 |
+
/**/
|
262 |
+
$output_time = /* Now record after output time. */ date("D M j, Y g:i:s a T");
|
263 |
+
/**/
|
264 |
+
wp_parse_str /* Parse NVP response. */($nvp, $response);
|
265 |
+
$response = c_ws_plugin__s2member_utils_strings::trim_deep($response);
|
266 |
+
/**/
|
267 |
+
if($response["RESULT"] !== "0")
|
268 |
+
{
|
269 |
+
if(strlen($response["RESPMSG"]))
|
270 |
+
/* translators: Exclude `%2$s`. These are English details returned by PayPal®. Replace `%2$s` with: `Unable to process, please try again`, or something to that affect. Or, if you prefer, you could Filter ``$response["__error"]`` with `ws_plugin__s2member_paypal_payflow_api_response`. */
|
271 |
+
$response["__error"] = sprintf(_x('Error #%1$s. %2$s.', "s2member-front", "s2member"), $response["RESULT"], rtrim($response["RESPMSG"], "."));
|
272 |
+
/**/
|
273 |
+
else $response["__error"] = _x("Error. Please contact Support for assistance.", "s2member-front", "s2member");
|
274 |
+
}
|
275 |
+
else if(isset($response["TRXRESULT"]) && $response["TRXRESULT"] !== "0")
|
276 |
+
{
|
277 |
+
if(strlen($response["TRXRESPMSG"]))
|
278 |
+
/* translators: Exclude `%2$s`. These are English details returned by PayPal®. Replace `%2$s` with: `Unable to process, please try again`, or something to that affect. Or, if you prefer, you could Filter ``$response["__error"]`` with `ws_plugin__s2member_paypal_payflow_api_response`. */
|
279 |
+
$response["__error"] = sprintf(_x('Error #%1$s. %2$s.', "s2member-front", "s2member"), $response["TRXRESULT"], rtrim($response["TRXRESPMSG"], "."));
|
280 |
+
/**/
|
281 |
+
else $response["__error"] = _x("Error. Please contact Support for assistance.", "s2member-front", "s2member");
|
282 |
+
}
|
283 |
+
/**/
|
284 |
+
$logv = c_ws_plugin__s2member_utilities::ver_details();
|
285 |
+
$logm = c_ws_plugin__s2member_utilities::mem_details();
|
286 |
+
$log4 = $_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]."\nUser-Agent: ".$_SERVER["HTTP_USER_AGENT"];
|
287 |
+
$log4 = (is_multisite() && !is_main_site()) ? ($_log4 = $current_blog->domain.$current_blog->path)."\n".$log4 : $log4;
|
288 |
+
$log2 = (is_multisite() && !is_main_site()) ? "paypal-payflow-api-4-".trim(preg_replace("/[^a-z0-9]/i", "-", $_log4), "-").".log" : "paypal-payflow-api.log";
|
289 |
+
/**/
|
290 |
+
if(isset($post_vars["ACCT"]) && strlen($post_vars["ACCT"]) > 4)
|
291 |
+
$post_vars["ACCT"] = str_repeat("*", strlen($post_vars["ACCT"]) - 4).substr($post_vars["ACCT"], -4);
|
292 |
+
/**/
|
293 |
+
if($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["gateway_debug_logs"])
|
294 |
+
if(is_dir($logs_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"]))
|
295 |
+
if(is_writable($logs_dir) && c_ws_plugin__s2member_utils_logs::archive_oversize_log_files())
|
296 |
+
if(($log = "-------- Input vars: ( ".$input_time." ) --------\n".var_export($post_vars, true)."\n"))
|
297 |
+
if(($log .= "-------- Output string/vars: ( ".$output_time." ) --------\n".$nvp."\n".var_export($response, true)))
|
298 |
+
file_put_contents($logs_dir."/".$log2, $logv."\n".$logm."\n".$log4."\n".$log."\n\n", FILE_APPEND);
|
299 |
+
/**/
|
300 |
+
return apply_filters("ws_plugin__s2member_paypal_payflow_api_response", c_ws_plugin__s2member_paypal_utilities::_paypal_payflow_api_response_filters($response), get_defined_vars());
|
301 |
+
}
|
302 |
+
/**
|
303 |
+
* A sort of callback function that Filters Payflow® responses.
|
304 |
+
*
|
305 |
+
* Provides alternative explanations in some cases that require special attention.
|
306 |
+
*
|
307 |
+
* @package s2Member\PayPal
|
308 |
+
* @since 120514
|
309 |
+
*
|
310 |
+
* @param array $response Expects an array of response variables returned by the Payflow® API.
|
311 |
+
* @return array An array of variables returned by the Payflow® API, after ``$response["__error"]`` is Filtered.
|
312 |
+
*/
|
313 |
+
public static function _paypal_payflow_api_response_filters($response = FALSE)
|
314 |
+
{
|
315 |
+
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
|
316 |
+
do_action("_ws_plugin__s2member_before_paypal_payflow_api_response_filters", get_defined_vars());
|
317 |
+
unset($__refs, $__v); /* Unset defined __refs, __v. */
|
318 |
+
/**/
|
319 |
+
if(!empty($response["__error"]) && !empty($response["L_ERRORCODE0"]))
|
320 |
+
{
|
321 |
+
if((int)$response["L_ERRORCODE0"] === 10422)
|
322 |
+
$response["__error"] = sprintf(_x("Error #%s. Transaction declined. Please use an alternate funding source.", "s2member-front", "s2member"), $response["L_ERRORCODE0"]);
|
323 |
+
/**/
|
324 |
+
else if((int)$response["L_ERRORCODE0"] === 10435)
|
325 |
+
$response["__error"] = sprintf(_x("Error #%s. Transaction declined. Express Checkout was NOT confirmed.", "s2member-front", "s2member"), $response["L_ERRORCODE0"]);
|
326 |
+
/**/
|
327 |
+
else if((int)$response["L_ERRORCODE0"] === 10417)
|
328 |
+
$response["__error"] = sprintf(_x("Error #%s. Transaction declined. Please use an alternate funding source.", "s2member-front", "s2member"), $response["L_ERRORCODE0"]);
|
329 |
+
}
|
330 |
+
/**/
|
331 |
+
return $response; /* Filters already applied with: ``ws_plugin__s2member_paypal_payflow_api_response``. */
|
332 |
+
}
|
333 |
+
/**
|
334 |
* Converts a term `D|W|M|Y` into PayPal® Pro format.
|
335 |
*
|
336 |
* @package s2Member\PayPal
|
339 |
* @param str $term Expects one of `D|W|M|Y`.
|
340 |
* @return bool|str A full singular description of the term *( i.e. `Day|Week|Month|Year` )*, else false.
|
341 |
*/
|
342 |
+
public static function paypal_pro_term($term = FALSE)
|
343 |
{
|
344 |
+
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
|
345 |
+
do_action("ws_plugin__s2member_before_paypal_pro_term", get_defined_vars());
|
346 |
+
unset($__refs, $__v); /* Unset defined __refs, __v. */
|
347 |
/**/
|
348 |
+
$paypal_pro_terms = array("D" => "Day", "W" => "Week", "M" => "Month", "Y" => "Year");
|
349 |
/**/
|
350 |
+
$pro_term = (!empty($paypal_pro_terms[strtoupper($term)])) ? $paypal_pro_terms[strtoupper($term)] : false;
|
351 |
/**/
|
352 |
+
return apply_filters("ws_plugin__s2member_paypal_pro_term", $pro_term, get_defined_vars());
|
353 |
+
}
|
354 |
+
/**
|
355 |
+
* Converts a term `D|W|M|Y` into Payflow® format.
|
356 |
+
*
|
357 |
+
* @package s2Member\PayPal
|
358 |
+
* @since 120514
|
359 |
+
*
|
360 |
+
* @param str $term Expects one of `D|W|M|Y`.
|
361 |
+
* @param str $period Expects a numeric value.
|
362 |
+
* @return bool|str A full singular description of the term *( i.e. `DAY|WEEK|BIWK|MONT|QTER|YEAR` )*, else false.
|
363 |
+
*
|
364 |
+
* @note Payflow® unfortunately does NOT support bi-monthly billing.
|
365 |
+
* It DOES support semi-monthly billing, but that can be confusing for customers.
|
366 |
+
*/
|
367 |
+
public static function paypal_payflow_term($term = FALSE, $period = FALSE)
|
368 |
+
{
|
369 |
+
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
|
370 |
+
do_action("ws_plugin__s2member_before_paypal_payflow_term", get_defined_vars());
|
371 |
+
unset($__refs, $__v); /* Unset defined __refs, __v. */
|
372 |
+
/**/
|
373 |
+
$paypal_payflow_terms = array("D" => "DAY", "W" => "WEEK", "M" => "MONT", "Y" => "YEAR");
|
374 |
+
/**/
|
375 |
+
$payflow_term = (!empty($paypal_payflow_terms[strtoupper($term)])) ? $paypal_payflow_terms[strtoupper($term)] : false;
|
376 |
+
/**/
|
377 |
+
if($payflow_term === "WEEK" && $period === "2")
|
378 |
+
$payflow_term = "BIWK";
|
379 |
+
/**/
|
380 |
+
else if($payflow_term === "MONT" && $period === "3")
|
381 |
+
$payflow_term = "QTER";
|
382 |
+
/**/
|
383 |
+
return apply_filters("ws_plugin__s2member_paypal_payflow_term", $payflow_term, get_defined_vars());
|
384 |
}
|
385 |
/**
|
386 |
* Converts a term `Day|Week|Month|Year` into PayPal® Standard format.
|
391 |
* @param str $term Expects one of `Day|Week|Month|Year`.
|
392 |
* @return bool|str A term code *( i.e. `D|W|M|Y` )*, else false.
|
393 |
*/
|
394 |
+
public static function paypal_std_term($term = FALSE)
|
395 |
{
|
396 |
+
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
|
397 |
+
do_action("ws_plugin__s2member_before_paypal_std_term", get_defined_vars());
|
398 |
+
unset($__refs, $__v); /* Unset defined __refs, __v. */
|
399 |
/**/
|
400 |
+
$paypal_std_terms = array("DAY" => "D", "WEEK" => "W", "MONTH" => "M", "YEAR" => "Y");
|
401 |
/**/
|
402 |
+
$std_term = (!empty($paypal_std_terms[strtoupper($term)])) ? $paypal_std_terms[strtoupper($term)] : false;
|
403 |
/**/
|
404 |
+
return apply_filters("ws_plugin__s2member_paypal_std_term", $std_term, get_defined_vars());
|
405 |
}
|
406 |
/**
|
407 |
* Get `subscr_id` from either an array with `recurring_payment_id|subscr_id`, or use an existing string.
|
412 |
* @param str|array $array_or_string Either an array of PayPal® post vars, or a string.
|
413 |
* @return str|bool A `subscr_id` string if non-empty, else false.
|
414 |
*/
|
415 |
+
public static function paypal_pro_subscr_id($array_or_string = FALSE)
|
416 |
{
|
417 |
+
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
|
418 |
+
do_action("ws_plugin__s2member_before_paypal_pro_subscr_id", get_defined_vars());
|
419 |
+
unset($__refs, $__v); /* Unset defined __refs, __v. */
|
420 |
/**/
|
421 |
+
if(is_array($array = $array_or_string) && !empty($array["recurring_payment_id"]))
|
422 |
+
$subscr_id = trim($array["recurring_payment_id"]);
|
423 |
/**/
|
424 |
+
else if(is_array($array = $array_or_string) && !empty($array["subscr_id"]))
|
425 |
+
$subscr_id = trim($array["subscr_id"]);
|
426 |
/**/
|
427 |
+
else if(is_string($string = $array_or_string) && !empty($string))
|
428 |
+
$subscr_id = trim($string);
|
429 |
/**/
|
430 |
+
return apply_filters("ws_plugin__s2member_paypal_pro_subscr_id", ((!empty($subscr_id)) ? $subscr_id : false), get_defined_vars());
|
431 |
}
|
432 |
/**
|
433 |
* Get `item_number` from either an array with `PROFILEREFERENCE|rp_invoice_id|item_number1|item_number`, or use an existing string.
|
439 |
* If it's a string, we make sure it is a valid `level:ccaps:eotper` or `sp:ids:expiration` combination.
|
440 |
* @return str|bool An `item_number` string if non-empty, else false.
|
441 |
*/
|
442 |
+
public static function paypal_pro_item_number($array_or_string = FALSE)
|
443 |
{
|
444 |
+
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
|
445 |
+
do_action("ws_plugin__s2member_before_paypal_pro_item_number", get_defined_vars());
|
446 |
+
unset($__refs, $__v); /* Unset defined __refs, __v. */
|
447 |
/**/
|
448 |
+
if(isset($array_or_string["PROFILENAME"]) /* Payflow® API alternative. */)
|
449 |
+
$array_or_string["PROFILEREFERENCE"] = $array_or_string["PROFILENAME"];
|
450 |
/**/
|
451 |
+
if(is_array($array = $array_or_string) && (!empty($array["PROFILEREFERENCE"]) || !empty($array["rp_invoice_id"])))
|
452 |
+
list($_reference, $_domain, $_item_number) = array_map("trim", preg_split("/~/", ((!empty($array["PROFILEREFERENCE"])) ? $array["PROFILEREFERENCE"] : $array["rp_invoice_id"]), 3));
|
453 |
/**/
|
454 |
+
else if(is_array($array = $array_or_string) && !empty($array["item_number1"]))
|
455 |
+
$_item_number = trim($array["item_number1"]);
|
456 |
/**/
|
457 |
+
else if(is_array($array = $array_or_string) && !empty($array["item_number"]))
|
458 |
+
$_item_number = trim($array["item_number"]);
|
459 |
/**/
|
460 |
+
else if(is_string($string = $array_or_string) && !empty($string))
|
461 |
+
$_item_number = trim($string);
|
462 |
+
/**/
|
463 |
+
if(!empty($_item_number) && preg_match($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_w_or_wo_level_regex"], $_item_number))
|
464 |
$item_number = $_item_number;
|
465 |
/**/
|
466 |
+
else if(!empty($_item_number) && preg_match($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["sp_access_item_number_regex"], $_item_number))
|
467 |
$item_number = $_item_number;
|
468 |
/**/
|
469 |
+
return apply_filters("ws_plugin__s2member_paypal_pro_item_number", ((!empty($item_number)) ? $item_number : false), get_defined_vars());
|
470 |
}
|
471 |
/**
|
472 |
* Get `item_name` from either an array with `product_name|item_name1|item_name`, or use an existing string.
|
477 |
* @param str|array $array_or_string Either an array of PayPal® post vars, or a string.
|
478 |
* @return str|bool An `item_name` string if non-empty, else false.
|
479 |
*/
|
480 |
+
public static function paypal_pro_item_name($array_or_string = FALSE)
|
481 |
{
|
482 |
+
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
|
483 |
+
do_action("ws_plugin__s2member_before_paypal_pro_item_name", get_defined_vars());
|
484 |
+
unset($__refs, $__v); /* Unset defined __refs, __v. */
|
485 |
/**/
|
486 |
+
if(is_array($array = $array_or_string) && !empty($array["product_name"]))
|
487 |
+
$item_name = trim($array["product_name"]);
|
488 |
/**/
|
489 |
+
else if(is_array($array = $array_or_string) && !empty($array["item_name1"]))
|
490 |
+
$item_name = trim($array["item_name1"]);
|
491 |
/**/
|
492 |
+
else if(is_array($array = $array_or_string) && !empty($array["item_name"]))
|
493 |
+
$item_name = trim($array["item_name"]);
|
494 |
/**/
|
495 |
+
else if(is_string($string = $array_or_string) && !empty($string))
|
496 |
+
$item_name = trim($string);
|
497 |
/**/
|
498 |
+
return apply_filters("ws_plugin__s2member_paypal_pro_item_name", ((!empty($item_name)) ? $item_name : false), get_defined_vars());
|
499 |
}
|
500 |
/**
|
501 |
* Get `period1` from either an array with `PROFILEREFERENCE|rp_invoice_id|period1`, or use an existing string.
|
511 |
* @param str $default Optional. Value if unavailable. Defaults to `0 D`.
|
512 |
* @return str A `period1` string if possible, or defaults to `0 D`.
|
513 |
*/
|
514 |
+
public static function paypal_pro_period1($array_or_string = FALSE, $default = "0 D")
|
515 |
{
|
516 |
+
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
|
517 |
+
do_action("ws_plugin__s2member_before_paypal_pro_period1", get_defined_vars());
|
518 |
+
unset($__refs, $__v); /* Unset defined __refs, __v. */
|
519 |
+
/**/
|
520 |
+
if(isset($array_or_string["PROFILENAME"]) /* Payflow® API alternative. */)
|
521 |
+
$array_or_string["PROFILEREFERENCE"] = $array_or_string["PROFILENAME"];
|
522 |
/**/
|
523 |
+
if(is_array($array = $array_or_string) && (!empty($array["PROFILEREFERENCE"]) || !empty($array["rp_invoice_id"])))
|
524 |
{
|
525 |
+
list($_reference, $_domain, $_item_number) = array_map("trim", preg_split("/~/", ((!empty($array["PROFILEREFERENCE"])) ? $array["PROFILEREFERENCE"] : $array["rp_invoice_id"]), 3));
|
526 |
+
list($_start_time, $_period1, $_period3) = array_map("trim", preg_split("/\:/", $_reference, 3));
|
527 |
}
|
528 |
+
else if(is_array($array = $array_or_string) && !empty($array["period1"]))
|
529 |
+
$_period1 = trim($array["period1"]);
|
530 |
/**/
|
531 |
+
else if(is_string($string = $array_or_string) && !empty($string))
|
532 |
+
$_period1 = trim($string);
|
533 |
/**/
|
534 |
+
if(!empty($_period1)) /* Were we able to get a `period1` string? */
|
535 |
{
|
536 |
+
list($num, $span) = array_map("trim", preg_split("/ /", $_period1, 2));
|
537 |
/**/
|
538 |
+
if(strtoupper($span) === "SEMIMONTH")
|
539 |
+
if(is_numeric($num) && $num >= 1)
|
540 |
+
eval('$num = "2"; $span = "W";');
|
541 |
/**/
|
542 |
+
if(strlen($span) !== 1) /* To Standard format. */
|
543 |
+
$span = c_ws_plugin__s2member_paypal_utilities::paypal_std_term($span);
|
544 |
/**/
|
545 |
+
$span = (preg_match("/^[DWMY]$/i", $span)) ? $span : "";
|
546 |
+
$num = ($span && is_numeric($num) && $num >= 0) ? $num : "";
|
547 |
/**/
|
548 |
+
$period1 = ($num && $span) ? $num." ".strtoupper($span) : $default;
|
549 |
/**/
|
550 |
+
return apply_filters("ws_plugin__s2member_paypal_pro_period1", $period1, get_defined_vars());
|
551 |
}
|
552 |
else /* Default. */
|
553 |
+
return apply_filters("ws_plugin__s2member_paypal_pro_period1", $default, get_defined_vars());
|
554 |
}
|
555 |
/**
|
556 |
* Get `period3` from either an array with `PROFILEREFERENCE|rp_invoice_id|period3`, or use an existing string.
|
567 |
* @param str $default Optional. Value if unavailable. Defaults to `1 D`.
|
568 |
* @return str A `period3` string if possible, or defaults to `1 D`.
|
569 |
*/
|
570 |
+
public static function paypal_pro_period3($array_or_string = FALSE, $default = "1 D")
|
571 |
{
|
572 |
+
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
|
573 |
+
do_action("ws_plugin__s2member_before_paypal_pro_period3", get_defined_vars());
|
574 |
+
unset($__refs, $__v); /* Unset defined __refs, __v. */
|
575 |
+
/**/
|
576 |
+
if(isset($array_or_string["PROFILENAME"]) /* Payflow® API alternative. */)
|
577 |
+
$array_or_string["PROFILEREFERENCE"] = $array_or_string["PROFILENAME"];
|
578 |
/**/
|
579 |
+
if(is_array($array = $array_or_string) && (!empty($array["PROFILEREFERENCE"]) || !empty($array["rp_invoice_id"])))
|
580 |
{
|
581 |
+
list($_reference, $_domain, $_item_number) = array_map("trim", preg_split("/~/", ((!empty($array["PROFILEREFERENCE"])) ? $array["PROFILEREFERENCE"] : $array["rp_invoice_id"]), 3));
|
582 |
+
list($_start_time, $_period1, $_period3) = array_map("trim", preg_split("/\:/", $_reference, 3));
|
583 |
}
|
584 |
+
else if(is_array($array = $array_or_string) && !empty($array["period3"]))
|
585 |
+
$_period3 = trim($array["period3"]);
|
586 |
/**/
|
587 |
+
else if(is_string($string = $array_or_string) && !empty($string))
|
588 |
+
$_period3 = trim($string);
|
589 |
/**/
|
590 |
+
if(!empty($_period3)) /* Were we able to get a `period3` string? */
|
591 |
{
|
592 |
+
list($num, $span) = array_map("trim", preg_split("/ /", $_period3, 2));
|
593 |
/**/
|
594 |
+
if(strtoupper($span) === "SEMIMONTH")
|
595 |
+
if(is_numeric($num) && $num >= 1)
|
596 |
+
eval('$num = "2"; $span = "W";');
|
597 |
/**/
|
598 |
+
if(strlen($span) !== 1) /* To Standard format. */
|
599 |
+
$span = c_ws_plugin__s2member_paypal_utilities::paypal_std_term($span);
|
600 |
/**/
|
601 |
+
$span = (preg_match("/^[DWMY]$/i", $span)) ? $span : "";
|
602 |
+
$num = ($span && is_numeric($num) && $num >= 0) ? $num : "";
|
603 |
/**/
|
604 |
+
$period3 = ($num && $span) ? $num." ".strtoupper($span) : $default;
|
605 |
/**/
|
606 |
+
return apply_filters("ws_plugin__s2member_paypal_pro_period3", $period3, get_defined_vars());
|
607 |
}
|
608 |
else /* Default. */
|
609 |
+
return apply_filters("ws_plugin__s2member_paypal_pro_period3", $default, get_defined_vars());
|
610 |
}
|
611 |
}
|
612 |
}
|
includes/classes/utils-urls.inc.php
CHANGED
@@ -14,10 +14,10 @@
|
|
14 |
* @package s2Member\Utilities
|
15 |
* @since 3.5
|
16 |
*/
|
17 |
-
if
|
18 |
-
exit
|
19 |
/**/
|
20 |
-
if
|
21 |
{
|
22 |
/**
|
23 |
* URL utilities.
|
@@ -35,9 +35,9 @@ if (!class_exists ("c_ws_plugin__s2member_utils_urls"))
|
|
35 |
*
|
36 |
* @return str Full URL to `/wp-signup.php`.
|
37 |
*/
|
38 |
-
public static function wp_signup_url
|
39 |
{
|
40 |
-
return apply_filters
|
41 |
}
|
42 |
/**
|
43 |
* Builds a WordPress® registration URL to `/wp-login.php?action=register`.
|
@@ -47,9 +47,9 @@ if (!class_exists ("c_ws_plugin__s2member_utils_urls"))
|
|
47 |
*
|
48 |
* @return str Full URL to `/wp-login.php?action=register`.
|
49 |
*/
|
50 |
-
public static function wp_register_url
|
51 |
{
|
52 |
-
return apply_filters
|
53 |
}
|
54 |
/**
|
55 |
* Builds a BuddyPress registration URL to `/register`.
|
@@ -59,10 +59,10 @@ if (!class_exists ("c_ws_plugin__s2member_utils_urls"))
|
|
59 |
*
|
60 |
* @return str|bool Full URL to `/register`, if BuddyPress is installed; else false.
|
61 |
*/
|
62 |
-
public static function bp_register_url
|
63 |
{
|
64 |
-
if
|
65 |
-
return site_url
|
66 |
/**/
|
67 |
return /* Default return false. */ false;
|
68 |
}
|
@@ -79,12 +79,12 @@ if (!class_exists ("c_ws_plugin__s2member_utils_urls"))
|
|
79 |
*
|
80 |
* @see http://en.wikipedia.org/wiki/Web_browser_engine
|
81 |
*/
|
82 |
-
public static function redirect_browsers_using_302_status
|
83 |
{
|
84 |
$engines = "msie|trident|gecko|webkit|presto|konqueror|playstation";
|
85 |
/**/
|
86 |
-
if
|
87 |
-
if
|
88 |
return /* Use 302 status. */ ($status = 302);
|
89 |
/**/
|
90 |
return /* Else use existing status. */ $status;
|
@@ -100,9 +100,9 @@ if (!class_exists ("c_ws_plugin__s2member_utils_urls"))
|
|
100 |
* @param str $url_uri_query A full URL, a partial URI, or just the query string.
|
101 |
* @return str A full URL, a partial URI, or just the query string; after having been encoded by this routine.
|
102 |
*/
|
103 |
-
public static function e_amps
|
104 |
{
|
105 |
-
return str_replace
|
106 |
}
|
107 |
/**
|
108 |
* Normalizes amperands to `&` when working with URLs, URIs, and/or query strings.
|
@@ -113,11 +113,11 @@ if (!class_exists ("c_ws_plugin__s2member_utils_urls"))
|
|
113 |
* @param str $url_uri_query A full URL, a partial URI, or just the query string.
|
114 |
* @return str A full URL, a partial URI, or just the query string; after having been normalized by this routine.
|
115 |
*/
|
116 |
-
public static function n_amps
|
117 |
{
|
118 |
-
$amps = implode
|
119 |
/**/
|
120 |
-
return /* Normalizes amperands to `&`. */ preg_replace
|
121 |
}
|
122 |
/**
|
123 |
* Parses out a full valid URI, from either a full URL, or a partial URI.
|
@@ -130,16 +130,16 @@ if (!class_exists ("c_ws_plugin__s2member_utils_urls"))
|
|
130 |
* @param str $url_uri Either a full URL, or a partial URI.
|
131 |
* @return str A valid URI, starting with `/` on success, else an empty string.
|
132 |
*/
|
133 |
-
public static function parse_uri
|
134 |
{
|
135 |
-
if
|
136 |
{
|
137 |
-
$parse["path"] = (!empty
|
138 |
/**/
|
139 |
-
return (!empty
|
140 |
}
|
141 |
else /* Force a string return value here. */
|
142 |
-
|
143 |
}
|
144 |
/**
|
145 |
* Parses a URL/URI with same args as PHP's ``parse_url()`` function.
|
@@ -155,21 +155,21 @@ if (!class_exists ("c_ws_plugin__s2member_utils_urls"))
|
|
155 |
* @return str|array|bool The return value from PHP's ``parse_url()`` function.
|
156 |
* However, if ``$component`` is passed, s2Member forces a string return.
|
157 |
*/
|
158 |
-
public static function parse_url
|
159 |
{
|
160 |
$component = ($component === false || $component === -1) ? -1 : $component;
|
161 |
/**/
|
162 |
-
if
|
163 |
{
|
164 |
-
list
|
165 |
-
$query = /* See: <https://bugs.php.net/bug.php?id=38143>. */ str_replace
|
166 |
-
$url_uri = /* Put it all back together again, after the above modifications. */ $_
|
167 |
-
unset /* A little housekeeping here. Unset these vars. */
|
168 |
}
|
169 |
-
$parse = @parse_url /* Let PHP work its magic via ``parse_url()``. */
|
170 |
/**/
|
171 |
-
if
|
172 |
-
$parse["path"] = /* Clean up the path now. */ preg_replace
|
173 |
/**/
|
174 |
return ($component !== -1) ? /* Force a string return value? */ (string)$parse : $parse;
|
175 |
}
|
@@ -188,42 +188,46 @@ if (!class_exists ("c_ws_plugin__s2member_utils_urls"))
|
|
188 |
* `code` *(http response code)*, `message` *(http response message)*, `headers` *(an array of lowercase headers)*, `body` *(the response body string)*, `response` *(full response array)*.
|
189 |
* @return str|array|bool Requested response str|array from remote location *(see ``$return_array`` parameter )*; else (bool)`false` on failure.
|
190 |
*/
|
191 |
-
public static function remote
|
192 |
{
|
193 |
-
if
|
194 |
{
|
195 |
-
$args = /* Force array, and disable SSL verification. */ (!is_array
|
196 |
-
$args["sslverify"] = (!isset
|
197 |
/**/
|
198 |
-
if
|
199 |
-
$args = array_merge
|
200 |
/**/
|
201 |
-
if
|
202 |
/* WordPress® v3.3 and prior, does NOT support `DELETE` via cURL unfortunately. */
|
203 |
-
add_filter
|
204 |
/**/
|
205 |
-
|
|
|
|
|
206 |
/**/
|
207 |
-
|
208 |
/**/
|
209 |
-
|
|
|
|
|
210 |
{
|
211 |
-
$a = array
|
212 |
-
$a = array_merge
|
213 |
-
$a = array_merge
|
214 |
-
$a = array_merge
|
215 |
-
$a = array_merge
|
216 |
/**/
|
217 |
return /* Return array w/ ``$response`` too. */ $a;
|
218 |
}
|
219 |
-
else if
|
220 |
-
return /* Return ``$response`` body only. */ wp_remote_retrieve_body
|
221 |
/**/
|
222 |
else /* Else this remote request has failed completely. Return false. */
|
223 |
-
|
224 |
}
|
225 |
else /* Else, return false. */
|
226 |
-
|
227 |
}
|
228 |
/**
|
229 |
* Shortens a long URL, based on s2Member configuration.
|
@@ -236,34 +240,34 @@ if (!class_exists ("c_ws_plugin__s2member_utils_urls"))
|
|
236 |
* @param bool $try_backups Defaults to true. If a failure occurs with the first API, we'll try others until we have success.
|
237 |
* @return str|bool The shortened URL on success, else false on failure.
|
238 |
*/
|
239 |
-
public static function shorten
|
240 |
{
|
241 |
-
$url = /* Force strings, else false. */ ($url && is_string
|
242 |
-
$api_sp = ($api_sp && is_string
|
243 |
/**/
|
244 |
$default_url_shortener = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["default_url_shortener"];
|
245 |
$default_custom_str_url_shortener = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["default_custom_str_url_shortener"];
|
246 |
/**/
|
247 |
-
$apis = /* The shortening APIs currently pre-integrated in this release of s2Member. */ array
|
248 |
/**/
|
249 |
-
if
|
250 |
{
|
251 |
-
if
|
252 |
return /* Using whatever other shortener API you prefer, over the ones available by default with s2Member. */ ($shorter_url = $custom_url);
|
253 |
/**/
|
254 |
-
else if
|
255 |
return /* Using whatever other shortener API that a site owner prefers, over the ones available by default with s2Member. */ ($shorter_url = $custom_url);
|
256 |
/**/
|
257 |
-
else if
|
258 |
return /* The default tinyURL API: <http://tinyurl.com/api-create.php?url=http://www.example.com/>. */ ($shorter_url = $tiny_url);
|
259 |
/**/
|
260 |
-
else if
|
261 |
return /* Google® API: <http://code.google.com/apis/urlshortener/v1/getting_started.html>. */ ($shorter_url = $goo_gl_url);
|
262 |
/**/
|
263 |
-
else if /* Try backups? This way we can still shorten the URL with a backup. */
|
264 |
/**/
|
265 |
-
foreach /* Try other backup APIs now. */
|
266 |
-
if
|
267 |
return /* Success, we can return now. */ ($shorter_url = $backup);
|
268 |
}
|
269 |
return /* Default return value. */ false;
|
@@ -278,13 +282,13 @@ if (!class_exists ("c_ws_plugin__s2member_utils_urls"))
|
|
278 |
* @param str $sig_var Optional. The name of the s2Member-generated signature variable. Defaults to `_s2member_sig`.
|
279 |
* @return str A full URL, a partial URI, or just the query string; without any s2Member-generated signatures.
|
280 |
*/
|
281 |
-
public static function remove_s2member_sigs
|
282 |
{
|
283 |
-
$url_uri_query = c_ws_plugin__s2member_utils_strings::trim
|
284 |
-
$sig_var = ($sig_var && is_string
|
285 |
-
$sigs = /* Remove all signatures. */ array_unique
|
286 |
/**/
|
287 |
-
return trim
|
288 |
}
|
289 |
/**
|
290 |
* Adds an s2Member-generated signature onto a full URL, a partial URI, or just a query string.
|
@@ -296,26 +300,26 @@ if (!class_exists ("c_ws_plugin__s2member_utils_urls"))
|
|
296 |
* @param str $sig_var Optional. The name of the s2Member-generated signature variable. Defaults to `_s2member_sig`.
|
297 |
* @return str A full URL, a partial URI, or just a query string; with an s2Member-generated signature.
|
298 |
*/
|
299 |
-
public static function add_s2member_sig
|
300 |
{
|
301 |
-
$url_uri_query = $query = c_ws_plugin__s2member_utils_strings::trim
|
302 |
-
$sig_var = ($sig_var && is_string
|
303 |
/**/
|
304 |
-
$url_uri_query = $query = c_ws_plugin__s2member_utils_urls::remove_s2member_sigs
|
305 |
-
if
|
306 |
-
$query = trim
|
307 |
/**/
|
308 |
-
$key = /* Obtain the proper encryption/decryption key. */ c_ws_plugin__s2member_utils_encryption::key
|
309 |
/**/
|
310 |
-
if
|
311 |
{
|
312 |
-
wp_parse_str /* Parse the query string into an array of ``$vars``. Then sort & serialize them into a string. */
|
313 |
-
$vars = c_ws_plugin__s2member_utils_arrays::remove_0b_strings
|
314 |
-
$vars = serialize
|
315 |
/**/
|
316 |
-
$sig = /* The s2Member-generated signature. */ ($time = time
|
317 |
/**/
|
318 |
-
$url_uri_query = add_query_arg
|
319 |
}
|
320 |
return /* Possibly with a ``$sig_var`` variable. */ $url_uri_query;
|
321 |
}
|
@@ -331,36 +335,36 @@ if (!class_exists ("c_ws_plugin__s2member_utils_urls"))
|
|
331 |
* @param str $sig_var Optional. The name of the s2Member-generated signature variable. Defaults to `_s2member_sig`.
|
332 |
* @return bool True if the s2Member-generated signature is OK, else false.
|
333 |
*/
|
334 |
-
public static function s2member_sig_ok
|
335 |
{
|
336 |
-
$url_uri_query = $query = c_ws_plugin__s2member_utils_strings::trim
|
337 |
-
if
|
338 |
-
$query = trim
|
339 |
/**/
|
340 |
$check_time = /* Are we checking time? Force a boolean value here. */ ($check_time) ? true : false;
|
341 |
-
$exp_secs = (is_numeric
|
342 |
-
$sig_var = ($sig_var && is_string
|
343 |
/**/
|
344 |
-
$key = /* Obtain the proper encryption/decryption key. */ c_ws_plugin__s2member_utils_encryption::key
|
345 |
/**/
|
346 |
-
if
|
347 |
{
|
348 |
-
$query = /* Remove existing s2Member-generated signatures. */ c_ws_plugin__s2member_utils_urls::remove_s2member_sigs
|
349 |
/**/
|
350 |
-
wp_parse_str /* Parse the query string into an array of ``$vars``. Then sort & serialize them into a string. */
|
351 |
-
$vars = c_ws_plugin__s2member_utils_arrays::remove_0b_strings
|
352 |
-
$vars = serialize
|
353 |
/**/
|
354 |
-
($time = $sigs[1][($i = count
|
355 |
/**/
|
356 |
-
if /* Checking time? This must NOT be older than ``$exp_secs`` seconds ago. */
|
357 |
-
return ($sig === $valid_sig && $time >= strtotime
|
358 |
/**/
|
359 |
else /* Ignoring time? Just need to compare signatures in this case. */
|
360 |
-
|
361 |
}
|
362 |
else /* Return false. No ``$query``, or no ``$sigs``. */
|
363 |
-
|
364 |
}
|
365 |
}
|
366 |
}
|
14 |
* @package s2Member\Utilities
|
15 |
* @since 3.5
|
16 |
*/
|
17 |
+
if(realpath(__FILE__) === realpath($_SERVER["SCRIPT_FILENAME"]))
|
18 |
+
exit("Do not access this file directly.");
|
19 |
/**/
|
20 |
+
if(!class_exists("c_ws_plugin__s2member_utils_urls"))
|
21 |
{
|
22 |
/**
|
23 |
* URL utilities.
|
35 |
*
|
36 |
* @return str Full URL to `/wp-signup.php`.
|
37 |
*/
|
38 |
+
public static function wp_signup_url()
|
39 |
{
|
40 |
+
return apply_filters("wp_signup_location", site_url("/wp-signup.php"));
|
41 |
}
|
42 |
/**
|
43 |
* Builds a WordPress® registration URL to `/wp-login.php?action=register`.
|
47 |
*
|
48 |
* @return str Full URL to `/wp-login.php?action=register`.
|
49 |
*/
|
50 |
+
public static function wp_register_url()
|
51 |
{
|
52 |
+
return apply_filters("wp_register_location", add_query_arg("action", urlencode("register"), wp_login_url()), get_defined_vars());
|
53 |
}
|
54 |
/**
|
55 |
* Builds a BuddyPress registration URL to `/register`.
|
59 |
*
|
60 |
* @return str|bool Full URL to `/register`, if BuddyPress is installed; else false.
|
61 |
*/
|
62 |
+
public static function bp_register_url()
|
63 |
{
|
64 |
+
if( /* If BuddyPress is installed. */c_ws_plugin__s2member_utils_conds::bp_is_installed())
|
65 |
+
return site_url(((function_exists("bp_get_signup_slug")) ? bp_get_signup_slug()."/" : BP_REGISTER_SLUG."/"));
|
66 |
/**/
|
67 |
return /* Default return false. */ false;
|
68 |
}
|
79 |
*
|
80 |
* @see http://en.wikipedia.org/wiki/Web_browser_engine
|
81 |
*/
|
82 |
+
public static function redirect_browsers_using_302_status($status = FALSE)
|
83 |
{
|
84 |
$engines = "msie|trident|gecko|webkit|presto|konqueror|playstation";
|
85 |
/**/
|
86 |
+
if( /* Default `301` status? */(int)$status === 301 && /* Have User-Agent? */ !empty($_SERVER["HTTP_USER_AGENT"]))
|
87 |
+
if(($is_browser = preg_match("/(".$engines.")[\/ ]([0-9\.]+)/i", $_SERVER["HTTP_USER_AGENT"])))
|
88 |
return /* Use 302 status. */ ($status = 302);
|
89 |
/**/
|
90 |
return /* Else use existing status. */ $status;
|
100 |
* @param str $url_uri_query A full URL, a partial URI, or just the query string.
|
101 |
* @return str A full URL, a partial URI, or just the query string; after having been encoded by this routine.
|
102 |
*/
|
103 |
+
public static function e_amps($url_uri_query = FALSE)
|
104 |
{
|
105 |
+
return str_replace("&", "&", c_ws_plugin__s2member_utils_urls::n_amps((string)$url_uri_query));
|
106 |
}
|
107 |
/**
|
108 |
* Normalizes amperands to `&` when working with URLs, URIs, and/or query strings.
|
113 |
* @param str $url_uri_query A full URL, a partial URI, or just the query string.
|
114 |
* @return str A full URL, a partial URI, or just the query string; after having been normalized by this routine.
|
115 |
*/
|
116 |
+
public static function n_amps($url_uri_query = FALSE)
|
117 |
{
|
118 |
+
$amps = implode("|", array_keys /* Keys are regex patterns. */(c_ws_plugin__s2member_utils_strings::$ampersand_entities));
|
119 |
/**/
|
120 |
+
return /* Normalizes amperands to `&`. */ preg_replace("/(?:".$amps.")/", "&", (string)$url_uri_query);
|
121 |
}
|
122 |
/**
|
123 |
* Parses out a full valid URI, from either a full URL, or a partial URI.
|
130 |
* @param str $url_uri Either a full URL, or a partial URI.
|
131 |
* @return str A valid URI, starting with `/` on success, else an empty string.
|
132 |
*/
|
133 |
+
public static function parse_uri($url_uri = FALSE)
|
134 |
{
|
135 |
+
if(is_string($url_uri) && is_array($parse = c_ws_plugin__s2member_utils_urls::parse_url($url_uri)))
|
136 |
{
|
137 |
+
$parse["path"] = (!empty($parse["path"])) ? ((strpos($parse["path"], "/") === 0) ? $parse["path"] : "/".$parse["path"]) : "/";
|
138 |
/**/
|
139 |
+
return (!empty($parse["query"])) ? $parse["path"]."?".$parse["query"] : $parse["path"];
|
140 |
}
|
141 |
else /* Force a string return value here. */
|
142 |
+
return /* Empty string. */ "";
|
143 |
}
|
144 |
/**
|
145 |
* Parses a URL/URI with same args as PHP's ``parse_url()`` function.
|
155 |
* @return str|array|bool The return value from PHP's ``parse_url()`` function.
|
156 |
* However, if ``$component`` is passed, s2Member forces a string return.
|
157 |
*/
|
158 |
+
public static function parse_url($url_uri = FALSE, $component = FALSE, $clean_path = TRUE)
|
159 |
{
|
160 |
$component = ($component === false || $component === -1) ? -1 : $component;
|
161 |
/**/
|
162 |
+
if(is_string($url_uri) && /* And, there is a query string? */ strpos($url_uri, "?") !== false)
|
163 |
{
|
164 |
+
list($_, $query) = preg_split /* Split @ query string marker. */("/\?/", $url_uri, 2);
|
165 |
+
$query = /* See: <https://bugs.php.net/bug.php?id=38143>. */ str_replace("://", urlencode("://"), $query);
|
166 |
+
$url_uri = /* Put it all back together again, after the above modifications. */ $_."?".$query;
|
167 |
+
unset /* A little housekeeping here. Unset these vars. */($_, $query);
|
168 |
}
|
169 |
+
$parse = @parse_url /* Let PHP work its magic via ``parse_url()``. */($url_uri, $component);
|
170 |
/**/
|
171 |
+
if($clean_path && isset($parse["path"]) && is_string($parse["path"]) && !empty($parse["path"]))
|
172 |
+
$parse["path"] = /* Clean up the path now. */ preg_replace("/\/+/", "/", $parse["path"]);
|
173 |
/**/
|
174 |
return ($component !== -1) ? /* Force a string return value? */ (string)$parse : $parse;
|
175 |
}
|
188 |
* `code` *(http response code)*, `message` *(http response message)*, `headers` *(an array of lowercase headers)*, `body` *(the response body string)*, `response` *(full response array)*.
|
189 |
* @return str|array|bool Requested response str|array from remote location *(see ``$return_array`` parameter )*; else (bool)`false` on failure.
|
190 |
*/
|
191 |
+
public static function remote($url = FALSE, $post_vars = FALSE, $args = FALSE, $return_array = FALSE)
|
192 |
{
|
193 |
+
if($url && /* We MUST have a valid full URL (string) before we do anything in this routine. */ is_string($url))
|
194 |
{
|
195 |
+
$args = /* Force array, and disable SSL verification. */ (!is_array($args)) ? array(): $args;
|
196 |
+
$args["sslverify"] = (!isset($args["sslverify"])) ? /* Off. */ false : $args["sslverify"];
|
197 |
/**/
|
198 |
+
if((is_array($post_vars) || is_string($post_vars)) && !empty($post_vars))
|
199 |
+
$args = array_merge($args, array("method" => "POST", "body" => $post_vars));
|
200 |
/**/
|
201 |
+
if(!empty($args["method"]) && strcasecmp((string)$args["method"], "DELETE") === 0)
|
202 |
/* WordPress® v3.3 and prior, does NOT support `DELETE` via cURL unfortunately. */
|
203 |
+
add_filter("use_curl_transport", "__return_false", /* ID via priority. */ 111209554);
|
204 |
/**/
|
205 |
+
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
|
206 |
+
do_action("ws_plugin__s2member_before_wp_remote_request", get_defined_vars());
|
207 |
+
unset($__refs, $__v); /* Unset defined __refs, __v. */
|
208 |
/**/
|
209 |
+
$response = /* Process remote request via ``wp_remote_request()``. */ wp_remote_request($url, $args);
|
210 |
/**/
|
211 |
+
remove_filter /* Remove this Filter now. */("use_curl_transport", "__return_false", 111209554);
|
212 |
+
/**/
|
213 |
+
if($return_array && !is_wp_error($response) && is_array($response))
|
214 |
{
|
215 |
+
$a = array("code" => (int)wp_remote_retrieve_response_code($response));
|
216 |
+
$a = array_merge($a, array("message" => wp_remote_retrieve_response_message($response)));
|
217 |
+
$a = array_merge($a, array("headers" => wp_remote_retrieve_headers($response)));
|
218 |
+
$a = array_merge($a, array("body" => wp_remote_retrieve_body($response)));
|
219 |
+
$a = array_merge($a, array("response" => $response));
|
220 |
/**/
|
221 |
return /* Return array w/ ``$response`` too. */ $a;
|
222 |
}
|
223 |
+
else if(!is_wp_error($response) && is_array($response) /* Return body only. */)
|
224 |
+
return /* Return ``$response`` body only. */ wp_remote_retrieve_body($response);
|
225 |
/**/
|
226 |
else /* Else this remote request has failed completely. Return false. */
|
227 |
+
return false; /* Remote request failed, return false. */
|
228 |
}
|
229 |
else /* Else, return false. */
|
230 |
+
return false;
|
231 |
}
|
232 |
/**
|
233 |
* Shortens a long URL, based on s2Member configuration.
|
240 |
* @param bool $try_backups Defaults to true. If a failure occurs with the first API, we'll try others until we have success.
|
241 |
* @return str|bool The shortened URL on success, else false on failure.
|
242 |
*/
|
243 |
+
public static function shorten($url = FALSE, $api_sp = FALSE, $try_backups = TRUE)
|
244 |
{
|
245 |
+
$url = /* Force strings, else false. */ ($url && is_string($url)) ? $url : false;
|
246 |
+
$api_sp = ($api_sp && is_string($api_sp)) ? strtolower($api_sp) : false;
|
247 |
/**/
|
248 |
$default_url_shortener = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["default_url_shortener"];
|
249 |
$default_custom_str_url_shortener = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["default_custom_str_url_shortener"];
|
250 |
/**/
|
251 |
+
$apis = /* The shortening APIs currently pre-integrated in this release of s2Member. */ array("tiny_url", "goo_gl");
|
252 |
/**/
|
253 |
+
if($url && ($api = /* If specific, use it. Otherwise, use the default shortening API. */ ($api_sp) ? $api_sp : $default_url_shortener))
|
254 |
{
|
255 |
+
if(!$api_sp && ($custom_url = trim(apply_filters("ws_plugin__s2member_url_shorten", false, get_defined_vars()))) && stripos($custom_url, "http") === 0)
|
256 |
return /* Using whatever other shortener API you prefer, over the ones available by default with s2Member. */ ($shorter_url = $custom_url);
|
257 |
/**/
|
258 |
+
else if(!$api_sp && stripos($default_custom_str_url_shortener, "http") === 0 && ($custom_url = trim(c_ws_plugin__s2member_utils_urls::remote(str_ireplace(array("%%s2_long_url%%", "%%s2_long_url_md5%%"), array(rawurlencode($url), urlencode(md5($url))), $default_custom_str_url_shortener)))) && stripos($custom_url, "http") === 0)
|
259 |
return /* Using whatever other shortener API that a site owner prefers, over the ones available by default with s2Member. */ ($shorter_url = $custom_url);
|
260 |
/**/
|
261 |
+
else if($api === "tiny_url" && ($tiny_url = trim(c_ws_plugin__s2member_utils_urls::remote("http://tinyurl.com/api-create.php?url=".rawurlencode($url)))) && stripos($tiny_url, "http") === 0)
|
262 |
return /* The default tinyURL API: <http://tinyurl.com/api-create.php?url=http://www.example.com/>. */ ($shorter_url = $tiny_url);
|
263 |
/**/
|
264 |
+
else if($api === "goo_gl" && ($goo_gl = json_decode(trim(c_ws_plugin__s2member_utils_urls::remote("https://www.googleapis.com/urlshortener/v1/url".((($goo_gl_key = apply_filters("ws_plugin__s2member_url_shorten_api_goo_gl_key", false))) ? "?key=".urlencode($goo_gl_key) : ""), json_encode(array("longUrl" => $url)), array("headers" => array("Content-Type" => "application/json")))), true)) && !empty($goo_gl["id"]) && is_string($goo_gl_url = $goo_gl["id"]) && stripos($goo_gl_url, "http") === 0)
|
265 |
return /* Google® API: <http://code.google.com/apis/urlshortener/v1/getting_started.html>. */ ($shorter_url = $goo_gl_url);
|
266 |
/**/
|
267 |
+
else if /* Try backups? This way we can still shorten the URL with a backup. */($try_backups && count($apis) > 1)
|
268 |
/**/
|
269 |
+
foreach /* Try other backup APIs now. */(array_diff($apis, array($api)) as $backup)
|
270 |
+
if(($backup = c_ws_plugin__s2member_utils_urls::shorten($url, $backup, false)))
|
271 |
return /* Success, we can return now. */ ($shorter_url = $backup);
|
272 |
}
|
273 |
return /* Default return value. */ false;
|
282 |
* @param str $sig_var Optional. The name of the s2Member-generated signature variable. Defaults to `_s2member_sig`.
|
283 |
* @return str A full URL, a partial URI, or just the query string; without any s2Member-generated signatures.
|
284 |
*/
|
285 |
+
public static function remove_s2member_sigs($url_uri_query = FALSE, $sig_var = FALSE)
|
286 |
{
|
287 |
+
$url_uri_query = c_ws_plugin__s2member_utils_strings::trim((string)$url_uri_query, false, "?&=");
|
288 |
+
$sig_var = ($sig_var && is_string($sig_var)) ? $sig_var : /* Use default. */ "_s2member_sig";
|
289 |
+
$sigs = /* Remove all signatures. */ array_unique(array($sig_var, "_s2member_sig"));
|
290 |
/**/
|
291 |
+
return trim(remove_query_arg($sigs, $url_uri_query), "?&=");
|
292 |
}
|
293 |
/**
|
294 |
* Adds an s2Member-generated signature onto a full URL, a partial URI, or just a query string.
|
300 |
* @param str $sig_var Optional. The name of the s2Member-generated signature variable. Defaults to `_s2member_sig`.
|
301 |
* @return str A full URL, a partial URI, or just a query string; with an s2Member-generated signature.
|
302 |
*/
|
303 |
+
public static function add_s2member_sig($url_uri_query = FALSE, $sig_var = FALSE)
|
304 |
{
|
305 |
+
$url_uri_query = $query = c_ws_plugin__s2member_utils_strings::trim((string)$url_uri_query, false, "?&=");
|
306 |
+
$sig_var = ($sig_var && is_string($sig_var)) ? $sig_var : /* Use default. */ "_s2member_sig";
|
307 |
/**/
|
308 |
+
$url_uri_query = $query = c_ws_plugin__s2member_utils_urls::remove_s2member_sigs($url_uri_query, $sig_var);
|
309 |
+
if( /* Is this a full URL, or a partial URI? */preg_match("/^(?:[a-z]+\:\/\/|\/)/i", ($url_uri_query)))
|
310 |
+
$query = trim(c_ws_plugin__s2member_utils_urls::parse_url($url_uri_query, PHP_URL_QUERY), "?&=");
|
311 |
/**/
|
312 |
+
$key = /* Obtain the proper encryption/decryption key. */ c_ws_plugin__s2member_utils_encryption::key();
|
313 |
/**/
|
314 |
+
if($url_uri_query && is_string /* We DO allow empty query strings. So we can sign a URL without one. */($query))
|
315 |
{
|
316 |
+
wp_parse_str /* Parse the query string into an array of ``$vars``. Then sort & serialize them into a string. */($query, $vars);
|
317 |
+
$vars = c_ws_plugin__s2member_utils_arrays::remove_0b_strings(c_ws_plugin__s2member_utils_strings::trim_deep($vars));
|
318 |
+
$vars = serialize(c_ws_plugin__s2member_utils_arrays::ksort_deep($vars));
|
319 |
/**/
|
320 |
+
$sig = /* The s2Member-generated signature. */ ($time = time())."-".md5($key.$time.$vars);
|
321 |
/**/
|
322 |
+
$url_uri_query = add_query_arg($sig_var, urlencode($sig), $url_uri_query);
|
323 |
}
|
324 |
return /* Possibly with a ``$sig_var`` variable. */ $url_uri_query;
|
325 |
}
|
335 |
* @param str $sig_var Optional. The name of the s2Member-generated signature variable. Defaults to `_s2member_sig`.
|
336 |
* @return bool True if the s2Member-generated signature is OK, else false.
|
337 |
*/
|
338 |
+
public static function s2member_sig_ok($url_uri_query = FALSE, $check_time = FALSE, $exp_secs = FALSE, $sig_var = FALSE)
|
339 |
{
|
340 |
+
$url_uri_query = $query = c_ws_plugin__s2member_utils_strings::trim((string)$url_uri_query, false, "?&=");
|
341 |
+
if( /* Is this a full URL, or a partial URI? */preg_match("/^(?:[a-z]+\:\/\/|\/)/i", ($url_uri_query)))
|
342 |
+
$query = trim(c_ws_plugin__s2member_utils_urls::parse_url($url_uri_query, PHP_URL_QUERY), "?&=");
|
343 |
/**/
|
344 |
$check_time = /* Are we checking time? Force a boolean value here. */ ($check_time) ? true : false;
|
345 |
+
$exp_secs = (is_numeric($exp_secs)) ? (int)$exp_secs : /* Else 10 seconds by default here. */ 10;
|
346 |
+
$sig_var = ($sig_var && is_string($sig_var)) ? $sig_var : /* Use default. */ "_s2member_sig";
|
347 |
/**/
|
348 |
+
$key = /* Obtain the proper encryption/decryption key. */ c_ws_plugin__s2member_utils_encryption::key();
|
349 |
/**/
|
350 |
+
if(preg_match_all /* Does ``$query`` have an s2Member-generated signature? */("/".preg_quote($sig_var, "/")."\=([0-9]+)-([^&$]+)/", $query, $sigs))
|
351 |
{
|
352 |
+
$query = /* Remove existing s2Member-generated signatures. */ c_ws_plugin__s2member_utils_urls::remove_s2member_sigs($query, $sig_var);
|
353 |
/**/
|
354 |
+
wp_parse_str /* Parse the query string into an array of ``$vars``. Then sort & serialize them into a string. */($query, $vars);
|
355 |
+
$vars = c_ws_plugin__s2member_utils_arrays::remove_0b_strings(c_ws_plugin__s2member_utils_strings::trim_deep($vars));
|
356 |
+
$vars = serialize(c_ws_plugin__s2member_utils_arrays::ksort_deep($vars));
|
357 |
/**/
|
358 |
+
($time = $sigs[1][($i = count($sigs[1]) - 1)]).($sig = $sigs[2][$i]).($valid_sig = md5($key.$time.$vars));
|
359 |
/**/
|
360 |
+
if /* Checking time? This must NOT be older than ``$exp_secs`` seconds ago. */($check_time)
|
361 |
+
return ($sig === $valid_sig && $time >= strtotime("-".$exp_secs." seconds"));
|
362 |
/**/
|
363 |
else /* Ignoring time? Just need to compare signatures in this case. */
|
364 |
+
return /* Do they match up? */ ($sig === $valid_sig);
|
365 |
}
|
366 |
else /* Return false. No ``$query``, or no ``$sigs``. */
|
367 |
+
return /* False, it's NOT ok. */ false;
|
368 |
}
|
369 |
}
|
370 |
}
|
includes/functions/api-functions.inc.php
CHANGED
@@ -242,10 +242,10 @@ if (!function_exists ("user_is_not"))
|
|
242 |
*
|
243 |
* ———— Shortcode Conditional Equivalent ————
|
244 |
* ```
|
245 |
-
* [s2If
|
246 |
* You ARE a Free Subscriber at Level #0.
|
247 |
* [/s2If]
|
248 |
-
* [s2If
|
249 |
* You ARE a Member at Level #1.
|
250 |
* [/s2If]
|
251 |
* [s2If current_user_can(access_s2member_level2)]
|
242 |
*
|
243 |
* ———— Shortcode Conditional Equivalent ————
|
244 |
* ```
|
245 |
+
* [s2If current_user_is(subscriber)]
|
246 |
* You ARE a Free Subscriber at Level #0.
|
247 |
* [/s2If]
|
248 |
+
* [s2If current_user_is(s2member_level1)]
|
249 |
* You ARE a Member at Level #1.
|
250 |
* [/s2If]
|
251 |
* [s2If current_user_can(access_s2member_level2)]
|
includes/hooks.inc.php
CHANGED
@@ -14,163 +14,164 @@
|
|
14 |
* @package s2Member
|
15 |
* @since 3.0
|
16 |
*/
|
17 |
-
if
|
18 |
exit("Do not access this file directly.");
|
19 |
/*
|
20 |
Add the plugin Actions/Filters here.
|
21 |
*/
|
22 |
-
add_action
|
23 |
/**/
|
24 |
-
add_action
|
25 |
-
add_action
|
26 |
-
add_action
|
27 |
/**/
|
28 |
-
add_action
|
29 |
-
add_action
|
30 |
-
add_action
|
31 |
-
add_action
|
32 |
-
add_action
|
33 |
-
add_action
|
34 |
-
add_action
|
35 |
-
add_action
|
36 |
-
add_action
|
37 |
-
add_action
|
38 |
-
/**/
|
39 |
-
add_action
|
40 |
-
add_action
|
41 |
-
add_action
|
42 |
-
/**/
|
43 |
-
add_action
|
44 |
/**/
|
45 |
-
add_action
|
46 |
-
add_action
|
47 |
-
add_action
|
48 |
-
/**/
|
49 |
-
add_action
|
50 |
-
/**/
|
51 |
-
add_action
|
52 |
-
/**/
|
53 |
-
add_action
|
54 |
-
/**/
|
55 |
-
add_action
|
56 |
-
add_action
|
57 |
-
/* Stay ahead of BuddyPress®
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
add_action
|
65 |
-
|
66 |
-
|
67 |
-
|
|
|
|
|
|
|
|
|
|
|
68 |
/**/
|
69 |
-
|
70 |
-
add_action ("wpmu_delete_user", "c_ws_plugin__s2member_user_deletions::handle_ms_user_deletions");
|
71 |
-
add_action ("remove_user_from_blog", "c_ws_plugin__s2member_user_deletions::handle_ms_user_deletions", 10, 2);
|
72 |
/**/
|
73 |
-
add_filter
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
/**/
|
75 |
-
add_filter
|
76 |
-
|
77 |
-
|
78 |
-
add_filter ("pre_site_option_dashboard_blog", "c_ws_plugin__s2member_option_forces::mms_dashboard_blog");
|
79 |
-
add_filter ("pre_option_users_can_register", "c_ws_plugin__s2member_option_forces::check_register_access");
|
80 |
-
add_filter ("pre_site_option_registration", "c_ws_plugin__s2member_option_forces::check_mms_register_access");
|
81 |
-
add_filter ("bp_core_get_root_options", "c_ws_plugin__s2member_option_forces::check_bp_mms_register_access");
|
82 |
-
add_filter ("bp_core_get_site_options", "c_ws_plugin__s2member_option_forces::check_bp_mms_register_access");
|
83 |
/**/
|
84 |
-
add_filter
|
85 |
-
|
86 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
/**/
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
add_action ("signup_hidden_fields", "c_ws_plugin__s2member_registrations::ms_process_signup_hidden_fields");
|
92 |
-
add_filter ("registration_errors", "c_ws_plugin__s2member_registrations::ms_register_existing_user", 11, 3);
|
93 |
-
add_filter ("wpmu_signup_user_notification_email", "c_ws_plugin__s2member_email_configs::ms_nice_email_roles", 11);
|
94 |
-
add_filter ("_wpmu_activate_existing_error_", "c_ws_plugin__s2member_registrations::ms_activate_existing_user", 10, 2);
|
95 |
-
add_action ("wpmu_activate_user", "c_ws_plugin__s2member_registrations::configure_user_on_ms_user_activation", 10, 3);
|
96 |
-
add_action ("wpmu_activate_blog", "c_ws_plugin__s2member_registrations::configure_user_on_ms_blog_activation", 10, 5);
|
97 |
-
add_action ("signup_extra_fields", "c_ws_plugin__s2member_custom_reg_fields::ms_custom_registration_fields");
|
98 |
/**/
|
99 |
-
add_action
|
100 |
-
add_action
|
101 |
-
|
|
|
|
|
102 |
/**/
|
103 |
-
add_action
|
104 |
-
add_action
|
105 |
-
add_filter ("login_headerurl", "c_ws_plugin__s2member_login_customizations::login_header_url");
|
106 |
-
add_filter ("login_headertitle", "c_ws_plugin__s2member_login_customizations::login_header_title");
|
107 |
-
add_action ("login_footer", "c_ws_plugin__s2member_login_customizations::login_footer_design");
|
108 |
/**/
|
109 |
-
add_action
|
110 |
-
add_action
|
111 |
/**/
|
112 |
-
add_action
|
113 |
-
add_action
|
114 |
/**/
|
115 |
-
add_action
|
116 |
-
add_action
|
117 |
/**/
|
118 |
-
add_action
|
119 |
-
add_action ("wp_footer", "c_ws_plugin__s2member_tracking_codes::display_sp_tracking_codes");
|
120 |
/**/
|
121 |
-
add_action
|
|
|
122 |
/**/
|
123 |
-
add_action
|
124 |
-
add_action
|
|
|
|
|
125 |
/**/
|
126 |
-
add_action
|
127 |
-
add_action
|
128 |
-
add_action
|
129 |
-
add_action
|
|
|
|
|
|
|
|
|
130 |
/**/
|
131 |
-
add_action
|
132 |
-
add_action
|
133 |
-
add_action
|
134 |
-
add_action ("network_admin_menu", "c_ws_plugin__s2member_menu_pages::add_network_admin_options");
|
135 |
-
add_action ("admin_bar_menu", "c_ws_plugin__s2member_admin_lockouts::filter_admin_menu_bar", 100);
|
136 |
-
add_action ("admin_print_scripts", "c_ws_plugin__s2member_menu_pages::add_admin_scripts");
|
137 |
-
add_action ("admin_print_styles", "c_ws_plugin__s2member_menu_pages::add_admin_styles");
|
138 |
-
add_filter ("update_feedback", "c_ws_plugin__s2member_mms_patches::sync_mms_patches");
|
139 |
/**/
|
140 |
-
add_action
|
141 |
-
|
142 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
/**/
|
144 |
-
|
145 |
-
|
146 |
-
add_filter ("manage_users_custom_column", "c_ws_plugin__s2member_users_list::users_list_display_cols", 10, 3);
|
147 |
-
add_action ("edit_user_profile", "c_ws_plugin__s2member_users_list::users_list_edit_cols");
|
148 |
-
add_action ("show_user_profile", "c_ws_plugin__s2member_users_list::users_list_edit_cols");
|
149 |
-
add_action ("edit_user_profile_update", "c_ws_plugin__s2member_users_list::users_list_update_cols");
|
150 |
-
add_action ("personal_options_update", "c_ws_plugin__s2member_users_list::users_list_update_cols");
|
151 |
-
add_action ("set_user_role", "c_ws_plugin__s2member_registration_times::synchronize_paid_reg_times", 10, 2);
|
152 |
-
add_filter ("show_password_fields", "c_ws_plugin__s2member_user_securities::hide_password_fields", 10, 2);
|
153 |
/**/
|
154 |
-
|
155 |
-
add_action ("ws_plugin__s2member_auto_eot_system__schedule", "c_ws_plugin__s2member_auto_eots::auto_eot_system");
|
156 |
/**/
|
157 |
-
add_action
|
158 |
-
|
159 |
-
|
160 |
-
add_action
|
161 |
-
|
162 |
-
|
163 |
-
add_action
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
/**/
|
168 |
-
|
169 |
-
/**/
|
170 |
-
add_action ("bbp_activation", "c_ws_plugin__s2member_roles_caps::config_roles", 11);
|
171 |
/*
|
172 |
Register the activation | de-activation routines.
|
173 |
*/
|
174 |
-
register_activation_hook
|
175 |
-
register_deactivation_hook
|
176 |
?>
|
14 |
* @package s2Member
|
15 |
* @since 3.0
|
16 |
*/
|
17 |
+
if(realpath(__FILE__) === realpath($_SERVER["SCRIPT_FILENAME"]))
|
18 |
exit("Do not access this file directly.");
|
19 |
/*
|
20 |
Add the plugin Actions/Filters here.
|
21 |
*/
|
22 |
+
add_action("init", "c_ws_plugin__s2member_translations::load", 2);
|
23 |
/**/
|
24 |
+
add_action("init", "c_ws_plugin__s2member_ssl::check_force_ssl", 3);
|
25 |
+
add_action("init", "c_ws_plugin__s2member_user_securities::initialize", 3);
|
26 |
+
add_action("init", "c_ws_plugin__s2member_no_cache::no_cache", 3);
|
27 |
/**/
|
28 |
+
add_action("init", "c_ws_plugin__s2member_register::register", 4);
|
29 |
+
add_action("init", "c_ws_plugin__s2member_paypal_notify::paypal_notify", 4);
|
30 |
+
add_action("init", "c_ws_plugin__s2member_files::check_file_download_access", 4);
|
31 |
+
add_action("init", "c_ws_plugin__s2member_profile_mods::handle_profile_modifications", 4);
|
32 |
+
add_action("init", "c_ws_plugin__s2member_profile_mods_4bp::handle_profile_modifications_4bp", 4);
|
33 |
+
add_action("init", "c_ws_plugin__s2member_tracking_cookies::delete_sp_tracking_cookie", 4);
|
34 |
+
add_action("init", "c_ws_plugin__s2member_tracking_cookies::delete_tracking_cookie", 4);
|
35 |
+
add_action("init", "c_ws_plugin__s2member_cron_jobs::auto_eot_system_via_cron", 4);
|
36 |
+
add_action("init", "c_ws_plugin__s2member_mo_page::membership_options_page", 4);
|
37 |
+
add_action("init", "c_ws_plugin__s2member_s_badge_status::s_badge_status", 4);
|
38 |
+
/**/
|
39 |
+
add_action("init", "c_ws_plugin__s2member_admin_css_js::menu_pages_css", 5);
|
40 |
+
add_action("init", "c_ws_plugin__s2member_admin_css_js::menu_pages_js", 5);
|
41 |
+
add_action("init", "c_ws_plugin__s2member_css_js::css", 5);
|
42 |
+
/**/
|
43 |
+
add_action("init", "c_ws_plugin__s2member_constants::constants", 6);
|
44 |
/**/
|
45 |
+
add_action("init", "c_ws_plugin__s2member_css_js::js_w_globals", 7);
|
46 |
+
add_action("init", "c_ws_plugin__s2member_paypal_return::paypal_return", 7);
|
47 |
+
add_action("init", "c_ws_plugin__s2member_profile::profile", 7);
|
48 |
+
/**/
|
49 |
+
add_action("init", "c_ws_plugin__s2member_labels::config_label_translations", 10);
|
50 |
+
/**/
|
51 |
+
add_action("init", "c_ws_plugin__s2member_login_redirects_r::remove_login_redirect_filters", 11);
|
52 |
+
/**/
|
53 |
+
add_action("pre_get_posts", "c_ws_plugin__s2member_security::security_gate_query", 100);
|
54 |
+
/**/
|
55 |
+
add_action("wp", "c_ws_plugin__s2member_ssl::check_force_ssl", 1);
|
56 |
+
add_action("wp", "c_ws_plugin__s2member_security::security_gate", 1);
|
57 |
+
/* Stay ahead of BuddyPress® at `3` on `wp in `bp-core-hooks.php`. */
|
58 |
+
/* Set to `1` so other plugins may come between these. */
|
59 |
+
/**/
|
60 |
+
add_filter("wp_mail", "c_ws_plugin__s2member_email_configs::email_filter");
|
61 |
+
/**/
|
62 |
+
add_filter("widget_text", "do_shortcode"); /* Shortcodes in widgets. */
|
63 |
+
/**/
|
64 |
+
add_action("wp_print_styles", "c_ws_plugin__s2member_css_js_themes::add_css");
|
65 |
+
add_action("wp_print_scripts", "c_ws_plugin__s2member_css_js_themes::add_js_w_globals");
|
66 |
+
/**/
|
67 |
+
add_action("wp_login_failed", "c_ws_plugin__s2member_brute_force::track_failed_logins");
|
68 |
+
add_filter("authenticate", "c_ws_plugin__s2member_brute_force::stop_brute_force_logins", 100);
|
69 |
+
/**/
|
70 |
+
add_action("delete_user", "c_ws_plugin__s2member_user_deletions::handle_user_deletions");
|
71 |
+
add_action("wpmu_delete_user", "c_ws_plugin__s2member_user_deletions::handle_ms_user_deletions");
|
72 |
+
add_action("remove_user_from_blog", "c_ws_plugin__s2member_user_deletions::handle_ms_user_deletions", 10, 2);
|
73 |
/**/
|
74 |
+
add_filter("enable_edit_any_user_configuration", "c_ws_plugin__s2member_user_securities::ms_allow_edits");
|
|
|
|
|
75 |
/**/
|
76 |
+
add_filter("pre_option_default_role", "c_ws_plugin__s2member_option_forces::force_default_role");
|
77 |
+
add_filter("pre_site_option_default_user_role", "c_ws_plugin__s2member_option_forces::force_mms_default_role");
|
78 |
+
add_filter("pre_site_option_add_new_users", "c_ws_plugin__s2member_option_forces::mms_allow_new_users");
|
79 |
+
add_filter("pre_site_option_dashboard_blog", "c_ws_plugin__s2member_option_forces::mms_dashboard_blog");
|
80 |
+
add_filter("pre_option_users_can_register", "c_ws_plugin__s2member_option_forces::check_register_access");
|
81 |
+
add_filter("pre_site_option_registration", "c_ws_plugin__s2member_option_forces::check_mms_register_access");
|
82 |
+
add_filter("bp_core_get_root_options", "c_ws_plugin__s2member_option_forces::check_bp_mms_register_access");
|
83 |
+
add_filter("bp_core_get_site_options", "c_ws_plugin__s2member_option_forces::check_bp_mms_register_access");
|
84 |
/**/
|
85 |
+
add_filter("random_password", "c_ws_plugin__s2member_registrations::generate_password");
|
86 |
+
add_action("user_register", "c_ws_plugin__s2member_registrations::configure_user_registration");
|
87 |
+
add_action("register_form", "c_ws_plugin__s2member_custom_reg_fields::custom_registration_fields");
|
|
|
|
|
|
|
|
|
|
|
88 |
/**/
|
89 |
+
add_filter("add_signup_meta", "c_ws_plugin__s2member_registrations::ms_process_signup_meta");
|
90 |
+
add_filter("bp_signup_usermeta", "c_ws_plugin__s2member_registrations::ms_process_signup_meta");
|
91 |
+
add_filter("wpmu_validate_user_signup", "c_ws_plugin__s2member_registrations::ms_validate_user_signup");
|
92 |
+
add_action("signup_hidden_fields", "c_ws_plugin__s2member_registrations::ms_process_signup_hidden_fields");
|
93 |
+
add_filter("registration_errors", "c_ws_plugin__s2member_registrations::ms_register_existing_user", 11, 3);
|
94 |
+
add_filter("wpmu_signup_user_notification_email", "c_ws_plugin__s2member_email_configs::ms_nice_email_roles", 11);
|
95 |
+
add_filter("_wpmu_activate_existing_error_", "c_ws_plugin__s2member_registrations::ms_activate_existing_user", 10, 2);
|
96 |
+
add_action("wpmu_activate_user", "c_ws_plugin__s2member_registrations::configure_user_on_ms_user_activation", 10, 3);
|
97 |
+
add_action("wpmu_activate_blog", "c_ws_plugin__s2member_registrations::configure_user_on_ms_blog_activation", 10, 5);
|
98 |
+
add_action("signup_extra_fields", "c_ws_plugin__s2member_custom_reg_fields::ms_custom_registration_fields");
|
99 |
/**/
|
100 |
+
add_action("bp_after_signup_profile_fields", "c_ws_plugin__s2member_custom_reg_fields_4bp::custom_registration_fields_4bp");
|
101 |
+
add_action("bp_after_profile_field_content", "c_ws_plugin__s2member_custom_reg_fields_4bp::custom_profile_fields_4bp");
|
102 |
+
add_action("bp_profile_field_item", "c_ws_plugin__s2member_custom_reg_fields_4bp::custom_profile_field_items_4bp");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
/**/
|
104 |
+
add_action("wp_login", "c_ws_plugin__s2member_login_redirects::login_redirect");
|
105 |
+
add_action("login_head", "c_ws_plugin__s2member_login_customizations::login_header_styles");
|
106 |
+
add_filter("login_headerurl", "c_ws_plugin__s2member_login_customizations::login_header_url");
|
107 |
+
add_filter("login_headertitle", "c_ws_plugin__s2member_login_customizations::login_header_title");
|
108 |
+
add_action("login_footer", "c_ws_plugin__s2member_login_customizations::login_footer_design");
|
109 |
/**/
|
110 |
+
add_action("login_footer", "c_ws_plugin__s2member_tracking_codes::display_signup_tracking_codes");
|
111 |
+
add_action("wp_footer", "c_ws_plugin__s2member_tracking_codes::display_signup_tracking_codes");
|
|
|
|
|
|
|
112 |
/**/
|
113 |
+
add_action("login_footer", "c_ws_plugin__s2member_tracking_codes::display_modification_tracking_codes");
|
114 |
+
add_action("wp_footer", "c_ws_plugin__s2member_tracking_codes::display_modification_tracking_codes");
|
115 |
/**/
|
116 |
+
add_action("login_footer", "c_ws_plugin__s2member_tracking_codes::display_ccap_tracking_codes");
|
117 |
+
add_action("wp_footer", "c_ws_plugin__s2member_tracking_codes::display_ccap_tracking_codes");
|
118 |
/**/
|
119 |
+
add_action("login_footer", "c_ws_plugin__s2member_tracking_codes::display_sp_tracking_codes");
|
120 |
+
add_action("wp_footer", "c_ws_plugin__s2member_tracking_codes::display_sp_tracking_codes");
|
121 |
/**/
|
122 |
+
add_action("wp_footer", "c_ws_plugin__s2member_wp_footer::wp_footer_code");
|
|
|
123 |
/**/
|
124 |
+
add_action("admin_init", "c_ws_plugin__s2member_admin_lockouts::admin_lockout", 1);
|
125 |
+
add_action("admin_init", "c_ws_plugin__s2member_check_activation::check");
|
126 |
/**/
|
127 |
+
add_action("load-settings.php", "c_ws_plugin__s2member_op_notices::multisite_ops_notice");
|
128 |
+
add_action("load-options-general.php", "c_ws_plugin__s2member_op_notices::general_ops_notice");
|
129 |
+
add_action("load-options-reading.php", "c_ws_plugin__s2member_op_notices::reading_ops_notice");
|
130 |
+
add_action("load-user-new.php", "c_ws_plugin__s2member_user_new::admin_user_new_fields");
|
131 |
/**/
|
132 |
+
add_action("add_meta_boxes", "c_ws_plugin__s2member_meta_boxes::add_meta_boxes");
|
133 |
+
add_action("save_post", "c_ws_plugin__s2member_meta_box_saves::save_meta_boxes");
|
134 |
+
add_action("admin_menu", "c_ws_plugin__s2member_menu_pages::add_admin_options");
|
135 |
+
add_action("network_admin_menu", "c_ws_plugin__s2member_menu_pages::add_network_admin_options");
|
136 |
+
add_action("admin_bar_menu", "c_ws_plugin__s2member_admin_lockouts::filter_admin_menu_bar", 100);
|
137 |
+
add_action("admin_print_scripts", "c_ws_plugin__s2member_menu_pages::add_admin_scripts");
|
138 |
+
add_action("admin_print_styles", "c_ws_plugin__s2member_menu_pages::add_admin_styles");
|
139 |
+
add_filter("update_feedback", "c_ws_plugin__s2member_mms_patches::sync_mms_patches");
|
140 |
/**/
|
141 |
+
add_action("admin_notices", "c_ws_plugin__s2member_admin_notices::admin_notices");
|
142 |
+
add_action("user_admin_notices", "c_ws_plugin__s2member_admin_notices::admin_notices");
|
143 |
+
add_action("network_admin_notices", "c_ws_plugin__s2member_admin_notices::admin_notices");
|
|
|
|
|
|
|
|
|
|
|
144 |
/**/
|
145 |
+
add_action("pre_user_query", "c_ws_plugin__s2member_users_list::users_list_query");
|
146 |
+
add_filter("manage_users_columns", "c_ws_plugin__s2member_users_list::users_list_cols");
|
147 |
+
add_filter("manage_users_custom_column", "c_ws_plugin__s2member_users_list::users_list_display_cols", 10, 3);
|
148 |
+
add_action("edit_user_profile", "c_ws_plugin__s2member_users_list::users_list_edit_cols");
|
149 |
+
add_action("show_user_profile", "c_ws_plugin__s2member_users_list::users_list_edit_cols");
|
150 |
+
add_action("edit_user_profile_update", "c_ws_plugin__s2member_users_list::users_list_update_cols");
|
151 |
+
add_action("personal_options_update", "c_ws_plugin__s2member_users_list::users_list_update_cols");
|
152 |
+
add_action("set_user_role", "c_ws_plugin__s2member_registration_times::synchronize_paid_reg_times", 10, 2);
|
153 |
+
add_filter("show_password_fields", "c_ws_plugin__s2member_user_securities::hide_password_fields", 10, 2);
|
154 |
/**/
|
155 |
+
add_filter("cron_schedules", "c_ws_plugin__s2member_cron_jobs::extend_cron_schedules");
|
156 |
+
add_action("ws_plugin__s2member_auto_eot_system__schedule", "c_ws_plugin__s2member_auto_eots::auto_eot_system");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
/**/
|
158 |
+
add_action("wp_ajax_ws_plugin__s2member_update_roles_via_ajax", "c_ws_plugin__s2member_roles_caps::update_roles_via_ajax");
|
|
|
159 |
/**/
|
160 |
+
add_action("wp_ajax_ws_plugin__s2member_sp_access_link_via_ajax", "c_ws_plugin__s2member_sp_access::sp_access_link_via_ajax");
|
161 |
+
add_action("wp_ajax_ws_plugin__s2member_reg_access_link_via_ajax", "c_ws_plugin__s2member_register_access::reg_access_link_via_ajax");
|
162 |
+
/**/
|
163 |
+
add_action("wp_ajax_ws_plugin__s2member_delete_reset_all_ip_restrictions_via_ajax", "c_ws_plugin__s2member_ip_restrictions::delete_reset_all_ip_restrictions_via_ajax");
|
164 |
+
add_action("wp_ajax_ws_plugin__s2member_delete_reset_specific_ip_restrictions_via_ajax", "c_ws_plugin__s2member_ip_restrictions::delete_reset_specific_ip_restrictions_via_ajax");
|
165 |
+
/**/
|
166 |
+
add_action("ws_plugin__s2member_during_collective_mods", "c_ws_plugin__s2member_list_servers::auto_process_list_server_removals", 10, 7);
|
167 |
+
add_action("ws_plugin__s2member_during_collective_eots", "c_ws_plugin__s2member_list_servers::auto_process_list_server_removals", 10, 4);
|
168 |
+
/**/
|
169 |
+
add_filter("ws_plugin__s2member_content_redirect_status", "c_ws_plugin__s2member_utils_urls::redirect_browsers_using_302_status");
|
170 |
+
/**/
|
171 |
+
add_action("bbp_activation", "c_ws_plugin__s2member_roles_caps::config_roles", 11);
|
|
|
|
|
172 |
/*
|
173 |
Register the activation | de-activation routines.
|
174 |
*/
|
175 |
+
register_activation_hook($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["plugin_basename"], "c_ws_plugin__s2member_installation::activate");
|
176 |
+
register_deactivation_hook($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["plugin_basename"], "c_ws_plugin__s2member_installation::deactivate");
|
177 |
?>
|
includes/menu-pages/code-samples/jwplayer-standard-mp4.x-php
CHANGED
@@ -1,22 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<div id="jw-container">JW Player® appears here.</div>
|
2 |
-
<script type="text/javascript" src="
|
3 |
<script type="text/javascript">
|
4 |
jwplayer("jw-container").setup({modes: /* JW Player®. */
|
5 |
[
|
6 |
/* First try psuedo-streaming with Flash® player. */
|
7 |
-
{type: "flash", provider: "http", src: "
|
8 |
-
config: {file: "/wp-content/plugins/s2member-files/s2member-file-inline
|
9 |
-
/* Shortcode equivalent: [s2File rewrite="yes" inline="yes" download="
|
10 |
|
11 |
/* Else, try an HTML5 video tag. */
|
12 |
{type: "html5", provider: "video",
|
13 |
-
config: {file: "/wp-content/plugins/s2member-files/s2member-file-inline
|
14 |
-
/* Shortcode equivalent: [s2File rewrite="yes" inline="yes" download="
|
15 |
|
16 |
/* Else, this is a safe fallback. */
|
17 |
{type: "download", /* Download the file. */
|
18 |
-
config: {file: "/wp-content/plugins/s2member-files/s2member-file-inline
|
19 |
-
/* Shortcode equivalent: [s2File rewrite="yes" inline="yes" download="
|
20 |
],
|
21 |
/* Set video dimensions. */ width: 480, height: 270
|
22 |
});
|
1 |
+
<?php
|
2 |
+
// Configuration.
|
3 |
+
$config["jwplayer"] = "/jwplayer/"; // Relative URL path to JW Player files directory.
|
4 |
+
$config["mp4_video_file_name"] = "video.mp4"; // Name of your MP4 test file.
|
5 |
+
// Don't edit anything else below unless you know what you're doing.
|
6 |
+
?>
|
7 |
+
|
8 |
<div id="jw-container">JW Player® appears here.</div>
|
9 |
+
<script type="text/javascript" src="<?php echo $config["jwplayer"]; ?>jwplayer.js"></script>
|
10 |
<script type="text/javascript">
|
11 |
jwplayer("jw-container").setup({modes: /* JW Player®. */
|
12 |
[
|
13 |
/* First try psuedo-streaming with Flash® player. */
|
14 |
+
{type: "flash", provider: "http", src: "<?php echo $config["jwplayer"]; ?>player.swf",
|
15 |
+
config: {file: "/wp-content/plugins/s2member-files/s2member-file-inline/<?php echo $config["mp4_video_file_name"]; ?>"}},
|
16 |
+
/* Shortcode equivalent: [s2File rewrite="yes" inline="yes" download="<?php echo $config["mp4_video_file_name"]; ?>" /] */
|
17 |
|
18 |
/* Else, try an HTML5 video tag. */
|
19 |
{type: "html5", provider: "video",
|
20 |
+
config: {file: "/wp-content/plugins/s2member-files/s2member-file-inline/<?php echo $config["mp4_video_file_name"]; ?>"}},
|
21 |
+
/* Shortcode equivalent: [s2File rewrite="yes" inline="yes" download="<?php echo $config["mp4_video_file_name"]; ?>" /] */
|
22 |
|
23 |
/* Else, this is a safe fallback. */
|
24 |
{type: "download", /* Download the file. */
|
25 |
+
config: {file: "/wp-content/plugins/s2member-files/s2member-file-inline/<?php echo $config["mp4_video_file_name"]; ?>"}}
|
26 |
+
/* Shortcode equivalent: [s2File rewrite="yes" inline="yes" download="<?php echo $config["mp4_video_file_name"]; ?>" /] */
|
27 |
],
|
28 |
/* Set video dimensions. */ width: 480, height: 270
|
29 |
});
|
includes/menu-pages/code-samples/jwplayer-streaming-mp4-sca.x-php
CHANGED
@@ -1,11 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<div id="jw-container">JW Player® appears here.</div>
|
2 |
-
<script type="text/javascript" src="
|
3 |
|
4 |
<script type="text/javascript">
|
5 |
/* The Shortcode here will return a JSON object for JavaScript notation. */
|
6 |
/* A direct URL to the RTMP source; counting the file against the current User in real-time. */
|
7 |
/* API Shortcode `s2File` returns a null object if access is denied to the current User/Member. */
|
8 |
-
var mp4 = [s2File download="
|
9 |
</script>
|
10 |
|
11 |
<script type="text/javascript">
|
@@ -14,7 +21,7 @@
|
|
14 |
jwplayer("jw-container").setup({modes: /* JW Player®. */
|
15 |
[
|
16 |
/* First try real-time streaming with Flash® player. */
|
17 |
-
{type: "flash", provider: "rtmp", src: "
|
18 |
config: {streamer: mp4['streamer'], file: mp4['file']}},
|
19 |
|
20 |
/* Else, try an HTML5 video tag. */
|
1 |
+
<?php
|
2 |
+
// Configuration.
|
3 |
+
$config["jwplayer"] = "/jwplayer/"; // Relative URL path to JW Player files directory.
|
4 |
+
$config["mp4_video_file_name"] = "video.mp4"; // Name of your MP4 test file.
|
5 |
+
// Don't edit anything else below unless you know what you're doing.
|
6 |
+
?>
|
7 |
+
|
8 |
<div id="jw-container">JW Player® appears here.</div>
|
9 |
+
<script type="text/javascript" src="<?php echo $config["jwplayer"]; ?>jwplayer.js"></script>
|
10 |
|
11 |
<script type="text/javascript">
|
12 |
/* The Shortcode here will return a JSON object for JavaScript notation. */
|
13 |
/* A direct URL to the RTMP source; counting the file against the current User in real-time. */
|
14 |
/* API Shortcode `s2File` returns a null object if access is denied to the current User/Member. */
|
15 |
+
var mp4 = [s2File download="<?php echo $config["mp4_video_file_name"]; ?>" url_to_storage_source="true" count_against_user="true" get_streamer_json="true" /];
|
16 |
</script>
|
17 |
|
18 |
<script type="text/javascript">
|
21 |
jwplayer("jw-container").setup({modes: /* JW Player®. */
|
22 |
[
|
23 |
/* First try real-time streaming with Flash® player. */
|
24 |
+
{type: "flash", provider: "rtmp", src: "<?php echo $config["jwplayer"]; ?>player.swf",
|
25 |
config: {streamer: mp4['streamer'], file: mp4['file']}},
|
26 |
|
27 |
/* Else, try an HTML5 video tag. */
|
includes/menu-pages/code-samples/jwplayer-streaming-mp4-webm.x-php
CHANGED
@@ -1,9 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<div id="jw-container">JW Player® appears here.</div>
|
2 |
-
<script type="text/javascript" src="
|
3 |
|
4 |
<?php /* A direct URL to the RTMP source; counting the file against the current User in real-time. */
|
5 |
-
$mp4_cfg = array ("file_download" => "
|
6 |
-
$webm_cfg = array ("file_download" => "
|
7 |
|
8 |
<?php /* API Function `s2member_file_download_url()` returns false if access is denied to the current User. */
|
9 |
if (($mp4 = s2member_file_download_url ($mp4_cfg, "get-streamer-array"))
|
@@ -13,7 +21,7 @@ if (($mp4 = s2member_file_download_url ($mp4_cfg, "get-streamer-array"))
|
|
13 |
jwplayer("jw-container").setup({modes: /* JW Player®. */
|
14 |
[
|
15 |
/* First try real-time streaming with Flash® player. */
|
16 |
-
{type: "flash", provider: "rtmp", src: "
|
17 |
config: {streamer: "<?php echo $mp4["streamer"]; ?>", file: "<?php echo $mp4["file"]; ?>"}},
|
18 |
|
19 |
/* Else, try an HTML5 video tag with the `mp4` file. */
|
1 |
+
<?php
|
2 |
+
// Configuration.
|
3 |
+
$config["jwplayer"] = "/jwplayer/"; // Relative URL path to JW Player files directory.
|
4 |
+
$config["mp4_video_file_name"] = "video.mp4"; // Name of your MP4 test file.
|
5 |
+
$config["webm_video_file_name"] = "video.webm"; // Name of your WEBM test file.
|
6 |
+
// Don't edit anything else below unless you know what you're doing.
|
7 |
+
?>
|
8 |
+
|
9 |
<div id="jw-container">JW Player® appears here.</div>
|
10 |
+
<script type="text/javascript" src="<?php echo $config["jwplayer"]; ?>jwplayer.js"></script>
|
11 |
|
12 |
<?php /* A direct URL to the RTMP source; counting the file against the current User in real-time. */
|
13 |
+
$mp4_cfg = array ("file_download" => $config["mp4_video_file_name"], "url_to_storage_source" => true, "count_against_user" => true);
|
14 |
+
$webm_cfg = array ("file_download" => $config["webm_video_file_name"], "url_to_storage_source" => true /* Don't count variations. */); ?>
|
15 |
|
16 |
<?php /* API Function `s2member_file_download_url()` returns false if access is denied to the current User. */
|
17 |
if (($mp4 = s2member_file_download_url ($mp4_cfg, "get-streamer-array"))
|
21 |
jwplayer("jw-container").setup({modes: /* JW Player®. */
|
22 |
[
|
23 |
/* First try real-time streaming with Flash® player. */
|
24 |
+
{type: "flash", provider: "rtmp", src: "<?php echo $config["jwplayer"]; ?>player.swf",
|
25 |
config: {streamer: "<?php echo $mp4["streamer"]; ?>", file: "<?php echo $mp4["file"]; ?>"}},
|
26 |
|
27 |
/* Else, try an HTML5 video tag with the `mp4` file. */
|
includes/menu-pages/code-samples/jwplayer-streaming-mp4.x-php
CHANGED
@@ -1,8 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<div id="jw-container">JW Player® appears here.</div>
|
2 |
-
<script type="text/javascript" src="
|
3 |
|
4 |
<?php /* A direct URL to the RTMP source; counting the file against the current User in real-time. */
|
5 |
-
$cfg = array ("file_download" => "
|
6 |
|
7 |
<?php /* API Function `s2member_file_download_url()` returns false if access is denied to the current User. */
|
8 |
if (($mp4 = s2member_file_download_url ($cfg, "get-streamer-array"))) { ?>
|
@@ -11,7 +18,7 @@ if (($mp4 = s2member_file_download_url ($cfg, "get-streamer-array"))) { ?>
|
|
11 |
jwplayer("jw-container").setup({modes: /* JW Player®. */
|
12 |
[
|
13 |
/* First try real-time streaming with Flash® player. */
|
14 |
-
{type: "flash", provider: "rtmp", src: "
|
15 |
config: {streamer: "<?php echo $mp4["streamer"]; ?>", file: "<?php echo $mp4["file"]; ?>"}},
|
16 |
|
17 |
/* Else, try an HTML5 video tag. */
|
1 |
+
<?php
|
2 |
+
// Configuration.
|
3 |
+
$config["jwplayer"] = "/jwplayer/"; // Relative URL path to JW Player files directory.
|
4 |
+
$config["mp4_video_file_name"] = "video.mp4"; // Name of your MP4 test file.
|
5 |
+
// Don't edit anything else below unless you know what you're doing.
|
6 |
+
?>
|
7 |
+
|
8 |
<div id="jw-container">JW Player® appears here.</div>
|
9 |
+
<script type="text/javascript" src="<?php echo $config["jwplayer"]; ?>jwplayer.js"></script>
|
10 |
|
11 |
<?php /* A direct URL to the RTMP source; counting the file against the current User in real-time. */
|
12 |
+
$cfg = array ("file_download" => $config["mp4_video_file_name"], "url_to_storage_source" => true, "count_against_user" => true); ?>
|
13 |
|
14 |
<?php /* API Function `s2member_file_download_url()` returns false if access is denied to the current User. */
|
15 |
if (($mp4 = s2member_file_download_url ($cfg, "get-streamer-array"))) { ?>
|
18 |
jwplayer("jw-container").setup({modes: /* JW Player®. */
|
19 |
[
|
20 |
/* First try real-time streaming with Flash® player. */
|
21 |
+
{type: "flash", provider: "rtmp", src: "<?php echo $config["jwplayer"]; ?>player.swf",
|
22 |
config: {streamer: "<?php echo $mp4["streamer"]; ?>", file: "<?php echo $mp4["file"]; ?>"}},
|
23 |
|
24 |
/* Else, try an HTML5 video tag. */
|
includes/menu-pages/code-samples/s2member-paid-registration-time-examples.x-php
CHANGED
@@ -20,11 +20,14 @@
|
|
20 |
|
21 |
This is some content that will be displayed to all Members that have paid you at some point.
|
22 |
|
23 |
-
<?php if
|
|
|
|
|
|
|
24 |
Drip content to Members that started paying you at Level#1, at least 30 days ago.
|
25 |
<?php } ?>
|
26 |
|
27 |
-
<?php if(
|
28 |
Drip more content to Members that started paying you at Level#1, at least 60 days ago.
|
29 |
<?php } ?>
|
30 |
|
20 |
|
21 |
This is some content that will be displayed to all Members that have paid you at some point.
|
22 |
|
23 |
+
<?php /* Timestamp at Level #1, or `0` if they've NOT yet paid for Level #1. */
|
24 |
+
$level1_payment_time = s2member_paid_registration_time("level1"); ?>
|
25 |
+
|
26 |
+
<?php if($level1_payment_time && $level1_payment_time <= ($_30_days_ago = strtotime("-30 days"))){ ?>
|
27 |
Drip content to Members that started paying you at Level#1, at least 30 days ago.
|
28 |
<?php } ?>
|
29 |
|
30 |
+
<?php if($level1_payment_time && $level1_payment_time <= ($_60_days_ago = strtotime("-60 days"))){ ?>
|
31 |
Drip more content to Members that started paying you at Level#1, at least 60 days ago.
|
32 |
<?php } ?>
|
33 |
|
includes/menu-pages/down-ops.inc.php
CHANGED
@@ -273,7 +273,7 @@ if(!class_exists("c_ws_plugin__s2member_menu_page_down_ops"))
|
|
273 |
/**/
|
274 |
echo '<th style="padding-top:0;">'."\n";
|
275 |
echo '<label for="ws-plugin--s2member-amazon-s3-files-bucket">'."\n";
|
276 |
-
echo 'Amazon® S3 File Bucket ( where protected files are ):'."\n";
|
277 |
echo '</label>'."\n";
|
278 |
echo '</th>'."\n";
|
279 |
/**/
|
@@ -282,7 +282,8 @@ if(!class_exists("c_ws_plugin__s2member_menu_page_down_ops"))
|
|
282 |
/**/
|
283 |
echo '<td>'."\n";
|
284 |
echo '<input type="text" autocomplete="off" name="ws_plugin__s2member_amazon_s3_files_bucket" id="ws-plugin--s2member-amazon-s3-files-bucket" value="'.format_to_edit($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_bucket"]).'" /><br />'."\n";
|
285 |
-
echo 'Your Amazon® S3 Bucket will be used, instead of the <code>/'.esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])).'/</code> directory
|
|
|
286 |
echo '</td>'."\n";
|
287 |
/**/
|
288 |
echo '</tr>'."\n";
|
273 |
/**/
|
274 |
echo '<th style="padding-top:0;">'."\n";
|
275 |
echo '<label for="ws-plugin--s2member-amazon-s3-files-bucket">'."\n";
|
276 |
+
echo 'Amazon® S3 File Bucket Name ( where protected files are ):'."\n";
|
277 |
echo '</label>'."\n";
|
278 |
echo '</th>'."\n";
|
279 |
/**/
|
282 |
/**/
|
283 |
echo '<td>'."\n";
|
284 |
echo '<input type="text" autocomplete="off" name="ws_plugin__s2member_amazon_s3_files_bucket" id="ws-plugin--s2member-amazon-s3-files-bucket" value="'.format_to_edit($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_bucket"]).'" /><br />'."\n";
|
285 |
+
echo 'Your Amazon® S3 Bucket will be used, instead of the <code>/'.esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])).'/</code> directory.<br />'."\n";
|
286 |
+
echo 'Please type the name of your Bucket. Ex: <code>mys3bucket</code>'."\n";
|
287 |
echo '</td>'."\n";
|
288 |
/**/
|
289 |
echo '</tr>'."\n";
|
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,""").replace(/\</g,"<").replace(/\>/g,">")};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)$/))?$(deflt_trs).css("display",""):$(deflt_trs).css("display","none");(type.match(/^(select|selects|checkboxes|radios)$/))?$(options_trs).css("display",""):$(options_trs).css("display","none");(type.match(/^(text|textarea)$/))?$(expected_trs).css("display",""):$(expected_trs).css("display","none")};ws_plugin__s2member_customRegFieldDelete=function(index){var newFields=new Array();for(var i=0;i<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)$/))?field.deflt:"";field.deflt=(field.type.match(/^(text)$/))?field.deflt.replace(/[\r\n\t ]+/g," "):field.deflt;field.options=(field.type.match(/^(select|selects|checkboxes|radios)$/))?field.options:"";field.expected=(field.type.match(/^(text|textarea)$/))?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)$/)&&!field.options){errors.push("Option Configuration File:\nThis is required. Please try again.")}else{if(field.type.match(/^(select|selects|checkboxes|radios)$/)){for(i=0;i<(options=field.options.split(/[\r\n]+/)).length;i++){if(!(options[i]=$.trim(options[i])).match(/^([^\|]*)(\|)([^\|]*)(\|default)?$/)){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,]+)$/)){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"> </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"> </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"> </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"> </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)$/))?"":' style="display:none;"')+'><td colspan="2"> </td></tr>';form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-deflt"'+((field.type.match(/^(text|textarea)$/))?"":' 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)$/))?"":' 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)$/))?"":' style="display:none;"')+'><td colspan="2"> </td></tr>';form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-options"'+((field.type.match(/^(select|selects|checkboxes|radios)$/))?"":' 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)$/))?"":' 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)$/))?"":' style="display:none;"')+'><td colspan="2"> </td></tr>';form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-expected"'+((field.type.match(/^(text|textarea)$/))?"":' 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)$/))?"":' 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 & 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 & Punctuation ( '+i+" character minimum )</option>";form+='<option value="alphanumerics-spaces-punctuation-'+i+'-e"'+((field.expected==="alphanumerics-spaces-punctuation-"+i+"-e")?' selected="selected"':"")+'">Alphanumerics, Spaces & Punctuation ( exactly '+i+" character"+((i>1)?"s":"")+" )</option>"}form+="</optgroup>";form+='<option disabled="disabled"></option>';form+='<optgroup label="Alphanumerics & Spaces Only">';for(i=1;i<=25;i++){form+='<option value="alphanumerics-spaces-'+i+'"'+((field.expected==="alphanumerics-spaces-"+i)?' selected="selected"':"")+'">Alphanumerics & Spaces ( '+i+" character minimum )</option>";form+='<option value="alphanumerics-spaces-'+i+'-e"'+((field.expected==="alphanumerics-spaces-"+i+"-e")?' selected="selected"':"")+'">Alphanumerics & Spaces ( exactly '+i+" character"+((i>1)?"s":"")+" )</option>"}form+="</optgroup>";form+='<option disabled="disabled"></option>';form+='<optgroup label="Alphanumerics & Punctuation Only">';for(i=1;i<=25;i++){form+='<option value="alphanumerics-punctuation-'+i+'"'+((field.expected==="alphanumerics-punctuation-"+i)?' selected="selected"':"")+'">Alphanumerics & Punctuation ( '+i+" character minimum )</option>";form+='<option value="alphanumerics-punctuation-'+i+'-e"'+((field.expected==="alphanumerics-punctuation-"+i+"-e")?' selected="selected"':"")+'">Alphanumerics & 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"> </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"> </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 & totally invisible after registration )</option>';form+='<option value="no-always-invisible"'+((field.editable==="no-always-invisible")?' selected="selected"':"")+'">No ( uneditable & totally invisible, both during & 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"> </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"> </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"> </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"> </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$/)}).change(function(){var button=this.id.replace(/^ws-plugin--s2member-(.+?)-term$/g,"$1");var trialDisabled=($(this).val().split("-")[2].replace(/[^0-1BN]/g,"")==="BN")?1:0;$("p#ws-plugin--s2member-"+button+"-trial-line").css("display",(trialDisabled?"none":""));$("span#ws-plugin--s2member-"+button+"-trial-then").css("display",(trialDisabled?"none":""));$("span#ws-plugin--s2member-"+button+"-20p-rule").css("display",(trialDisabled?"none":""));(trialDisabled)?$("input#ws-plugin--s2member-"+button+"-trial-period").val(0):null;(trialDisabled)?$("input#ws-plugin--s2member-"+button+"-trial-amount").val("0.00"):null});$("div.ws-menu-page input[id]").filter(function(){return this.id.match(/^ws-plugin--s2member-(level[1-9][0-9]*|modification|ccap)-ccaps$/)}).keyup(function(){var value=this.value.replace(/^(-all|-al|-a|-)[;,]*/gi,""),_all=(this.value.match(/^(-all|-al|-a|-)[;,]*/i))?"-all,":"";if(value.match(/[^a-z_0-9,]/)){this.value=_all+$.trim($.trim(value).replace(/[ \-]/g,"_").replace(/[^a-z_0-9,]/gi,"").toLowerCase())}});ws_plugin__s2member_paypalButtonGenerate=function(button){var shortCodeTemplate='[s2Member-PayPal-Button %%attrs%% image="default" output="button" /]',shortCodeTemplateAttrs="",labels={};eval("<?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"&®Term!=="L")?level+":"+cCaps+":"+regPeriod+" "+regTerm:level+":"+cCaps;levelCcapsPer=levelCcapsPer.replace(/\:+$/g,"");if(trialAmount!=="0"&&(isNaN(trialAmount)||trialAmount<0)){alert("— Oops, a slight problem: —\n\nWhen provided, Trial Amount must be >= 0.00");return false}else{if(trialAmount!=="0"&&trialAmount>10000){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"&®Term!=="L")?"*:"+cCaps+":"+regPeriod+" "+regTerm:"*:"+cCaps;levelCcapsPer=levelCcapsPer.replace(/\:+$/g,"");if(!cCaps||cCaps==="-all"){alert("— Oops, a slight problem: —\n\nPlease provide at least one Custom Capability.");return false}else{if(!regAmount||isNaN(regAmount)||regAmount<0.01){alert("— Oops, a slight problem: —\n\nAmount must be >= 0.01");return false}else{if(regAmount>10000){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$/))?level+":"+cCaps+":"+fixedTerm:level+":"+cCaps;levelCcapsPer=levelCcapsPer.replace(/\:+$/g,"");if(!subscrID){alert("— Oops, a slight problem: —\n\nPaid Subscr. ID is a required value.");return false}else{if(!custom||custom.indexOf('<?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)$/)){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$/,"/unchecked.png"))}else{if(val==1){$rows.css("display",""),$prevImg.attr("src",$prevImg.attr("src").replace(/\/unchecked\.png$/,"/checked.png"))}else{if(val==2){$rows.css("display",""),$prevImg.attr("src",$prevImg.attr("src").replace(/\/checked\.png$/,"/unchecked.png"))}}}});$('div.ws-plugin--s2member-opt-out-section input[type="checkbox"][name="ws_plugin__s2member_custom_reg_auto_opt_outs[]"]').change(function(){var thisChange=$(this).val(),checkedIndexes=[];$('div.ws-plugin--s2member-opt-out-section input[type="checkbox"][name="ws_plugin__s2member_custom_reg_auto_opt_outs[]"]').each(function(){var $this=$(this),val=$this.val(),checkboxes='input[type="checkbox"]';if(val==="removal-deletion"&&this.checked){$this.nextAll(checkboxes).slice(0,2).attr({checked:"checked",disabled:"disabled"})}else{if(val==="removal-deletion"&&!this.checked){$this.nextAll(checkboxes).slice(0,2).removeAttr("disabled");(thisChange==="removal-deletion")?$this.nextAll(checkboxes).slice(0,2).removeAttr("checked"):null}else{if(val==="modification"&&this.checked){$this.nextAll(checkboxes).slice(0,3).attr({checked:"checked",disabled:"disabled"})}else{if(val==="modification"&&!this.checked){(thisChange==="modification")?$this.nextAll(checkboxes).slice(0,3).removeAttr("checked"):null;$this.nextAll(checkboxes).slice(0,3).removeAttr("disabled")}}}}}).each(function(index){(this.checked)?checkedIndexes.push(index):null});$("select#ws-plugin--s2member-custom-reg-auto-opt-out-transitions").removeAttr("disabled");if($.inArray(3,checkedIndexes)===-1&&$.inArray(4,checkedIndexes)===-1&&$.inArray(5,checkedIndexes)===-1&&$.inArray(6,checkedIndexes)===-1){$("select#ws-plugin--s2member-custom-reg-auto-opt-out-transitions").attr("disabled","disabled")}}).last().trigger("change")}});
|
1 |
+
jQuery(document).ready(function($){var esc_attr=esc_html=function(str){return String(str).replace(/"/g,""").replace(/\</g,"<").replace(/\>/g,">")};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)$/))?$(deflt_trs).css("display",""):$(deflt_trs).css("display","none");(type.match(/^(select|selects|checkboxes|radios)$/))?$(options_trs).css("display",""):$(options_trs).css("display","none");(type.match(/^(text|textarea)$/))?$(expected_trs).css("display",""):$(expected_trs).css("display","none")};ws_plugin__s2member_customRegFieldDelete=function(index){var newFields=new Array();for(var i=0;i<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)$/))?field.deflt:"";field.deflt=(field.type.match(/^(text)$/))?field.deflt.replace(/[\r\n\t ]+/g," "):field.deflt;field.options=(field.type.match(/^(select|selects|checkboxes|radios)$/))?field.options:"";field.expected=(field.type.match(/^(text|textarea)$/))?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)$/)&&!field.options){errors.push("Option Configuration File:\nThis is required. Please try again.")}else{if(field.type.match(/^(select|selects|checkboxes|radios)$/)){for(i=0;i<(options=field.options.split(/[\r\n]+/)).length;i++){if(!(options[i]=$.trim(options[i])).match(/^([^\|]*)(\|)([^\|]*)(\|default)?$/)){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,]+)$/)){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"> </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"> </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"> </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"> </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)$/))?"":' style="display:none;"')+'><td colspan="2"> </td></tr>';form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-deflt"'+((field.type.match(/^(text|textarea)$/))?"":' 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)$/))?"":' 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)$/))?"":' style="display:none;"')+'><td colspan="2"> </td></tr>';form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-options"'+((field.type.match(/^(select|selects|checkboxes|radios)$/))?"":' 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)$/))?"":' 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)$/))?"":' style="display:none;"')+'><td colspan="2"> </td></tr>';form+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-expected"'+((field.type.match(/^(text|textarea)$/))?"":' 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)$/))?"":' 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 & 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 & Punctuation ( '+i+" character minimum )</option>";form+='<option value="alphanumerics-spaces-punctuation-'+i+'-e"'+((field.expected==="alphanumerics-spaces-punctuation-"+i+"-e")?' selected="selected"':"")+'">Alphanumerics, Spaces & Punctuation ( exactly '+i+" character"+((i>1)?"s":"")+" )</option>"}form+="</optgroup>";form+='<option disabled="disabled"></option>';form+='<optgroup label="Alphanumerics & Spaces Only">';for(i=1;i<=25;i++){form+='<option value="alphanumerics-spaces-'+i+'"'+((field.expected==="alphanumerics-spaces-"+i)?' selected="selected"':"")+'">Alphanumerics & Spaces ( '+i+" character minimum )</option>";form+='<option value="alphanumerics-spaces-'+i+'-e"'+((field.expected==="alphanumerics-spaces-"+i+"-e")?' selected="selected"':"")+'">Alphanumerics & Spaces ( exactly '+i+" character"+((i>1)?"s":"")+" )</option>"}form+="</optgroup>";form+='<option disabled="disabled"></option>';form+='<optgroup label="Alphanumerics & Punctuation Only">';for(i=1;i<=25;i++){form+='<option value="alphanumerics-punctuation-'+i+'"'+((field.expected==="alphanumerics-punctuation-"+i)?' selected="selected"':"")+'">Alphanumerics & Punctuation ( '+i+" character minimum )</option>";form+='<option value="alphanumerics-punctuation-'+i+'-e"'+((field.expected==="alphanumerics-punctuation-"+i+"-e")?' selected="selected"':"")+'">Alphanumerics & 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"> </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"> </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 & totally invisible after registration )</option>';form+='<option value="no-always-invisible"'+((field.editable==="no-always-invisible")?' selected="selected"':"")+'">No ( uneditable & totally invisible, both during & 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"> </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"> </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"> </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"> </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$/)}).change(function(){var button=this.id.replace(/^ws-plugin--s2member-(.+?)-term$/g,"$1");var trialDisabled=($(this).val().split("-")[2].replace(/[^0-1BN]/g,"")==="BN")?1:0;$("p#ws-plugin--s2member-"+button+"-trial-line").css("display",(trialDisabled?"none":""));$("span#ws-plugin--s2member-"+button+"-trial-then").css("display",(trialDisabled?"none":""));$("span#ws-plugin--s2member-"+button+"-20p-rule").css("display",(trialDisabled?"none":""));(trialDisabled)?$("input#ws-plugin--s2member-"+button+"-trial-period").val(0):null;(trialDisabled)?$("input#ws-plugin--s2member-"+button+"-trial-amount").val("0.00"):null});$("div.ws-menu-page input[id]").filter(function(){return this.id.match(/^ws-plugin--s2member-(level[1-9][0-9]*|modification|ccap)-ccaps$/)}).keyup(function(){var value=this.value.replace(/^(-all|-al|-a|-)[;,]*/gi,""),_all=(this.value.match(/^(-all|-al|-a|-)[;,]*/i))?"-all,":"";if(value.match(/[^a-z_0-9,]/)){this.value=_all+$.trim($.trim(value).replace(/[ \-]/g,"_").replace(/[^a-z_0-9,]/gi,"").toLowerCase())}});ws_plugin__s2member_paypalButtonGenerate=function(button){var shortCodeTemplate='[s2Member-PayPal-Button %%attrs%% image="default" output="button" /]',shortCodeTemplateAttrs="",labels={};eval("<?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"&®Term!=="L")?level+":"+cCaps+":"+regPeriod+" "+regTerm:level+":"+cCaps;levelCcapsPer=levelCcapsPer.replace(/\:+$/g,"");if(trialAmount!=="0"&&(isNaN(trialAmount)||trialAmount<0)){alert("— Oops, a slight problem: —\n\nWhen provided, Trial Amount must be >= 0.00");return false}else{if(trialAmount!=="0"&&trialAmount>10000){alert("— Oops, a slight problem: —\n\nMaximum Trial Amount is: 10000.00");return false}else{if(trialTerm==="D"&&trialPeriod>90){alert("— Oops, a slight problem: —\n\nMaximum Trial Days is: 90.\nIf you want to offer more than 90 days, please choose Weeks or Months from the drop-down.");return false}else{if(trialTerm==="W"&&trialPeriod>52){alert("— Oops, a slight problem: —\n\nMaximum Trial Weeks is: 52.\nIf you want to offer more than 52 weeks, please choose Months from the drop-down.");return false}else{if(trialTerm==="M"&&trialPeriod>24){alert("— Oops, a slight problem: —\n\nMaximum Trial Months is: 24.\nIf you want to offer more than 24 months, please choose Years from the drop-down.");return false}else{if(trialTerm==="Y"&&trialPeriod>5){alert("— Oops, a slight problem: —\n\nMax Trial Period Years is: 5.");return false}else{if(!regAmount||isNaN(regAmount)||regAmount<0.01){alert("— Oops, a slight problem: —\n\nAmount must be >= 0.01");return false}else{if(regAmount>10000){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"&®Term!=="L")?"*:"+cCaps+":"+regPeriod+" "+regTerm:"*:"+cCaps;levelCcapsPer=levelCcapsPer.replace(/\:+$/g,"");if(!cCaps||cCaps==="-all"){alert("— Oops, a slight problem: —\n\nPlease provide at least one Custom Capability.");return false}else{if(!regAmount||isNaN(regAmount)||regAmount<0.01){alert("— Oops, a slight problem: —\n\nAmount must be >= 0.01");return false}else{if(regAmount>10000){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_styl |