<?php
/**
 * @package DJ-SlideshowTimeline
 * @copyright Copyright (C) 2017  DJ-Extensions.com LTD, All rights reserved.
 * @license http://www.gnu.org/licenses GNU/GPL
 * @author url: http://dj-extensions.com
 * @author email contact@dj-extensions.com
 *
 * DJ-SlideshowTimeline is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * DJ-SlideshowTimeline is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with DJ-SlideshowTimeline. If not, see <http://www.gnu.org/licenses/>.
 *
 */

defined('_JEXEC') or die;


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


class plgSystemDJSlideshowTimeline extends CMSPlugin
{
    public function __construct(&$subject, $config = array())
    {
        parent::__construct($subject, $config);
        $this->loadLanguage();

    }

    public function onBeforeRender() {

    }

    public function onAfterInitialise()
    {
        if (class_exists(Application::class, false)) {
            $app = Application::getInstance();

            $root = __DIR__;
            $rootUrl = Uri::root(true);

            Path::setAlias('~djslideshowtimeline', $root);
            Path::setAlias('~djslideshowtimeline_url', $rootUrl . '/plugins/system/djslideshowtimeline');

            require_once __DIR__ . '/vendor/autoload.php';

            // bootstrap modules
            $app->load('~djslideshowtimeline/yootheme/modules/builder/bootstrap.php');
        }
    }
}
