| @@ -17,22 +17,16 @@ | ||
| 17 | 17 | $fs = freemius( $VARS['id'] ); |
| 18 | 18 | |
| 19 | 19 | $slug = $fs->get_slug(); |
| 20 | 20 | |
| 21 | - $payments = $fs->_fetch_payments(); | |
| 21 | + $edit_text = fs_text_x_inline( 'Edit', 'verb', 'edit', $slug ); | |
| 22 | + $update_text = fs_text_x_inline( 'Update', 'verb', 'update', $slug ); | |
| 22 | 23 | |
| 23 | - $show_billing = ( is_array( $payments ) && 0 < count( $payments ) ); | |
| 24 | - | |
| 25 | - if ( $show_billing ) : | |
| 26 | - | |
| 27 | - $edit_text = fs_text_x_inline( 'Edit', 'verb', 'edit', $slug ); | |
| 28 | - $update_text = fs_text_x_inline( 'Update', 'verb', 'update', $slug ); | |
| 29 | - | |
| 30 | - $billing = $fs->_fetch_billing(); | |
| 31 | - $has_billing = ( $billing instanceof FS_Billing ); | |
| 32 | - if ( ! $has_billing ) { | |
| 33 | - $billing = new FS_Billing(); | |
| 34 | - } | |
| 24 | + $billing = $fs->_fetch_billing(); | |
| 25 | + $has_billing = ( $billing instanceof FS_Billing ); | |
| 26 | + if ( ! $has_billing ) { | |
| 27 | + $billing = new FS_Billing(); | |
| 28 | + } | |
| 35 | 29 | ?> |
| 36 | 30 | <!-- Billing --> |
| 37 | 31 | <div class="postbox"> |
| 38 | 32 | <div id="fs_billing"> |
| @@ -40,18 +34,18 @@ | ||
| 40 | 34 | <table id="fs_billing_address"<?php if ( $has_billing ) { |
| 41 | 35 | echo ' class="fs-read-mode"'; |
| 42 | 36 | } ?>> |
| 43 | 37 | <tr> |
| 44 | - <td><label><span><?php fs_esc_html_echo_inline( 'Business name', 'business-name', $slug ) ?>:</span> <input id="business_name" value="<?php echo $billing->business_name ?>" placeholder="<?php fs_esc_attr_echo_inline( 'Business name', 'business-name', $slug ) ?>"></label></td> | |
| 45 | - <td><label><span><?php fs_esc_html_echo_inline( 'Tax / VAT ID', 'tax-vat-id', $slug ) ?>:</span> <input id="tax_id" value="<?php echo $billing->tax_id ?>" placeholder="<?php fs_esc_attr_echo_inline( 'Tax / VAT ID', 'tax-vat-id', $slug ) ?>"></label></td> | |
| 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> | |
| 46 | 40 | </tr> |
| 47 | 41 | <tr> |
| 48 | - <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 $billing->address_street ?>" placeholder="<?php printf( fs_esc_attr_inline( 'Address Line %d', 'address-line-n', $slug ), 1 ) ?>"></label></td> | |
| 49 | - <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 $billing->address_apt ?>" placeholder="<?php printf( fs_esc_attr_inline( 'Address Line %d', 'address-line-n', $slug ), 2 ) ?>"></label></td> | |
| 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> | |
| 50 | 44 | </tr> |
| 51 | 45 | <tr> |
| 52 | - <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 $billing->address_city ?>" placeholder="<?php fs_esc_attr_echo_inline( 'City', 'city', $slug ) ?> / <?php fs_esc_attr_echo_inline( 'Town', 'town', $slug ) ?>"></label></td> | |
| 53 | - <td><label><span><?php fs_esc_html_echo_inline( 'ZIP / Postal Code', 'zip-postal-code', $slug ) ?>:</span> <input id="address_zip" value="<?php echo $billing->address_zip ?>" placeholder="<?php fs_esc_attr_echo_inline( 'ZIP / Postal Code', 'zip-postal-code', $slug ) ?>"></label></td> | |
| 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> | |
| 54 | 48 | </tr> |
| 55 | 49 | <tr> |
| 56 | 50 | <?php $countries = array( |
| 57 | 51 | 'AF' => 'Afghanistan', |
| @@ -310,13 +304,13 @@ | ||
| 310 | 304 | <option value="" selected><?php fs_esc_html_echo_inline( 'Select Country', 'select-country', $slug ) ?></option> |
| 311 | 305 | <?php endif ?> |
| 312 | 306 | <?php foreach ( $countries as $code => $country ) : ?> |
| 313 | 307 | <option |
| 314 | - value="<?php echo $code ?>" <?php selected( $billing->address_country_code, $code ) ?>><?php echo $country ?></option> | |
| 308 | + value="<?php echo esc_attr( $code ) ?>" <?php selected( $billing->address_country_code, $code ) ?>><?php echo esc_html( $country ) ?></option> | |
| 315 | 309 | <?php endforeach ?> |
| 316 | 310 | </select></label></td> |
| 317 | 311 | <td><label><span><?php fs_esc_html_echo_inline( 'State', 'state', $slug ) ?> / <?php fs_esc_html_echo_inline( 'Province', 'province', $slug ) ?>:</span> |
| 318 | - <input id="address_state" value="<?php echo $billing->address_state ?>" placeholder="<?php fs_esc_html_echo_inline( 'State', 'state', $slug ) ?> / <?php fs_esc_html_echo_inline( 'Province', 'province', $slug ) ?>"></label></td> | |
| 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> | |
| 319 | 313 | </tr> |
| 320 | 314 | <tr> |
| 321 | 315 | <td colspan="2"> |
| 322 | 316 | <button |
| @@ -382,14 +376,14 @@ | ||
| 382 | 376 | } |
| 383 | 377 | }); |
| 384 | 378 | |
| 385 | 379 | $.ajax({ |
| 386 | - url : ajaxurl, | |
| 380 | + url : <?php echo Freemius::ajax_url() ?>, | |
| 387 | 381 | method : 'POST', |
| 388 | 382 | data : { |
| 389 | - action : '<?php echo $fs->get_ajax_action( 'update_billing' ) ?>', | |
| 390 | - security : '<?php echo $fs->get_ajax_security( 'update_billing' ) ?>', | |
| 391 | - module_id: '<?php echo $fs->get_id() ?>', | |
| 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() ) ?>, | |
| 392 | 386 | billing : billing |
| 393 | 387 | }, |
| 394 | 388 | success: function (resultObj) { |
| 395 | 389 | if (resultObj.success) { |
| @@ -425,7 +419,5 @@ | ||
| 425 | 419 | .toggleClass('button-primary'); |
| 426 | 420 | } |
| 427 | 421 | }); |
| 428 | 422 | })(jQuery); |
| 429 | -</script> | |
| 430 | -<?php | |
| 431 | - endif; | |
| 423 | +</script> | |