Your IP : 216.73.216.68


Current Path : /home/jeromecohp/www/plugins/system/yooessentials/
Upload File :
Current File : /home/jeromecohp/www/plugins/system/yooessentials/yooessentials.php

<?php
/**
 * @package   Essentials YOOtheme Pro (Freemium) 2.0.19 build 1026.0920
 * @author    ZOOlanders https://www.zoolanders.com
 * @copyright Copyright (C) Joolanders, SL
 * @license   http://www.gnu.org/licenses/gpl.html GNU/GPL
 */

defined('_JEXEC') or die();

use function YOOtheme\app;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\CMS\Uri\Uri;
use YOOtheme\Application;
use YOOtheme\Path;

if (!class_exists('plgSystemYooessentialsHelper')) {
    require_once __DIR__ . '/helper.php';
}

class plgSystemYooessentials extends CMSPlugin
{
    public function onExtensionBeforeUpdate(string $type, ?SimpleXMLElement $manifest)
    {
        if ($manifest) {
            plgSystemYooessentialsHelper::preinstallThemeCheck($manifest);
        }
    }

    public function onExtensionBeforeInstall(string $method, string $type, ?SimpleXMLElement $manifest)
    {
        if ($manifest) {
            plgSystemYooessentialsHelper::preinstallThemeCheck($manifest);
        }
    }

    public function onAfterInitialise()
    {
        try {
            plgSystemYooessentialsHelper::validatePlatform();
            plgSystemYooessentialsHelper::validateChecksums();
        } catch (\RuntimeException $e) {
            plgSystemYooessentialsHelper::adminNotice($e->getMessage());

            return;
        }

        if (!class_exists(Application::class, false)) {
            return;
        }

        include_once __DIR__ . '/modules/autoload.php';

        Path::setAlias('~yooessentials', __DIR__);
        Path::setAlias('~yooessentials_url', Uri::root(true) . '/plugins/system/yooessentials');

        $config = plgSystemYooessentialsHelper::fetchConfig();
        $modules = ['core', 'condition', 'api', 'auth', 'storage'];

        foreach (['access', 'form', 'source', 'icon', 'dynamic', 'layout', 'element'] as $addon) {
            $enabled = $config[$addon]['state'] ?? true;

            if ($enabled) {
                $modules[] = $addon;
            }
        }

        foreach ($modules as $module) {
            app()->load('~yooessentials/modules/{' . $module . '{,-joomla}}/bootstrap.php');
        }
    }
}