<?php
/**
 * @package embed-sharepoint-onedrive-documents
 * @author miniOrange
 * @link https://plugins.miniorange.com
 */


namespace MoSharePointObjectSync\LicenseLibrary\Handlers;

use MoSharePointObjectSync\LicenseLibrary\Classes\Mo_License_Constants;
use MoSharePointObjectSync\LicenseLibrary\Classes\Mo_License_Dao;
use MoSharePointObjectSync\LicenseLibrary\Mo_License_Config;
use MoSharePointObjectSync\LicenseLibrary\Mo_License_Service;
use MoSharePointObjectSync\LicenseLibrary\Utils\Mo_License_Actions_Utility;
use MoSharePointObjectSync\LicenseLibrary\Views\Mo_License_Notice_Views;
if (defined("\x41\102\x53\x50\101\124\110")) {
    goto pI;
}
exit;
pI:
class Mo_License_Actions_Handler
{
    private $license_expiry_date;
    public function __construct($d6)
    {
        $this->license_expiry_date = $d6;
    }
    public function run_license_cron()
    {
        if (Mo_License_Service::is_customer_license_verified()) {
            goto ZP;
        }
        return;
        ZP:
        $sW = Mo_License_Dao::mo_get_option(Mo_License_Constants::LAST_CHECK_TIME_OPTION);
        if (!$sW) {
            goto Jx;
        }
        $sW = intval($sW);
        if (!(time() - $sW < 3600 * 24 * Mo_License_Config::LICENSE_CRON_INTERVAL)) {
            goto rc;
        }
        return;
        rc:
        Jx:
        $EQ = Mo_License_Actions_Utility::fetch_license_expiry_date();
        if (!$EQ) {
            goto bn;
        }
        Mo_License_Service::update_license_expiry($EQ);
        Mo_License_Dao::mo_update_option(Mo_License_Constants::LAST_CHECK_TIME_OPTION, time());
        bn:
    }
    public function dismiss_admin_license_notice()
    {
        if (!(current_user_can("\155\x61\156\x61\147\145\x5f\x6f\160\x74\151\157\x6e\x73") && !empty($_POST["\157\160\164\x69\157\156"]) && Mo_License_Constants::ADMIN_NOTICE_DISMISS_ID === $_POST["\157\160\x74\x69\157\x6e"] && check_admin_referer(Mo_License_Constants::ADMIN_NOTICE_DISMISS_ID))) {
            goto TH;
        }
        $cB = Mo_License_Service::get_expiry_remaining_days($this->license_expiry_date);
        Mo_License_Dao::mo_update_option(Mo_License_Constants::EXPIRY_NOTICE_CLOSE_OPTION, $cB);
        TH:
    }
    public function refresh_admin_widget_expiry()
    {
        if (!(current_user_can("\x6d\141\156\x61\x67\145\x5f\157\x70\x74\x69\157\x6e\x73") && !empty($_POST["\x6f\x70\x74\151\157\x6e"]) && Mo_License_Constants::DASHBOARD_WIDGET_REFRESH_ID === $_POST["\x6f\160\164\x69\157\156"] && check_admin_referer(Mo_License_Constants::DASHBOARD_WIDGET_REFRESH_ID))) {
            goto YZ;
        }
        Mo_License_Service::refresh_license_expiry();
        YZ:
    }
}
