HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux wordpress-ubuntu-s-2vcpu-4gb-fra1-01 5.4.0-169-generic #187-Ubuntu SMP Thu Nov 23 14:52:28 UTC 2023 x86_64
User: root (0)
PHP: 7.4.33
Disabled: 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_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/shoetique/wp-content/plugins/wp-all-export-pro/src/Scheduling/LicensingManager.php
<?php

namespace Wpae\Scheduling;


class LicensingManager
{
    private $options = false;

    public function checkLicense($licenseKey, $productName)
    {
		// Short-circuit check if recently validated.
		if ( get_transient( 'wpai_wpae_scheduling_license_verified' ) ) {
			return ['success' => true];
		}
        if ($productName !== false) {
            // data to send in our API request
            $api_params = array(
                'edd_action' => 'activate_license',
                'license' => \PMXE_Plugin::decode($licenseKey),
                'item_name' => urlencode($productName) // the name of our product in EDD
            );

            // Call the custom API.
            $response = wp_remote_get(
                esc_url_raw(
                    add_query_arg(
                        $api_params,
                        $this->getInfoApiUrl()
                )),
                array(
                    'timeout' => 15,
                    'sslverify' => true
                )
            );

            // make sure the response came back okay
            if (is_wp_error($response)){
                return ['success' => false];
            }

            $responseData = \json_decode($response['body'], true);

            if(is_null($responseData) || empty($responseData['success'])) {
                return $responseData ?? ['success' => false];
            } else {
				// Set transient so we only recheck successful licenses once every ten minutes.
	            set_transient('wpai_wpae_scheduling_license_verified', true, 600);
                return $responseData;
            }
        } else {
            return ['success' => false];
        }
    }

    public function getLicense()
    {
        $options = $this->getOptions();
        return $options['license'];
    }

    public function getInfoApiUrl()
    {
        $options = $this->getOptions();
        return $options['info_api_url_new'];
    }

    private function getOptions()
    {
        // Cache the options
        if(!$this->options) {
            $this->options = \PMXE_Plugin::getInstance()->getOption();
        }

        return $this->options;
    }
}