| @@ -9,11 +9,11 @@ | ||
| 9 | 9 | * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3 |
| 10 | 10 | * @since 1.0.9 |
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 14 | - exit; | |
| 15 | -} | |
| 13 | + if ( ! defined( 'ABSPATH' ) ) { | |
| 14 | + exit; | |
| 15 | + } | |
| 16 | 16 | ?> |
| 17 | 17 | <script type="text/javascript"> |
| 18 | 18 | jQuery( document ).ready(function( $ ) { |
| 19 | 19 | $( '#fs_firewall_issue_options a.fs-resolve' ).click(function() { |
| @@ -22,11 +22,9 @@ | ||
| 22 | 22 | notice = $( this ).parents( '.fs-notice' ), |
| 23 | 23 | ajaxActionSuffix = notice.attr( 'data-manager-id' ).replace( ':', '-' ); |
| 24 | 24 | |
| 25 | 25 | var data = { |
| 26 | - action : 'fs_resolve_firewall_issues_' + ajaxActionSuffix, | |
| 27 | - // As such we don't need to use `wp_json_encode` method but using it to follow wp.org guideline. | |
| 28 | - _wpnonce : <?php echo wp_json_encode( wp_create_nonce( 'fs_resolve_firewall_issues' ) ); ?>, | |
| 26 | + action : 'fs_resolve_firewall_issues_' + ajaxActionSuffix, | |
| 29 | 27 | error_type: error_type |
| 30 | 28 | }; |
| 31 | 29 | |
| 32 | 30 | if ( 'squid' === error_type ) { |
| @@ -40,16 +38,15 @@ | ||
| 40 | 38 | } |
| 41 | 39 | } |
| 42 | 40 | |
| 43 | 41 | if ( 'retry_ping' === error_type ) { |
| 44 | - data.action = 'fs_retry_connectivity_test_' + ajaxActionSuffix; | |
| 45 | - // As such we don't need to use `wp_json_encode` method but using it to follow wp.org guideline. | |
| 46 | - data._wpnonce = <?php echo wp_json_encode( wp_create_nonce( 'fs_retry_connectivity_test' ) ); ?>; | |
| 42 | + data.action = 'fs_retry_connectivity_test_' + ajaxActionSuffix; | |
| 47 | 43 | } |
| 48 | 44 | |
| 49 | 45 | $( this ).css({'cursor': 'wait'}); |
| 50 | 46 | |
| 51 | - $.post( <?php echo Freemius::ajax_url(); ?>, data, function( response ) { | |
| 47 | + // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php | |
| 48 | + $.post( ajaxurl, data, function( response ) { | |
| 52 | 49 | if ( 1 == response ) { |
| 53 | 50 | // Refresh page on success. |
| 54 | 51 | location.reload(); |
| 55 | 52 | } else if ( 'http' === response.substr( 0, 4 ) ) { |
| @@ -58,5 +55,5 @@ | ||
| 58 | 55 | } |
| 59 | 56 | }); |
| 60 | 57 | }); |
| 61 | 58 | }); |
| 62 | -</script> | |
| 59 | +</script> | |