HEX
Server: Apache/2.4.62 (Unix) OpenSSL/1.1.1k
System: Linux box12.multicloud.host 4.18.0-553.52.1.el8_10.x86_64 #1 SMP Wed May 14 09:36:12 EDT 2025 x86_64
User: kashmira (1008)
PHP: 8.1.32
Disabled: NONE
Upload Files
File: /home/kashmira/public_html/razitahir.com/wp-content/plugins/stylo-core/assets/js/ajax.js
function stylo_activate_license() {
    console.log("License activation initiated");
    jQuery("#actiavtionBTN").html('Working...');
    
    jQuery.ajax({
        url: ajaxurl,
        type: 'post',
        data: {
            action: 'stylothemes_activate'
        },
        success: function(response) {
            jQuery("#wpacAjaxResponse").fadeIn();
            jQuery("#wpacAjaxResponse span").html(response);
            
            if (response.includes("Activated") || response.includes("Success")) {
                jQuery("#actiavtionBTN").html('Success');
                setTimeout(function() {
                    location.reload();
                }, 1000);
            } else {
                jQuery("#actiavtionBTN").html('Failed');
                setTimeout(function() {
                    jQuery("#actiavtionBTN").html('Activate License');
                }, 2000);
            }
        },
        error: function(xhr, status, error) {
            console.error("Activation error:", error);
            jQuery("#wpacAjaxResponse").fadeIn();
            jQuery("#wpacAjaxResponse span").html("Error: " + error);
            jQuery("#actiavtionBTN").html('Failed');
        }
    });
}

function stylo_deactivate_license() {
    console.log("License deactivation initiated");
    jQuery("#deactiavtionBTN").html('Working...');
    
    jQuery.ajax({
        url: ajaxurl,
        type: 'post',
        data: {
            action: 'stylothemes_deactivate',
        },
        success: function(response) {
            jQuery("#wpacAjaxResponse").fadeIn();
            jQuery("#wpacAjaxResponse span").html(response);
            
            if (response.includes("Deactivated")) {
                jQuery("#deactiavtionBTN").html('Success');
                setTimeout(function() {
                    location.reload();
                }, 2000);
            } else {
                jQuery("#deactiavtionBTN").html('Failed');
                setTimeout(function() {
                    jQuery("#deactiavtionBTN").html('Deactivate License');
                }, 2000);
            }
        },
        error: function(xhr, status, error) {
            console.error("Deactivation error:", error);
            jQuery("#wpacAjaxResponse").fadeIn();
            jQuery("#wpacAjaxResponse span").html("Error: " + error);
            jQuery("#deactiavtionBTN").html('Failed');
        }
    });
}

jQuery(document).ready(function($) {
    // Load license information panel
    jQuery.ajax({
        url: ajaxurl,
        type: 'post',
        data: {
            action: 'license_info_panel',
        },
        success: function(response) {
            jQuery("#licenseInfoPanel").html(response);
        },
        error: function(xhr, status, error) {
            console.error("License info error:", error);
            jQuery("#licenseInfoPanel").html("Error loading license information");
        }
    });
    
    // Load news and updates
    function fetchPosts() {
        jQuery.ajax({
            url: 'https://stylothemes.com/wp-json/wp/v2/posts?per_page=5',
            headers: {
                'Content-Type': 'application/x-www-form-urlencoded'
            },
            type: 'GET',
            dataType: 'json',
            crossDomain: true,
            success: function(response) {
                if (response.length > 0) {
                    $('#stylothemes-updates-restapi').empty();
                    $.each(response, function(index, post) {
                        var postHTML = '<h4><a href="' + post.link + '" target="_blank">' + post.title.rendered + '</a></h4>';
                        $('#stylothemes-updates-restapi').append(postHTML);
                    });
                } else {
                    $('#stylothemes-updates-restapi').html('No posts found.');
                }
            },
            error: function(xhr, status, error) {
                console.error("News fetch error:", error);
                $('#stylothemes-updates-restapi').html('Unable to load updates. Please try again later.');
            }
        });
    }

    fetchPosts();
});