SILENT KILLERPanel

Current Path: > home > codekrsu > > escapematrixonline.com > wp-content > plugins > koko-analytics > src >


Operation   : Linux premium131.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
Software     : Apache
Server IP    : 162.0.232.56 | Your IP: 216.73.216.111
Domains      : 1034 Domain(s)
Permission   : [ 0755 ]

Files and Folders in: /home/codekrsu//escapematrixonline.com/wp-content/plugins/koko-analytics/src/

NameTypeSizeLast ModifiedActions
views Directory - -
backwards-compat.php File 370 bytes June 12 2025 11:44:36.
class-actions.php File 845 bytes February 10 2025 14:48:06.
class-admin-actions.php File 4609 bytes June 12 2025 11:44:36.
class-admin-bar.php File 713 bytes February 18 2025 13:13:36.
class-admin-page.php File 5425 bytes June 12 2025 11:44:36.
class-admin.php File 4019 bytes February 10 2025 14:48:06.
class-aggregator.php File 2952 bytes February 25 2025 13:03:20.
class-burst-importer.php File 11294 bytes June 13 2025 15:30:02.
class-chart-view.php File 5748 bytes June 12 2025 11:44:36.
class-command.php File 514 bytes April 15 2025 12:32:12.
class-dashboard-widget.php File 1548 bytes February 18 2025 13:13:36.
class-dashboard.php File 9510 bytes June 12 2025 11:44:36.
class-data-exporter.php File 3168 bytes February 18 2025 13:13:36.
class-data-importer.php File 2270 bytes February 18 2025 13:13:36.
class-endpoint-installer.php File 5526 bytes June 13 2025 10:27:30.
class-fingerprinter.php File 2279 bytes June 12 2025 11:44:36.
class-fmt.php File 1332 bytes February 18 2025 13:13:36.
class-jetpack-importer.php File 15592 bytes June 13 2025 15:30:02.
class-migrations.php File 2436 bytes January 17 2025 13:46:42.
class-notice-pro.php File 4591 bytes March 24 2025 11:30:04.
class-pageview-aggregator.php File 12890 bytes March 10 2025 11:31:16.
class-plugin.php File 1234 bytes June 12 2025 11:44:36.
class-pruner.php File 1460 bytes April 15 2025 12:32:12.
class-query-loop-block.php File 1533 bytes March 10 2025 11:31:16.
class-rest.php File 8271 bytes February 10 2025 14:48:06.
class-script-loader.php File 4741 bytes June 12 2025 11:44:36.
class-shortcode-most-viewed-posts.php File 1861 bytes February 25 2025 13:03:20.
class-shortcode-site-counter.php File 1727 bytes March 10 2025 11:31:16.
class-stats.php File 7099 bytes June 12 2025 11:44:36.
class-widget-most-viewed-posts.php File 5828 bytes February 10 2025 14:48:06.
collect-functions.php File 9907 bytes June 18 2025 21:02:18.
external-strings.php File 7144 bytes April 15 2025 12:32:12.
functions.php File 6447 bytes June 12 2025 11:44:36.
global-functions.php File 2521 bytes January 17 2025 13:46:42.
template-functions.php File 567 bytes February 18 2025 13:13:36.

Reading File: /home/codekrsu//escapematrixonline.com/wp-content/plugins/koko-analytics/src//class-admin-page.php

<?php

/**
 * @package koko-analytics
 * @license GPL-3.0+
 * @author Danny van Kooten
 */

namespace KokoAnalytics;

class Admin_Page
{
    public static function show_page(): void
    {
        add_action('koko_analytics_show_settings_page', [self::class, 'show_settings_page'], 10, 0);
        add_action('koko_analytics_show_dashboard_page', [self::class, 'show_dashboard_page'], 10, 0);

        $tab = $_GET['tab'] ?? 'dashboard';
        do_action("koko_analytics_show_{$tab}_page");

        add_filter('admin_footer_text', [self::class, 'footer_text'], 10, 1);
    }

    public static function show_dashboard_page(): void
    {
        // aggregate stats whenever this page is requested
        do_action('koko_analytics_aggregate_stats');

        // check if cron event is scheduled properly
        if (false === self::is_cron_event_working()) {
            echo '<div class="notice notice-warning inline koko-analytics-cron-warning is-dismissible"><p>';
            echo esc_html__('There seems to be an issue with your site\'s WP Cron configuration that prevents Koko Analytics from automatically processing your statistics.', 'koko-analytics');
            echo ' ';
            echo esc_html__('If you\'re not sure what this is about, please ask your webhost to look into this.', 'koko-analytics');
            echo '</p></div>';
        }

        // determine whether buffer file is writable
        $buffer_filename        = get_buffer_filename();
        $buffer_dirname         = dirname($buffer_filename);
        $is_buffer_dir_writable = wp_mkdir_p($buffer_dirname) && is_writable($buffer_dirname);

        if (false === $is_buffer_dir_writable) {
            echo '<div class="notice notice-warning inline is-dismissible"><p>';
            echo wp_kses(\sprintf(__('Koko Analytics is unable to write to the <code>%s</code> directory. Please update the file permissions so that your web server can write to it.', 'koko-analytics'), $buffer_dirname), ['code' => []]);
            echo '</p></div>';
        }

        $dashboard = new Dashboard();
        $dashboard->show();
    }

    public static function show_settings_page(): void
    {
        if (!current_user_can('manage_koko_analytics')) {
            return;
        }

        $settings           = get_settings();
        $using_custom_endpoint = using_custom_endpoint();
        $database_size      = self::get_database_size();
        $user_roles   = self::get_available_roles();
        $date_presets = (new Dashboard())->get_date_presets();

        require __DIR__ . '/views/settings-page.php';
    }

    public static function footer_text($text): string
    {
        // ensure upgrade text isn't showing
        add_filter('update_footer', '__return_empty_string');

        /* translators: %1$s links to the WordPress.org plugin review page, %2$s links to the admin page for creating a new post */
        return \sprintf(wp_kses(__('If you enjoy using Koko Analytics, please consider <a href="%1$s">purchasing Koko Analytics Pro</a>, <a href="%2$s">reviewing the plugin on WordPress.org</a> or <a href="%3$s">writing about it on your blog</a> to help out.', 'koko-analytics'), ['a' => ['href' => []]]), 'https://www.kokoanalytics.com/pricing/', 'https://wordpress.org/support/view/plugin-reviews/koko-analytics?rate=5#postform', admin_url('post-new.php'));
    }

    private static function get_available_roles(): array
    {
        $roles = [];
        foreach (wp_roles()->roles as $key => $role) {
            $roles[$key] = $role['name'];
        }
        return $roles;
    }

    /**
     * Checks to see if the cron event is correctly scheduled and running periodically
     * If the cron event is somehow not scheduled, this will schedule it again.
     */
    private static function is_cron_event_working(): bool
    {
        // Always return true on localhost / dev-ish environments
        $site_url = get_site_url();
        $parts = parse_url($site_url);
        if (!is_array($parts) || !empty($parts['port']) || str_contains($parts['host'], 'localhost') || str_contains($parts['host'], 'local')) {
            return true;
        }

        // detect issues with WP Cron event not running
        // it should run every minute, so if it didn't run in 40 minutes there is most likely something wrong
        // some host run WP Cron only once per 15 minutes, so that is probably the lower bound of this check
        $next_scheduled = wp_next_scheduled('koko_analytics_aggregate_stats');
        if ($next_scheduled === false) {
            // if the event does not appear in scheduled event list at all
            // schedule it now
            wp_schedule_event(time() + 60, 'koko_analytics_stats_aggregate_interval', 'koko_analytics_aggregate_stats');
            return true;
        }

        return $next_scheduled !== false && $next_scheduled > (time() - 40 * 60);
    }

    /**
     * @return int Total size of all Koko Analytics database tables in bytes
     */
    public static function get_database_size(): int
    {
        /** @var \wpdb $wpdb */
        global $wpdb;
        $sql = $wpdb->prepare(
            '
            SELECT SUM(DATA_LENGTH + INDEX_LENGTH)
            FROM information_schema.TABLES
            WHERE TABLE_SCHEMA = %s AND TABLE_NAME LIKE %s',
            [DB_NAME, $wpdb->prefix . 'koko_analytics_%']
        );
        return (int) $wpdb->get_var($sql);
    }
}

SILENT KILLER Tool