PluginProbe ʕ •ᴥ•ʔ
Auto Post Cleaner / 3.10.2
Auto Post Cleaner v3.10.2
3.12.0 3.13.1 3.2.4 3.2.5 3.3.0 3.3.10 3.3.11 3.3.8 3.4.2 3.5.3 3.6.0 3.7.0 3.7.1 3.7.2 3.7.3 3.7.5 3.7.6 3.8.0 3.9.0 3.9.4 3.9.6 3.9.7 trunk 3.0.0 3.1.0 3.10.1 3.10.2 3.11.4
delete-old-posts-programmatically / freemius / templates / account / billing.php
delete-old-posts-programmatically / freemius / templates / account Last commit date
partials 2 years ago billing.php 2 years ago index.php 5 years ago payments.php 3 years ago
billing.php
423 lines
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.2.0
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 /**
14 * @var array $VARS
15 * @var Freemius $fs
16 */
17 $fs = freemius( $VARS['id'] );
18
19 $slug = $fs->get_slug();
20
21 $edit_text = fs_text_x_inline( 'Edit', 'verb', 'edit', $slug );
22 $update_text = fs_text_x_inline( 'Update', 'verb', 'update', $slug );
23
24 $billing = $fs->_fetch_billing();
25 $has_billing = ( $billing instanceof FS_Billing );
26 if ( ! $has_billing ) {
27 $billing = new FS_Billing();
28 }
29 ?>
30 <!-- Billing -->
31 <div class="postbox">
32 <div id="fs_billing">
33 <h3><span class="dashicons dashicons-portfolio"></span> <?php fs_esc_html_echo_inline( 'Billing', 'billing', $slug ) ?></h3>
34 <table id="fs_billing_address"<?php if ( $has_billing ) {
35 echo ' class="fs-read-mode"';
36 } ?>>
37 <tr>
38 <td><label><span><?php fs_esc_html_echo_inline( 'Business name', 'business-name', $slug ) ?>:</span> <input id="business_name" value="<?php echo esc_attr( $billing->business_name ) ?>" placeholder="<?php fs_esc_attr_echo_inline( 'Business name', 'business-name', $slug ) ?>"></label></td>
39 <td><label><span><?php fs_esc_html_echo_inline( 'Tax / VAT ID', 'tax-vat-id', $slug ) ?>:</span> <input id="tax_id" value="<?php echo esc_attr( $billing->tax_id ) ?>" placeholder="<?php fs_esc_attr_echo_inline( 'Tax / VAT ID', 'tax-vat-id', $slug ) ?>"></label></td>
40 </tr>
41 <tr>
42 <td><label><span><?php printf( fs_esc_html_inline( 'Address Line %d', 'address-line-n', $slug ), 1 ) ?>:</span> <input id="address_street" value="<?php echo esc_attr( $billing->address_street ) ?>" placeholder="<?php printf( fs_esc_attr_inline( 'Address Line %d', 'address-line-n', $slug ), 1 ) ?>"></label></td>
43 <td><label><span><?php printf( fs_esc_html_inline( 'Address Line %d', 'address-line-n', $slug ), 2 ) ?>:</span> <input id="address_apt" value="<?php echo esc_attr( $billing->address_apt ) ?>" placeholder="<?php printf( fs_esc_attr_inline( 'Address Line %d', 'address-line-n', $slug ), 2 ) ?>"></label></td>
44 </tr>
45 <tr>
46 <td><label><span><?php fs_esc_html_echo_inline( 'City', 'city', $slug ) ?> / <?php fs_esc_html_echo_inline( 'Town', 'town', $slug ) ?>:</span> <input id="address_city" value="<?php echo esc_attr( $billing->address_city ) ?>" placeholder="<?php fs_esc_attr_echo_inline( 'City', 'city', $slug ) ?> / <?php fs_esc_attr_echo_inline( 'Town', 'town', $slug ) ?>"></label></td>
47 <td><label><span><?php fs_esc_html_echo_inline( 'ZIP / Postal Code', 'zip-postal-code', $slug ) ?>:</span> <input id="address_zip" value="<?php echo esc_attr( $billing->address_zip ) ?>" placeholder="<?php fs_esc_attr_echo_inline( 'ZIP / Postal Code', 'zip-postal-code', $slug ) ?>"></label></td>
48 </tr>
49 <tr>
50 <?php $countries = array(
51 'AF' => 'Afghanistan',
52 'AX' => 'Aland Islands',
53 'AL' => 'Albania',
54 'DZ' => 'Algeria',
55 'AS' => 'American Samoa',
56 'AD' => 'Andorra',
57 'AO' => 'Angola',
58 'AI' => 'Anguilla',
59 'AQ' => 'Antarctica',
60 'AG' => 'Antigua and Barbuda',
61 'AR' => 'Argentina',
62 'AM' => 'Armenia',
63 'AW' => 'Aruba',
64 'AU' => 'Australia',
65 'AT' => 'Austria',
66 'AZ' => 'Azerbaijan',
67 'BS' => 'Bahamas',
68 'BH' => 'Bahrain',
69 'BD' => 'Bangladesh',
70 'BB' => 'Barbados',
71 'BY' => 'Belarus',
72 'BE' => 'Belgium',
73 'BZ' => 'Belize',
74 'BJ' => 'Benin',
75 'BM' => 'Bermuda',
76 'BT' => 'Bhutan',
77 'BO' => 'Bolivia',
78 'BQ' => 'Bonaire, Saint Eustatius and Saba',
79 'BA' => 'Bosnia and Herzegovina',
80 'BW' => 'Botswana',
81 'BV' => 'Bouvet Island',
82 'BR' => 'Brazil',
83 'IO' => 'British Indian Ocean Territory',
84 'VG' => 'British Virgin Islands',
85 'BN' => 'Brunei',
86 'BG' => 'Bulgaria',
87 'BF' => 'Burkina Faso',
88 'BI' => 'Burundi',
89 'KH' => 'Cambodia',
90 'CM' => 'Cameroon',
91 'CA' => 'Canada',
92 'CV' => 'Cape Verde',
93 'KY' => 'Cayman Islands',
94 'CF' => 'Central African Republic',
95 'TD' => 'Chad',
96 'CL' => 'Chile',
97 'CN' => 'China',
98 'CX' => 'Christmas Island',
99 'CC' => 'Cocos Islands',
100 'CO' => 'Colombia',
101 'KM' => 'Comoros',
102 'CK' => 'Cook Islands',
103 'CR' => 'Costa Rica',
104 'HR' => 'Croatia',
105 'CU' => 'Cuba',
106 'CW' => 'Curacao',
107 'CY' => 'Cyprus',
108 'CZ' => 'Czech Republic',
109 'CD' => 'Democratic Republic of the Congo',
110 'DK' => 'Denmark',
111 'DJ' => 'Djibouti',
112 'DM' => 'Dominica',
113 'DO' => 'Dominican Republic',
114 'TL' => 'East Timor',
115 'EC' => 'Ecuador',
116 'EG' => 'Egypt',
117 'SV' => 'El Salvador',
118 'GQ' => 'Equatorial Guinea',
119 'ER' => 'Eritrea',
120 'EE' => 'Estonia',
121 'ET' => 'Ethiopia',
122 'FK' => 'Falkland Islands',
123 'FO' => 'Faroe Islands',
124 'FJ' => 'Fiji',
125 'FI' => 'Finland',
126 'FR' => 'France',
127 'GF' => 'French Guiana',
128 'PF' => 'French Polynesia',
129 'TF' => 'French Southern Territories',
130 'GA' => 'Gabon',
131 'GM' => 'Gambia',
132 'GE' => 'Georgia',
133 'DE' => 'Germany',
134 'GH' => 'Ghana',
135 'GI' => 'Gibraltar',
136 'GR' => 'Greece',
137 'GL' => 'Greenland',
138 'GD' => 'Grenada',
139 'GP' => 'Guadeloupe',
140 'GU' => 'Guam',
141 'GT' => 'Guatemala',
142 'GG' => 'Guernsey',
143 'GN' => 'Guinea',
144 'GW' => 'Guinea-Bissau',
145 'GY' => 'Guyana',
146 'HT' => 'Haiti',
147 'HM' => 'Heard Island and McDonald Islands',
148 'HN' => 'Honduras',
149 'HK' => 'Hong Kong',
150 'HU' => 'Hungary',
151 'IS' => 'Iceland',
152 'IN' => 'India',
153 'ID' => 'Indonesia',
154 'IR' => 'Iran',
155 'IQ' => 'Iraq',
156 'IE' => 'Ireland',
157 'IM' => 'Isle of Man',
158 'IL' => 'Israel',
159 'IT' => 'Italy',
160 'CI' => 'Ivory Coast',
161 'JM' => 'Jamaica',
162 'JP' => 'Japan',
163 'JE' => 'Jersey',
164 'JO' => 'Jordan',
165 'KZ' => 'Kazakhstan',
166 'KE' => 'Kenya',
167 'KI' => 'Kiribati',
168 'XK' => 'Kosovo',
169 'KW' => 'Kuwait',
170 'KG' => 'Kyrgyzstan',
171 'LA' => 'Laos',
172 'LV' => 'Latvia',
173 'LB' => 'Lebanon',
174 'LS' => 'Lesotho',
175 'LR' => 'Liberia',
176 'LY' => 'Libya',
177 'LI' => 'Liechtenstein',
178 'LT' => 'Lithuania',
179 'LU' => 'Luxembourg',
180 'MO' => 'Macao',
181 'MK' => 'Macedonia',
182 'MG' => 'Madagascar',
183 'MW' => 'Malawi',
184 'MY' => 'Malaysia',
185 'MV' => 'Maldives',
186 'ML' => 'Mali',
187 'MT' => 'Malta',
188 'MH' => 'Marshall Islands',
189 'MQ' => 'Martinique',
190 'MR' => 'Mauritania',
191 'MU' => 'Mauritius',
192 'YT' => 'Mayotte',
193 'MX' => 'Mexico',
194 'FM' => 'Micronesia',
195 'MD' => 'Moldova',
196 'MC' => 'Monaco',
197 'MN' => 'Mongolia',
198 'ME' => 'Montenegro',
199 'MS' => 'Montserrat',
200 'MA' => 'Morocco',
201 'MZ' => 'Mozambique',
202 'MM' => 'Myanmar',
203 'NA' => 'Namibia',
204 'NR' => 'Nauru',
205 'NP' => 'Nepal',
206 'NL' => 'Netherlands',
207 'NC' => 'New Caledonia',
208 'NZ' => 'New Zealand',
209 'NI' => 'Nicaragua',
210 'NE' => 'Niger',
211 'NG' => 'Nigeria',
212 'NU' => 'Niue',
213 'NF' => 'Norfolk Island',
214 'KP' => 'North Korea',
215 'MP' => 'Northern Mariana Islands',
216 'NO' => 'Norway',
217 'OM' => 'Oman',
218 'PK' => 'Pakistan',
219 'PW' => 'Palau',
220 'PS' => 'Palestinian Territory',
221 'PA' => 'Panama',
222 'PG' => 'Papua New Guinea',
223 'PY' => 'Paraguay',
224 'PE' => 'Peru',
225 'PH' => 'Philippines',
226 'PN' => 'Pitcairn',
227 'PL' => 'Poland',
228 'PT' => 'Portugal',
229 'PR' => 'Puerto Rico',
230 'QA' => 'Qatar',
231 'CG' => 'Republic of the Congo',
232 'RE' => 'Reunion',
233 'RO' => 'Romania',
234 'RU' => 'Russia',
235 'RW' => 'Rwanda',
236 'BL' => 'Saint Barthelemy',
237 'SH' => 'Saint Helena',
238 'KN' => 'Saint Kitts and Nevis',
239 'LC' => 'Saint Lucia',
240 'MF' => 'Saint Martin',
241 'PM' => 'Saint Pierre and Miquelon',
242 'VC' => 'Saint Vincent and the Grenadines',
243 'WS' => 'Samoa',
244 'SM' => 'San Marino',
245 'ST' => 'Sao Tome and Principe',
246 'SA' => 'Saudi Arabia',
247 'SN' => 'Senegal',
248 'RS' => 'Serbia',
249 'SC' => 'Seychelles',
250 'SL' => 'Sierra Leone',
251 'SG' => 'Singapore',
252 'SX' => 'Sint Maarten',
253 'SK' => 'Slovakia',
254 'SI' => 'Slovenia',
255 'SB' => 'Solomon Islands',
256 'SO' => 'Somalia',
257 'ZA' => 'South Africa',
258 'GS' => 'South Georgia and the South Sandwich Islands',
259 'KR' => 'South Korea',
260 'SS' => 'South Sudan',
261 'ES' => 'Spain',
262 'LK' => 'Sri Lanka',
263 'SD' => 'Sudan',
264 'SR' => 'Suriname',
265 'SJ' => 'Svalbard and Jan Mayen',
266 'SZ' => 'Swaziland',
267 'SE' => 'Sweden',
268 'CH' => 'Switzerland',
269 'SY' => 'Syria',
270 'TW' => 'Taiwan',
271 'TJ' => 'Tajikistan',
272 'TZ' => 'Tanzania',
273 'TH' => 'Thailand',
274 'TG' => 'Togo',
275 'TK' => 'Tokelau',
276 'TO' => 'Tonga',
277 'TT' => 'Trinidad and Tobago',
278 'TN' => 'Tunisia',
279 'TR' => 'Turkey',
280 'TM' => 'Turkmenistan',
281 'TC' => 'Turks and Caicos Islands',
282 'TV' => 'Tuvalu',
283 'VI' => 'U.S. Virgin Islands',
284 'UG' => 'Uganda',
285 'UA' => 'Ukraine',
286 'AE' => 'United Arab Emirates',
287 'GB' => 'United Kingdom',
288 'US' => 'United States',
289 'UM' => 'United States Minor Outlying Islands',
290 'UY' => 'Uruguay',
291 'UZ' => 'Uzbekistan',
292 'VU' => 'Vanuatu',
293 'VA' => 'Vatican',
294 'VE' => 'Venezuela',
295 'VN' => 'Vietnam',
296 'WF' => 'Wallis and Futuna',
297 'EH' => 'Western Sahara',
298 'YE' => 'Yemen',
299 'ZM' => 'Zambia',
300 'ZW' => 'Zimbabwe',
301 ) ?>
302 <td><label><span><?php fs_esc_html_echo_inline( 'Country', 'country', $slug ) ?>:</span> <select id="address_country_code">
303 <?php if ( empty( $billing->address_country_code ) ) : ?>
304 <option value="" selected><?php fs_esc_html_echo_inline( 'Select Country', 'select-country', $slug ) ?></option>
305 <?php endif ?>
306 <?php foreach ( $countries as $code => $country ) : ?>
307 <option
308 value="<?php echo esc_attr( $code ) ?>" <?php selected( $billing->address_country_code, $code ) ?>><?php echo esc_html( $country ) ?></option>
309 <?php endforeach ?>
310 </select></label></td>
311 <td><label><span><?php fs_esc_html_echo_inline( 'State', 'state', $slug ) ?> / <?php fs_esc_html_echo_inline( 'Province', 'province', $slug ) ?>:</span>
312 <input id="address_state" value="<?php echo esc_attr( $billing->address_state ) ?>" placeholder="<?php fs_esc_html_echo_inline( 'State', 'state', $slug ) ?> / <?php fs_esc_html_echo_inline( 'Province', 'province', $slug ) ?>"></label></td>
313 </tr>
314 <tr>
315 <td colspan="2">
316 <button
317 class="button"><?php echo esc_html( $has_billing ?
318 $edit_text :
319 $update_text
320 ) ?></button>
321 </td>
322 </tr>
323 </table>
324 </div>
325 </div>
326 <!--/ Billing -->
327 <script type="text/javascript">
328 (function($){
329 var $billingAddress = $('#fs_billing_address'),
330 $billingInputs = $billingAddress.find('input, select');
331
332 var setPrevValues = function () {
333 $billingInputs.each(function () {
334 $(this).attr('data-val', $(this).val());
335 });
336 };
337
338 setPrevValues();
339
340 var hasBillingChanged = function () {
341 for (var i = 0, len = $billingInputs.length; i < len; i++){
342 var $this = $($billingInputs[i]);
343 if ($this.attr('data-val') !== $this.val()) {
344 return true;
345 }
346 }
347
348 return false;
349 };
350
351 var isEditAllFieldsMode = false;
352
353 $billingAddress.find('.button').click(function(){
354 $billingAddress.toggleClass('fs-read-mode');
355
356 var isEditMode = !$billingAddress.hasClass('fs-read-mode');
357
358 $(this)
359 .html(isEditMode ? '<?php echo esc_js( $update_text ) ?>' : '<?php echo esc_js( $edit_text ) ?>')
360 .toggleClass('button-primary');
361
362 if (isEditMode) {
363 $('#business_name').focus().select();
364 isEditAllFieldsMode = true;
365 } else {
366 isEditAllFieldsMode = false;
367
368 if (!hasBillingChanged())
369 return;
370
371 var billing = {};
372
373 $billingInputs.each(function(){
374 if ($(this).attr('data-val') !== $(this).val()) {
375 billing[$(this).attr('id')] = $(this).val();
376 }
377 });
378
379 $.ajax({
380 url : <?php echo Freemius::ajax_url() ?>,
381 method : 'POST',
382 data : {
383 action : <?php echo wp_json_encode( $fs->get_ajax_action( 'update_billing' ) ) ?>,
384 security : <?php echo wp_json_encode( $fs->get_ajax_security( 'update_billing' ) ) ?>,
385 module_id: <?php echo wp_json_encode( $fs->get_id() ) ?>,
386 billing : billing
387 },
388 success: function (resultObj) {
389 if (resultObj.success) {
390 setPrevValues();
391 } else {
392 alert(resultObj.error);
393 }
394 }
395 });
396 }
397 });
398
399 $billingInputs
400 // Get into edit mode upon selection.
401 .focus(function () {
402 var isEditMode = !$billingAddress.hasClass('fs-read-mode');
403
404 if (isEditMode) {
405 return;
406 }
407
408 $billingAddress.toggleClass('fs-read-mode');
409 $billingAddress.find('.button')
410 .html('<?php echo esc_js( $update_text ) ?>')
411 .toggleClass('button-primary');
412 })
413 // If blured after editing only one field without changes, exit edit mode.
414 .blur(function () {
415 if (!isEditAllFieldsMode && !hasBillingChanged()) {
416 $billingAddress.toggleClass('fs-read-mode');
417 $billingAddress.find('.button')
418 .html('<?php echo esc_js( $edit_text ) ?>')
419 .toggleClass('button-primary');
420 }
421 });
422 })(jQuery);
423 </script>