e9276577 by Jeff Balicki

woo

Signed-off-by: Jeff <jeff@gotenzing.com>
1 parent ba221ea5
Showing 277 changed files with 4816 additions and 0 deletions
1 jQuery(document).ready(function ($) {
2
3 var PricingRuleBlock = function () {
4
5 this.$block = null;
6 this.initializedBlocks = [];
7
8 this.init = function (id) {
9
10 this.variationCanBeChangedAlreadyTriggered = false;
11 this.id = id;
12 this.$block = jQuery('#' + id);
13
14 if ($.selectWoo) {
15 this.$block.find('.rcbp-add-new-rule-form__identifier-selector').selectWoo();
16 }
17
18 if (this.initializedBlocks[id] !== undefined) {
19 this.unbindEvents();
20 }
21
22 this.bindEvents();
23
24 this.initializedBlocks[id] = this;
25 };
26
27 this.bindEvents = function () {
28 $('body').on('click', '#' + this.id + ' .rcbp-pricing-rule-action--delete', this.removeRole.bind(this));
29 $('body').on('click', '#' + this.id + ' .rcbp-pricing-rule__header', this.toggleRoleView.bind(this));
30 $('body').on('click', '#' + this.id + ' .rcbp-add-new-rule-form__add-button', this.addRole.bind(this));
31
32 $('body').on('change', '#' + this.id + ' .rcbp-pricing-type-input', this.handlePricingTypeView.bind(this)).trigger('change');
33 }
34
35 this.unbindEvents = function () {
36 $('body').off('click', '#' + this.id + ' .rcbp-pricing-rule-action--delete');
37 $('body').off('click', '#' + this.id + ' .rcbp-pricing-rule__header');
38 $('body').off('click', '#' + this.id + ' .rcbp-add-new-rule-form__add-button');
39
40 $('body').off('change', '#' + this.id + ' .rcbp-pricing-type-input');
41 }
42
43 this.handlePricingTypeView = function (event) {
44
45 var container = $(event.target).closest('.rcbp-pricing-rule-form');
46
47 if (container.length) {
48
49 var pricingType = container.find('.rcbp-pricing-type-input')
50 .filter(':checked')
51 .val();
52
53 if (pricingType === 'flat') {
54 container.find('.rcbp-pricing-rule-form__flat_prices').show();
55 container.find('.rcbp-pricing-rule-form__percentage_discount').hide();
56 } else {
57 container.find('.rcbp-pricing-rule-form__flat_prices').hide();
58 container.find('.rcbp-pricing-rule-form__percentage_discount').show();
59 }
60 }
61
62 }
63
64 this.getPricingType = function () {
65 return this.$block.find('#' + this.id + ' .rcbp-pricing-type-input').filter(':checked').val();
66 }
67
68 this.toggleRoleView = function (event) {
69
70 var $element = $(event.target);
71
72 if ($element.hasClass('rcbp-pricing-rule-action--delete')) {
73 return;
74 }
75 var role = $element.closest('.rcbp-pricing-rule');
76
77 if (role.data('visible')) {
78 this.hideRole(role);
79 } else {
80 this.showRole(role);
81 }
82 };
83
84 this.showRole = function ($role) {
85 $role.find('.rcbp-pricing-rule__content').stop().slideDown(400);
86 $role.find('.rcbp-pricing-rule__action-toggle-view')
87 .removeClass('rcbp-pricing-rule__action-toggle-view--open')
88 .addClass('rcbp-pricing-rule__action-toggle-view--close');
89
90 $role.data('visible', true);
91 };
92
93 this.hideRole = function ($role) {
94 $role.find('.rcbp-pricing-rule__content').stop().slideUp(400);
95 $role.find('.rcbp-pricing-rule__action-toggle-view')
96 .removeClass('rcbp-pricing-rule__action-toggle-view--close')
97 .addClass('rcbp-pricing-rule__action-toggle-view--open');
98 $role.data('visible', false);
99 };
100
101 this.removeRole = function (e) {
102 e.preventDefault();
103
104 if (confirm("Are you sure?")) {
105
106 var $roleToRemove = $(e.target).closest('.rcbp-pricing-rule');
107 var roleSlug = $roleToRemove.data('identifier-slug');
108
109 this.$block.find('.rcbp-add-new-rule-form__identifier-selector').append('<option value="' + roleSlug + '">' + $roleToRemove.data('identifier') + '</option>');
110
111 $roleToRemove.slideUp(400, function () {
112 $roleToRemove.remove();
113 });
114
115 this.triggerVariationCanBeUpdated();
116 }
117 };
118
119 this.block = function () {
120 this.$block.block({
121 message: null,
122 overlayCSS: {
123 background: '#fff',
124 opacity: 0.6
125 }
126 });
127 };
128
129 this.unblock = function () {
130 this.$block.unblock();
131 };
132
133 this.addRole = function (event) {
134
135 event.preventDefault();
136
137 var selectedIdentifier = this.$block.find('.rcbp-add-new-rule-form__identifier-selector').val();
138
139 if (selectedIdentifier) {
140
141 var action = this.$block.data('add-action');
142 var nonce = this.$block.data('add-action-nonce');
143 var productId = this.$block.data('product-id');
144 var loop = this.$block.data('loop');
145 var type = this.$block.data('rule-type');
146
147 $.ajax({
148 method: 'GET',
149 url: ajaxurl,
150 data: {
151 action: action,
152 nonce: nonce,
153 identifier: selectedIdentifier,
154 product_id: productId,
155 loop: loop,
156 type: type,
157 },
158 beforeSend: (function () {
159 this.block();
160 }).bind(this)
161 }).done((function (response) {
162 if (response.success && response.role_row_html) {
163 this.$block.find('.rcbp-pricing-rules').append(response.role_row_html);
164 this.$block.find('.rcbp-no-rules').css('display', 'none');
165
166 $.each(this.$block.find('.rcbp-pricing-rule'), (function (i, el) {
167 this.hideRole($(el));
168 }).bind(this));
169
170 this.showRole(this.$block.find('.rcbp-pricing-rule').last());
171
172 this.$block.find('.rcbp-add-new-rule-form__identifier-selector').find('[value="' + selectedIdentifier + '"]').remove();
173
174 $('.woocommerce-help-tip').tipTip({
175 'attribute': 'data-tip',
176 'fadeIn': 50,
177 'fadeOut': 50,
178 'delay': 200
179 });
180
181 this.triggerVariationCanBeUpdated();
182
183 } else {
184 response.error_message && alert(response.error_message);
185 }
186 this.unblock();
187 }).bind(this));
188 }
189 }
190
191 this.triggerVariationCanBeUpdated = function () {
192
193 if (!this.variationCanBeChangedAlreadyTriggered) {
194
195 this.$block
196 .closest('.woocommerce_variation')
197 .addClass('variation-needs-update');
198
199 jQuery('button.cancel-variation-changes, button.save-variation-changes').removeAttr('disabled');
200 jQuery('#variable_product_options').trigger('woocommerce_variations_defaults_changed');
201
202 this.variationCanBeChangedAlreadyTriggered = true;
203 }
204
205 }
206 };
207
208 jQuery.each($('.rcbp-pricing-rule-block'), function (i, el) {
209 (new PricingRuleBlock()).init(jQuery(el).attr('id'));
210 });
211
212 jQuery(document).on('woocommerce_variations_loaded', function () {
213 jQuery.each(jQuery('.rcbp-pricing-rule-block'), function (i, el) {
214
215 var $el = jQuery(el);
216
217 if ($el.data('product-type') === 'variation') {
218 (new PricingRuleBlock()).init($el.attr('id'));
219 }
220 });
221 });
222
223 jQuery(document).on('woocommerce_variations_saved', function () {
224 jQuery.each(jQuery('.rcbp-pricing-rule-block'), function (i, el) {
225 (new PricingRuleBlock()).init(jQuery(el).attr('id'));
226 });
227 });
228
229 if ($.selectWoo) {
230 $('.rbp-select-woo').selectWoo();
231 }
232 });
...\ No newline at end of file ...\ No newline at end of file
1 jQuery(document).ready(function ($) {
2 let addToCartNoticeForNonLoggedInUsers = $('[name=role_and_customer_based_pricing_non_logged_in_users_purchase_message]').closest('tr');
3
4 $('[name=role_and_customer_based_pricing_prevent_purchase_for_non_logged_in_users]').on('change', function () {
5
6 if ($(this).is(':checked')) {
7 addToCartNoticeForNonLoggedInUsers.show();
8 } else {
9 addToCartNoticeForNonLoggedInUsers.hide();
10 }
11
12 }).trigger('change');
13
14 console.log(234);
15 });
...\ No newline at end of file ...\ No newline at end of file
1 #woocommerce-product-data ul.wc-tabs li.role-specific-pricing-options_tab a::before {
2 font-family: Dashicons;
3 speak: none;
4 font-weight: 400;
5 font-variant: normal;
6 text-transform: none;
7 line-height: 1;
8 -webkit-font-smoothing: antialiased;
9 content: "\f307";
10 text-decoration: none;
11 }
12
13 /** Role based pricing **/
14
15 .rcbp-pricing-rule-block {
16 padding: 0 9px 0 162px;
17 position: relative;
18 margin: 20px 0;
19 }
20
21 .rcbp-pricing-rule-block--variation, .rcbp-pricing-rule-block--global {
22 padding: 0;
23 }
24
25 .rcbp-pricing-rule__header {
26 cursor: pointer;
27 display: flex;
28 justify-content: space-between;
29 padding: 13px;
30 border: 1px solid #eee;
31 border-bottom: none;
32 }
33
34 .rcbp-add-new-rule-form {
35 margin: 15px 0;
36 }
37
38 .rcbp-add-new-rule-form__add-button {
39 margin-left: 10px !important;
40 }
41
42 .rcbp-pricing-rule:last-child .rcbp-pricing-rule__header {
43 border-bottom: 1px solid #eee;
44 }
45
46 .rcbp-pricing-rule:last-child .rcbp-pricing-rule__content {
47 border-top: none;
48 border-bottom: 1px solid #eee;
49 }
50
51 .rcbp-pricing-rule__content {
52 overflow: hidden;
53 background: #fdfdfd;
54 border: 1px solid #eee;
55 display: none;
56 border-bottom: none;
57 }
58
59 .rcbp-pricing-rule-block--variation .rcbp-pricing-rule__content {
60 padding: 20px;
61 background: #fafafa;
62 border-color: #eee;
63 }
64
65 .rcbp-pricing-rule-block--variation .rcbp-pricing-rules {
66 margin: 10px 0;
67 }
68
69 .rcbp-pricing-rule-action--delete {
70 color: red;
71 font-weight: 400;
72 text-decoration: none;
73 position: relative;
74 }
75
76 .rcbp-pricing-rule-action--delete:hover {
77 color: #a20000;
78 }
79
80 .rcbp-pricing-rule__action-toggle-view {
81 padding: 10px;
82 color: #888;
83 cursor: pointer;
84 }
85
86 .rcbp-pricing-rule__header .rcbp-pricing-rule__actions {
87 visibility: hidden;
88 }
89
90 .rcbp-pricing-rule:hover .rcbp-pricing-rule__actions {
91 visibility: visible;
92 }
93
94 .rcbp-pricing-rule__action-toggle-view:hover {
95 color: #000;
96 }
97
98 .rcbp-pricing-rule__action-toggle-view--open:before {
99 content: "▼" !important;
100 }
101
102 .rcbp-pricing-rule__action-toggle-view--close:before {
103 content: "▲" !important;
104 }
105
106 .rcbp-pricing-rule__name b {
107 background: #ebeef3;
108 padding: 5px 10px;
109 border-radius: 5px;
110 }
111
112 .rcbp-title-separator {
113 margin: 30px 0;
114 position: relative;
115 border-color: #f6f6f6;
116 }
117
118 .rcbp-title-separator::after {
119 content: attr(data-title);
120 position: absolute;
121 top: 50%;
122 left: 50%;
123 background: #fdfdfd;
124 padding: 10px 20px;
125 transform: translate(-50%, -50%);
126 font-size: 1.1em;
127 }
128
129 .rcbp-title-separator--light::after {
130 background: #fff;
131 }
132
133 .rcbp-pricing-premium-content {
134 pointer-events: none;
135 opacity: .5;
136 }
137 .rcbp-pricing-rule-form__premium-version-warning p {
138 margin: 2px 0 !important;
139 }
140
141 .rcbp-pricing-rule-form .rcbp-pricing-rule-form__pricing-type-label {
142 width: auto;
143 float: none;
144 margin: 0 15px 0 5px;
145 }
146
147 .rcbp-pricing-rule-form__flat-prices-warning {
148 display: none;
149 }
150
151 .rcbp-pricing-rule-block--simple .rcbp-pricing-rule-form input[type=text], .rcbp-pricing-rule-block--simple .rcbp-pricing-rule-form input[type=number] {
152 width: 80% !important;
153 }
154
155 .rcbp-pricing-rule-block--variable .rcbp-pricing-rule-form input[type=text], .rcbp-pricing-rule-block--variable .rcbp-pricing-rule-form input[type=number] {
156 width: 80% !important;
157 }
158
159 .rcbp-pricing-rule-block--variation .rcbp-pricing-rule-form__pricing-type > p > label:first-child {
160 display: block;
161 margin-bottom: 5px;
162 }
163
164 .rcbp-pricing-rule-block--global .rcbp-pricing-rule-form__pricing-type > p > label:first-child {
165 display: block;
166 margin-bottom: 5px;
167 }
168
169 .rcbp-pricing-rule-block--global .rcbp-title-separator::after {
170 background: #fff;
171 }
172
173 .rcbp-pricing-rule-block--global .rcbp-pricing-rule-form__flat-prices-warning {
174 display: block;
175 }
176
177 .post-type-rcbp-rule .column-is_valid {
178 vertical-align: middle;
179 width: 25px;
180 }
181
182 .post-type-rcbp-rule #misc-publishing-actions {
183 display: none;
184 }
185
186 .post-type-rcbp-rule .column-status {
187 width: 14ch;
188 }
189
190 .rcbp-rule-suspend-status {
191 display: inline-flex;
192 line-height: 2.5em;
193 color: #777;
194 background: #e5e5e5;
195 border-radius: 4px;
196 border-bottom: 1px solid rgba(0, 0, 0, .05);
197 margin: -.25em 0;
198 cursor: inherit !important;
199 white-space: nowrap;
200 max-width: 100%;
201 }
202
203 .rcbp-rule-suspend-status span {
204 margin: 0 1em;
205 overflow: hidden;
206 text-overflow: ellipsis;
207 }
208
209 .rcbp-rule-suspend-status--active {
210 background: #c6e1c6;
211 color: #5b841b;
212 }
213
214 .rcbp-rule-suspend-status--suspended {
215 background: #f8dda7;
216 color: #94660c;
217 }
218
219 .rcbp-rule-status {
220 width: 20px;
221 height: 20px;
222 cursor: pointer;
223 border-radius: 50%;
224 color: #fff;
225 text-align: center;
226 }
227
228 .rcbp-rule-status--valid {
229 background: green;
230 }
231
232 .rcbp-rule-status--invalid {
233 background: #d63638;
234 }
235
236
237 /**
238 *******
239 SETTINGS
240 *******
241 **/
242
243
244 input[type="checkbox"].rcbp-toggle-switch {
245 opacity: 0;
246 position: absolute;
247 margin: 8px 0 0 16px;
248 }
249
250 input[type="checkbox"].rcbp-toggle-switch + label {
251 position: relative;
252 padding: 5px 0 0 50px;
253 line-height: 2.0em;
254 }
255
256 input[type="checkbox"].rcbp-toggle-switch + label:before {
257 content: "";
258 position: absolute;
259 display: block;
260 left: 0;
261 top: 0;
262 width: 44px;
263 height: 25px;
264 border-radius: 16px;
265 background: #fff;
266 border: 1px solid #d9d9d9;
267 -webkit-transition: all 0.3s;
268 transition: all 0.3s;
269 }
270
271 input[type="checkbox"].rcbp-toggle-switch + label:after {
272 content: "";
273 position: absolute;
274 display: block;
275 left: 5px;
276 top: 3px;
277 width: 20px;
278 height: 19px;
279 border-radius: 16px;
280 background: #fff;
281 border: 1px solid #d9d9d9;
282 -webkit-transition: all 0.3s;
283 transition: all 0.3s;
284 }
285
286 input[type="checkbox"].rcbp-toggle-switch:checked + label:after {
287 margin-left: 16px;
288 border-color: #935687;
289 }
290
291 input[type="checkbox"].rcbp-toggle-switch:checked + label:before {
292 background: #935687;
293 }
294
295 input[type="checkbox"].rcbp-toggle-switch + label > [data-rcbp-toggle-switch-on] {
296 display: none;
297 }
298
299 input[type="checkbox"].rcbp-toggle-switch:checked + label > [data-rcbp-toggle-switch-on] {
300 display: inline;
301 }
302
303 input[type="checkbox"].rcbp-toggle-switch:checked + label > [data-rcbp-toggle-switch-off] {
304 display: none;
305 }
306
307 .forminp-rcbp_template > div {
308 margin-top: -25px;
309 }
310
311 /****
312 ****
313 ***
314 ***
315 ***
316 ***
317 ***
318 */
319
320 /** Buttons **/
321 .rcbp-button {
322 display: inline-block;
323 margin-left: 5px;
324 text-decoration: none;
325 font-weight: bold;
326 padding: 10px 20px;
327 color: #fff;
328 transition: .3s all;
329 }
330
331 .rcbp-button:focus, .rcbp-button:focus {
332 outline: none;
333 color: #fff;
334 }
335
336 .rcbp-button--default {
337 background: #3D4C53;
338 color: #fff;
339 }
340
341 .rcbp-button--default:hover {
342 background-color: #4a5b63;
343 color: #fff;
344 }
345
346 .rcbp-button--accent {
347
348 background: #08a6a6;
349 color: #fff;
350 }
351
352 .rcbp-button--accent:hover {
353 background-color: #51cece;
354 color: #fff;
355 }
356
357 .rcbp-button--bounce {
358 animation: rcbp-bounce-animation 2s infinite;
359 -webkit-animation: rcbp-bounce-animation 2s infinite;
360 -moz-animation: rcbp-bounce-animation 2s infinite;
361 }
362
363 .rcbp-button--bounce:hover, .rcbp-button--bounce:active, .rcbp-button--bounce:focus {
364 animation: none;
365 -webkit-animation: none;
366 -moz-animation: none;
367 }
368
369 /** Alert **/
370
371 .rcbp-alert {
372 display: flex;
373 flex-wrap: wrap;
374 padding: 15px;
375 margin: 20px 0;
376 background: #fff;
377 box-shadow: 0 5px 10px rgba(61, 76, 83, 0.15);
378 color: #3D4C53;
379 border: 1px solid rgba(61, 76, 83, 0.26);
380 }
381
382 .rcbp-alert__icon {
383 width: 40px;
384 height: 40px;
385 margin-right: 10px;
386 fill: #3D4C53;
387 }
388
389 .rcbp-alert__text {
390 font-size: 15px;
391 font-weight: bold;
392 display: flex;
393 justify-content: center;
394 align-items: center;
395 }
396
397 .rcbp-alert__buttons {
398 margin-left: auto;
399 display: flex;
400 justify-content: center;
401 align-items: center;
402 }
403
404 @media (max-width: 1200px) {
405 .rcbp-alert__icon {
406 width: 70px;
407 height: 70px;
408 display: block;
409 margin: 0 auto;
410 margin-bottom: 10px;
411 }
412
413 .rcbp-alert__buttons {
414 flex: 1 0 100%;
415 }
416
417 .rcbp-alert__text {
418 margin-bottom: 20px;
419 flex: 1 0 100%;
420 line-height: 1;
421 }
422
423 .rcbp-alert {
424 text-align: center;
425 }
426 }
427
428 /** Animation **/
429
430 @-webkit-keyframes rcbp-bounce-animation {
431 0%, 20%, 50%, 80%, 100% {
432 -webkit-transform: translateY(0);
433 }
434 40% {
435 -webkit-transform: translateY(-5px);
436 }
437 60% {
438 -webkit-transform: translateY(-2px);
439 }
440 }
441
442 @-moz-keyframes rcbp-bounce-animation {
443 0%, 20%, 50%, 80%, 100% {
444 -moz-transform: translateY(0);
445 }
446 40% {
447 -moz-transform: translateY(-5px);
448 }
449 60% {
450 -moz-transform: translateY(-2px);
451 }
452 }
453
454 @-o-keyframes rcbp-bounce-animation {
455 0%, 20%, 50%, 80%, 100% {
456 -o-transform: translateY(0);
457 }
458 40% {
459 -o-transform: translateY(-5px);
460 }
461 60% {
462 -o-transform: translateY(-2px);
463 }
464 }
465
466 @keyframes rcbp-bounce-animation {
467 0%, 20%, 50%, 80%, 100% {
468 transform: translateY(0);
469 }
470 40% {
471 transform: translateY(-5px);
472 }
473 60% {
474 transform: translateY(-2px);
475 }
476 }
...\ No newline at end of file ...\ No newline at end of file
1 label.fs-tag,span.fs-tag{background:#ffba00;color:#fff;display:inline-block;border-radius:3px;padding:5px;font-size:11px;line-height:11px;vertical-align:baseline}label.fs-tag.fs-warn,span.fs-tag.fs-warn{background:#ffba00}label.fs-tag.fs-info,span.fs-tag.fs-info{background:#00a0d2}label.fs-tag.fs-success,span.fs-tag.fs-success{background:#46b450}label.fs-tag.fs-error,span.fs-tag.fs-error{background:#dc3232}.fs-notice[data-id="license_not_whitelabeled"].success,.fs-notice[data-id="license_whitelabeled"].success{color:inherit;border-left-color:#00a0d2}.fs-notice[data-id="license_not_whitelabeled"].success label.fs-plugin-title,.fs-notice[data-id="license_whitelabeled"].success label.fs-plugin-title{display:none}#fs_account .postbox,#fs_account .widefat{max-width:800px}#fs_account h3{font-size:1.3em;padding:12px 15px;margin:0 0 12px 0;line-height:1.4;border-bottom:1px solid #F1F1F1}#fs_account h3 .dashicons{width:26px;height:26px;font-size:1.3em}#fs_account i.dashicons{font-size:1.2em;height:1.2em;width:1.2em}#fs_account .dashicons{vertical-align:middle}#fs_account .fs-header-actions{position:absolute;top:17px;right:15px;font-size:0.9em}#fs_account .fs-header-actions ul{margin:0}#fs_account .fs-header-actions li{float:left}#fs_account .fs-header-actions li form{display:inline-block}#fs_account .fs-header-actions li a{text-decoration:none}#fs_account_details .button-group{float:right}.rtl #fs_account .fs-header-actions{left:15px;right:auto}.fs-key-value-table{width:100%}.fs-key-value-table form{display:inline-block}.fs-key-value-table tr td:first-child{text-align:right}.fs-key-value-table tr td:first-child nobr{font-weight:bold}.fs-key-value-table tr td:first-child form{display:block}.fs-key-value-table tr td.fs-right{text-align:right}.fs-key-value-table tr.fs-odd{background:#ebebeb}.fs-key-value-table td,.fs-key-value-table th{padding:10px}.fs-key-value-table code{line-height:28px}.fs-key-value-table var,.fs-key-value-table code,.fs-key-value-table input[type="text"]{color:#0073AA;font-size:16px;background:none}.fs-key-value-table input[type="text"]{width:100%;font-weight:bold}.fs-field-beta_program label{margin-left:7px}label.fs-tag{background:#ffba00;color:#fff;display:inline-block;border-radius:3px;padding:5px;font-size:11px;line-height:11px;vertical-align:baseline}label.fs-tag.fs-warn{background:#ffba00}label.fs-tag.fs-success{background:#46b450}label.fs-tag.fs-error{background:#dc3232}#fs_sites .fs-scrollable-table .fs-table-body{max-height:200px;overflow:auto;border:1px solid #e5e5e5}#fs_sites .fs-scrollable-table .fs-table-body>table.widefat{border:none !important}#fs_sites .fs-scrollable-table .fs-main-column{width:100%}#fs_sites .fs-scrollable-table .fs-site-details td:first-of-type{text-align:right;color:grey;width:1px}#fs_sites .fs-scrollable-table .fs-site-details td:last-of-type{text-align:right}#fs_sites .fs-scrollable-table .fs-install-details table tr td{width:1px;white-space:nowrap}#fs_sites .fs-scrollable-table .fs-install-details table tr td:last-of-type{width:auto}#fs_addons h3{border:none;margin-bottom:0;padding:4px 5px}#fs_addons td{vertical-align:middle}#fs_addons thead{white-space:nowrap}#fs_addons td:first-child,#fs_addons th:first-child{text-align:left;font-weight:bold}#fs_addons td:last-child,#fs_addons th:last-child{text-align:right}#fs_addons th{font-weight:bold}#fs_billing_address{width:100%}#fs_billing_address tr td{width:50%;padding:5px}#fs_billing_address tr:first-of-type td{padding-top:0}#fs_billing_address span{font-weight:bold}#fs_billing_address input,#fs_billing_address select{display:block;width:100%;margin-top:5px}#fs_billing_address input::-moz-placeholder,#fs_billing_address select::-moz-placeholder{color:transparent;opacity:1}#fs_billing_address input:-ms-input-placeholder,#fs_billing_address select:-ms-input-placeholder{color:transparent}#fs_billing_address input::-webkit-input-placeholder,#fs_billing_address select::-webkit-input-placeholder{color:transparent}#fs_billing_address input.fs-read-mode,#fs_billing_address select.fs-read-mode{border-color:transparent;color:#777;border-bottom:1px dashed #ccc;padding-left:0;background:none}#fs_billing_address.fs-read-mode td span{display:none}#fs_billing_address.fs-read-mode input,#fs_billing_address.fs-read-mode select{border-color:transparent;color:#777;border-bottom:1px dashed #ccc;padding-left:0;background:none}#fs_billing_address.fs-read-mode input::-moz-placeholder,#fs_billing_address.fs-read-mode select::-moz-placeholder{color:#ccc;opacity:1}#fs_billing_address.fs-read-mode input:-ms-input-placeholder,#fs_billing_address.fs-read-mode select:-ms-input-placeholder{color:#ccc}#fs_billing_address.fs-read-mode input::-webkit-input-placeholder,#fs_billing_address.fs-read-mode select::-webkit-input-placeholder{color:#ccc}#fs_billing_address button{display:block;width:100%}
1 @charset "UTF-8";#fs_affiliation_content_wrapper #messages{margin-top:25px}#fs_affiliation_content_wrapper h3{font-size:24px;padding:0;margin-left:0}#fs_affiliation_content_wrapper ul li{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;list-style-type:none}#fs_affiliation_content_wrapper ul li:before{content:'✓';margin-right:10px;font-weight:bold}#fs_affiliation_content_wrapper p:not(.description),#fs_affiliation_content_wrapper li,#fs_affiliation_content_wrapper label{font-size:16px !important;line-height:26px !important}#fs_affiliation_content_wrapper .button{margin-top:20px;margin-bottom:7px;line-height:35px;height:40px;font-size:16px}#fs_affiliation_content_wrapper .button#cancel_button{margin-right:5px}#fs_affiliation_content_wrapper form .input-container{margin-bottom:15px}#fs_affiliation_content_wrapper form .input-container .input-label{font-weight:bold;display:block;width:100%}#fs_affiliation_content_wrapper form .input-container.input-container-text label,#fs_affiliation_content_wrapper form .input-container.input-container-text input,#fs_affiliation_content_wrapper form .input-container.input-container-text textarea{display:block}#fs_affiliation_content_wrapper form .input-container #add_domain,#fs_affiliation_content_wrapper form .input-container .remove-domain{text-decoration:none;display:inline-block;margin-top:3px}#fs_affiliation_content_wrapper form .input-container #add_domain:focus,#fs_affiliation_content_wrapper form .input-container .remove-domain:focus{box-shadow:none}#fs_affiliation_content_wrapper form .input-container #add_domain.disabled,#fs_affiliation_content_wrapper form .input-container .remove-domain.disabled{color:#aaa;cursor:default}#fs_affiliation_content_wrapper form #extra_domains_container .description{margin-top:0;position:relative;top:-4px}#fs_affiliation_content_wrapper form #extra_domains_container .extra-domain-input-container{margin-bottom:15px}#fs_affiliation_content_wrapper form #extra_domains_container .extra-domain-input-container .domain{display:inline-block;margin-right:5px}#fs_affiliation_content_wrapper form #extra_domains_container .extra-domain-input-container .domain:last-of-type{margin-bottom:0}
1 @media screen and (max-width: 782px){#wpbody-content{padding-bottom:0 !important}}
1 .fs-badge{position:absolute;top:10px;right:0;background:#71ae00;color:white;text-transform:uppercase;padding:5px 10px;-moz-border-radius:3px 0 0 3px;-webkit-border-radius:3px 0 0 3px;border-radius:3px 0 0 3px;font-weight:bold;border-right:0;-moz-box-shadow:0 2px 1px -1px rgba(0,0,0,0.3);-webkit-box-shadow:0 2px 1px -1px rgba(0,0,0,0.3);box-shadow:0 2px 1px -1px rgba(0,0,0,0.3)}.theme-browser .theme .fs-premium-theme-badge-container{position:absolute;right:0;top:0}.theme-browser .theme .fs-premium-theme-badge-container .fs-badge{position:relative;top:0;margin-top:10px;text-align:center}.theme-browser .theme .fs-premium-theme-badge-container .fs-badge.fs-premium-theme-badge{font-size:1.1em}.theme-browser .theme .fs-premium-theme-badge-container .fs-badge.fs-beta-theme-badge{background:#00a0d2}.fs-switch{position:relative;display:inline-block;color:#ccc;text-shadow:0 1px 1px rgba(255,255,255,0.8);height:18px;padding:6px 6px 5px 6px;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.2);background:#ececec;box-shadow:0 0 4px rgba(0,0,0,0.1),inset 0 1px 3px 0 rgba(0,0,0,0.1);cursor:pointer}.fs-switch span{display:inline-block;width:35px;text-transform:uppercase}.fs-switch .fs-toggle{position:absolute;top:1px;width:37px;height:25px;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.3);border-radius:4px;background:#fff;background-color:#fff;background-image:-webkit-gradient(linear, left top, left bottom, color-stop(0, #ececec), color-stop(1, #fff));background-image:-webkit-linear-gradient(top, #ececec, #fff);background-image:-moz-linear-gradient(top, #ececec, #fff);background-image:-ms-linear-gradient(top, #ececec, #fff);background-image:-o-linear-gradient(top, #ececec, #fff);background-image:linear-gradient(top, bottom, #ececec, #fff);box-shadow:inset 0 1px 0 0 rgba(255,255,255,0.5);z-index:999;-moz-transition:0.4s cubic-bezier(0.54, 1.6, 0.5, 1);-o-transition:0.4s cubic-bezier(0.54, 1.6, 0.5, 1);-ms-transition:0.4s cubic-bezier(0.54, 1.6, 0.5, 1);-webkit-transition:0.4s cubic-bezier(0.54, 1.6, 0.5, 1);transition:0.4s cubic-bezier(0.54, 1.6, 0.5, 1)}.fs-switch.fs-off .fs-toggle{left:2%}.fs-switch.fs-on .fs-toggle{left:54%}.fs-switch.fs-round{top:8px;padding:4px 25px;-moz-border-radius:24px;-webkit-border-radius:24px;border-radius:24px}.fs-switch.fs-round .fs-toggle{top:0;width:24px;height:24px;-moz-border-radius:24px;-webkit-border-radius:24px;border-radius:24px}.fs-switch.fs-round.fs-off .fs-toggle{left:-1px}.fs-switch.fs-round.fs-on{background:#0085ba}.fs-switch.fs-round.fs-on .fs-toggle{left:25px}.fs-switch.fs-small.fs-round{padding:1px 19px}.fs-switch.fs-small.fs-round .fs-toggle{top:0;width:18px;height:18px;-moz-border-radius:18px;-webkit-border-radius:18px;border-radius:18px}.fs-switch.fs-small.fs-round.fs-on .fs-toggle{left:19px}.fs-switch-feedback{margin-left:10px}.fs-switch-feedback.success{color:#71ae00}.rtl .fs-switch-feedback{margin-left:0;margin-right:10px}#fs_frame{line-height:0;font-size:0}.fs-full-size-wrapper{margin:40px 0 -65px -20px}@media (max-width: 600px){.fs-full-size-wrapper{margin:0 0 -65px -10px}}
2 .fs-notice{position:relative}.fs-notice.fs-has-title{margin-bottom:30px !important}.fs-notice.success{color:green}.fs-notice.promotion{border-color:#00a0d2 !important;background-color:#f2fcff !important}.fs-notice .fs-notice-body{margin:.5em 0;padding:2px}.fs-notice .fs-close{cursor:pointer;color:#aaa;float:right}.fs-notice .fs-close:hover{color:#666}.fs-notice .fs-close>*{margin-top:7px;display:inline-block}.fs-notice label.fs-plugin-title{background:rgba(0,0,0,0.3);color:#fff;padding:2px 10px;position:absolute;top:100%;bottom:auto;right:auto;-moz-border-radius:0 0 3px 3px;-webkit-border-radius:0 0 3px 3px;border-radius:0 0 3px 3px;left:10px;font-size:12px;font-weight:bold;cursor:auto}div.fs-notice.updated,div.fs-notice.success,div.fs-notice.promotion{display:block !important}.rtl .fs-notice .fs-close{float:left}.fs-secure-notice{position:fixed;top:32px;left:160px;right:0;background:#ebfdeb;padding:10px 20px;color:green;z-index:9999;-moz-box-shadow:0 2px 2px rgba(6,113,6,0.3);-webkit-box-shadow:0 2px 2px rgba(6,113,6,0.3);box-shadow:0 2px 2px rgba(6,113,6,0.3);opacity:0.95;filter:alpha(opacity=95)}.fs-secure-notice:hover{opacity:1;filter:alpha(opacity=100)}.fs-secure-notice a.fs-security-proof{color:green;text-decoration:none}@media screen and (max-width: 960px){.fs-secure-notice{left:36px}}@media screen and (max-width: 600px){.fs-secure-notice{display:none}}@media screen and (max-width: 1250px){#fs_promo_tab{display:none}}@media screen and (max-width: 782px){.fs-secure-notice{left:0;top:46px;text-align:center}}span.fs-submenu-item.fs-sub:before{content:'\21B3';padding:0 5px}.rtl span.fs-submenu-item.fs-sub:before{content:'\21B2'}.fs-submenu-item.pricing.upgrade-mode{color:greenyellow}.fs-submenu-item.pricing.trial-mode{color:#83e2ff}#adminmenu .update-plugins.fs-trial{background-color:#00b9eb}.fs-ajax-spinner{border:0;width:20px;height:20px;margin-right:5px;vertical-align:sub;display:inline-block;background:url("/wp-admin/images/wpspin_light-2x.gif");background-size:contain;margin-bottom:-2px}.wrap.fs-section h2{text-align:left}.plugins p.fs-upgrade-notice{border:0;background-color:#d54e21;padding:10px;color:#f9f9f9;margin-top:10px}
1 #fs_connect{width:480px;-moz-box-shadow:0px 1px 2px rgba(0,0,0,0.3);-webkit-box-shadow:0px 1px 2px rgba(0,0,0,0.3);box-shadow:0px 1px 2px rgba(0,0,0,0.3);margin:20px 0}@media screen and (max-width: 479px){#fs_connect{-moz-box-shadow:none;-webkit-box-shadow:none;box-shadow:none;width:auto;margin:0 0 0 -10px}}#fs_connect .fs-content{background:#fff;padding:15px 20px}#fs_connect .fs-content .fs-error{background:snow;color:#d3135a;border:1px solid #d3135a;-moz-box-shadow:0 1px 1px 0 rgba(0,0,0,0.1);-webkit-box-shadow:0 1px 1px 0 rgba(0,0,0,0.1);box-shadow:0 1px 1px 0 rgba(0,0,0,0.1);text-align:center;padding:5px;margin-bottom:10px}#fs_connect .fs-content p{margin:0;padding:0;font-size:1.2em}#fs_connect .fs-license-key-container{position:relative;width:280px;margin:10px auto 0 auto}#fs_connect .fs-license-key-container input{width:100%}#fs_connect .fs-license-key-container .dashicons{position:absolute;top:5px;right:5px}#fs_connect.require-license-key .fs-sites-list-container td{cursor:pointer}#fs_connect #delegate_to_site_admins{margin-right:15px;float:right;height:26px;vertical-align:middle;line-height:37px;font-weight:bold;border-bottom:1px dashed;text-decoration:none}#fs_connect #delegate_to_site_admins.rtl{margin-left:15px;margin-right:0}#fs_connect .fs-actions{padding:10px 20px;background:#C0C7CA}#fs_connect .fs-actions .button{padding:0 10px 1px;line-height:35px;height:37px;font-size:16px;margin-bottom:0}#fs_connect .fs-actions .button .dashicons{font-size:37px;margin-left:-8px;margin-right:12px}#fs_connect .fs-actions .button.button-primary{padding-right:15px;padding-left:15px}#fs_connect .fs-actions .button.button-primary:after{content:' \279C'}#fs_connect .fs-actions .button.button-primary.fs-loading:after{content:''}#fs_connect .fs-actions .button.button-secondary{float:right}#fs_connect.fs-anonymous-disabled .fs-actions .button.button-primary{width:100%}#fs_connect .fs-permissions{padding:10px 20px;background:#FEFEFE;-moz-transition:background 0.5s ease;-o-transition:background 0.5s ease;-ms-transition:background 0.5s ease;-webkit-transition:background 0.5s ease;transition:background 0.5s ease}#fs_connect .fs-permissions .fs-license-sync-disclaimer{text-align:center;margin-top:0}#fs_connect .fs-permissions>.fs-trigger{font-size:0.9em;text-decoration:none;text-align:center;display:block}#fs_connect .fs-permissions ul{height:0;overflow:hidden;margin:0}#fs_connect .fs-permissions ul li{margin-bottom:12px}#fs_connect .fs-permissions ul li:last-child{margin-bottom:0}#fs_connect .fs-permissions ul li>i.dashicons{float:left;font-size:40px;width:40px;height:40px}#fs_connect .fs-permissions ul li .fs-switch{float:right}#fs_connect .fs-permissions ul li .fs-permission-description{margin-left:55px}#fs_connect .fs-permissions ul li .fs-permission-description span{font-weight:bold;text-transform:uppercase;color:#23282d}#fs_connect .fs-permissions ul li .fs-permission-description p{margin:2px 0 0 0}#fs_connect .fs-permissions.fs-open{background:#fff}#fs_connect .fs-permissions.fs-open ul{overflow:initial;height:auto;margin:20px 20px 10px 20px}@media screen and (max-width: 479px){#fs_connect .fs-permissions{background:#fff}#fs_connect .fs-permissions .fs-trigger{display:none}#fs_connect .fs-permissions ul{height:auto;margin:20px}}#fs_connect .fs-freemium-licensing{padding:8px;background:#777;color:#fff}#fs_connect .fs-freemium-licensing p{text-align:center;display:block;margin:0;padding:0}#fs_connect .fs-freemium-licensing a{color:#C2EEFF;text-decoration:underline}#fs_connect .fs-visual{padding:12px;line-height:0;background:#fafafa;height:80px;position:relative}#fs_connect .fs-visual .fs-site-icon{position:absolute;left:20px;top:10px}#fs_connect .fs-visual .fs-connect-logo{position:absolute;right:20px;top:10px}#fs_connect .fs-visual .fs-plugin-icon{position:absolute;top:10px;left:50%;margin-left:-40px}#fs_connect .fs-visual .fs-plugin-icon,#fs_connect .fs-visual .fs-site-icon,#fs_connect .fs-visual img,#fs_connect .fs-visual object{width:80px;height:80px}#fs_connect .fs-visual .dashicons-wordpress{font-size:64px;background:#01749a;color:#fff;width:64px;height:64px;padding:8px}#fs_connect .fs-visual .dashicons-plus{position:absolute;top:50%;font-size:30px;margin-top:-10px;color:#bbb}#fs_connect .fs-visual .dashicons-plus.fs-first{left:28%}#fs_connect .fs-visual .dashicons-plus.fs-second{left:65%}#fs_connect .fs-visual .fs-plugin-icon,#fs_connect .fs-visual .fs-connect-logo,#fs_connect .fs-visual .fs-site-icon{border:1px solid #ccc;padding:1px;background:#fff}#fs_connect .fs-terms{text-align:center;font-size:0.85em;padding:5px;background:rgba(0,0,0,0.05)}#fs_connect .fs-terms,#fs_connect .fs-terms a{color:#999}#fs_connect .fs-terms a{text-decoration:none}.fs-multisite-options-container{margin-top:10px;border:1px solid #ccc;padding:5px}.fs-multisite-options-container a{text-decoration:none}.fs-multisite-options-container a:focus{box-shadow:none}.fs-multisite-options-container a.selected{font-weight:bold}.fs-multisite-options-container.fs-apply-on-all-sites{border:0 none;padding:0}.fs-multisite-options-container.fs-apply-on-all-sites .fs-all-sites-options{border-spacing:0}.fs-multisite-options-container.fs-apply-on-all-sites .fs-all-sites-options td:not(:first-child){display:none}.fs-multisite-options-container .fs-sites-list-container{display:none;overflow:auto}.fs-multisite-options-container .fs-sites-list-container table td{border-top:1px solid #ccc;padding:4px 2px}.fs-tooltip-trigger{position:relative}.fs-tooltip-trigger:not(a){cursor:help}.fs-tooltip-trigger .fs-tooltip{opacity:0;visibility:hidden;-moz-transition:opacity 0.3s ease-in-out;-o-transition:opacity 0.3s ease-in-out;-ms-transition:opacity 0.3s ease-in-out;-webkit-transition:opacity 0.3s ease-in-out;transition:opacity 0.3s ease-in-out;position:absolute;background:rgba(0,0,0,0.8);color:#fff !important;font-family:'arial', serif;font-size:12px;padding:10px;z-index:999999;bottom:100%;margin-bottom:5px;left:-17px;right:0;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;-moz-box-shadow:1px 1px 1px rgba(0,0,0,0.2);-webkit-box-shadow:1px 1px 1px rgba(0,0,0,0.2);box-shadow:1px 1px 1px rgba(0,0,0,0.2);line-height:1.3em;font-weight:bold;text-align:left;text-transform:none !important}.rtl .fs-tooltip-trigger .fs-tooltip{text-align:right;left:auto;right:-17px}.fs-tooltip-trigger .fs-tooltip::after{content:' ';display:block;width:0;height:0;border-style:solid;border-width:5px 5px 0 5px;border-color:rgba(0,0,0,0.8) transparent transparent transparent;position:absolute;top:100%;left:21px}.rtl .fs-tooltip-trigger .fs-tooltip::after{right:21px;left:auto}.fs-tooltip-trigger:hover .fs-tooltip{visibility:visible;opacity:1}#fs_marketing_optin{display:none;margin-top:10px;border:1px solid #ccc;padding:10px;line-height:1.5em}#fs_marketing_optin .fs-message{display:block;margin-bottom:5px;font-size:1.05em;font-weight:600}#fs_marketing_optin.error{border:1px solid #d3135a;background:#fee}#fs_marketing_optin.error .fs-message{color:#d3135a}#fs_marketing_optin .fs-input-container{margin-top:5px}#fs_marketing_optin .fs-input-container label{margin-top:5px;display:block}#fs_marketing_optin .fs-input-container label input{float:left;margin:1px 0 0 0}#fs_marketing_optin .fs-input-container label:first-child{display:block;margin-bottom:2px}#fs_marketing_optin .fs-input-label{display:block;margin-left:20px}#fs_marketing_optin .fs-input-label .underlined{text-decoration:underline}.rtl #fs_marketing_optin .fs-input-container label input{float:right}.rtl #fs_marketing_optin .fs-input-label{margin-left:0;margin-right:20px}.rtl #fs_connect .fs-actions{padding:10px 20px;background:#C0C7CA}.rtl #fs_connect .fs-actions .button .dashicons{font-size:37px;margin-left:-8px;margin-right:12px}.rtl #fs_connect .fs-actions .button.button-primary:after{content:' \000bb'}.rtl #fs_connect .fs-actions .button.button-primary.fs-loading:after{content:''}.rtl #fs_connect .fs-actions .button.button-secondary{float:left}.rtl #fs_connect .fs-permissions ul li .fs-permission-description{margin-right:55px;margin-left:0}.rtl #fs_connect .fs-permissions ul li .fs-switch{float:left}.rtl #fs_connect .fs-permissions ul li i.dashicons{float:right}.rtl #fs_connect .fs-visual .fs-site-icon{right:20px;left:auto}.rtl #fs_connect .fs-visual .fs-connect-logo{right:auto;left:20px}#fs_theme_connect_wrapper{position:fixed;top:0;height:100%;width:100%;z-index:99990;background:rgba(0,0,0,0.75);text-align:center;overflow-y:auto}#fs_theme_connect_wrapper:before{content:"";display:inline-block;vertical-align:middle;height:100%}#fs_theme_connect_wrapper>button.close{color:white;cursor:pointer;height:40px;width:40px;position:absolute;right:0;border:0;background-color:transparent;top:32px}#fs_theme_connect_wrapper #fs_connect{top:0;text-align:left;display:inline-block;vertical-align:middle;margin-top:52px;margin-bottom:20px}#fs_theme_connect_wrapper #fs_connect .fs-terms{background:rgba(140,140,140,0.64)}#fs_theme_connect_wrapper #fs_connect .fs-terms,#fs_theme_connect_wrapper #fs_connect .fs-terms a{color:#c5c5c5}.wp-pointer-content #fs_connect{margin:0;-moz-box-shadow:none;-webkit-box-shadow:none;box-shadow:none}.fs-opt-in-pointer .wp-pointer-content{padding:0}.fs-opt-in-pointer.wp-pointer-top .wp-pointer-arrow{border-bottom-color:#dfdfdf}.fs-opt-in-pointer.wp-pointer-top .wp-pointer-arrow-inner{border-bottom-color:#fafafa}.fs-opt-in-pointer.wp-pointer-bottom .wp-pointer-arrow{border-top-color:#dfdfdf}.fs-opt-in-pointer.wp-pointer-bottom .wp-pointer-arrow-inner{border-top-color:#fafafa}.fs-opt-in-pointer.wp-pointer-left .wp-pointer-arrow{border-right-color:#dfdfdf}.fs-opt-in-pointer.wp-pointer-left .wp-pointer-arrow-inner{border-right-color:#fafafa}.fs-opt-in-pointer.wp-pointer-right .wp-pointer-arrow{border-left-color:#dfdfdf}.fs-opt-in-pointer.wp-pointer-right .wp-pointer-arrow-inner{border-left-color:#fafafa}#license_issues_link{display:block;text-align:center;font-size:0.9em;margin-top:10px}
1 .fs-switch-label{font-size:20px;line-height:31px;margin:0 5px}#fs_log_book table{font-family:Consolas,Monaco,monospace;font-size:12px}#fs_log_book table th{color:#ccc}#fs_log_book table tr{background:#232525}#fs_log_book table tr.alternate{background:#2b2b2b}#fs_log_book table tr td.fs-col--logger{color:#5a7435}#fs_log_book table tr td.fs-col--type{color:#ffc861}#fs_log_book table tr td.fs-col--function{color:#a7b7b1;font-weight:bold}#fs_log_book table tr td.fs-col--message,#fs_log_book table tr td.fs-col--message a{color:#9a73ac !important}#fs_log_book table tr td.fs-col--file{color:#d07922}#fs_log_book table tr td.fs-col--timestamp{color:#6596be}
1 .fs-notice[data-id^="gdpr_optin_actions"] .underlined{text-decoration:underline}.fs-notice[data-id^="gdpr_optin_actions"] ul .button,.fs-notice[data-id^="gdpr_optin_actions"] ul .action-description{vertical-align:middle}.fs-notice[data-id^="gdpr_optin_actions"] ul .action-description{display:inline-block;margin-left:3px}
1 <?php
2 // Silence is golden.
3 // Hide file structure from users on unprotected servers.
...\ No newline at end of file ...\ No newline at end of file
1 label.fs-tag,span.fs-tag{background:#ffba00;color:#fff;display:inline-block;border-radius:3px;padding:5px;font-size:11px;line-height:11px;vertical-align:baseline}label.fs-tag.fs-warn,span.fs-tag.fs-warn{background:#ffba00}label.fs-tag.fs-info,span.fs-tag.fs-info{background:#00a0d2}label.fs-tag.fs-success,span.fs-tag.fs-success{background:#46b450}label.fs-tag.fs-error,span.fs-tag.fs-error{background:#dc3232}.wp-list-table.plugins .plugin-title span.fs-tag{display:inline-block;margin-left:5px;line-height:10px}
1 #fs_customizer_upsell .fs-customizer-plan{padding:10px 20px 20px 20px;border-radius:3px;background:#fff}#fs_customizer_upsell .fs-customizer-plan h2{position:relative;margin:0;line-height:2em;text-transform:uppercase}#fs_customizer_upsell .fs-customizer-plan h2 .button-link{top:-2px}#fs_customizer_upsell .fs-feature{position:relative}#fs_customizer_upsell .dashicons-yes{color:#0085ba;font-size:2em;vertical-align:bottom;margin-left:-7px;margin-right:10px}.rtl #fs_customizer_upsell .dashicons-yes{margin-left:10px;margin-right:-7px}#fs_customizer_upsell .dashicons-editor-help{color:#bbb;cursor:help}#fs_customizer_upsell .dashicons-editor-help .fs-feature-desc{opacity:0;visibility:hidden;-moz-transition:opacity 0.3s ease-in-out;-o-transition:opacity 0.3s ease-in-out;-ms-transition:opacity 0.3s ease-in-out;-webkit-transition:opacity 0.3s ease-in-out;transition:opacity 0.3s ease-in-out;position:absolute;background:#000;color:#fff;font-family:'arial', serif;font-size:12px;padding:10px;z-index:999999;bottom:100%;margin-bottom:5px;left:0;right:0;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;-moz-box-shadow:1px 1px 1px rgba(0,0,0,0.2);-webkit-box-shadow:1px 1px 1px rgba(0,0,0,0.2);box-shadow:1px 1px 1px rgba(0,0,0,0.2);line-height:1.3em;font-weight:bold;text-align:left}.rtl #fs_customizer_upsell .dashicons-editor-help .fs-feature-desc{text-align:right}#fs_customizer_upsell .dashicons-editor-help .fs-feature-desc::after{content:' ';display:block;width:0;height:0;border-style:solid;border-width:5px 5px 0 5px;border-color:#000 transparent transparent transparent;position:absolute;top:100%;left:21px}.rtl #fs_customizer_upsell .dashicons-editor-help .fs-feature-desc::after{right:21px;left:auto}#fs_customizer_upsell .dashicons-editor-help:hover .fs-feature-desc{visibility:visible;opacity:1}#fs_customizer_upsell .button-primary{display:block;text-align:center;margin-top:10px}#fs_customizer_support{display:block !important}#fs_customizer_support .button{float:right}#fs_customizer_support .button-group{width:100%;display:block;margin-top:10px}#fs_customizer_support .button-group .button{float:none;width:50%;text-align:center}#customize-theme-controls #accordion-section-freemius_upsell{border-top:1px solid #0085ba !important;border-bottom:1px solid #0085ba !important}#customize-theme-controls #accordion-section-freemius_upsell h3.accordion-section-title{color:#fff;background-color:#0085ba;border-left:4px solid #0085ba;transition:.15s background-color ease-in-out, .15s border-color ease-in-out;outline:none;border-bottom:none !important}#customize-theme-controls #accordion-section-freemius_upsell h3.accordion-section-title:hover{background-color:#008ec2;border-left-color:#0073aa}#customize-theme-controls #accordion-section-freemius_upsell h3.accordion-section-title:after{color:#fff}#customize-theme-controls #accordion-section-freemius_upsell .rtl h3.accordion-section-title{border-left:none;border-right:4px solid #0085ba}#customize-theme-controls #accordion-section-freemius_upsell .rtl h3.accordion-section-title:hover{border-right-color:#0073aa}
1 <?php
2 // Silence is golden.
3 // Hide file structure from users on unprotected servers.
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 // Silence is golden.
3 // Hide file structure from users on unprotected servers.
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 // Silence is golden.
3 // Hide file structure from users on unprotected servers.
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 // Silence is golden.
3 // Hide file structure from users on unprotected servers.
...\ No newline at end of file ...\ No newline at end of file
1 /*!
2 * jQuery postMessage - v0.5 - 9/11/2009
3 * http://benalman.com/projects/jquery-postmessage-plugin/
4 *
5 * Copyright (c) 2009 "Cowboy" Ben Alman
6 * Dual licensed under the MIT and GPL licenses.
7 * http://benalman.com/about/license/
8 *
9 * Non-jQuery fork by Jeff Lee
10 *
11 * This fork consists of the following changes:
12 * 1. Basic code cleanup and restructuring, for legibility.
13 * 2. The `postMessage` and `receiveMessage` functions can be bound arbitrarily,
14 * in terms of both function names and object scope. Scope is specified by
15 * the the "this" context of NoJQueryPostMessageMixin();
16 * 3. I've removed the check for Opera 9.64, which used `$.browser`. There were
17 * at least three different GitHub users requesting the removal of this
18 * "Opera sniff" on the original project's Issues page, so I figured this
19 * would be a relatively safe change.
20 * 4. `postMessage` no longer uses `$.param` to serialize messages that are not
21 * strings. I actually prefer this structure anyway. `receiveMessage` does
22 * not implement a corresponding deserialization step, and as such it seems
23 * cleaner and more symmetric to leave both data serialization and
24 * deserialization to the client.
25 * 5. The use of `$.isFunction` is replaced by a functionally-identical check.
26 * 6. The `$:nomunge` YUI option is no longer necessary.
27 */
28
29 function NoJQueryPostMessageMixin(postBinding, receiveBinding) {
30
31 var setMessageCallback, unsetMessageCallback, currentMsgCallback,
32 intervalId, lastHash, cacheBust = 1;
33
34 if (window.postMessage) {
35
36 if (window.addEventListener) {
37 setMessageCallback = function(callback) {
38 window.addEventListener('message', callback, false);
39 }
40
41 unsetMessageCallback = function(callback) {
42 window.removeEventListener('message', callback, false);
43 }
44 } else {
45 setMessageCallback = function(callback) {
46 window.attachEvent('onmessage', callback);
47 }
48
49 unsetMessageCallback = function(callback) {
50 window.detachEvent('onmessage', callback);
51 }
52 }
53
54 this[postBinding] = function(message, targetUrl, target) {
55 if (!targetUrl) {
56 return;
57 }
58
59 // The browser supports window.postMessage, so call it with a targetOrigin
60 // set appropriately, based on the targetUrl parameter.
61 target.postMessage( message, targetUrl.replace( /([^:]+:\/\/[^\/]+).*/, '$1' ) );
62 }
63
64 // Since the browser supports window.postMessage, the callback will be
65 // bound to the actual event associated with window.postMessage.
66 this[receiveBinding] = function(callback, sourceOrigin, delay) {
67 // Unbind an existing callback if it exists.
68 if (currentMsgCallback) {
69 unsetMessageCallback(currentMsgCallback);
70 currentMsgCallback = null;
71 }
72
73 if (!callback) {
74 return false;
75 }
76
77 // Bind the callback. A reference to the callback is stored for ease of
78 // unbinding.
79 currentMsgCallback = setMessageCallback(function(e) {
80 switch(Object.prototype.toString.call(sourceOrigin)) {
81 case '[object String]':
82 if (sourceOrigin !== e.origin) {
83 return false;
84 }
85 break;
86 case '[object Function]':
87 if (sourceOrigin(e.origin)) {
88 return false;
89 }
90 break;
91 }
92
93 callback(e);
94 });
95 };
96
97 } else {
98
99 this[postBinding] = function(message, targetUrl, target) {
100 if (!targetUrl) {
101 return;
102 }
103
104 // The browser does not support window.postMessage, so set the location
105 // of the target to targetUrl#message. A bit ugly, but it works! A cache
106 // bust parameter is added to ensure that repeat messages trigger the
107 // callback.
108 target.location = targetUrl.replace( /#.*$/, '' ) + '#' + (+new Date) + (cacheBust++) + '&' + message;
109 }
110
111 // Since the browser sucks, a polling loop will be started, and the
112 // callback will be called whenever the location.hash changes.
113 this[receiveBinding] = function(callback, sourceOrigin, delay) {
114 if (intervalId) {
115 clearInterval(intervalId);
116 intervalId = null;
117 }
118
119 if (callback) {
120 delay = typeof sourceOrigin === 'number'
121 ? sourceOrigin
122 : typeof delay === 'number'
123 ? delay
124 : 100;
125
126 intervalId = setInterval(function(){
127 var hash = document.location.hash,
128 re = /^#?\d+&/;
129 if ( hash !== lastHash && re.test( hash ) ) {
130 lastHash = hash;
131 callback({ data: hash.replace( re, '' ) });
132 }
133 }, delay );
134 }
135 };
136
137 }
138
139 return this;
140 }
...\ No newline at end of file ...\ No newline at end of file
1 /*
2 * nojquery-postmessage by Jeff Lee
3 * a non-jQuery fork of:
4 *
5 * jQuery postMessage - v0.5 - 9/11/2009
6 * http://benalman.com/projects/jquery-postmessage-plugin/
7 *
8 * Copyright (c) 2009 "Cowboy" Ben Alman
9 * Dual licensed under the MIT and GPL licenses.
10 * http://benalman.com/about/license/
11 */
12 function NoJQueryPostMessageMixin(g,a){var b,h,e,d,f,c=1;if(window.postMessage){if(window.addEventListener){b=function(i){window.addEventListener("message",i,false)};h=function(i){window.removeEventListener("message",i,false)}}else{b=function(i){window.attachEvent("onmessage",i)};h=function(i){window.detachEvent("onmessage",i)}}this[g]=function(i,k,j){if(!k){return}j.postMessage(i,k.replace(/([^:]+:\/\/[^\/]+).*/,"$1"))};this[a]=function(k,j,i){if(e){h(e);e=null}if(!k){return false}e=b(function(l){switch(Object.prototype.toString.call(j)){case"[object String]":if(j!==l.origin){return false}break;case"[object Function]":if(j(l.origin)){return false}break}k(l)})}}else{this[g]=function(i,k,j){if(!k){return}j.location=k.replace(/#.*$/,"")+"#"+(+new Date)+(c++)+"&"+i};this[a]=function(k,j,i){if(d){clearInterval(d);d=null}if(k){i=typeof j==="number"?j:typeof i==="number"?i:100;d=setInterval(function(){var m=document.location.hash,l=/^#?\d+&/;if(m!==f&&l.test(m)){f=m;k({data:m.replace(l,"")})}},i)}}}return this};
...\ No newline at end of file ...\ No newline at end of file
1 (function ($, undef) {
2 var global = this;
3
4 // Namespace.
5 global.FS = global.FS || {};
6
7 global.FS.PostMessage = function ()
8 {
9 var
10 _is_child = false,
11 _postman = new NoJQueryPostMessageMixin('postMessage', 'receiveMessage'),
12 _callbacks = {},
13 _base_url,
14 _parent_url = decodeURIComponent(document.location.hash.replace(/^#/, '')),
15 _parent_subdomain = _parent_url.substring(0, _parent_url.indexOf('/', ('https://' === _parent_url.substring(0, ('https://').length)) ? 8 : 7)),
16 _init = function () {
17 _postman.receiveMessage(function (e) {
18 var data = JSON.parse(e.data);
19
20 if (_callbacks[data.type]) {
21 for (var i = 0; i < _callbacks[data.type].length; i++) {
22 // Execute type callbacks.
23 _callbacks[data.type][i](data.data);
24 }
25 }
26 }, _base_url);
27 },
28 _hasParent = ('' !== _parent_url),
29 $window = $(window),
30 $html = $('html');
31
32 return {
33 init : function (url, iframes)
34 {
35 _base_url = url;
36 _init();
37
38 // Automatically receive forward messages.
39 FS.PostMessage.receiveOnce('forward', function (data){
40 window.location = data.url;
41 });
42
43 iframes = iframes || [];
44
45 if (iframes.length > 0) {
46 $window.on('scroll', function () {
47 for (var i = 0; i < iframes.length; i++) {
48 FS.PostMessage.postScroll(iframes[i]);
49 }
50 });
51 }
52 },
53 init_child : function ()
54 {
55 this.init(_parent_subdomain);
56
57 _is_child = true;
58
59 // Post height of a child right after window is loaded.
60 $(window).bind('load', function () {
61 FS.PostMessage.postHeight();
62
63 // Post message that window was loaded.
64 FS.PostMessage.post('loaded');
65 });
66 },
67 hasParent : function ()
68 {
69 return _hasParent;
70 },
71 postHeight : function (diff, wrapper) {
72 diff = diff || 0;
73 wrapper = wrapper || '#wrap_section';
74 this.post('height', {
75 height: diff + $(wrapper).outerHeight(true)
76 });
77 },
78 postScroll : function (iframe) {
79 this.post('scroll', {
80 top: $window.scrollTop(),
81 height: ($window.height() - parseFloat($html.css('paddingTop')) - parseFloat($html.css('marginTop')))
82 }, iframe);
83 },
84 post : function (type, data, iframe)
85 {
86 console.debug('PostMessage.post', type);
87
88 if (iframe)
89 {
90 // Post to iframe.
91 _postman.postMessage(JSON.stringify({
92 type: type,
93 data: data
94 }), iframe.src, iframe.contentWindow);
95 }
96 else {
97 // Post to parent.
98 _postman.postMessage(JSON.stringify({
99 type: type,
100 data: data
101 }), _parent_url, window.parent);
102 }
103 },
104 receive: function (type, callback)
105 {
106 console.debug('PostMessage.receive', type);
107
108 if (undef === _callbacks[type])
109 _callbacks[type] = [];
110
111 _callbacks[type].push(callback);
112 },
113 receiveOnce: function (type, callback)
114 {
115 if (this.is_set(type))
116 return;
117
118 this.receive(type, callback);
119 },
120 // Check if any callbacks assigned to a specified message type.
121 is_set: function (type)
122 {
123 return (undef != _callbacks[type]);
124 },
125 parent_url: function ()
126 {
127 return _parent_url;
128 },
129 parent_subdomain: function ()
130 {
131 return _parent_subdomain;
132 }
133 };
134 }();
135 })(jQuery);
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 /**
3 * @package Freemius
4 * @copyright Copyright (c) 2015, Freemius, Inc.
5 * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
6 * @since 1.0.3
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 define( 'WP_FS__SECURITY_PARAMS_PREFIX', 's_' );
14
15 /**
16 * Class FS_Security
17 */
18 class FS_Security {
19 /**
20 * @var FS_Security
21 * @since 1.0.3
22 */
23 private static $_instance;
24 /**
25 * @var FS_Logger
26 * @since 1.0.3
27 */
28 private static $_logger;
29
30 /**
31 * @return \FS_Security
32 */
33 public static function instance() {
34 if ( ! isset( self::$_instance ) ) {
35 self::$_instance = new FS_Security();
36 self::$_logger = FS_Logger::get_logger(
37 WP_FS__SLUG,
38 WP_FS__DEBUG_SDK,
39 WP_FS__ECHO_DEBUG_SDK
40 );
41 }
42
43 return self::$_instance;
44 }
45
46 private function __construct() {
47 }
48
49 /**
50 * @param \FS_Scope_Entity $entity
51 * @param int $timestamp
52 * @param string $action
53 *
54 * @return string
55 */
56 function get_secure_token( FS_Scope_Entity $entity, $timestamp, $action = '' ) {
57 return md5(
58 $timestamp .
59 $entity->id .
60 $entity->secret_key .
61 $entity->public_key .
62 $action
63 );
64 }
65
66 /**
67 * @param \FS_Scope_Entity $entity
68 * @param int|bool $timestamp
69 * @param string $action
70 *
71 * @return array
72 */
73 function get_context_params( FS_Scope_Entity $entity, $timestamp = false, $action = '' ) {
74 if ( false === $timestamp ) {
75 $timestamp = time();
76 }
77
78 return array(
79 's_ctx_type' => $entity->get_type(),
80 's_ctx_id' => $entity->id,
81 's_ctx_ts' => $timestamp,
82 's_ctx_secure' => $this->get_secure_token( $entity, $timestamp, $action ),
83 );
84 }
85 }
1 <?php
2 /**
3 * @package Freemius
4 * @copyright Copyright (c) 2015, Freemius, Inc.
5 * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
6 * @since 2.1.0
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 /**
14 * Class FS_User_Lock
15 */
16 class FS_User_Lock {
17 /**
18 * @var int
19 */
20 private $_wp_user_id;
21 /**
22 * @var int
23 */
24 private $_thread_id;
25
26 #--------------------------------------------------------------------------------
27 #region Singleton
28 #--------------------------------------------------------------------------------
29
30 /**
31 * @var FS_User_Lock
32 */
33 private static $_instance;
34
35 /**
36 * @author Vova Feldman (@svovaf)
37 * @since 2.1.0
38 *
39 * @return FS_User_Lock
40 */
41 static function instance() {
42 if ( ! isset( self::$_instance ) ) {
43 self::$_instance = new self();
44 }
45
46 return self::$_instance;
47 }
48
49 #endregion
50
51 private function __construct() {
52 $this->_wp_user_id = Freemius::get_current_wp_user_id();
53 $this->_thread_id = mt_rand( 0, 32000 );
54 }
55
56
57 /**
58 * Try to acquire lock. If the lock is already set or is being acquired by another locker, don't do anything.
59 *
60 * @author Vova Feldman (@svovaf)
61 * @since 2.1.0
62 *
63 * @param int $expiration
64 *
65 * @return bool TRUE if successfully acquired lock.
66 */
67 function try_lock( $expiration = 0 ) {
68 if ( $this->is_locked() ) {
69 // Already locked.
70 return false;
71 }
72
73 set_site_transient( "locked_{$this->_wp_user_id}", $this->_thread_id, $expiration );
74
75 if ( $this->has_lock() ) {
76 set_site_transient( "locked_{$this->_wp_user_id}", true, $expiration );
77
78 return true;
79 }
80
81 return false;
82 }
83
84 /**
85 * Acquire lock regardless if it's already acquired by another locker or not.
86 *
87 * @author Vova Feldman (@svovaf)
88 * @since 2.1.0
89 *
90 * @param int $expiration
91 */
92 function lock( $expiration = 0 ) {
93 set_site_transient( "locked_{$this->_wp_user_id}", true, $expiration );
94 }
95
96 /**
97 * Checks if lock is currently acquired.
98 *
99 * @author Vova Feldman (@svovaf)
100 * @since 2.1.0
101 *
102 * @return bool
103 */
104 function is_locked() {
105 return ( false !== get_site_transient( "locked_{$this->_wp_user_id}" ) );
106 }
107
108 /**
109 * Unlock the lock.
110 *
111 * @author Vova Feldman (@svovaf)
112 * @since 2.1.0
113 */
114 function unlock() {
115 delete_site_transient( "locked_{$this->_wp_user_id}" );
116 }
117
118 /**
119 * Checks if lock is currently acquired by the current locker.
120 *
121 * @return bool
122 */
123 private function has_lock() {
124 return ( $this->_thread_id == get_site_transient( "locked_{$this->_wp_user_id}" ) );
125 }
126 }
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 /**
3 * @package Freemius
4 * @copyright Copyright (c) 2015, Freemius, Inc.
5 * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
6 * @since 1.2.2.7
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 /**
14 * Class Zerif_Customizer_Theme_Info_Main
15 *
16 * @since 1.0.0
17 * @access public
18 */
19 class FS_Customizer_Support_Section extends WP_Customize_Section {
20
21 function __construct( $manager, $id, $args = array() ) {
22 $manager->register_section_type( 'FS_Customizer_Support_Section' );
23
24 parent::__construct( $manager, $id, $args );
25 }
26
27 /**
28 * The type of customize section being rendered.
29 *
30 * @since 1.0.0
31 * @access public
32 * @var string
33 */
34 public $type = 'freemius-support-section';
35
36 /**
37 * @var Freemius
38 */
39 public $fs = null;
40
41 /**
42 * Add custom parameters to pass to the JS via JSON.
43 *
44 * @since 1.0.0
45 */
46 public function json() {
47 $json = parent::json();
48
49 $is_contact_visible = $this->fs->is_page_visible( 'contact' );
50 $is_support_visible = $this->fs->is_page_visible( 'support' );
51
52 $json['theme_title'] = $this->fs->get_plugin_name();
53
54 if ( $is_contact_visible && $is_support_visible ) {
55 $json['theme_title'] .= ' ' . $this->fs->get_text_inline( 'Support', 'support' );
56 }
57
58 if ( $is_contact_visible ) {
59 $json['contact'] = array(
60 'label' => $this->fs->get_text_inline( 'Contact Us', 'contact-us' ),
61 'url' => $this->fs->contact_url(),
62 );
63 }
64
65 if ( $is_support_visible ) {
66 $json['support'] = array(
67 'label' => $this->fs->get_text_inline( 'Support Forum', 'support-forum' ),
68 'url' => $this->fs->get_support_forum_url()
69 );
70 }
71
72 return $json;
73 }
74
75 /**
76 * Outputs the Underscore.js template.
77 *
78 * @since 1.0.0
79 */
80 protected function render_template() {
81 ?>
82 <li id="fs_customizer_support"
83 class="accordion-section control-section control-section-{{ data.type }} cannot-expand">
84 <h3 class="accordion-section-title">
85 <span>{{ data.theme_title }}</span>
86 <# if ( data.contact && data.support ) { #>
87 <div class="button-group">
88 <# } #>
89 <# if ( data.contact ) { #>
90 <a class="button" href="{{ data.contact.url }}" target="_blank" rel="noopener noreferrer">{{ data.contact.label }} </a>
91 <# } #>
92 <# if ( data.support ) { #>
93 <a class="button" href="{{ data.support.url }}" target="_blank" rel="noopener noreferrer">{{ data.support.label }} </a>
94 <# } #>
95 <# if ( data.contact && data.support ) { #>
96 </div>
97 <# } #>
98 </h3>
99 </li>
100 <?php
101 }
102 }
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 /**
3 * @package Freemius
4 * @copyright Copyright (c) 2015, Freemius, Inc.
5 * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
6 * @since 1.2.2.7
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 /**
14 * Class FS_Customizer_Upsell_Control
15 */
16 class FS_Customizer_Upsell_Control extends WP_Customize_Control {
17
18 /**
19 * Control type
20 *
21 * @var string control type
22 */
23 public $type = 'freemius-upsell-control';
24
25 /**
26 * @var Freemius
27 */
28 public $fs = null;
29
30 /**
31 * @param WP_Customize_Manager $manager the customize manager class.
32 * @param string $id id.
33 * @param array $args customizer manager parameters.
34 */
35 public function __construct( WP_Customize_Manager $manager, $id, array $args ) {
36 $manager->register_control_type( 'FS_Customizer_Upsell_Control' );
37
38 parent::__construct( $manager, $id, $args );
39 }
40
41 /**
42 * Enqueue resources for the control.
43 */
44 public function enqueue() {
45 fs_enqueue_local_style( 'fs_customizer', 'customizer.css' );
46 }
47
48 /**
49 * Json conversion
50 */
51 public function to_json() {
52 $pricing_cta = esc_html( $this->fs->get_pricing_cta_label() ) . '&nbsp;&nbsp;' . ( is_rtl() ? '&#x2190;' : '&#x27a4;' );
53
54 parent::to_json();
55
56 $this->json['button_text'] = $pricing_cta;
57 $this->json['button_url'] = $this->fs->is_in_trial_promotion() ?
58 $this->fs->get_trial_url() :
59 $this->fs->get_upgrade_url();
60
61 $api = FS_Plugin::is_valid_id( $this->fs->get_bundle_id() ) ?
62 $this->fs->get_api_bundle_scope() :
63 $this->fs->get_api_plugin_scope();
64
65 // Load features.
66 $pricing = $api->get( $this->fs->add_show_pending( "pricing.json" ) );
67
68 if ( $this->fs->is_api_result_object( $pricing, 'plans' ) ) {
69 // Add support features.
70 if ( is_array( $pricing->plans ) && 0 < count( $pricing->plans ) ) {
71 $support_features = array(
72 'kb' => 'Help Center',
73 'forum' => 'Support Forum',
74 'email' => 'Priority Email Support',
75 'phone' => 'Phone Support',
76 'skype' => 'Skype Support',
77 'is_success_manager' => 'Personal Success Manager',
78 );
79
80 for ( $i = 0, $len = count( $pricing->plans ); $i < $len; $i ++ ) {
81 if ( 'free' == $pricing->plans[$i]->name ) {
82 continue;
83 }
84
85 if ( ! isset( $pricing->plans[ $i ]->features ) ||
86 ! is_array( $pricing->plans[ $i ]->features ) ) {
87 $pricing->plans[$i]->features = array();
88 }
89
90 foreach ( $support_features as $key => $label ) {
91 $key = ( 'is_success_manager' !== $key ) ?
92 "support_{$key}" :
93 $key;
94
95 if ( ! empty( $pricing->plans[ $i ]->{$key} ) ) {
96
97 $support_feature = new stdClass();
98 $support_feature->title = $label;
99
100 $pricing->plans[ $i ]->features[] = $support_feature;
101 }
102 }
103 }
104 }
105 }
106
107 $this->json['plans'] = $pricing->plans;
108
109 $this->json['strings'] = array(
110 'plan' => $this->fs->get_text_x_inline( 'Plan', 'as product pricing plan', 'plan' ),
111 );
112 }
113
114 /**
115 * Control content
116 */
117 public function content_template() {
118 ?>
119 <div id="fs_customizer_upsell">
120 <# if ( data.plans ) { #>
121 <ul class="fs-customizer-plans">
122 <# for (i in data.plans) { #>
123 <# if ( 'free' != data.plans[i].name && (null != data.plans[i].features && 0 < data.plans[i].features.length) ) { #>
124 <li class="fs-customizer-plan">
125 <div class="fs-accordion-section-open">
126 <h2 class="fs-accordion-section-title menu-item">
127 <span>{{ data.plans[i].title }}</span>
128 <button type="button" class="button-link item-edit" aria-expanded="true">
129 <span class="screen-reader-text">Toggle section: {{ data.plans[i].title }} {{ data.strings.plan }}</span>
130 <span class="toggle-indicator" aria-hidden="true"></span>
131 </button>
132 </h2>
133 <div class="fs-accordion-section-content">
134 <# if ( data.plans[i].description ) { #>
135 <h3>{{ data.plans[i].description }}</h3>
136 <# } #>
137 <# if ( data.plans[i].features ) { #>
138 <ul>
139 <# for ( j in data.plans[i].features ) { #>
140 <li><div class="fs-feature">
141 <span class="dashicons dashicons-yes"></span><span><# if ( data.plans[i].features[j].value ) { #>{{ data.plans[i].features[j].value }} <# } #>{{ data.plans[i].features[j].title }}</span>
142 <# if ( data.plans[i].features[j].description ) { #>
143 <span class="dashicons dashicons-editor-help"><span class="fs-feature-desc">{{ data.plans[i].features[j].description }}</span></span>
144 <# } #>
145 </div></li>
146 <# } #>
147 </ul>
148 <# } #>
149 <# if ( 'free' != data.plans[i].name ) { #>
150 <a href="{{ data.button_url }}" class="button button-primary" target="_blank">{{{ data.button_text }}}</a>
151 <# } #>
152 </div>
153 </div>
154 </li>
155 <# } #>
156 <# } #>
157 </ul>
158 <# } #>
159 </div>
160 <?php }
161 }
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 // Silence is golden.
3 // Hide file structure from users on unprotected servers.
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 /**
3 * @package Freemius
4 * @copyright Copyright (c) 2015, Freemius, Inc.
5 * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
6 * @since 1.1.7.3
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 /**
14 * Extends Debug Bar plugin by adding a panel to show all Freemius API requests.
15 *
16 * @author Vova Feldman (@svovaf)
17 * @since 1.1.7.3
18 *
19 * Class Freemius_Debug_Bar_Panel
20 */
21 class Freemius_Debug_Bar_Panel extends Debug_Bar_Panel {
22 function init() {
23 $this->title( 'Freemius' );
24 }
25
26 static function requests_count() {
27 if ( class_exists( 'Freemius_Api_WordPress' ) ) {
28 $logger = Freemius_Api_WordPress::GetLogger();
29 } else {
30 $logger = array();
31 }
32
33 return number_format( count( $logger ) );
34 }
35
36 static function total_time() {
37 if ( class_exists( 'Freemius_Api_WordPress' ) ) {
38 $logger = Freemius_Api_WordPress::GetLogger();
39 } else {
40 $logger = array();
41 }
42
43 $total_time = .0;
44 foreach ( $logger as $l ) {
45 $total_time += $l['total'];
46 }
47
48 return number_format( 100 * $total_time, 2 ) . ' ' . fs_text_x_inline( 'ms', 'milliseconds' );
49 }
50
51 function render() {
52 ?>
53 <div id='debug-bar-php'>
54 <?php fs_require_template( '/debug/api-calls.php' ) ?>
55 <br>
56 <?php fs_require_template( '/debug/scheduled-crons.php' ) ?>
57 <br>
58 <?php fs_require_template( '/debug/plugins-themes-sync.php' ) ?>
59 <br>
60 <?php fs_require_template( '/debug/logger.php' ) ?>
61 </div>
62 <?php
63 }
64 }
1 <?php
2 /**
3 * @package Freemius
4 * @copyright Copyright (c) 2015, Freemius, Inc.
5 * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
6 * @since 1.1.7.3
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 if ( ! WP_FS__DEBUG_SDK ) {
14 return;
15 }
16
17 /**
18 * Initialize Freemius custom debug panels.
19 *
20 * @param array $panels Debug bar panels objects
21 *
22 * @return array Debug bar panels with your custom panels
23 */
24 function fs_custom_panels_init( $panels ) {
25 if ( class_exists( 'Debug_Bar_Panel' ) ) {
26 if ( FS_API__LOGGER_ON ) {
27 require_once dirname( __FILE__ ) . '/class-fs-debug-bar-panel.php';
28 $panels[] = new Freemius_Debug_Bar_Panel();
29 }
30 }
31
32 return $panels;
33 }
34
35 function fs_custom_status_init( $statuses ) {
36 if ( class_exists( 'Debug_Bar_Panel' ) ) {
37 if ( FS_API__LOGGER_ON ) {
38 require_once dirname( __FILE__ ) . '/class-fs-debug-bar-panel.php';
39 $statuses[] = array(
40 'fs_api_requests',
41 fs_text_inline( 'Freemius API' ),
42 Freemius_Debug_Bar_Panel::requests_count() . ' ' . fs_text_inline( 'Requests' ) .
43 ' (' . Freemius_Debug_Bar_Panel::total_time() . ')'
44 );
45 }
46 }
47
48 return $statuses;
49 }
50
51 add_filter( 'debug_bar_panels', 'fs_custom_panels_init' );
52 add_filter( 'debug_bar_statuses', 'fs_custom_status_init' );
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 // Silence is golden.
3 // Hide file structure from users on unprotected servers.
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 /**
3 * @package Freemius
4 * @copyright Copyright (c) 2015, Freemius, Inc.
5 * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
6 * @since 1.2.3
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 class FS_AffiliateTerms extends FS_Scope_Entity {
14
15 #region Properties
16
17 /**
18 * @var bool
19 */
20 public $is_active;
21 /**
22 * @var string Enum: `affiliation` or `rewards`. Defaults to `affiliation`.
23 */
24 public $type;
25 /**
26 * @var string Enum: `payout` or `credit`. Defaults to `payout`.
27 */
28 public $reward_type;
29 /**
30 * If `first`, the referral will be attributed to the first visited source containing the affiliation link that
31 * was clicked.
32 *
33 * @var string Enum: `first` or `last`. Defaults to `first`.
34 */
35 public $referral_attribution;
36 /**
37 * @var int Defaults to `30`, `0` for session cookie, and `null` for endless cookie (until cookies are cleaned).
38 */
39 public $cookie_days;
40 /**
41 * @var int
42 */
43 public $commission;
44 /**
45 * @var string Enum: `percentage` or `dollar`. Defaults to `percentage`.
46 */
47 public $commission_type;
48 /**
49 * @var null|int Defaults to `0` (affiliate only on first payment). `null` for commission for all renewals. If
50 * greater than `0`, affiliate will get paid for all renewals for `commission_renewals_days` days after
51 * the initial upgrade/purchase.
52 */
53 public $commission_renewals_days;
54 /**
55 * @var int Only cents and no percentage. In US cents, e.g.: 100 = $1.00. Defaults to `null`.
56 */
57 public $install_commission;
58 /**
59 * @var string Required default target link, e.g.: pricing page.
60 */
61 public $default_url;
62 /**
63 * @var string One of the following: 'all', 'new_customer', 'new_user'.
64 * If 'all' - reward for any user type.
65 * If 'new_customer' - reward only for new customers.
66 * If 'new_user' - reward only for new users.
67 */
68 public $reward_customer_type;
69 /**
70 * @var int Defaults to `0` (affiliate only on directly affiliated links). `null` if an affiliate will get
71 * paid for all customers' lifetime payments. If greater than `0`, an affiliate will get paid for all
72 * customer payments for `future_payments_days` days after the initial payment.
73 */
74 public $future_payments_days;
75 /**
76 * @var bool If `true`, allow referrals from social sites.
77 */
78 public $is_social_allowed;
79 /**
80 * @var bool If `true`, allow conversions without HTTP referrer header at all.
81 */
82 public $is_app_allowed;
83 /**
84 * @var bool If `true`, allow referrals from any site.
85 */
86 public $is_any_site_allowed;
87
88 #endregion Properties
89
90 /**
91 * @author Leo Fajardo (@leorw)
92 *
93 * @return string
94 */
95 function get_formatted_commission()
96 {
97 return ( 'dollar' === $this->commission_type ) ?
98 ( '$' . $this->commission ) :
99 ( $this->commission . '%' );
100 }
101
102 /**
103 * @author Leo Fajardo (@leorw)
104 *
105 * @return bool
106 */
107 function has_lifetime_commission() {
108 return ( 0 !== $this->future_payments_days );
109 }
110
111 /**
112 * @author Leo Fajardo (@leorw)
113 *
114 * @return bool
115 */
116 function is_session_cookie() {
117 return ( 0 == $this->cookie_days );
118 }
119
120 /**
121 * @author Leo Fajardo (@leorw)
122 *
123 * @return bool
124 */
125 function has_renewals_commission() {
126 return ( is_null( $this->commission_renewals_days ) || $this->commission_renewals_days > 0 );
127 }
128 }
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 /**
3 * @package Freemius
4 * @copyright Copyright (c) 2015, Freemius, Inc.
5 * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
6 * @since 1.2.3
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 class FS_Affiliate extends FS_Scope_Entity {
14
15 #region Properties
16
17 /**
18 * @var string
19 */
20 public $paypal_email;
21 /**
22 * @var number
23 */
24 public $custom_affiliate_terms_id;
25 /**
26 * @var boolean
27 */
28 public $is_using_custom_terms;
29 /**
30 * @var string status Enum: `pending`, `rejected`, `suspended`, or `active`. Defaults to `pending`.
31 */
32 public $status;
33 /**
34 * @var string
35 */
36 public $domain;
37
38 #endregion Properties
39
40 /**
41 * @author Leo Fajardo
42 *
43 * @return bool
44 */
45 function is_active() {
46 return ( 'active' === $this->status );
47 }
48
49 /**
50 * @author Leo Fajardo
51 *
52 * @return bool
53 */
54 function is_pending() {
55 return ( 'pending' === $this->status );
56 }
57
58 /**
59 * @author Leo Fajardo
60 *
61 * @return bool
62 */
63 function is_suspended() {
64 return ( 'suspended' === $this->status );
65 }
66
67 /**
68 * @author Leo Fajardo
69 *
70 * @return bool
71 */
72 function is_rejected() {
73 return ( 'rejected' === $this->status );
74 }
75
76 /**
77 * @author Leo Fajardo
78 *
79 * @return bool
80 */
81 function is_blocked() {
82 return ( 'blocked' === $this->status );
83 }
84 }
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 /**
3 * @package Freemius for EDD Add-On
4 * @copyright Copyright (c) 2016, Freemius, Inc.
5 * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
6 * @since 1.0.0
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 class FS_Billing extends FS_Entity {
14
15 #region Properties
16
17 /**
18 * @var int
19 */
20 public $entity_id;
21 /**
22 * @var string (Enum) Linked entity type. One of: developer, plugin, user, install
23 */
24 public $entity_type;
25 /**
26 * @var string
27 */
28 public $business_name;
29 /**
30 * @var string
31 */
32 public $first;
33 /**
34 * @var string
35 */
36 public $last;
37 /**
38 * @var string
39 */
40 public $email;
41 /**
42 * @var string
43 */
44 public $phone;
45 /**
46 * @var string
47 */
48 public $website;
49 /**
50 * @var string Tax or VAT ID.
51 */
52 public $tax_id;
53 /**
54 * @var string
55 */
56 public $address_street;
57 /**
58 * @var string
59 */
60 public $address_apt;
61 /**
62 * @var string
63 */
64 public $address_city;
65 /**
66 * @var string
67 */
68 public $address_country;
69 /**
70 * @var string Two chars country code.
71 */
72 public $address_country_code;
73 /**
74 * @var string
75 */
76 public $address_state;
77 /**
78 * @var number Numeric ZIP code (cab be with leading zeros).
79 */
80 public $address_zip;
81
82 #endregion Properties
83
84
85 /**
86 * @param object|bool $event
87 */
88 function __construct( $event = false ) {
89 parent::__construct( $event );
90 }
91
92 static function get_type() {
93 return 'billing';
94 }
95 }
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 /**
3 * @package Freemius
4 * @copyright Copyright (c) 2015, Freemius, Inc.
5 * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
6 * @since 1.0.3
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 /**
14 * Get object's public variables.
15 *
16 * @author Vova Feldman (@svovaf)
17 * @since 1.0.0
18 *
19 * @param object $object
20 *
21 * @return array
22 */
23 function fs_get_object_public_vars( $object ) {
24 return get_object_vars( $object );
25 }
26
27 class FS_Entity {
28 /**
29 * @var number
30 */
31 public $id;
32 /**
33 * @var string Datetime value in 'YYYY-MM-DD HH:MM:SS' format.
34 */
35 public $updated;
36 /**
37 * @var string Datetime value in 'YYYY-MM-DD HH:MM:SS' format.
38 */
39 public $created;
40
41 /**
42 * @param bool|object $entity
43 */
44 function __construct( $entity = false ) {
45 if ( ! ( $entity instanceof stdClass ) && ! ( $entity instanceof FS_Entity ) ) {
46 return;
47 }
48
49 $props = fs_get_object_public_vars( $this );
50
51 foreach ( $props as $key => $def_value ) {
52 $this->{$key} = isset( $entity->{$key} ) ?
53 $entity->{$key} :
54 $def_value;
55 }
56 }
57
58 static function get_type() {
59 return 'type';
60 }
61
62 /**
63 * @author Vova Feldman (@svovaf)
64 * @since 1.0.6
65 *
66 * @param FS_Entity $entity1
67 * @param FS_Entity $entity2
68 *
69 * @return bool
70 */
71 static function equals( $entity1, $entity2 ) {
72 if ( is_null( $entity1 ) && is_null( $entity2 ) ) {
73 return true;
74 } else if ( is_object( $entity1 ) && is_object( $entity2 ) ) {
75 return ( $entity1->id == $entity2->id );
76 } else if ( is_object( $entity1 ) ) {
77 return is_null( $entity1->id );
78 } else {
79 return is_null( $entity2->id );
80 }
81 }
82
83 private $_is_updated = false;
84
85 /**
86 * Update object property.
87 *
88 * @author Vova Feldman (@svovaf)
89 * @since 1.0.9
90 *
91 * @param string|array[string]mixed $key
92 * @param string|bool $val
93 *
94 * @return bool
95 */
96 function update( $key, $val = false ) {
97 if ( ! is_array( $key ) ) {
98 $key = array( $key => $val );
99 }
100
101 $is_updated = false;
102
103 foreach ( $key as $k => $v ) {
104 if ( $this->{$k} === $v ) {
105 continue;
106 }
107
108 if ( ( is_string( $this->{$k} ) && is_numeric( $v ) ||
109 ( is_numeric( $this->{$k} ) && is_string( $v ) ) ) &&
110 $this->{$k} == $v
111 ) {
112 continue;
113 }
114
115 // Update value.
116 $this->{$k} = $v;
117
118 $is_updated = true;
119 }
120
121 $this->_is_updated = $is_updated;
122
123 return $is_updated;
124 }
125
126 /**
127 * Checks if entity was updated.
128 *
129 * @author Vova Feldman (@svovaf)
130 * @since 1.0.9
131 *
132 * @return bool
133 */
134 function is_updated() {
135 return $this->_is_updated;
136 }
137
138 /**
139 * @param $id
140 *
141 * @author Vova Feldman (@svovaf)
142 * @since 1.1.2
143 *
144 * @return bool
145 */
146 static function is_valid_id($id){
147 return is_numeric($id);
148 }
149
150 /**
151 * @author Leo Fajardo (@leorw)
152 * @since 2.3.1
153 *
154 * @return string
155 */
156 public static function get_class_name() {
157 return get_called_class();
158 }
159 }
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 /**
3 * @package Freemius
4 * @copyright Copyright (c) 2016, Freemius, Inc.
5 * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
6 * @since 1.0.0
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 class FS_Payment extends FS_Entity {
14
15 #region Properties
16
17 /**
18 * @var number
19 */
20 public $plugin_id;
21 /**
22 * @var number
23 */
24 public $user_id;
25 /**
26 * @var number
27 */
28 public $install_id;
29 /**
30 * @var number
31 */
32 public $subscription_id;
33 /**
34 * @var number
35 */
36 public $plan_id;
37 /**
38 * @var number
39 */
40 public $license_id;
41 /**
42 * @var float
43 */
44 public $gross;
45 /**
46 * @author Leo Fajardo (@leorw)
47 * @since 2.3.0
48 *
49 * @var string One of the following: `usd`, `gbp`, `eur`.
50 */
51 public $currency;
52 /**
53 * @var number
54 */
55 public $bound_payment_id;
56 /**
57 * @var string
58 */
59 public $external_id;
60 /**
61 * @var string
62 */
63 public $gateway;
64 /**
65 * @var string ISO 3166-1 alpha-2 - two-letter country code.
66 *
67 * @link http://www.wikiwand.com/en/ISO_3166-1_alpha-2
68 */
69 public $country_code;
70 /**
71 * @var string
72 */
73 public $vat_id;
74 /**
75 * @var float Actual Tax / VAT in $$$
76 */
77 public $vat;
78 /**
79 * @var int Payment source.
80 */
81 public $source = 0;
82
83 #endregion Properties
84
85 const CURRENCY_USD = 'usd';
86 const CURRENCY_GBP = 'gbp';
87 const CURRENCY_EUR = 'eur';
88
89 /**
90 * @param object|bool $payment
91 */
92 function __construct( $payment = false ) {
93 parent::__construct( $payment );
94 }
95
96 static function get_type() {
97 return 'payment';
98 }
99
100 /**
101 * @author Vova Feldman (@svovaf)
102 * @since 1.0.0
103 *
104 * @return bool
105 */
106 function is_refund() {
107 return ( parent::is_valid_id( $this->bound_payment_id ) && 0 > $this->gross );
108 }
109
110 /**
111 * Checks if the payment was migrated from another platform.
112 *
113 * @author Vova Feldman (@svovaf)
114 * @since 2.0.2
115 *
116 * @return bool
117 */
118 function is_migrated() {
119 return ( 0 != $this->source );
120 }
121
122 /**
123 * Returns the gross in this format:
124 * `{symbol}{amount | 2 decimal digits} {currency | uppercase}`
125 *
126 * Examples: £9.99 GBP, -£9.99 GBP.
127 *
128 * @author Leo Fajardo (@leorw)
129 * @since 2.3.0
130 *
131 * @return string
132 */
133 function formatted_gross()
134 {
135 return (
136 ( $this->gross < 0 ? '-' : '' ) .
137 $this->get_symbol() .
138 number_format( abs( $this->gross ), 2, '.', ',' ) . ' ' .
139 strtoupper( $this->currency )
140 );
141 }
142
143 /**
144 * A map between supported currencies with their symbols.
145 *
146 * @var array<string,string>
147 */
148 static $CURRENCY_2_SYMBOL;
149
150 /**
151 * @author Leo Fajardo (@leorw)
152 * @since 2.3.0
153 *
154 * @return string
155 */
156 private function get_symbol() {
157 if ( ! isset( self::$CURRENCY_2_SYMBOL ) ) {
158 // Lazy load.
159 self::$CURRENCY_2_SYMBOL = array(
160 self::CURRENCY_USD => '$',
161 self::CURRENCY_GBP => '&pound;',
162 self::CURRENCY_EUR => '&euro;',
163 );
164 }
165
166 return self::$CURRENCY_2_SYMBOL[ $this->currency ];
167 }
168 }
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 /**
3 * @package Freemius
4 * @copyright Copyright (c) 2015, Freemius, Inc.
5 * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
6 * @since 1.0.3
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 class FS_Plugin_Info extends FS_Entity {
14 public $plugin_id;
15 public $description;
16 public $short_description;
17 public $banner_url;
18 public $card_banner_url;
19 public $selling_point_0;
20 public $selling_point_1;
21 public $selling_point_2;
22 public $screenshots;
23
24 /**
25 * @param stdClass|bool $plugin_info
26 */
27 function __construct( $plugin_info = false ) {
28 parent::__construct( $plugin_info );
29 }
30
31 static function get_type() {
32 return 'plugin';
33 }
34 }
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 /**
3 * @package Freemius
4 * @copyright Copyright (c) 2015, Freemius, Inc.
5 * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
6 * @since 1.0.5
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 /**
14 * Class FS_Plugin_License
15 */
16 class FS_Plugin_License extends FS_Entity {
17
18 #region Properties
19
20 /**
21 * @var number
22 */
23 public $plugin_id;
24 /**
25 * @var number
26 */
27 public $user_id;
28 /**
29 * @var number
30 */
31 public $plan_id;
32 /**
33 * @author Leo Fajardo (@leorw)
34 * @since 2.3.0
35 *
36 * @var string
37 */
38 public $parent_plan_name;
39 /**
40 * @author Leo Fajardo (@leorw)
41 * @since 2.3.0
42 *
43 * @var string
44 */
45 public $parent_plan_title;
46 /**
47 * @author Leo Fajardo (@leorw)
48 * @since 2.3.0
49 *
50 * @var number
51 */
52 public $parent_license_id;
53 /**
54 * @author Leo Fajardo (@leorw)
55 * @since 2.4.0
56 *
57 * @var array
58 */
59 public $products;
60 /**
61 * @var number
62 */
63 public $pricing_id;
64 /**
65 * @var int|null
66 */
67 public $quota;
68 /**
69 * @var int
70 */
71 public $activated;
72 /**
73 * @var int
74 */
75 public $activated_local;
76 /**
77 * @var string
78 */
79 public $expiration;
80 /**
81 * @var string
82 */
83 public $secret_key;
84 /**
85 * @var bool
86 */
87 public $is_whitelabeled;
88 /**
89 * @var bool $is_free_localhost Defaults to true. If true, allow unlimited localhost installs with the same
90 * license.
91 */
92 public $is_free_localhost;
93 /**
94 * @var bool $is_block_features Defaults to true. If false, don't block features after license expiry - only
95 * block updates and support.
96 */
97 public $is_block_features;
98 /**
99 * @var bool
100 */
101 public $is_cancelled;
102
103 #endregion Properties
104
105 /**
106 * @param stdClass|bool $license
107 */
108 function __construct( $license = false ) {
109 parent::__construct( $license );
110 }
111
112 /**
113 * Get entity type.
114 *
115 * @return string
116 */
117 static function get_type() {
118 return 'license';
119 }
120
121 /**
122 * Check how many site activations left.
123 *
124 * @author Vova Feldman (@svovaf)
125 * @since 1.0.5
126 *
127 * @return int
128 */
129 function left() {
130 if ( ! $this->is_features_enabled() ) {
131 return 0;
132 }
133
134 if ( $this->is_unlimited() ) {
135 return 999;
136 }
137
138 return ( $this->quota - $this->activated - ( $this->is_free_localhost ? 0 : $this->activated_local ) );
139 }
140
141 /**
142 * Check if single site license.
143 *
144 * @author Vova Feldman (@svovaf)
145 * @since 1.1.8.1
146 *
147 * @return bool
148 */
149 function is_single_site() {
150 return ( is_numeric( $this->quota ) && 1 == $this->quota );
151 }
152
153 /**
154 * @author Vova Feldman (@svovaf)
155 * @since 1.0.5
156 *
157 * @return bool
158 */
159 function is_expired() {
160 return ! $this->is_lifetime() && ( strtotime( $this->expiration ) < WP_FS__SCRIPT_START_TIME );
161 }
162
163 /**
164 * Check if license is not expired.
165 *
166 * @author Vova Feldman (@svovaf)
167 * @since 1.2.1
168 *
169 * @return bool
170 */
171 function is_valid() {
172 return ! $this->is_expired();
173 }
174
175 /**
176 * @author Vova Feldman (@svovaf)
177 * @since 1.0.6
178 *
179 * @return bool
180 */
181 function is_lifetime() {
182 return is_null( $this->expiration );
183 }
184
185 /**
186 * @author Vova Feldman (@svovaf)
187 * @since 1.2.0
188 *
189 * @return bool
190 */
191 function is_unlimited() {
192 return is_null( $this->quota );
193 }
194
195 /**
196 * Check if license is fully utilized.
197 *
198 * @author Vova Feldman (@svovaf)
199 * @since 1.0.6
200 *
201 * @param bool|null $is_localhost
202 *
203 * @return bool
204 */
205 function is_utilized( $is_localhost = null ) {
206 if ( is_null( $is_localhost ) ) {
207 $is_localhost = WP_FS__IS_LOCALHOST_FOR_SERVER;
208 }
209
210 if ( $this->is_unlimited() ) {
211 return false;
212 }
213
214 return ! ( $this->is_free_localhost && $is_localhost ) &&
215 ( $this->quota <= $this->activated + ( $this->is_free_localhost ? 0 : $this->activated_local ) );
216 }
217
218 /**
219 * Check if license can be activated.
220 *
221 * @author Vova Feldman (@svovaf)
222 * @since 2.0.0
223 *
224 * @param bool|null $is_localhost
225 *
226 * @return bool
227 */
228 function can_activate( $is_localhost = null ) {
229 return ! $this->is_utilized( $is_localhost ) && $this->is_features_enabled();
230 }
231
232 /**
233 * Check if license can be activated on a given number of production and localhost sites.
234 *
235 * @author Vova Feldman (@svovaf)
236 * @since 2.0.0
237 *
238 * @param int $production_count
239 * @param int $localhost_count
240 *
241 * @return bool
242 */
243 function can_activate_bulk( $production_count, $localhost_count ) {
244 if ( $this->is_unlimited() ) {
245 return true;
246 }
247
248 /**
249 * For simplicity, the logic will work as following: when given X sites to activate the license on, if it's
250 * possible to activate on ALL of them, do the activation. If it's not possible to activate on ALL of them,
251 * do NOT activate on any of them.
252 */
253 return ( $this->quota >= $this->activated + $production_count + ( $this->is_free_localhost ? 0 : $this->activated_local + $localhost_count ) );
254 }
255
256 /**
257 * @author Vova Feldman (@svovaf)
258 * @since 1.2.1
259 *
260 * @return bool
261 */
262 function is_active() {
263 return ( ! $this->is_cancelled );
264 }
265
266 /**
267 * Check if license's plan features are enabled.
268 *
269 * - Either if plan not expired
270 * - If expired, based on the configuration to block features or not.
271 *
272 * @author Vova Feldman (@svovaf)
273 * @since 1.0.6
274 *
275 * @return bool
276 */
277 function is_features_enabled() {
278 return $this->is_active() && ( ! $this->is_block_features || ! $this->is_expired() );
279 }
280
281 /**
282 * Subscription considered to be new without any payments
283 * if the license expires in less than 24 hours
284 * from the license creation.
285 *
286 * @author Vova Feldman (@svovaf)
287 * @since 1.0.9
288 *
289 * @return bool
290 */
291 function is_first_payment_pending() {
292 return ( WP_FS__TIME_24_HOURS_IN_SEC >= strtotime( $this->expiration ) - strtotime( $this->created ) );
293 }
294
295 /**
296 * @return int
297 */
298 function total_activations() {
299 return ( $this->activated + $this->activated_local );
300 }
301
302 /**
303 * @author Vova Feldman (@svovaf)
304 * @since 2.3.1
305 *
306 * @return string
307 */
308 function get_html_escaped_masked_secret_key() {
309 return self::mask_secret_key_for_html( $this->secret_key );
310 }
311
312 /**
313 * @author Vova Feldman (@svovaf)
314 * @since 2.3.1
315 *
316 * @param string $secret_key
317 *
318 * @return string
319 */
320 static function mask_secret_key_for_html( $secret_key ) {
321 return (
322 // Initial 6 chars - sk_ABC
323 htmlspecialchars( substr( $secret_key, 0, 6 ) ) .
324 // Masking
325 str_pad( '', ( strlen( $secret_key ) - 9 ) * 6, '&bull;' ) .
326 // Last 3 chars.
327 htmlspecialchars( substr( $secret_key, - 3 ) )
328 );
329 }
330 }
1 <?php
2 /**
3 * @package Freemius
4 * @copyright Copyright (c) 2015, Freemius, Inc.
5 * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
6 * @since 1.0.5
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 /**
14 * Class FS_Plugin_Plan
15 *
16 * @property FS_Pricing[] $pricing
17 */
18 class FS_Plugin_Plan extends FS_Entity {
19
20 #region Properties
21
22 /**
23 * @var number
24 */
25 public $plugin_id;
26 /**
27 * @var string
28 */
29 public $name;
30 /**
31 * @var string
32 */
33 public $title;
34 /**
35 * @var string
36 */
37 public $description;
38 /**
39 * @var bool Defaults to true. If true, allow unlimited localhost installs with the same license.
40 */
41 public $is_free_localhost;
42 /**
43 * @var bool Defaults to true. If false, don't block features after license expiry - only block updates and
44 * support.
45 */
46 public $is_block_features;
47 /**
48 * @var int
49 */
50 public $license_type;
51 /**
52 * @var bool
53 */
54 public $is_https_support;
55 /**
56 * @var int Trial days.
57 */
58 public $trial_period;
59 /**
60 * @var string If true, require payment for trial.
61 */
62 public $is_require_subscription;
63 /**
64 * @var string Knowledge Base URL.
65 */
66 public $support_kb;
67 /**
68 * @var string Support Forum URL.
69 */
70 public $support_forum;
71 /**
72 * @var string Support email address.
73 */
74 public $support_email;
75 /**
76 * @var string Support phone.
77 */
78 public $support_phone;
79 /**
80 * @var string Support skype username.
81 */
82 public $support_skype;
83 /**
84 * @var bool Is personal success manager supported with the plan.
85 */
86 public $is_success_manager;
87 /**
88 * @var bool Is featured plan.
89 */
90 public $is_featured;
91
92 #endregion Properties
93
94 /**
95 * @param object|bool $plan
96 */
97 function __construct( $plan = false ) {
98 parent::__construct( $plan );
99
100 if ( is_object( $plan ) ) {
101 $this->name = strtolower( $plan->name );
102 }
103 }
104
105 static function get_type() {
106 return 'plan';
107 }
108
109 /**
110 * @author Vova Feldman (@svovaf)
111 * @since 1.0.9
112 *
113 * @return bool
114 */
115 function is_free() {
116 return ( 'free' === $this->name );
117 }
118
119 /**
120 * Checks if this plan supports "Technical Support".
121 *
122 * @author Leo Fajardo (leorw)
123 * @since 1.2.0
124 *
125 * @return bool
126 */
127 function has_technical_support() {
128 return ( ! empty( $this->support_email ) ||
129 ! empty( $this->support_skype ) ||
130 ! empty( $this->support_phone ) ||
131 ! empty( $this->is_success_manager )
132 );
133 }
134
135 /**
136 * @author Vova Feldman (@svovaf)
137 * @since 1.0.9
138 *
139 * @return bool
140 */
141 function has_trial() {
142 return ! $this->is_free() &&
143 is_numeric( $this->trial_period ) && ( $this->trial_period > 0 );
144 }
145 }
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 /**
3 * @package Freemius
4 * @copyright Copyright (c) 2018, Freemius, Inc.
5 * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
6 * @since 2.0.0
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 class FS_Plugin_Tag extends FS_Entity {
14 /**
15 * @var string
16 */
17 public $version;
18 /**
19 * @var string
20 */
21 public $url;
22 /**
23 * @var string
24 */
25 public $requires_platform_version;
26 /**
27 * @var string
28 */
29 public $tested_up_to_version;
30 /**
31 * @var bool
32 */
33 public $has_free;
34 /**
35 * @var bool
36 */
37 public $has_premium;
38 /**
39 * @var string One of the following: `pending`, `beta`, `unreleased`.
40 */
41 public $release_mode;
42
43 function __construct( $tag = false ) {
44 parent::__construct( $tag );
45 }
46
47 static function get_type() {
48 return 'tag';
49 }
50
51 /**
52 * @author Leo Fajardo (@leorw)
53 * @since 2.3.0
54 *
55 * @return bool
56 */
57 function is_beta() {
58 return ( 'beta' === $this->release_mode );
59 }
60 }
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 /**
3 * @package Freemius
4 * @copyright Copyright (c) 2015, Freemius, Inc.
5 * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
6 * @since 1.0.3
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 class FS_Plugin extends FS_Scope_Entity {
14 /**
15 * @since 1.0.6
16 * @var null|number
17 */
18 public $parent_plugin_id;
19 /**
20 * @var string
21 */
22 public $title;
23 /**
24 * @var string
25 */
26 public $slug;
27 /**
28 * @author Leo Fajardo (@leorw)
29 * @since 2.2.1
30 *
31 * @var string
32 */
33 public $premium_slug;
34 /**
35 * @since 1.2.2
36 *
37 * @var string 'plugin' or 'theme'
38 */
39 public $type;
40 /**
41 * @author Leo Fajardo (@leorw)
42 *
43 * @since 1.2.3
44 *
45 * @var string|false false if the module doesn't have an affiliate program or one of the following: 'selected', 'customers', or 'all'.
46 */
47 public $affiliate_moderation;
48 /**
49 * @var bool Set to true if the free version of the module is hosted on WordPress.org. Defaults to true.
50 */
51 public $is_wp_org_compliant = true;
52 /**
53 * @author Leo Fajardo (@leorw)
54 * @since 2.2.5
55 *
56 * @var int
57 */
58 public $premium_releases_count;
59
60 #region Install Specific Properties
61
62 /**
63 * @var string
64 */
65 public $file;
66 /**
67 * @var string
68 */
69 public $version;
70 /**
71 * @var bool
72 */
73 public $auto_update;
74 /**
75 * @var FS_Plugin_Info
76 */
77 public $info;
78 /**
79 * @since 1.0.9
80 *
81 * @var bool
82 */
83 public $is_premium;
84 /**
85 * @author Leo Fajardo (@leorw)
86 * @since 2.2.1
87 *
88 * @var string
89 */
90 public $premium_suffix;
91 /**
92 * @since 1.0.9
93 *
94 * @var bool
95 */
96 public $is_live;
97 /**
98 * @since 2.2.3
99 * @var null|number
100 */
101 public $bundle_id;
102 /**
103 * @since 2.3.1
104 * @var null|string
105 */
106 public $bundle_public_key;
107
108 const AFFILIATE_MODERATION_CUSTOMERS = 'customers';
109
110 #endregion Install Specific Properties
111
112 /**
113 * @param stdClass|bool $plugin
114 */
115 function __construct( $plugin = false ) {
116 parent::__construct( $plugin );
117
118 $this->is_premium = false;
119 $this->is_live = true;
120
121 if ( empty( $this->premium_slug ) && ! empty( $plugin->slug ) ) {
122 $this->premium_slug = "{$this->slug}-premium";
123 }
124
125 if ( empty( $this->premium_suffix ) ) {
126 $this->premium_suffix = '(Premium)';
127 }
128
129 if ( isset( $plugin->info ) && is_object( $plugin->info ) ) {
130 $this->info = new FS_Plugin_Info( $plugin->info );
131 }
132 }
133
134 /**
135 * Check if plugin is an add-on (has parent).
136 *
137 * @author Vova Feldman (@svovaf)
138 * @since 1.0.6
139 *
140 * @return bool
141 */
142 function is_addon() {
143 return isset( $this->parent_plugin_id ) && is_numeric( $this->parent_plugin_id );
144 }
145
146 /**
147 * @author Leo Fajardo (@leorw)
148 * @since 1.2.3
149 *
150 * @return bool
151 */
152 function has_affiliate_program() {
153 return ( ! empty( $this->affiliate_moderation ) );
154 }
155
156 static function get_type() {
157 return 'plugin';
158 }
159 }
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 /**
3 * @package Freemius for EDD Add-On
4 * @copyright Copyright (c) 2015, Freemius, Inc.
5 * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
6 * @since 1.0.0
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 class FS_Pricing extends FS_Entity {
14
15 #region Properties
16
17 /**
18 * @var number
19 */
20 public $plan_id;
21 /**
22 * @var int
23 */
24 public $licenses;
25 /**
26 * @var null|float
27 */
28 public $monthly_price;
29 /**
30 * @var null|float
31 */
32 public $annual_price;
33 /**
34 * @var null|float
35 */
36 public $lifetime_price;
37 /**
38 * @author Leo Fajardo (@leorw)
39 * @since 2.3.1
40 *
41 * @var string One of the following: `usd`, `gbp`, `eur`.
42 */
43 public $currency;
44
45 #endregion Properties
46
47 /**
48 * @param object|bool $pricing
49 */
50 function __construct( $pricing = false ) {
51 parent::__construct( $pricing );
52 }
53
54 static function get_type() {
55 return 'pricing';
56 }
57
58 /**
59 * @author Vova Feldman (@svovaf)
60 * @since 1.1.8
61 *
62 * @return bool
63 */
64 function has_monthly() {
65 return ( is_numeric( $this->monthly_price ) && $this->monthly_price > 0 );
66 }
67
68 /**
69 * @author Vova Feldman (@svovaf)
70 * @since 1.1.8
71 *
72 * @return bool
73 */
74 function has_annual() {
75 return ( is_numeric( $this->annual_price ) && $this->annual_price > 0 );
76 }
77
78 /**
79 * @author Vova Feldman (@svovaf)
80 * @since 1.1.8
81 *
82 * @return bool
83 */
84 function has_lifetime() {
85 return ( is_numeric( $this->lifetime_price ) && $this->lifetime_price > 0 );
86 }
87
88 /**
89 * Check if unlimited licenses pricing.
90 *
91 * @author Vova Feldman (@svovaf)
92 * @since 1.1.8
93 *
94 * @return bool
95 */
96 function is_unlimited() {
97 return is_null( $this->licenses );
98 }
99
100
101 /**
102 * Check if pricing has more than one billing cycle.
103 *
104 * @author Vova Feldman (@svovaf)
105 * @since 1.1.8
106 *
107 * @return bool
108 */
109 function is_multi_cycle() {
110 $cycles = 0;
111 if ( $this->has_monthly() ) {
112 $cycles ++;
113 }
114 if ( $this->has_annual() ) {
115 $cycles ++;
116 }
117 if ( $this->has_lifetime() ) {
118 $cycles ++;
119 }
120
121 return $cycles > 1;
122 }
123
124 /**
125 * Get annual over monthly discount.
126 *
127 * @author Vova Feldman (@svovaf)
128 * @since 1.1.8
129 *
130 * @return int
131 */
132 function annual_discount_percentage() {
133 return floor( $this->annual_savings() / ( $this->monthly_price * 12 * ( $this->is_unlimited() ? 1 : $this->licenses ) ) * 100 );
134 }
135
136 /**
137 * Get annual over monthly savings.
138 *
139 * @author Vova Feldman (@svovaf)
140 * @since 1.1.8
141 *
142 * @return float
143 */
144 function annual_savings() {
145 return ( $this->monthly_price * 12 - $this->annual_price ) * ( $this->is_unlimited() ? 1 : $this->licenses );
146 }
147
148 /**
149 * @author Leo Fajardo (@leorw)
150 * @since 2.3.1
151 *
152 * @return bool
153 */
154 function is_usd() {
155 return ( 'usd' === $this->currency );
156 }
157 }
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 /**
3 * @package Freemius
4 * @copyright Copyright (c) 2015, Freemius, Inc.
5 * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
6 * @since 1.0.4
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 class FS_Scope_Entity extends FS_Entity {
14 /**
15 * @var string
16 */
17 public $public_key;
18 /**
19 * @var string
20 */
21 public $secret_key;
22
23 /**
24 * @param bool|stdClass $scope_entity
25 */
26 function __construct( $scope_entity = false ) {
27 parent::__construct( $scope_entity );
28 }
29 }
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 /**
3 * @package Freemius
4 * @copyright Copyright (c) 2015, Freemius, Inc.
5 * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
6 * @since 1.0.3
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 class FS_Site extends FS_Scope_Entity {
14 /**
15 * @var number
16 */
17 public $site_id;
18 /**
19 * @var number
20 */
21 public $plugin_id;
22 /**
23 * @var number
24 */
25 public $user_id;
26 /**
27 * @var string
28 */
29 public $title;
30 /**
31 * @var string
32 */
33 public $url;
34 /**
35 * @var string
36 */
37 public $version;
38 /**
39 * @var string E.g. en-GB
40 */
41 public $language;
42 /**
43 * @var string E.g. UTF-8
44 */
45 public $charset;
46 /**
47 * @var string Platform version (e.g WordPress version).
48 */
49 public $platform_version;
50 /**
51 * Freemius SDK version
52 *
53 * @author Leo Fajardo (@leorw)
54 * @since 1.2.2
55 *
56 * @var string SDK version (e.g.: 1.2.2)
57 */
58 public $sdk_version;
59 /**
60 * @var string Programming language version (e.g PHP version).
61 */
62 public $programming_language_version;
63 /**
64 * @var number|null
65 */
66 public $plan_id;
67 /**
68 * @var number|null
69 */
70 public $license_id;
71 /**
72 * @var number|null
73 */
74 public $trial_plan_id;
75 /**
76 * @var string|null
77 */
78 public $trial_ends;
79 /**
80 * @since 1.0.9
81 *
82 * @var bool
83 */
84 public $is_premium = false;
85 /**
86 * @author Leo Fajardo (@leorw)
87 *
88 * @since 1.2.1.5
89 *
90 * @var bool
91 */
92 public $is_disconnected = false;
93 /**
94 * @since 2.0.0
95 *
96 * @var bool
97 */
98 public $is_active = true;
99 /**
100 * @since 2.0.0
101 *
102 * @var bool
103 */
104 public $is_uninstalled = false;
105 /**
106 * @author Edgar Melkonyan
107 *
108 * @since 2.4.2
109 *
110 * @var bool
111 */
112 public $is_beta;
113
114 /**
115 * @param stdClass|bool $site
116 */
117 function __construct( $site = false ) {
118 parent::__construct( $site );
119
120 if ( is_object( $site ) ) {
121 $this->plan_id = $site->plan_id;
122 }
123
124 if ( ! is_bool( $this->is_disconnected ) ) {
125 $this->is_disconnected = false;
126 }
127 }
128
129 static function get_type() {
130 return 'install';
131 }
132
133 /**
134 * @author Vova Feldman (@svovaf)
135 * @since 2.0.0
136 *
137 * @param string $url
138 *
139 * @return bool
140 */
141 static function is_localhost_by_address( $url ) {
142 if ( false !== strpos( $url, '127.0.0.1' ) ||
143 false !== strpos( $url, 'localhost' )
144 ) {
145 return true;
146 }
147
148 if ( ! fs_starts_with( $url, 'http' ) ) {
149 $url = 'http://' . $url;
150 }
151
152 $url_parts = parse_url( $url );
153
154 $subdomain = $url_parts['host'];
155
156 return (
157 // Starts with.
158 fs_starts_with( $subdomain, 'local.' ) ||
159 fs_starts_with( $subdomain, 'dev.' ) ||
160 fs_starts_with( $subdomain, 'test.' ) ||
161 fs_starts_with( $subdomain, 'stage.' ) ||
162 fs_starts_with( $subdomain, 'staging.' ) ||
163
164 // Ends with.
165 fs_ends_with( $subdomain, '.dev' ) ||
166 fs_ends_with( $subdomain, '.test' ) ||
167 fs_ends_with( $subdomain, '.staging' ) ||
168 fs_ends_with( $subdomain, '.local' ) ||
169 fs_ends_with( $subdomain, '.example' ) ||
170 fs_ends_with( $subdomain, '.invalid' ) ||
171 // GoDaddy test/dev.
172 fs_ends_with( $subdomain, '.myftpupload.com' ) ||
173 // ngrok tunneling.
174 fs_ends_with( $subdomain, '.ngrok.io' ) ||
175 // wpsandbox.
176 fs_ends_with( $subdomain, '.wpsandbox.pro' ) ||
177 // SiteGround staging.
178 fs_starts_with( $subdomain, 'staging' ) ||
179 // WPEngine staging.
180 fs_ends_with( $subdomain, '.staging.wpengine.com' ) ||
181 fs_ends_with( $subdomain, '.dev.wpengine.com' ) ||
182 fs_ends_with( $subdomain, '.wpengine.com' ) ||
183 // Pantheon
184 ( fs_ends_with( $subdomain, 'pantheonsite.io' ) &&
185 ( fs_starts_with( $subdomain, 'test-' ) || fs_starts_with( $subdomain, 'dev-' ) ) ) ||
186 // Cloudways
187 fs_ends_with( $subdomain, '.cloudwaysapps.com' ) ||
188 // Kinsta
189 ( fs_starts_with( $subdomain, 'staging-' ) && ( fs_ends_with( $subdomain, '.kinsta.com' ) || fs_ends_with( $subdomain, '.kinsta.cloud' ) ) ) ||
190 // DesktopServer
191 fs_ends_with( $subdomain, '.dev.cc' ) ||
192 // Pressable
193 fs_ends_with( $subdomain, '.mystagingwebsite.com' )
194 );
195 }
196
197 function is_localhost() {
198 return ( WP_FS__IS_LOCALHOST_FOR_SERVER || self::is_localhost_by_address( $this->url ) );
199 }
200
201 /**
202 * Check if site in trial.
203 *
204 * @author Vova Feldman (@svovaf)
205 * @since 1.0.9
206 *
207 * @return bool
208 */
209 function is_trial() {
210 return is_numeric( $this->trial_plan_id ) && ( strtotime( $this->trial_ends ) > WP_FS__SCRIPT_START_TIME );
211 }
212
213 /**
214 * Check if user already utilized the trial with the current install.
215 *
216 * @author Vova Feldman (@svovaf)
217 * @since 1.0.9
218 *
219 * @return bool
220 */
221 function is_trial_utilized() {
222 return is_numeric( $this->trial_plan_id );
223 }
224
225 /**
226 * @author Vova Feldman (@svovaf)
227 * @since 2.0.0
228 *
229 * @return bool
230 */
231 function is_tracking_allowed() {
232 return ( true !== $this->is_disconnected );
233 }
234
235 /**
236 * @author Vova Feldman (@svovaf)
237 * @since 2.0.0
238 *
239 * @return bool
240 */
241 function is_tracking_prohibited() {
242 return ! $this->is_tracking_allowed();
243 }
244
245 /**
246 * @author Edgar Melkonyan
247 *
248 * @return bool
249 */
250 function is_beta() {
251 return ( isset( $this->is_beta ) && true === $this->is_beta );
252 }
253 }
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 /**
3 * @package Freemius
4 * @copyright Copyright (c) 2015, Freemius, Inc.
5 * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
6 * @since 1.0.9
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 class FS_Subscription extends FS_Entity {
14
15 #region Properties
16
17 /**
18 * @var number
19 */
20 public $user_id;
21 /**
22 * @var number
23 */
24 public $install_id;
25 /**
26 * @var number
27 */
28 public $plan_id;
29 /**
30 * @var number
31 */
32 public $license_id;
33 /**
34 * @var float
35 */
36 public $total_gross;
37 /**
38 * @var float
39 */
40 public $amount_per_cycle;
41 /**
42 * @var int # of months
43 */
44 public $billing_cycle;
45 /**
46 * @var float
47 */
48 public $outstanding_balance;
49 /**
50 * @var int
51 */
52 public $failed_payments;
53 /**
54 * @var string
55 */
56 public $gateway;
57 /**
58 * @var string
59 */
60 public $external_id;
61 /**
62 * @var string|null
63 */
64 public $trial_ends;
65 /**
66 * @var string|null Datetime of the next payment, or null if cancelled.
67 */
68 public $next_payment;
69 /**
70 * @since 2.3.1
71 *
72 * @var string|null Datetime of the cancellation.
73 */
74 public $canceled_at;
75 /**
76 * @var string|null
77 */
78 public $vat_id;
79 /**
80 * @var string Two characters country code
81 */
82 public $country_code;
83
84 #endregion Properties
85
86 /**
87 * @param object|bool $subscription
88 */
89 function __construct( $subscription = false ) {
90 parent::__construct( $subscription );
91 }
92
93 static function get_type() {
94 return 'subscription';
95 }
96
97 /**
98 * Check if subscription is active.
99 *
100 * @author Vova Feldman (@svovaf)
101 * @since 1.0.9
102 *
103 * @return bool
104 */
105 function is_active() {
106 if ( $this->is_canceled() ) {
107 return false;
108 }
109
110 return (
111 ! empty( $this->next_payment ) &&
112 strtotime( $this->next_payment ) > WP_FS__SCRIPT_START_TIME
113 );
114 }
115
116 /**
117 * @author Vova Feldman (@svovaf)
118 * @since 2.3.1
119 *
120 * @return bool
121 */
122 function is_canceled() {
123 return ! is_null( $this->canceled_at );
124 }
125
126 /**
127 * Subscription considered to be new without any payments
128 * if the next payment should be made within less than 24 hours
129 * from the subscription creation.
130 *
131 * @author Vova Feldman (@svovaf)
132 * @since 1.0.9
133 *
134 * @return bool
135 */
136 function is_first_payment_pending() {
137 return ( WP_FS__TIME_24_HOURS_IN_SEC >= strtotime( $this->next_payment ) - strtotime( $this->created ) );
138 }
139
140 /**
141 * @author Vova Feldman (@svovaf)
142 * @since 1.1.7
143 */
144 function has_trial() {
145 return ! is_null( $this->trial_ends );
146 }
147 }
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 /**
3 * @package Freemius
4 * @copyright Copyright (c) 2015, Freemius, Inc.
5 * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
6 * @since 1.0.3
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 class FS_User extends FS_Scope_Entity {
14
15 #region Properties
16
17 /**
18 * @var string
19 */
20 public $email;
21 /**
22 * @var string
23 */
24 public $first;
25 /**
26 * @var string
27 */
28 public $last;
29 /**
30 * @var bool
31 */
32 public $is_verified;
33 /**
34 * @var string|null
35 */
36 public $customer_id;
37 /**
38 * @var float
39 */
40 public $gross;
41
42 #endregion Properties
43
44 /**
45 * @param object|bool $user
46 */
47 function __construct( $user = false ) {
48 parent::__construct( $user );
49 }
50
51 function get_name() {
52 return trim( ucfirst( trim( is_string( $this->first ) ? $this->first : '' ) ) . ' ' . ucfirst( trim( is_string( $this->last ) ? $this->last : '' ) ) );
53 }
54
55 function is_verified() {
56 return ( isset( $this->is_verified ) && true === $this->is_verified );
57 }
58
59 static function get_type() {
60 return 'user';
61 }
62 }
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 // Silence is golden.
3 // Hide file structure from users on unprotected servers.
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 // Silence is golden.
3 // Hide file structure from users on unprotected servers.
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 /**
3 * @package Freemius
4 * @copyright Copyright (c) 2015, Freemius, Inc.
5 * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
6 * @since 1.2.1.6
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 /**
14 * Retrieve the translation of $text.
15 *
16 * @since 1.2.1.6
17 *
18 * @param string $text
19 *
20 * @return string
21 */
22 function _fs_text( $text ) {
23 // Avoid misleading Theme Check warning.
24 $fn = 'translate';
25 return $fn( $text, 'freemius' );
26 }
27
28 /**
29 * Retrieve translated string with gettext context.
30 *
31 * Quite a few times, there will be collisions with similar translatable text
32 * found in more than two places, but with different translated context.
33 *
34 * By including the context in the pot file, translators can translate the two
35 * strings differently.
36 *
37 * @since 1.2.1.6
38 *
39 * @param string $text
40 * @param string $context
41 *
42 * @return string
43 */
44 function _fs_x( $text, $context ) {
45 // Avoid misleading Theme Check warning.
46 $fn = 'translate_with_gettext_context';
47 return $fn( $text, $context, 'freemius' );
48 }
1 <?php
2 /**
3 * @package Freemius
4 * @copyright Copyright (c) 2015, Freemius, Inc.
5 * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
6 * @since 1.1.6
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 class FS_Cache_Manager {
14 /**
15 * @var FS_Option_Manager
16 */
17 private $_options;
18 /**
19 * @var FS_Logger
20 */
21 private $_logger;
22
23 /**
24 * @var FS_Cache_Manager[]
25 */
26 private static $_MANAGERS = array();
27
28 /**
29 * @author Vova Feldman (@svovaf)
30 * @since 1.1.3
31 *
32 * @param string $id
33 */
34 private function __construct( $id ) {
35 $this->_logger = FS_Logger::get_logger( WP_FS__SLUG . '_cach_mngr_' . $id, WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK );
36
37 $this->_logger->entrance();
38 $this->_logger->log( 'id = ' . $id );
39
40 $this->_options = FS_Option_Manager::get_manager( $id, true, true, false );
41 }
42
43 /**
44 * @author Vova Feldman (@svovaf)
45 * @since 1.1.6
46 *
47 * @param $id
48 *
49 * @return FS_Cache_Manager
50 */
51 static function get_manager( $id ) {
52 $id = strtolower( $id );
53
54 if ( ! isset( self::$_MANAGERS[ $id ] ) ) {
55 self::$_MANAGERS[ $id ] = new FS_Cache_Manager( $id );
56 }
57
58 return self::$_MANAGERS[ $id ];
59 }
60
61 /**
62 * @author Vova Feldman (@svovaf)
63 * @since 1.1.6
64 *
65 * @return bool
66 */
67 function is_empty() {
68 $this->_logger->entrance();
69
70 return $this->_options->is_empty();
71 }
72
73 /**
74 * @author Vova Feldman (@svovaf)
75 * @since 1.1.6
76 */
77 function clear() {
78 $this->_logger->entrance();
79
80 $this->_options->clear( true );
81 }
82
83 /**
84 * Delete cache manager from DB.
85 *
86 * @author Vova Feldman (@svovaf)
87 * @since 1.0.9
88 */
89 function delete() {
90 $this->_options->delete();
91 }
92
93 /**
94 * Check if there's a cached item.
95 *
96 * @author Vova Feldman (@svovaf)
97 * @since 1.1.6
98 *
99 * @param string $key
100 *
101 * @return bool
102 */
103 function has( $key ) {
104 $cache_entry = $this->_options->get_option( $key, false );
105
106 return ( is_object( $cache_entry ) &&
107 isset( $cache_entry->timestamp ) &&
108 is_numeric( $cache_entry->timestamp )
109 );
110 }
111
112 /**
113 * Check if there's a valid cached item.
114 *
115 * @author Vova Feldman (@svovaf)
116 * @since 1.1.6
117 *
118 * @param string $key
119 * @param null|int $expiration Since 1.2.2.7
120 *
121 * @return bool
122 */
123 function has_valid( $key, $expiration = null ) {
124 $cache_entry = $this->_options->get_option( $key, false );
125
126 $is_valid = ( is_object( $cache_entry ) &&
127 isset( $cache_entry->timestamp ) &&
128 is_numeric( $cache_entry->timestamp ) &&
129 $cache_entry->timestamp > WP_FS__SCRIPT_START_TIME
130 );
131
132 if ( $is_valid &&
133 is_numeric( $expiration ) &&
134 isset( $cache_entry->created ) &&
135 is_numeric( $cache_entry->created ) &&
136 $cache_entry->created + $expiration < WP_FS__SCRIPT_START_TIME
137 ) {
138 /**
139 * Even if the cache is still valid, since we are checking for validity
140 * with an explicit expiration period, if the period has past, return
141 * `false` as if the cache is invalid.
142 *
143 * @since 1.2.2.7
144 */
145 $is_valid = false;
146 }
147
148 return $is_valid;
149 }
150
151 /**
152 * @author Vova Feldman (@svovaf)
153 * @since 1.1.6
154 *
155 * @param string $key
156 * @param mixed $default
157 *
158 * @return mixed
159 */
160 function get( $key, $default = null ) {
161 $this->_logger->entrance( 'key = ' . $key );
162
163 $cache_entry = $this->_options->get_option( $key, false );
164
165 if ( is_object( $cache_entry ) &&
166 isset( $cache_entry->timestamp ) &&
167 is_numeric( $cache_entry->timestamp )
168 ) {
169 return $cache_entry->result;
170 }
171
172 return is_object( $default ) ? clone $default : $default;
173 }
174
175 /**
176 * @author Vova Feldman (@svovaf)
177 * @since 1.1.6
178 *
179 * @param string $key
180 * @param mixed $default
181 *
182 * @return mixed
183 */
184 function get_valid( $key, $default = null ) {
185 $this->_logger->entrance( 'key = ' . $key );
186
187 $cache_entry = $this->_options->get_option( $key, false );
188
189 if ( is_object( $cache_entry ) &&
190 isset( $cache_entry->timestamp ) &&
191 is_numeric( $cache_entry->timestamp ) &&
192 $cache_entry->timestamp > WP_FS__SCRIPT_START_TIME
193 ) {
194 return $cache_entry->result;
195 }
196
197 return is_object( $default ) ? clone $default : $default;
198 }
199
200 /**
201 * @author Vova Feldman (@svovaf)
202 * @since 1.1.6
203 *
204 * @param string $key
205 * @param mixed $value
206 * @param int $expiration
207 * @param int $created Since 2.0.0 Cache creation date.
208 */
209 function set( $key, $value, $expiration = WP_FS__TIME_24_HOURS_IN_SEC, $created = WP_FS__SCRIPT_START_TIME ) {
210 $this->_logger->entrance( 'key = ' . $key );
211
212 $cache_entry = new stdClass();
213
214 $cache_entry->result = $value;
215 $cache_entry->created = $created;
216 $cache_entry->timestamp = $created + $expiration;
217 $this->_options->set_option( $key, $cache_entry, true );
218 }
219
220 /**
221 * Get cached record expiration, or false if not cached or expired.
222 *
223 * @author Vova Feldman (@svovaf)
224 * @since 1.1.7.3
225 *
226 * @param string $key
227 *
228 * @return bool|int
229 */
230 function get_record_expiration( $key ) {
231 $this->_logger->entrance( 'key = ' . $key );
232
233 $cache_entry = $this->_options->get_option( $key, false );
234
235 if ( is_object( $cache_entry ) &&
236 isset( $cache_entry->timestamp ) &&
237 is_numeric( $cache_entry->timestamp ) &&
238 $cache_entry->timestamp > WP_FS__SCRIPT_START_TIME
239 ) {
240 return $cache_entry->timestamp;
241 }
242
243 return false;
244 }
245
246 /**
247 * Purge cached item.
248 *
249 * @author Vova Feldman (@svovaf)
250 * @since 1.1.6
251 *
252 * @param string $key
253 */
254 function purge( $key ) {
255 $this->_logger->entrance( 'key = ' . $key );
256
257 $this->_options->unset_option( $key, true );
258 }
259
260 /**
261 * Extend cached item caching period.
262 *
263 * @author Vova Feldman (@svovaf)
264 * @since 2.0.0
265 *
266 * @param string $key
267 * @param int $expiration
268 *
269 * @return bool
270 */
271 function update_expiration( $key, $expiration = WP_FS__TIME_24_HOURS_IN_SEC ) {
272 $this->_logger->entrance( 'key = ' . $key );
273
274 $cache_entry = $this->_options->get_option( $key, false );
275
276 if ( ! is_object( $cache_entry ) ||
277 ! isset( $cache_entry->timestamp ) ||
278 ! is_numeric( $cache_entry->timestamp )
279 ) {
280 return false;
281 }
282
283 $this->set( $key, $cache_entry->result, $expiration, $cache_entry->created );
284
285 return true;
286 }
287
288 /**
289 * Set cached item as expired.
290 *
291 * @author Vova Feldman (@svovaf)
292 * @since 1.2.2.7
293 *
294 * @param string $key
295 */
296 function expire( $key ) {
297 $this->_logger->entrance( 'key = ' . $key );
298
299 $cache_entry = $this->_options->get_option( $key, false );
300
301 if ( is_object( $cache_entry ) &&
302 isset( $cache_entry->timestamp ) &&
303 is_numeric( $cache_entry->timestamp )
304 ) {
305 // Set to expired.
306 $cache_entry->timestamp = WP_FS__SCRIPT_START_TIME;
307 $this->_options->set_option( $key, $cache_entry, true );
308 }
309 }
310
311 #--------------------------------------------------------------------------------
312 #region Migration
313 #--------------------------------------------------------------------------------
314
315 /**
316 * Migrate options from site level.
317 *
318 * @author Vova Feldman (@svovaf)
319 * @since 2.0.0
320 */
321 function migrate_to_network() {
322 $this->_options->migrate_to_network();
323 }
324
325 #endregion
326 }
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 /**
3 * @package Freemius
4 * @copyright Copyright (c) 2015, Freemius, Inc.
5 * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
6 * @since 2.1.0
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 class FS_GDPR_Manager {
14 /**
15 * @var FS_Option_Manager
16 */
17 private $_storage;
18 /**
19 * @var array {
20 * @type bool $required Are GDPR rules apply on the current context admin.
21 * @type bool $show_opt_in_notice Should the marketing and offers opt-in message be shown to the admin or not. If not set, defaults to `true`.
22 * @type int $notice_shown_at Last time the special GDPR opt-in message was shown to the current admin.
23 * }
24 */
25 private $_data;
26 /**
27 * @var int
28 */
29 private $_wp_user_id;
30 /**
31 * @var string
32 */
33 private $_option_name;
34 /**
35 * @var FS_Admin_Notices
36 */
37 private $_notices;
38
39 #--------------------------------------------------------------------------------
40 #region Singleton
41 #--------------------------------------------------------------------------------
42
43 /**
44 * @var FS_GDPR_Manager
45 */
46 private static $_instance;
47
48 /**
49 * @return FS_GDPR_Manager
50 */
51 public static function instance() {
52 if ( ! isset( self::$_instance ) ) {
53 self::$_instance = new self();
54 }
55
56 return self::$_instance;
57 }
58
59 #endregion
60
61 private function __construct() {
62 $this->_storage = FS_Option_Manager::get_manager( WP_FS__GDPR_OPTION_NAME, true, true );
63 $this->_wp_user_id = Freemius::get_current_wp_user_id();
64 $this->_option_name = "u{$this->_wp_user_id}";
65 $this->_data = $this->_storage->get_option( $this->_option_name, array() );
66 $this->_notices = FS_Admin_Notices::instance( 'all_admins', '', '', true );
67
68 if ( ! is_array( $this->_data ) ) {
69 $this->_data = array();
70 }
71 }
72
73 /**
74 * Update a GDPR option for the current admin and store it.
75 *
76 * @author Vova Feldman (@svovaf)
77 * @since 2.1.0
78 *
79 * @param string $name
80 * @param mixed $value
81 */
82 private function update_option( $name, $value ) {
83 $this->_data[ $name ] = $value;
84
85 $this->_storage->set_option( $this->_option_name, $this->_data, true );
86 }
87
88 /**
89 * @author Leo Fajardo (@leorw)
90 * @since 2.1.0
91 *
92 * @return bool|null
93 */
94 public function is_required() {
95 return isset( $this->_data['required'] ) ?
96 $this->_data['required'] :
97 null;
98 }
99
100 /**
101 * @author Leo Fajardo (@leorw)
102 * @since 2.1.0
103 *
104 * @param bool $is_required
105 */
106 public function store_is_required( $is_required ) {
107 $this->update_option( 'required', $is_required );
108 }
109
110 /**
111 * Checks if the GDPR opt-in sticky notice is currently shown.
112 *
113 * @author Vova Feldman (@svovaf)
114 * @since 2.1.0
115 *
116 * @return bool
117 */
118 public function is_opt_in_notice_shown() {
119 return $this->_notices->has_sticky( "gdpr_optin_actions_{$this->_wp_user_id}", true );
120 }
121
122 /**
123 * Remove the GDPR opt-in sticky notice.
124 *
125 * @author Vova Feldman (@svovaf)
126 * @since 2.1.0
127 */
128 public function remove_opt_in_notice() {
129 $this->_notices->remove_sticky( "gdpr_optin_actions_{$this->_wp_user_id}", true );
130
131 $this->disable_opt_in_notice();
132 }
133
134 /**
135 * Prevents the opt-in message from being added/shown.
136 *
137 * @author Leo Fajardo (@leorw)
138 * @since 2.1.0
139 */
140 public function disable_opt_in_notice() {
141 $this->update_option( 'show_opt_in_notice', false );
142 }
143
144 /**
145 * Checks if a GDPR opt-in message needs to be shown to the current admin.
146 *
147 * @author Vova Feldman (@svovaf)
148 * @since 2.1.0
149 *
150 * @return bool
151 */
152 public function should_show_opt_in_notice() {
153 return (
154 ! isset( $this->_data['show_opt_in_notice'] ) ||
155 true === $this->_data['show_opt_in_notice']
156 );
157 }
158
159 /**
160 * Get the last time the GDPR opt-in notice was shown.
161 *
162 * @author Vova Feldman (@svovaf)
163 * @since 2.1.0
164 *
165 * @return false|int
166 */
167 public function last_time_notice_was_shown() {
168 return isset( $this->_data['notice_shown_at'] ) ?
169 $this->_data['notice_shown_at'] :
170 false;
171 }
172
173 /**
174 * Update the timestamp of the last time the GDPR opt-in message was shown to now.
175 *
176 * @author Vova Feldman (@svovaf)
177 * @since 2.1.0
178 */
179 public function notice_was_just_shown() {
180 $this->update_option( 'notice_shown_at', WP_FS__SCRIPT_START_TIME );
181 }
182
183 /**
184 * @param string $message
185 * @param string|null $plugin_title
186 *
187 * @author Vova Feldman (@svovaf)
188 * @since 2.1.0
189 */
190 public function add_opt_in_sticky_notice( $message, $plugin_title = null ) {
191 $this->_notices->add_sticky(
192 $message,
193 "gdpr_optin_actions_{$this->_wp_user_id}",
194 '',
195 'promotion',
196 true,
197 $this->_wp_user_id,
198 $plugin_title,
199 true
200 );
201 }
202 }
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 /**
3 * @package Freemius
4 * @copyright Copyright (c) 2015, Freemius, Inc.
5 * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
6 * @since 1.0.6
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 class FS_License_Manager /*extends FS_Abstract_Manager*/
14 {
15 //
16 //
17 // /**
18 // * @var FS_License_Manager[]
19 // */
20 // private static $_instances = array();
21 //
22 // static function instance( Freemius $fs ) {
23 // $slug = strtolower( $fs->get_slug() );
24 //
25 // if ( ! isset( self::$_instances[ $slug ] ) ) {
26 // self::$_instances[ $slug ] = new FS_License_Manager( $slug, $fs );
27 // }
28 //
29 // return self::$_instances[ $slug ];
30 // }
31 //
32 //// private function __construct($slug) {
33 //// parent::__construct($slug);
34 //// }
35 //
36 // function entry_id() {
37 // return 'licenses';
38 // }
39 //
40 // function sync( $id ) {
41 //
42 // }
43 //
44 // /**
45 // * @author Vova Feldman (@svovaf)
46 // * @since 1.0.5
47 // * @uses FS_Api
48 // *
49 // * @param number|bool $plugin_id
50 // *
51 // * @return FS_Plugin_License[]|stdClass Licenses or API error.
52 // */
53 // function api_get_user_plugin_licenses( $plugin_id = false ) {
54 // $api = $this->_fs->get_api_user_scope();
55 //
56 // if ( ! is_numeric( $plugin_id ) ) {
57 // $plugin_id = $this->_fs->get_id();
58 // }
59 //
60 // $result = $api->call( "/plugins/{$plugin_id}/licenses.json" );
61 //
62 // if ( ! isset( $result->error ) ) {
63 // for ( $i = 0, $len = count( $result->licenses ); $i < $len; $i ++ ) {
64 // $result->licenses[ $i ] = new FS_Plugin_License( $result->licenses[ $i ] );
65 // }
66 //
67 // $result = $result->licenses;
68 // }
69 //
70 // return $result;
71 // }
72 //
73 // function api_get_many() {
74 //
75 // }
76 //
77 // function api_activate( $id ) {
78 //
79 // }
80 //
81 // function api_deactivate( $id ) {
82 //
83 // }
84
85 /**
86 * @param FS_Plugin_License[] $licenses
87 *
88 * @return bool
89 */
90 static function has_premium_license( $licenses ) {
91 if ( is_array( $licenses ) ) {
92 foreach ( $licenses as $license ) {
93 /**
94 * @var FS_Plugin_License $license
95 */
96 if ( ! $license->is_utilized() && $license->is_features_enabled() ) {
97 return true;
98 }
99 }
100 }
101
102 return false;
103 }
104 }
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 /**
3 * @package Freemius
4 * @copyright Copyright (c) 2015, Freemius, Inc.
5 * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
6 * @since 1.0.6
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 class FS_Plan_Manager {
14 /**
15 * @var FS_Plan_Manager
16 */
17 private static $_instance;
18
19 /**
20 * @return FS_Plan_Manager
21 */
22 static function instance() {
23 if ( ! isset( self::$_instance ) ) {
24 self::$_instance = new FS_Plan_Manager();
25 }
26
27 return self::$_instance;
28 }
29
30 private function __construct() {
31 }
32
33 /**
34 * @param FS_Plugin_License[] $licenses
35 *
36 * @return bool
37 */
38 function has_premium_license( $licenses ) {
39 if ( is_array( $licenses ) ) {
40 /**
41 * @var FS_Plugin_License[] $licenses
42 */
43 foreach ( $licenses as $license ) {
44 if ( ! $license->is_utilized() && $license->is_features_enabled() ) {
45 return true;
46 }
47 }
48 }
49
50 return false;
51 }
52
53 /**
54 * Check if plugin has any paid plans.
55 *
56 * @author Vova Feldman (@svovaf)
57 * @since 1.0.7
58 *
59 * @param FS_Plugin_Plan[] $plans
60 *
61 * @return bool
62 */
63 function has_paid_plan( $plans ) {
64 if ( ! is_array( $plans ) || 0 === count( $plans ) ) {
65 return false;
66 }
67
68 /**
69 * @var FS_Plugin_Plan[] $plans
70 */
71 for ( $i = 0, $len = count( $plans ); $i < $len; $i ++ ) {
72 if ( ! $plans[ $i ]->is_free() ) {
73 return true;
74 }
75 }
76
77 return false;
78 }
79
80 /**
81 * Check if plugin has any free plan, or is it premium only.
82 *
83 * Note: If no plans configured, assume plugin is free.
84 *
85 * @author Vova Feldman (@svovaf)
86 * @since 1.0.7
87 *
88 * @param FS_Plugin_Plan[] $plans
89 *
90 * @return bool
91 */
92 function has_free_plan( $plans ) {
93 if ( ! is_array( $plans ) || 0 === count( $plans ) ) {
94 return true;
95 }
96
97 /**
98 * @var FS_Plugin_Plan[] $plans
99 */
100 for ( $i = 0, $len = count( $plans ); $i < $len; $i ++ ) {
101 if ( $plans[ $i ]->is_free() ) {
102 return true;
103 }
104 }
105
106 return false;
107 }
108
109 /**
110 * Find all plans that have trial.
111 *
112 * @author Vova Feldman (@svovaf)
113 * @since 1.0.9
114 *
115 * @param FS_Plugin_Plan[] $plans
116 *
117 * @return FS_Plugin_Plan[]
118 */
119 function get_trial_plans( $plans ) {
120 $trial_plans = array();
121
122 if ( is_array( $plans ) && 0 < count( $plans ) ) {
123 /**
124 * @var FS_Plugin_Plan[] $plans
125 */
126 for ( $i = 0, $len = count( $plans ); $i < $len; $i ++ ) {
127 if ( $plans[ $i ]->has_trial() ) {
128 $trial_plans[] = $plans[ $i ];
129 }
130 }
131 }
132
133 return $trial_plans;
134 }
135
136 /**
137 * Check if plugin has any trial plan.
138 *
139 * @author Vova Feldman (@svovaf)
140 * @since 1.0.9
141 *
142 * @param FS_Plugin_Plan[] $plans
143 *
144 * @return bool
145 */
146 function has_trial_plan( $plans ) {
147 if ( ! is_array( $plans ) || 0 === count( $plans ) ) {
148 return true;
149 }
150
151 /**
152 * @var FS_Plugin_Plan[] $plans
153 */
154 for ( $i = 0, $len = count( $plans ); $i < $len; $i ++ ) {
155 if ( $plans[ $i ]->has_trial() ) {
156 return true;
157 }
158 }
159
160 return false;
161 }
162 }
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 /**
3 * @package Freemius
4 * @copyright Copyright (c) 2015, Freemius, Inc.
5 * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
6 * @since 1.0.6
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 class FS_Plugin_Manager {
14 /**
15 * @since 1.2.2
16 *
17 * @var string|number
18 */
19 protected $_module_id;
20 /**
21 * @since 1.2.2
22 *
23 * @var FS_Plugin
24 */
25 protected $_module;
26
27 /**
28 * @var FS_Plugin_Manager[]
29 */
30 private static $_instances = array();
31 /**
32 * @var FS_Logger
33 */
34 protected $_logger;
35
36 /**
37 * Option names
38 *
39 * @author Leo Fajardo (@leorw)
40 * @since 1.2.2
41 */
42 const OPTION_NAME_PLUGINS = 'plugins';
43 const OPTION_NAME_THEMES = 'themes';
44
45 /**
46 * @param string|number $module_id
47 *
48 * @return FS_Plugin_Manager
49 */
50 static function instance( $module_id ) {
51 $key = 'm_' . $module_id;
52
53 if ( ! isset( self::$_instances[ $key ] ) ) {
54 self::$_instances[ $key ] = new FS_Plugin_Manager( $module_id );
55 }
56
57 return self::$_instances[ $key ];
58 }
59
60 /**
61 * @param string|number $module_id
62 */
63 protected function __construct( $module_id ) {
64 $this->_logger = FS_Logger::get_logger( WP_FS__SLUG . '_' . $module_id . '_' . 'plugins', WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK );
65 $this->_module_id = $module_id;
66
67 $this->load();
68 }
69
70 protected function get_option_manager() {
71 return FS_Option_Manager::get_manager( WP_FS__ACCOUNTS_OPTION_NAME, true, true );
72 }
73
74 /**
75 * @author Leo Fajardo (@leorw)
76 * @since 1.2.2
77 *
78 * @param string|bool $module_type "plugin", "theme", or "false" for all modules.
79 *
80 * @return array
81 */
82 protected function get_all_modules( $module_type = false ) {
83 $option_manager = $this->get_option_manager();
84
85 if ( false !== $module_type ) {
86 return fs_get_entities( $option_manager->get_option( $module_type . 's', array() ), FS_Plugin::get_class_name() );
87 }
88
89 return array(
90 self::OPTION_NAME_PLUGINS => fs_get_entities( $option_manager->get_option( self::OPTION_NAME_PLUGINS, array() ), FS_Plugin::get_class_name() ),
91 self::OPTION_NAME_THEMES => fs_get_entities( $option_manager->get_option( self::OPTION_NAME_THEMES, array() ), FS_Plugin::get_class_name() ),
92 );
93 }
94
95 /**
96 * Load plugin data from local DB.
97 *
98 * @author Vova Feldman (@svovaf)
99 * @since 1.0.6
100 */
101 function load() {
102 $all_modules = $this->get_all_modules();
103
104 if ( ! is_numeric( $this->_module_id ) ) {
105 unset( $all_modules[ self::OPTION_NAME_THEMES ] );
106 }
107
108 foreach ( $all_modules as $modules ) {
109 /**
110 * @since 1.2.2
111 *
112 * @var $modules FS_Plugin[]
113 */
114 foreach ( $modules as $module ) {
115 $found_module = false;
116
117 /**
118 * If module ID is not numeric, it must be a plugin's slug.
119 *
120 * @author Leo Fajardo (@leorw)
121 * @since 1.2.2
122 */
123 if ( ! is_numeric( $this->_module_id ) ) {
124 if ( $this->_module_id === $module->slug ) {
125 $this->_module_id = $module->id;
126 $found_module = true;
127 }
128 } else if ( $this->_module_id == $module->id ) {
129 $found_module = true;
130 }
131
132 if ( $found_module ) {
133 $this->_module = $module;
134 break;
135 }
136 }
137 }
138 }
139
140 /**
141 * Store plugin on local DB.
142 *
143 * @author Vova Feldman (@svovaf)
144 * @since 1.0.6
145 *
146 * @param bool|FS_Plugin $module
147 * @param bool $flush
148 *
149 * @return bool|\FS_Plugin
150 */
151 function store( $module = false, $flush = true ) {
152 if ( false !== $module ) {
153 $this->_module = $module;
154 }
155
156 $all_modules = $this->get_all_modules( $this->_module->type );
157 $all_modules[ $this->_module->slug ] = $this->_module;
158
159 $options_manager = $this->get_option_manager();
160 $options_manager->set_option( $this->_module->type . 's', $all_modules, $flush );
161
162 return $this->_module;
163 }
164
165 /**
166 * Update local plugin data if different.
167 *
168 * @author Vova Feldman (@svovaf)
169 * @since 1.0.6
170 *
171 * @param \FS_Plugin $plugin
172 * @param bool $store
173 *
174 * @return bool True if plugin was updated.
175 */
176 function update( FS_Plugin $plugin, $store = true ) {
177 if ( ! ($this->_module instanceof FS_Plugin ) ||
178 $this->_module->slug != $plugin->slug ||
179 $this->_module->public_key != $plugin->public_key ||
180 $this->_module->secret_key != $plugin->secret_key ||
181 $this->_module->parent_plugin_id != $plugin->parent_plugin_id ||
182 $this->_module->title != $plugin->title
183 ) {
184 $this->store( $plugin, $store );
185
186 return true;
187 }
188
189 return false;
190 }
191
192 /**
193 * @author Vova Feldman (@svovaf)
194 * @since 1.0.6
195 *
196 * @param FS_Plugin $plugin
197 * @param bool $store
198 */
199 function set( FS_Plugin $plugin, $store = false ) {
200 $this->_module = $plugin;
201
202 if ( $store ) {
203 $this->store();
204 }
205 }
206
207 /**
208 * @author Vova Feldman (@svovaf)
209 * @since 1.0.6
210 *
211 * @return bool|\FS_Plugin
212 */
213 function get() {
214 return isset( $this->_module ) ?
215 $this->_module :
216 false;
217 }
218
219
220 }
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 // Silence is golden.
3 // Hide file structure from users on unprotected servers.
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 exit;
4 }
5
6 if ( ! class_exists( 'Freemius_InvalidArgumentException' ) ) {
7 exit;
8 }
9
10 if ( ! class_exists( 'Freemius_ArgumentNotExistException' ) ) {
11 class Freemius_ArgumentNotExistException extends Freemius_InvalidArgumentException {
12 }
13 }
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 exit;
4 }
5
6 if ( ! class_exists( 'Freemius_InvalidArgumentException' ) ) {
7 exit;
8 }
9
10 if ( ! class_exists( 'Freemius_EmptyArgumentException' ) ) {
11 class Freemius_EmptyArgumentException extends Freemius_InvalidArgumentException {
12 }
13 }
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 exit;
4 }
5
6 if ( ! class_exists( 'Freemius_Exception' ) ) {
7 /**
8 * Thrown when an API call returns an exception.
9 *
10 */
11 class Freemius_Exception extends Exception {
12 protected $_result;
13 protected $_type;
14 protected $_code;
15
16 /**
17 * Make a new API Exception with the given result.
18 *
19 * @param array $result The result from the API server.
20 */
21 public function __construct( $result ) {
22 $this->_result = $result;
23
24 $code = 0;
25 $message = 'Unknown error, please check GetResult().';
26 $type = '';
27
28 if ( isset( $result['error'] ) && is_array( $result['error'] ) ) {
29 if ( isset( $result['error']['code'] ) ) {
30 $code = $result['error']['code'];
31 }
32 if ( isset( $result['error']['message'] ) ) {
33 $message = $result['error']['message'];
34 }
35 if ( isset( $result['error']['type'] ) ) {
36 $type = $result['error']['type'];
37 }
38 }
39
40 $this->_type = $type;
41 $this->_code = $code;
42
43 parent::__construct( $message, is_numeric( $code ) ? $code : 0 );
44 }
45
46 /**
47 * Return the associated result object returned by the API server.
48 *
49 * @return array The result from the API server
50 */
51 public function getResult() {
52 return $this->_result;
53 }
54
55 public function getStringCode() {
56 return $this->_code;
57 }
58
59 public function getType() {
60 return $this->_type;
61 }
62
63 /**
64 * To make debugging easier.
65 *
66 * @return string The string representation of the error
67 */
68 public function __toString() {
69 $str = $this->getType() . ': ';
70
71 if ( $this->code != 0 ) {
72 $str .= $this->getStringCode() . ': ';
73 }
74
75 return $str . $this->getMessage();
76 }
77 }
78 }
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.