PluginProbe ʕ •ᴥ•ʔ
EmbedPress – PDF Embedder, Embed PDF viewer, YouTube Videos, 3D FlipBook, Social feeds & more / 2.0.1
EmbedPress – PDF Embedder, Embed PDF viewer, YouTube Videos, 3D FlipBook, Social feeds & more v2.0.1
4.5.6 4.5.5 4.5.4 4.5.3 4.5.2 trunk 1.0.0 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.3.0 1.3.1 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.7.0 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 2.0.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.2.0 2.2.1 2.2.2 2.3.0 2.3.1 2.3.2 2.3.3 2.4.0 2.4.1 2.5.0 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 2.6.0 2.6.1 2.6.2 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.1.0 3.1.1 3.1.2 3.1.3 3.2.0 3.2.1 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.4.0 3.4.1 3.4.2 3.4.3 3.5.0 3.5.1 3.5.2 3.5.3 3.6.0 3.6.1 3.6.2 3.6.3 3.6.4 3.6.5 3.6.6 3.6.7 3.6.8 3.7.0 3.7.1 3.7.2 3.7.3 3.8.0 3.8.1 3.8.2 3.8.3 3.8.4 3.8.5 3.9.0 3.9.1 3.9.10 3.9.11 3.9.12 3.9.13 3.9.14 3.9.15 3.9.16 3.9.17 3.9.2 3.9.3 3.9.4 3.9.5 3.9.6 3.9.7 3.9.8 3.9.9 4.0.0 4.0.1 4.0.10 4.0.11 4.0.12 4.0.13 4.0.14 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.0.7 4.0.8 4.0.9 4.1.0 4.1.1 4.1.10 4.1.2 4.1.3 4.1.4 4.1.5 4.1.6 4.1.7 4.1.8 4.1.9 4.2.0 4.2.1 4.2.2 4.2.3 4.2.4 4.2.5 4.2.6 4.2.7 4.2.8 4.2.9 4.3.0 4.3.1 4.4.0 4.4.1 4.4.10 4.4.11 4.4.2 4.4.3 4.4.4 4.4.5 4.4.6 4.4.7 4.4.8 4.4.9 4.5.0 4.5.1
embedpress / freemius / templates / billing.php
embedpress / freemius / templates Last commit date
debug 9 years ago forms 9 years ago plugin-info 9 years ago account.php 9 years ago add-ons.php 9 years ago add-trial-to-pricing.php 9 years ago admin-notice.php 9 years ago ajax-loader.php 9 years ago all-admin-notice.php 9 years ago auto-installation.php 9 years ago billing.php 9 years ago checkout-legacy.php 9 years ago checkout.php 9 years ago connect.php 9 years ago contact.php 9 years ago debug.php 9 years ago email.php 9 years ago firewall-issues-js.php 9 years ago index.php 9 years ago plugin-icon.php 9 years ago powered-by.php 9 years ago pricing.php 9 years ago sticky-admin-notice-js.php 9 years ago
billing.php
506 lines
1 <?php
2 /**
3 * @package Freemius
4 * @copyright Copyright (c) 2016, Freemius, Inc.
5 * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6 * @since 1.2.0
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 /**
14 * @var array $VARS
15 */
16 $slug = $VARS['slug'];
17 /**
18 * @var Freemius $fs
19 */
20 $fs = freemius( $slug );
21
22 /**
23 * @var FS_Plugin_Tag $update
24 */
25 $update = $fs->get_update( false, false );
26
27 $is_paying = $fs->is_paying();
28 $user = $fs->get_user();
29 $site = $fs->get_site();
30 $name = $user->get_name();
31 $license = $fs->_get_license();
32 $subscription = $fs->_get_subscription();
33 $plan = $fs->get_plan();
34 $is_active_subscription = ( is_object( $subscription ) && $subscription->is_active() );
35 $is_paid_trial = $fs->is_paid_trial();
36 $show_upgrade = ( ! $is_paying && ! $is_paid_trial );
37
38 $billing = $fs->_fetch_billing();
39 $has_billing = ( $billing instanceof FS_Billing );
40 if ( ! $has_billing ) {
41 $billing = new FS_Billing();
42 }
43
44 $readonly_attr = $has_billing ? 'readonly' : '';
45 ?>
46
47 <div id="fs_account" class="wrap">
48 <h2 class="nav-tab-wrapper">
49 <a href="<?php echo $fs->get_account_url() ?>" class="nav-tab"><?php fs_echo( 'account', $slug ) ?></a>
50 <?php if ( $fs->has_addons() ) : ?>
51 <a href="<?php echo $fs->_get_admin_page_url( 'addons' ) ?>"
52 class="nav-tab"><?php fs_echo( 'add-ons', $slug ) ?></a>
53 <?php endif ?>
54 <?php if ( $fs->is_not_paying() && $fs->has_paid_plan() ) : ?>
55 <a href="<?php echo $fs->get_upgrade_url() ?>" class="nav-tab"><?php fs_echo( 'upgrade', $slug ) ?></a>
56 <?php if ( $fs->apply_filters( 'show_trial', true ) && ! $fs->is_trial_utilized() && $fs->has_trial_plan() ) : ?>
57 <a href="<?php echo $fs->get_trial_url() ?>"
58 class="nav-tab"><?php fs_echo( 'free-trial', $slug ) ?></a>
59 <?php endif ?>
60 <?php endif ?>
61 <?php if ( ! $plan->is_free() ) : ?>
62 <a href="<?php echo $fs->get_account_tab_url( 'billing' ) ?>"
63 class="nav-tab nav-tab-active"><?php fs_echo( 'billing', $slug ) ?></a>
64 <?php endif ?>
65 </h2>
66
67 <div id="poststuff">
68 <div id="fs_billing">
69 <div class="has-sidebar has-right-sidebar">
70 <div class="has-sidebar-content">
71 <div class="postbox">
72 <h3><span class="dashicons dashicons-businessman"></span> <?php fs_echo( 'billing', $slug ) ?></h3>
73 <table id="fs_billing_address"<?php if ( $has_billing ) {
74 echo ' class="fs-read-mode"';
75 } ?>>
76 <tr>
77 <td><label><span><?php fs_echo( 'business-name', $slug ) ?>:</span> <input id="business_name" value="<?php echo $billing->business_name ?>" placeholder="<?php fs_echo( 'business-name', $slug ) ?>"></label></td>
78 <td><label><span><?php fs_echo( 'tax-vat-id', $slug ) ?>:</span> <input id="tax_id" value="<?php echo $billing->tax_id ?>" placeholder="<?php fs_echo( 'tax-vat-id', $slug ) ?>"></label></td>
79 </tr>
80 <tr>
81 <td><label><span><?php printf( fs_text( 'address-line-n', $slug ), 1 ) ?>:</span> <input id="address_street" value="<?php echo $billing->address_street ?>" placeholder="<?php printf( fs_text( 'address-line-n', $slug ), 1 ) ?>"></label></td>
82 <td><label><span><?php printf( fs_text( 'address-line-n', $slug ), 2 ) ?>:</span> <input id="address_apt" value="<?php echo $billing->address_apt ?>" placeholder="<?php printf( fs_text( 'address-line-n', $slug ), 2 ) ?>"></label></td>
83 </tr>
84 <tr>
85 <td><label><span><?php fs_echo( 'city', $slug ) ?> / <?php fs_echo( 'town', $slug ) ?>:</span> <input id="address_city" value="<?php echo $billing->address_city ?>" placeholder="<?php fs_echo( 'city', $slug ) ?> / <?php fs_echo( 'town', $slug ) ?>"></label></td>
86 <td><label><span><?php fs_echo( 'zip-postal-code', $slug ) ?>:</span> <input id="address_zip" value="<?php echo $billing->address_zip ?>" placeholder="<?php fs_echo( 'zip-postal-code', $slug ) ?>"></label></td>
87 </tr>
88 <tr>
89 <?php $countries = array(
90 'AF' => 'Afghanistan',
91 'AX' => 'Aland Islands',
92 'AL' => 'Albania',
93 'DZ' => 'Algeria',
94 'AS' => 'American Samoa',
95 'AD' => 'Andorra',
96 'AO' => 'Angola',
97 'AI' => 'Anguilla',
98 'AQ' => 'Antarctica',
99 'AG' => 'Antigua and Barbuda',
100 'AR' => 'Argentina',
101 'AM' => 'Armenia',
102 'AW' => 'Aruba',
103 'AU' => 'Australia',
104 'AT' => 'Austria',
105 'AZ' => 'Azerbaijan',
106 'BS' => 'Bahamas',
107 'BH' => 'Bahrain',
108 'BD' => 'Bangladesh',
109 'BB' => 'Barbados',
110 'BY' => 'Belarus',
111 'BE' => 'Belgium',
112 'BZ' => 'Belize',
113 'BJ' => 'Benin',
114 'BM' => 'Bermuda',
115 'BT' => 'Bhutan',
116 'BO' => 'Bolivia',
117 'BQ' => 'Bonaire, Saint Eustatius and Saba',
118 'BA' => 'Bosnia and Herzegovina',
119 'BW' => 'Botswana',
120 'BV' => 'Bouvet Island',
121 'BR' => 'Brazil',
122 'IO' => 'British Indian Ocean Territory',
123 'VG' => 'British Virgin Islands',
124 'BN' => 'Brunei',
125 'BG' => 'Bulgaria',
126 'BF' => 'Burkina Faso',
127 'BI' => 'Burundi',
128 'KH' => 'Cambodia',
129 'CM' => 'Cameroon',
130 'CA' => 'Canada',
131 'CV' => 'Cape Verde',
132 'KY' => 'Cayman Islands',
133 'CF' => 'Central African Republic',
134 'TD' => 'Chad',
135 'CL' => 'Chile',
136 'CN' => 'China',
137 'CX' => 'Christmas Island',
138 'CC' => 'Cocos Islands',
139 'CO' => 'Colombia',
140 'KM' => 'Comoros',
141 'CK' => 'Cook Islands',
142 'CR' => 'Costa Rica',
143 'HR' => 'Croatia',
144 'CU' => 'Cuba',
145 'CW' => 'Curacao',
146 'CY' => 'Cyprus',
147 'CZ' => 'Czech Republic',
148 'CD' => 'Democratic Republic of the Congo',
149 'DK' => 'Denmark',
150 'DJ' => 'Djibouti',
151 'DM' => 'Dominica',
152 'DO' => 'Dominican Republic',
153 'TL' => 'East Timor',
154 'EC' => 'Ecuador',
155 'EG' => 'Egypt',
156 'SV' => 'El Salvador',
157 'GQ' => 'Equatorial Guinea',
158 'ER' => 'Eritrea',
159 'EE' => 'Estonia',
160 'ET' => 'Ethiopia',
161 'FK' => 'Falkland Islands',
162 'FO' => 'Faroe Islands',
163 'FJ' => 'Fiji',
164 'FI' => 'Finland',
165 'FR' => 'France',
166 'GF' => 'French Guiana',
167 'PF' => 'French Polynesia',
168 'TF' => 'French Southern Territories',
169 'GA' => 'Gabon',
170 'GM' => 'Gambia',
171 'GE' => 'Georgia',
172 'DE' => 'Germany',
173 'GH' => 'Ghana',
174 'GI' => 'Gibraltar',
175 'GR' => 'Greece',
176 'GL' => 'Greenland',
177 'GD' => 'Grenada',
178 'GP' => 'Guadeloupe',
179 'GU' => 'Guam',
180 'GT' => 'Guatemala',
181 'GG' => 'Guernsey',
182 'GN' => 'Guinea',
183 'GW' => 'Guinea-Bissau',
184 'GY' => 'Guyana',
185 'HT' => 'Haiti',
186 'HM' => 'Heard Island and McDonald Islands',
187 'HN' => 'Honduras',
188 'HK' => 'Hong Kong',
189 'HU' => 'Hungary',
190 'IS' => 'Iceland',
191 'IN' => 'India',
192 'ID' => 'Indonesia',
193 'IR' => 'Iran',
194 'IQ' => 'Iraq',
195 'IE' => 'Ireland',
196 'IM' => 'Isle of Man',
197 'IL' => 'Israel',
198 'IT' => 'Italy',
199 'CI' => 'Ivory Coast',
200 'JM' => 'Jamaica',
201 'JP' => 'Japan',
202 'JE' => 'Jersey',
203 'JO' => 'Jordan',
204 'KZ' => 'Kazakhstan',
205 'KE' => 'Kenya',
206 'KI' => 'Kiribati',
207 'XK' => 'Kosovo',
208 'KW' => 'Kuwait',
209 'KG' => 'Kyrgyzstan',
210 'LA' => 'Laos',
211 'LV' => 'Latvia',
212 'LB' => 'Lebanon',
213 'LS' => 'Lesotho',
214 'LR' => 'Liberia',
215 'LY' => 'Libya',
216 'LI' => 'Liechtenstein',
217 'LT' => 'Lithuania',
218 'LU' => 'Luxembourg',
219 'MO' => 'Macao',
220 'MK' => 'Macedonia',
221 'MG' => 'Madagascar',
222 'MW' => 'Malawi',
223 'MY' => 'Malaysia',
224 'MV' => 'Maldives',
225 'ML' => 'Mali',
226 'MT' => 'Malta',
227 'MH' => 'Marshall Islands',
228 'MQ' => 'Martinique',
229 'MR' => 'Mauritania',
230 'MU' => 'Mauritius',
231 'YT' => 'Mayotte',
232 'MX' => 'Mexico',
233 'FM' => 'Micronesia',
234 'MD' => 'Moldova',
235 'MC' => 'Monaco',
236 'MN' => 'Mongolia',
237 'ME' => 'Montenegro',
238 'MS' => 'Montserrat',
239 'MA' => 'Morocco',
240 'MZ' => 'Mozambique',
241 'MM' => 'Myanmar',
242 'NA' => 'Namibia',
243 'NR' => 'Nauru',
244 'NP' => 'Nepal',
245 'NL' => 'Netherlands',
246 'NC' => 'New Caledonia',
247 'NZ' => 'New Zealand',
248 'NI' => 'Nicaragua',
249 'NE' => 'Niger',
250 'NG' => 'Nigeria',
251 'NU' => 'Niue',
252 'NF' => 'Norfolk Island',
253 'KP' => 'North Korea',
254 'MP' => 'Northern Mariana Islands',
255 'NO' => 'Norway',
256 'OM' => 'Oman',
257 'PK' => 'Pakistan',
258 'PW' => 'Palau',
259 'PS' => 'Palestinian Territory',
260 'PA' => 'Panama',
261 'PG' => 'Papua New Guinea',
262 'PY' => 'Paraguay',
263 'PE' => 'Peru',
264 'PH' => 'Philippines',
265 'PN' => 'Pitcairn',
266 'PL' => 'Poland',
267 'PT' => 'Portugal',
268 'PR' => 'Puerto Rico',
269 'QA' => 'Qatar',
270 'CG' => 'Republic of the Congo',
271 'RE' => 'Reunion',
272 'RO' => 'Romania',
273 'RU' => 'Russia',
274 'RW' => 'Rwanda',
275 'BL' => 'Saint Barthelemy',
276 'SH' => 'Saint Helena',
277 'KN' => 'Saint Kitts and Nevis',
278 'LC' => 'Saint Lucia',
279 'MF' => 'Saint Martin',
280 'PM' => 'Saint Pierre and Miquelon',
281 'VC' => 'Saint Vincent and the Grenadines',
282 'WS' => 'Samoa',
283 'SM' => 'San Marino',
284 'ST' => 'Sao Tome and Principe',
285 'SA' => 'Saudi Arabia',
286 'SN' => 'Senegal',
287 'RS' => 'Serbia',
288 'SC' => 'Seychelles',
289 'SL' => 'Sierra Leone',
290 'SG' => 'Singapore',
291 'SX' => 'Sint Maarten',
292 'SK' => 'Slovakia',
293 'SI' => 'Slovenia',
294 'SB' => 'Solomon Islands',
295 'SO' => 'Somalia',
296 'ZA' => 'South Africa',
297 'GS' => 'South Georgia and the South Sandwich Islands',
298 'KR' => 'South Korea',
299 'SS' => 'South Sudan',
300 'ES' => 'Spain',
301 'LK' => 'Sri Lanka',
302 'SD' => 'Sudan',
303 'SR' => 'Suriname',
304 'SJ' => 'Svalbard and Jan Mayen',
305 'SZ' => 'Swaziland',
306 'SE' => 'Sweden',
307 'CH' => 'Switzerland',
308 'SY' => 'Syria',
309 'TW' => 'Taiwan',
310 'TJ' => 'Tajikistan',
311 'TZ' => 'Tanzania',
312 'TH' => 'Thailand',
313 'TG' => 'Togo',
314 'TK' => 'Tokelau',
315 'TO' => 'Tonga',
316 'TT' => 'Trinidad and Tobago',
317 'TN' => 'Tunisia',
318 'TR' => 'Turkey',
319 'TM' => 'Turkmenistan',
320 'TC' => 'Turks and Caicos Islands',
321 'TV' => 'Tuvalu',
322 'VI' => 'U.S. Virgin Islands',
323 'UG' => 'Uganda',
324 'UA' => 'Ukraine',
325 'AE' => 'United Arab Emirates',
326 'GB' => 'United Kingdom',
327 'US' => 'United States',
328 'UM' => 'United States Minor Outlying Islands',
329 'UY' => 'Uruguay',
330 'UZ' => 'Uzbekistan',
331 'VU' => 'Vanuatu',
332 'VA' => 'Vatican',
333 'VE' => 'Venezuela',
334 'VN' => 'Vietnam',
335 'WF' => 'Wallis and Futuna',
336 'EH' => 'Western Sahara',
337 'YE' => 'Yemen',
338 'ZM' => 'Zambia',
339 'ZW' => 'Zimbabwe',
340 ) ?>
341 <td><label><span><?php fs_echo( 'country', $slug ) ?>:</span> <select id="address_country_code">
342 <?php if ( empty( $billing->address_country_code ) ) : ?>
343 <option value=""
344 selected><?php fs_echo( 'select-country', $slug ) ?></option>
345 <?php endif ?>
346 <?php foreach ( $countries as $code => $country ) : ?>
347 <option
348 value="<?php echo $code ?>" <?php selected( $billing->address_country_code, $code ) ?>><?php echo $country ?></option>
349 <?php endforeach ?>
350 </select></label></td>
351 <td><label><span><?php fs_echo( 'state', $slug ) ?> / <?php fs_echo( 'province', $slug ) ?>:</span>
352 <input id="address_state" value="<?php echo $billing->address_state ?>" placeholder="<?php fs_echo( 'state', $slug ) ?> / <?php fs_echo( 'province', $slug ) ?>"></label></td>
353 </tr>
354 <tr>
355 <td colspan="2">
356 <button
357 class="button"><?php fs_echo( $has_billing ? 'edit' : 'update', $slug ) ?></button>
358 </td>
359 </tr>
360 </table>
361 </div>
362 <div class="postbox">
363 <h3><span class="dashicons dashicons-paperclip"></span> <?php fs_echo( 'payments', $slug ) ?></h3>
364
365 <?php
366 $payments = $fs->_fetch_payments();
367 ?>
368
369 <div class="inside">
370 <table class="widefat">
371 <thead>
372 <tr>
373 <th><?php fs_echo( 'id', $slug ) ?></th>
374 <th><?php fs_echo( 'date', $slug ) ?></th>
375 <!-- <th>--><?php //fs_echo( 'transaction' ) ?><!--</th>-->
376 <th><?php fs_echo( 'amount', $slug ) ?></th>
377 <th><?php fs_echo( 'invoice', $slug ) ?></th>
378 </tr>
379 </thead>
380 <tbody>
381 <?php $odd = true ?>
382 <?php foreach ( $payments as $payment ) : ?>
383 <tr<?php echo $odd ? ' class="alternate"' : '' ?>>
384 <td><?php echo $payment->id ?></td>
385 <td><?php echo date( 'M j, Y', strtotime( $payment->created ) ) ?></td>
386 <td>$<?php echo $payment->gross ?></td>
387 <td><a href="<?php echo $fs->_get_invoice_api_url( $payment->id ) ?>"
388 class="button button-small"
389 target="_blank"><?php fs_echo( 'invoice', $slug ) ?></a></td>
390 </tr>
391 <?php $odd = ! $odd; endforeach ?>
392 </tbody>
393 </table>
394 </div>
395 </div>
396 </div>
397 </div>
398 </div>
399 </div>
400 </div>
401 <script type="text/javascript">
402 (function($){
403 var $billingAddress = $('#fs_billing_address'),
404 $billingInputs = $billingAddress.find('input, select');
405
406 var setPrevValues = function () {
407 $billingInputs.each(function () {
408 $(this).attr('data-val', $(this).val());
409 });
410 };
411
412 setPrevValues();
413
414 var hasBillingChanged = function () {
415 for (var i = 0, len = $billingInputs.length; i < len; i++){
416 var $this = $($billingInputs[i]);
417 if ($this.attr('data-val') !== $this.val()) {
418 return true;
419 }
420 }
421
422 return false;
423 };
424
425 var isEditAllFieldsMode = false;
426
427 $billingAddress.find('.button').click(function(){
428 $billingAddress.toggleClass('fs-read-mode');
429
430 var isEditMode = !$billingAddress.hasClass('fs-read-mode');
431
432 $(this)
433 .html(isEditMode ? <?php echo json_encode(fs_text('update', $slug)) ?> : <?php echo json_encode(fs_text('edit', $slug)) ?>)
434 .toggleClass('button-primary');
435
436 if (isEditMode) {
437 $('#business_name').focus().select();
438 isEditAllFieldsMode = true;
439 } else {
440 isEditAllFieldsMode = false;
441
442 if (!hasBillingChanged())
443 return;
444
445 var billing = {};
446
447 $billingInputs.each(function(){
448 if ($(this).attr('data-val') !== $(this).val()) {
449 billing[$(this).attr('id')] = $(this).val();
450 }
451 });
452
453 $.ajax({
454 url : ajaxurl,
455 method : 'POST',
456 data : {
457 action : '<?php echo $fs->get_ajax_action( 'update_billing' ) ?>',
458 security : '<?php echo $fs->get_ajax_security( 'update_billing' ) ?>',
459 slug : '<?php echo $slug ?>',
460 billing : billing
461 },
462 success: function (resultObj) {
463 if (resultObj.success) {
464 setPrevValues();
465 } else {
466 alert(resultObj.error);
467 }
468 }
469 });
470 }
471 });
472
473 $billingInputs
474 // Get into edit mode upon selection.
475 .focus(function () {
476 var isEditMode = !$billingAddress.hasClass('fs-read-mode');
477
478 if (isEditMode) {
479 return;
480 }
481
482 $billingAddress.toggleClass('fs-read-mode');
483 $billingAddress.find('.button')
484 .html(<?php echo json_encode( fs_text( 'update', $slug ) ) ?>)
485 .toggleClass('button-primary');
486 })
487 // If blured after editing only one field without changes, exit edit mode.
488 .blur(function () {
489 if (!isEditAllFieldsMode && !hasBillingChanged()) {
490 $billingAddress.toggleClass('fs-read-mode');
491 $billingAddress.find('.button')
492 .html(<?php echo json_encode( fs_text( 'edit', $slug ) ) ?>)
493 .toggleClass('button-primary');
494 }
495 });
496 })(jQuery);
497 </script>
498 <?php
499 $params = array(
500 'page' => 'account',
501 'module_id' => $fs->get_id(),
502 'module_slug' => $slug,
503 'module_version' => $fs->get_plugin_version(),
504 );
505 fs_require_template( 'powered-by.php', $params );
506 ?>