/var/www/hkosl.com/aga/wp-content/plugins/foogallery/freemius/templates/firewall-issues-js.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
    
/**
     * API connectivity issues (CloudFlare's firewall) handler for handling different
     * scenarios selected by the user after connectivity issue is detected, by sending
     * AJAX call to the server in order to make the actual actions.
     *
     * @package     Freemius
     * @copyright   Copyright (c) 2015, Freemius, Inc.
     * @license     https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
     * @since       1.0.9
     */

    
if ( ! defined'ABSPATH' ) ) {
        exit;
    }
?>
<script type="text/javascript">
    jQuery( document ).ready(function( $ ) {
        $( '#fs_firewall_issue_options a.fs-resolve' ).click(function() {
            var
                error_type       = $( this ).attr( 'data-type' ),
                notice           = $( this ).parents( '.fs-notice' ),
                ajaxActionSuffix = notice.attr( 'data-manager-id' ).replace( ':', '-' );

            var data = {
                action    : 'fs_resolve_firewall_issues_' + ajaxActionSuffix,
                error_type: error_type
            };

            if ( 'squid' === error_type ) {
                data.hosting_company = prompt( 'What is the name or URL of your hosting company?' );
                if ( null == data.hosting_company )
                    return false;

                if ( '' === data.hosting_company ) {
                    alert( 'We won\'t be able to help without knowing your hosting company.' );
                    return false;
                }
            }

            if ( 'retry_ping' === error_type ) {
                data.action = 'fs_retry_connectivity_test_' + ajaxActionSuffix;
            }

            $( this ).css({'cursor': 'wait'});

            // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
            $.post( ajaxurl, data, function( response ) {
                if ( 1 == response ) {
                    // Refresh page on success.
                    location.reload();
                } else if ( 'http' === response.substr( 0, 4 ) ) {
                    // Ping actually worked, redirect.
                    window.location = response;
                }
            });
        });
    });
</script>