403Webshell
Server IP : 38.190.208.107  /  Your IP : 216.73.217.13
Web Server : nginx/1.28.1
System : Linux ht2026040333114 6.1.0-10-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.37-1 (2023-07-03) x86_64
User : root ( 0)
PHP Version : 8.2.28
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv,eval,assert,passthru,system,exec,shell_exec,popen,proc_open
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /www/wwwroot/wp.10/wp-content/plugins/clarity-seo/includes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/wwwroot/wp.10/wp-content/plugins/clarity-seo/includes/gsc.php
<?php
if ( ! defined( 'ABSPATH' ) ) {
    exit; // Exit if accessed directly
}
// GSC Integration - Fetch data via Google API
function clarity_seo_fetch_gsc_data($access_token, $site_url) {
    if (empty($access_token) || empty($site_url)) return ['error' => 'Access token or site URL missing.'];

    // Fetch errors/index issues (simplified; real would use Search Analytics for more)
    $api_url = "https://searchconsole.googleapis.com/webmasters/v3/sites/" . urlencode($site_url) . "/searchAnalytics/query";
    $body = json_encode([
        'startDate' => gmdate('Y-m-d', strtotime('-30 days')),
        'endDate' => gmdate('Y-m-d', strtotime('-1 day')),
        'dimensions' => ['page'],
        'rowLimit' => 5
    ]);

    $response = wp_remote_post($api_url, [
        'headers' => ['Authorization' => 'Bearer ' . $access_token, 'Content-Type' => 'application/json'],
        'body' => $body
    ]);

    if (is_wp_error($response)) return ['error' => $response->get_error_message()];

    $data = json_decode(wp_remote_retrieve_body($response), true);
    if (isset($data['error'])) return $data['error'];

    return $data['rows'] ?? ['No data found.'];
}

// Hook to display in settings
add_action('clarity_seo_settings_page', function() {
    $gsc_token = get_option('clarity_seo_gsc_access_token', '');
    $gsc_site = get_option('clarity_seo_gsc_site_url', '');
    if (!empty($gsc_token) && !empty($gsc_site)) {
        $gsc_data = clarity_seo_fetch_gsc_data($gsc_token, $gsc_site);
        echo '<p><strong>GSC Data (Top Pages):</strong></p><ul>';
        if (isset($gsc_data['error'])) {
            echo '<li>Error: ' . esc_html($gsc_data['error']['message']) . '</li>';
        } else {
            foreach ($gsc_data as $row) {
                echo '<li>Page: ' . esc_html($row['keys'][0]) . ' - Position: ' . esc_html(round($row['position'], 1)) . '</li>';
            }
        }
        echo '</ul>';
    } else {
        echo '<p>Set GSC access token and site URL in settings.</p>';
    }
});

// Enhanced: Fetch index status for tracking
function clarity_seo_fetch_gsc_index_status($access_token, $url) {
    $api_url = "https://searchconsole.googleapis.com/v1/urlInspection/index/inspect";
    $body = json_encode(['inspectionUrl' => $url, 'siteUrl' => get_option('clarity_seo_gsc_site_url', '')]);

    $response = wp_remote_post($api_url, [
        'headers' => ['Authorization' => 'Bearer ' . $access_token, 'Content-Type' => 'application/json'],
        'body' => $body
    ]);

    if (is_wp_error($response)) return 'Error: ' . $response->get_error_message();

    $data = json_decode(wp_remote_retrieve_body($response), true);
    return $data['inspectionResult']['indexStatusResult']['verdict'] ?? 'Unknown';
}
?>

Youez - 2016 - github.com/yon3zu
LinuXploit