| @@ -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,9 +22,11 @@ | ||
| 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, | |
| 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' ) ); ?>, | |
| 27 | 29 | error_type: error_type |
| 28 | 30 | }; |
| 29 | 31 | |
| 30 | 32 | if ( 'squid' === error_type ) { |
| @@ -38,15 +40,16 @@ | ||
| 38 | 40 | } |
| 39 | 41 | } |
| 40 | 42 | |
| 41 | 43 | if ( 'retry_ping' === error_type ) { |
| 42 | - data.action = 'fs_retry_connectivity_test_' + ajaxActionSuffix; | |
| 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' ) ); ?>; | |
| 43 | 47 | } |
| 44 | 48 | |
| 45 | 49 | $( this ).css({'cursor': 'wait'}); |
| 46 | 50 | |
| 47 | - // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php | |
| 48 | - $.post( ajaxurl, data, function( response ) { | |
| 51 | + $.post( <?php echo Freemius::ajax_url(); ?>, data, function( response ) { | |
| 49 | 52 | if ( 1 == response ) { |
| 50 | 53 | // Refresh page on success. |
| 51 | 54 | location.reload(); |
| 52 | 55 | } else if ( 'http' === response.substr( 0, 4 ) ) { |
| @@ -55,5 +58,5 @@ | ||
| 55 | 58 | } |
| 56 | 59 | }); |
| 57 | 60 | }); |
| 58 | 61 | }); |
| 59 | -</script> | |
| 62 | +</script> | |