HEX
Server: Apache
System: Linux pdx1-shared-a2-01 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: dh_mhscom (5469217)
PHP: 8.3.30
Disabled: NONE
Upload Files
File: /home/dh_mhscom/marcoshsilva.com/wp-content/plugins/yoo-slider/classes/GKSNotificationManager.php
<?php

class GKSNotificationManager
{
    const GKS_NOTIFICATIONS_OPTION_KEY = 'gks_notifications_option_key';
    const TYPE_WARNING = 'warning';
    const TYPE_ERROR = 'error';
    const TYPE_INFO = 'info';

    const KEY_OVERUSED = 'overused';
    const KEY_INVALID = 'invalid';
    const KEY_EXPIRED = 'expired';
    const KEY_EXPIRING = 'expiring';
    const KEY_NOT_FOUND = 'not_found';
    const KEY_MISMATCH = 'mismatch';

    public function register($key, $data)
    {
        $notifications = get_option(GKSNotificationManager::GKS_NOTIFICATIONS_OPTION_KEY);
        $notifications = empty($notifications) ? array() : json_decode($notifications, true);
        $notifications[$key] = json_encode($data);
        update_option(GKSNotificationManager::GKS_NOTIFICATIONS_OPTION_KEY, json_encode($notifications));
    }

    public function registerForStatus($status)
    {
        // if ($status == GKSLicenseManager::STATUS_EXPIRING || $status == GKSLicenseManager::STATUS_EXPIRED || $status == GKSLicenseManager::STATUS_INVALID) {
        //     return;
        // }

        $data = array();
        $key = null;
        if ($status == GKSLicenseManager::RS_OVERUSED) {
            $key = GKSNotificationManager::KEY_OVERUSED;
            $data['type'] = GKSNotificationManager::TYPE_WARNING;
            $data['title'] = '';//'<h3>Overused</h3>';
            $data['content'] = '<p>| <b>Yoo Slider</b> | <i>You have reached to the limit of websites included in your license! Manage your license on <a href="'. esc_url(admin_url('admin.php?page=' . GKS_SUBMENU_LICENSE_SLUG)).'">Yoo Slider License</a> page.</i></p>';
            $data['buttons'] = '';
        } elseif ($status == GKSLicenseManager::RS_INVALID) {
            $key = GKSNotificationManager::KEY_INVALID;
            $data['type'] = GKSNotificationManager::TYPE_ERROR;
            $data['title'] = '';//'<h3>Invalid</h3>';
            $data['content'] = '<p>| <b>Yoo Slider</b> | <i>Your license is invalid!</i></p>';
            $data['buttons'] = '';
        } elseif ($status == GKSLicenseManager::RS_MISMATCH) {
            $key = GKSNotificationManager::KEY_MISMATCH;
            $data['type'] = GKSNotificationManager::TYPE_ERROR;
            $data['title'] = '';//'<h4>Package - Key mismatch</h4>';
            $data['content'] = '<p>| <b>Yoo Slider</b> | <i>The entered license key was not registered for this package!</i></p>';
            $data['buttons'] = '';
        } elseif ($status == GKSLicenseManager::RS_EXPIRED) {
            $key = GKSNotificationManager::KEY_EXPIRED;
            $data['type'] = GKSNotificationManager::TYPE_ERROR;
            $data['title'] = '';//'<h3>Expired</h3>';
            $data['content'] = '<p>| <b>Yoo Slider</b> | <i>Updates included in your license expired! Manage your license on <a href="'.esc_url(admin_url('admin.php?page=' . GKS_SUBMENU_LICENSE_SLUG)).'">Yoo Slider License</a> page.</i></p>';
            $data['buttons'] = '';
        } elseif ($status == GKSLicenseManager::RS_EXPIRING) {
            $key = GKSNotificationManager::KEY_EXPIRING;
            $data['type'] = GKSNotificationManager::TYPE_WARNING;
            $data['title'] = '';//'<h3>Expiring</h3>';
            $data['content'] = '<p>| <b>Yoo Slider</b> | <i>Updates included in your license are about to expire! Manage your license on <a href="'.esc_url(admin_url('admin.php?page=' . GKS_SUBMENU_LICENSE_SLUG)).'">Yoo Slider License</a> page.</i></p>';
            $data['buttons'] = '';
        } elseif ($status == GKSLicenseManager::RS_NOT_FOUND) {
            $key = GKSNotificationManager::KEY_NOT_FOUND;
            $data['type'] = GKSNotificationManager::TYPE_ERROR;
            $data['title'] = '';//'<h3>Not found</h3>';
            $data['content'] = '<p>| <b>Yoo Slider</b> | <i>License key was not found!</i></p>';
            $data['buttons'] = '';
        }
        if (!empty($key)) {
            GKSNotificationManager::register($key, $data);
        }
    }

    public function dismissAll()
    {
       delete_option(GKSNotificationManager::GKS_NOTIFICATIONS_OPTION_KEY);
    }

    public function showAll()
    {
        $notifications = get_option(GKSNotificationManager::GKS_NOTIFICATIONS_OPTION_KEY);
        if (!empty($notifications)) {
            $notifications = json_decode($notifications, true);
            foreach ($notifications as $key => $notification) {
                $notification = json_decode($notification, true);
?>
                <div class="notice notice-<?php echo esc_attr($notification['type']); ?> is-dismissible">
                    <?php echo wp_kses($notification['title'], GKS_ALLOWED_HTML); ?>
                    <?php echo wp_kses($notification['content'], GKS_ALLOWED_HTML); ?>
                    <?php echo wp_kses($notification['buttons'], GKS_ALLOWED_HTML); ?>
                </div>
<?php

            }
        }
    }

}