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/inc/validity-test.php
<?php
// Add this to functions.php or a test file

// Add menu item for testing
add_action('admin_menu', 'add_license_test_menu');
function add_license_test_menu() {
    add_submenu_page(
        'tools.php',
        'License Validator Test',
        'License Validator',
        'manage_options',
        'license-validator-test',
        'display_license_validator_test'
    );
}

// Display test page
function display_license_validator_test() {
    if (!current_user_can('manage_options')) {
        return;
    }

    global $stylo_sdk_license;

    // Handle test action
    if (isset($_POST['test_license_validity']) && check_admin_referer('test_license_validity')) {
        $test_results = $stylo_sdk_license->force_check_validity();
        $next_check = $stylo_sdk_license->get_next_validation_time();
    }
    ?>
    <div class="wrap">
        <h1>License Validator Test</h1>
        
        <form method="post" action="">
            <?php wp_nonce_field('test_license_validity'); ?>
            <p><input type="submit" name="test_license_validity" class="button button-primary" value="Test License Validity Now"></p>
        </form>

        <?php if (isset($test_results)): ?>
            <h2>Test Results</h2>
            <table class="widefat" style="max-width: 800px; margin-top: 20px;">
                <tr>
                    <th>Check Time</th>
                    <td><?php echo esc_html($test_results['check_time']); ?></td>
                </tr>
                <tr>
                    <th>Previous Check</th>
                    <td><?php echo esc_html($test_results['last_check']); ?></td>
                </tr>
                <tr>
                    <th>Next Scheduled Check</th>
                    <td><?php echo esc_html($next_check['next_check']); ?></td>
                </tr>
                <tr>
                    <th>Current Status</th>
                    <td><?php echo esc_html($next_check['current_status']); ?></td>
                </tr>
                <tr>
                    <th>Server Response</th>
                    <td><pre><?php print_r($test_results['server_response']); ?></pre></td>
                </tr>
            </table>
        <?php endif; ?>

        <h2>Current License Status</h2>
        <?php 
        $current_status = $stylo_sdk_license->get_next_validation_time();
        ?>
        <table class="widefat" style="max-width: 800px;">
            <tr>
                <th>Next Scheduled Check</th>
                <td><?php echo esc_html($current_status['next_check']); ?></td>
            </tr>
            <tr>
                <th>Time Until Next Check</th>
                <td><?php echo esc_html(human_time_diff(time(), time() + $current_status['time_remaining'])); ?></td>
            </tr>
            <tr>
                <th>Current Status</th>
                <td><?php echo esc_html($current_status['current_status']); ?></td>
            </tr>
        </table>

        <h2>Database Values</h2>
        <?php 
        $license_status = get_option('stylo_license_status');
        $license_data = get_option('stylocore_license_data');
        ?>
        <table class="widefat" style="max-width: 800px;">
            <tr>
                <th>License Status Option</th>
                <td><pre><?php print_r($license_status); ?></pre></td>
            </tr>
            <tr>
                <th>License Data Option</th>
                <td><pre><?php print_r($license_data); ?></pre></td>
            </tr>
        </table>
    </div>
    <?php
}