PluginProbe
WP Reset / 1.83
WP Reset v1.83
trunk 1.0 1.1 1.11 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.77 1.80 1.81 1.82 1.83 1.84 1.85 1.86 1.90 All 42 releases
wp-reset / js / wf-licensing.js

wf-licensing.js in WP Reset 1.83, at js/wf-licensing.js

84 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * WebFactory Licensing Manager
3 * (c) WebFactory Ltd
4 * www.webfactoryltd.com
5 */
6
7
8 function wf_licensing_verify_licence_ajax(prefix, license_key, button) {
9 data = window['wf_licensing_' + prefix];
10 if (!data) {
11 alert('Licensing data is missing. Please reload the page and try again.');
12 return;
13 }
14
15 jQuery(button).addClass('loading');
16
17 jQuery
18 .post(
19 ajaxurl,
20 {
21 action: 'wf_licensing_' + prefix + '_validate',
22 license_key: license_key,
23 _ajax_nonce: data.nonce,
24 _rand: Math.floor(Math.random() * 9999) + 1
25 },
26 function (response) {
27 if (data.debug) {
28 console.log('Validate license, first try: ', response);
29 }
30 if (response.success) {
31 location.reload();
32 } else {
33 alert('Unable to contact licensing server. Please try again in a few moments or contact support.');
34 }
35 }
36 )
37 .fail(function () {
38 alert('Undocumented error. Please reload the page and try again.');
39 })
40 .always(function () {
41 jQuery(button).removeClass('loading');
42 jQuery(window).trigger('wf_licensing:ajax_always');
43 });
44 } // wf_licensing_verify_licence_ajax
45
46
47 function wf_licensing_deactivate_licence_ajax(prefix, license_key, button) {
48 data = window['wf_licensing_' + prefix];
49 if (!data) {
50 alert('Licensing data is missing. Please reload the page and try again.');
51 return;
52 }
53
54 jQuery(button).addClass('loading');
55
56 jQuery
57 .post(
58 ajaxurl,
59 {
60 action: 'wf_licensing_' + prefix + '_deactivate',
61 license_key: license_key,
62 _ajax_nonce: data.nonce,
63 _rand: Math.floor(Math.random() * 9999) + 1
64 },
65 function (response) {
66 if (data.debug) {
67 console.log('Deactivate license, first try: ', response);
68 }
69 if (response.success) {
70 location.reload();
71 } else {
72 alert('Unable to contact licensing server. Please try again in a few moments or contact support.');
73 }
74 }
75 )
76 .fail(function () {
77 alert('Undocumented error. Please reload the page and try again.');
78 })
79 .always(function () {
80 jQuery(button).removeClass('loading');
81 jQuery(window).trigger('wf_licensing:ajax_always');
82 });
83 } // wf_licensing_deactivate_licence_ajax
84