$48 GRAYBYTE WORDPRESS FILE MANAGER $18

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 104.21.43.35 | ADMIN IP 216.73.216.157
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : mail

/home/bravrvjk/itiministry.org/wp-content/plugins/give/src/License/

HOME
Current File : /home/bravrvjk/itiministry.org/wp-content/plugins/give/src/License//PremiumAddonsListManager.php
<?php

namespace Give\License;

/**
 * Class PremiumAddonManager
 * @package Give\License
 *
 * this class we use to manager premium addons list for licensing.
 *
 * @since 2.9.2
 */
class PremiumAddonsListManager
{
    /**
     * Products list api url.
     *
     * @since 2.9.2
     */
    const PRODUCTS_LIST_API_URL = 'https://givewp.com/edd-api/products';

    /**
     * Cached addon values for the same request, prevents subsequent transient queries
     *
     * @since 2.11.3
     */
    private $addonIds;

    /**
     * Get premium addons slugs as addons ids.
     *
     * @since 2.11.3 Always cache to avoid timeouts on givewp.com
     * @since 2.9.2
     *
     * @return array
     */
    private function getAddonsIds()
    {
        if (isset($this->addonIds)) {
            return $this->addonIds;
        }

        $optionName = 'give_premium_addons_ids';
        $cachedResult = get_transient($optionName);
        if ($cachedResult !== false) {
            return $this->addonIds = $cachedResult;
        }

        $response = wp_remote_get(
            self::PRODUCTS_LIST_API_URL . '?number=-1',
            [
                'timeout' => 3,
            ]
        );
        $productsInformation = wp_remote_retrieve_body($response);
        $responseCode = wp_remote_retrieve_response_code($response);
        if ( ! $productsInformation || $responseCode < 200 || $responseCode > 299) {
            set_transient($optionName, [], HOUR_IN_SECONDS);

            return $this->addonIds = [];
        }

        $productsInformation = json_decode($productsInformation, true);
        $productsIds = [];
        foreach ($productsInformation['products'] as $product) {
            $productsIds[] = $product['info']['slug'];
        }

        if ($productsIds) {
            set_transient($optionName, $productsIds, DAY_IN_SECONDS);
        }

        return $this->addonIds = $productsIds;
    }

    /**
     * Return whether or not addon is premium addon.
     *
     * @since 2.9.2
     *
     * @param string $pluginURI
     *
     * @return bool
     */
    public function isPremiumAddons($pluginURI)
    {
        $addonId = basename($pluginURI);
        $addonsIds = $this->getAddonsIds();

        return in_array($addonId, $addonsIds, true);
    }
}


Current_dir [ WRITEABLE ] Document_root [ NOT WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
4 Apr 2026 1.57 AM
bravrvjk / bravrvjk
0755
Actions
--
4 Apr 2026 1.57 AM
bravrvjk / bravrvjk
0755
DataTransferObjects
--
4 Apr 2026 1.57 AM
bravrvjk / bravrvjk
0755
Migrations
--
4 Apr 2026 1.57 AM
bravrvjk / bravrvjk
0755
Repositories
--
4 Apr 2026 1.57 AM
bravrvjk / bravrvjk
0755
ValueObjects
--
4 Apr 2026 1.57 AM
bravrvjk / bravrvjk
0755
LicenseServiceProvider.php
1.198 KB
10 Sep 2025 5.42 PM
bravrvjk / bravrvjk
0644
PremiumAddonsListManager.php
2.231 KB
24 Nov 2021 4.55 AM
bravrvjk / bravrvjk
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025 CONTACT ME
Static GIF