Your IP : 216.73.216.240


Current Path : /home/juvelize/saulnois/tmp/install_695d2cf0b4957/src/View/Sky/
Upload File :
Current File : /home/juvelize/saulnois/tmp/install_695d2cf0b4957/src/View/Sky/Bootstrap.php

<?php
/*
* @package		Tech Fry Library
* @license		https://www.gnu.org/licenses/gpl-3.0.en.html
*/

namespace TechFry\Library\View\Sky;

defined('_JEXEC') or die;

use TechFry\Library\TResource;
use Joomla\CMS\HTML\HTMLHelper;
use TechFry\Library\TAmp;
use TechFry\Library\View\Html\TBody;

class Bootstrap
{
    public $config = [];

    public $data;
    
    public $output;

    public $class_options = [];

    public $framework;

    public $html;

    public function __construct($data = [], $config = [])
    {
        $this->config = (array) $config;

        $this->data = $data;

        $amp = new TAmp();
        if ($amp->is_amp())
        {
        	$this->framework = 'amp';
        }

        $this->html = new TBody();
    }

    // Get class from style options
	public function get_class()
    {   
        $class_str = '';

        foreach ($this->class_options as $class_option)
        {
            if (isset($this->config[$class_option]) && $this->config[$class_option])
            {   
                $class_str .= ' ' . $this->config[$class_option];
            }
        }

        $class_str = trim(preg_replace('/\s+/', ' ', $class_str));

        return $class_str;
    }

    public function add_data($data)
    { 
        $this->data[] = $data; 
    }

    public function reset_data($data)
    { 
        $this->data = $data; 
    }

    public function set_config($type, $value)
    {
        $this->config[$type] = $value;
    }

    // Get unique id
    public function get_id()
    {
        return 'b' . rand(10000, 99999);
    }

    public function include_bsjs($type)
    {
        HTMLHelper::_('bootstrap.' . $type);
    }

    public function include_tfcss($type)
    {
        $css_url = 'media/techfry/css/' . $type . '.css';

        $r = new TResource();
        $r->add_resource('style', $type . '.css', $css_url);
    }

    public function include_tfjs($type)
    {
        $js_url = 'media/techfry/js/' . $type . '.js';

        $r = new TResource();
        $r->add_resource('script', $type . '.js', $js_url);
    }
}