Your IP : 216.73.216.240


Current Path : /home/juvelize/saulnois/tmp/install_695d2cf0b4957/src/View/Html/
Upload File :
Current File : /home/juvelize/saulnois/tmp/install_695d2cf0b4957/src/View/Html/TfDoc.php

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

namespace TechFry\Library\View\Html;

defined('_JEXEC') or die;

use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;

// Depreciated
class TfDoc
{
    public static function get_doctype()
    {
        $output = '<!DOCTYPE html>' . "\n";

        return $output;
    }

    public static function open_html($attribs = array(), $is_amp = false)
    {   
        $output = '<html';

        if ($is_amp)
        {
            $output .= ' amp';    
        }

        if (!empty($attribs))
        {
            foreach ($attribs as $k => $v)
            {
                if ($v)
                {
                    $output .= ' ' . $k . '="' . $v . '"';  
                }
            }
        }

        $output .= '>' . "\n";

        return $output;
    }

    public static function close_html()
    {
        return '</html>' . "\n";
    }

    public static function open_head()
    {
        return '<head>' . "\n";  
    }

    public static function close_head()
    {
        return '</head>' . "\n";  
    }

    public static function open_body($attribs = array())
    {   
        return TfHtml::open_tag('body', $attribs);
    }

    public static function close_body()
    {
        return '</body>' . "\n";  
    }

    public static function open_section($attribs = array())
    {           
        return TfHtml::open_tag('section', $attribs);
    }

    public static function close_section()
    {
        return '</section>' . "\n";  
    }

    public static function open_footer($attribs = array())
    {           
        return TfHtml::open_tag('footer', $attribs);
    }

    public static function close_footer()
    {
        return '</footer>' . "\n";  
    }

    public static function open_main($attribs = array())
    {           
        return TfHtml::open_tag('main', $attribs);
    }

    public static function close_main()
    {
        return '</main>' . "\n";
    }

    public static function open_article($attribs = array())
    {           
        return TfHtml::open_tag('article', $attribs);
    }

    public static function close_article()
    {
        return '</article>' . "\n";
    }

    public static function open_aside($attribs = array())
    {           
        return TfHtml::open_tag('aside', $attribs);
    }

    public static function close_aside()
    {
        return '</aside>' . "\n";
    }

    public static function open_nav($attribs = array())
    {           
        return TfHtml::open_tag('nav', $attribs);
    }

    public static function close_nav()
    {
        return '</nav>' . "\n";
    }

    public static function open_header($attribs = array())
    {           
        return TfHtml::open_tag('header', $attribs);
    }

    public static function close_header()
    {
        return '</header>' . "\n";
    }

    public static function open_div($attribs = array(), $bool = '')
    {           
        return TfHtml::open_tag('div', $attribs, $bool);
    }

    public static function close_div()
    {
        return '</div>' . "\n";
    }

    public static function include_position($position, $style = 'none')
    {
        return '<jdoc:include type="modules" name="' . $position . '" style="' . $style . '" />';
    }

    public static function include_component()
    {
        return '<jdoc:include type="component" />';
    }

    public static function get_font_family($type)
    {
        switch ($type)
        {
            case 'arial' :    
            return 'Arial, Helvetica, sans-serif';
            break;

            case 'tahoma' :    
            return 'Tahoma, Verdana, sans-serif';
            break;

            case 'trebuchet-ms' :    
            return '"Trebuchet MS", Helvetica, sans-serif';
            break;

            case 'times-new-roman' :    
            return '"Times New Roman", Times, serif';
            break;

            case 'georgia' :    
            return 'Georgia, serif';
            break;

            case 'garamond' :    
            return 'Garamond, serif';
            break;

            case 'courier-new' :
            return '"Courier New", Courier, monospace';
            break;

            case 'brush-script-mt' :
            return '"Brush Script MT", cursive';
            break;
        }
    }

    // https://open-props.style/ (Numbers 2, 8, 10)
    public static function get_hex_colors($theme)
    {   
        switch ($theme)
        {
            case 'blue' :    
                return array('#a5d8ff', '#1971c2', '#145591');
                break;

            case 'brown' :    
                return array('#e0cab7', '#825b3a', '#5e3a21');
                break;

            case 'choco' :
                return array('#f7ca9e', '#a45117', '#703a13');
                break;

            case 'cyan' :
                return array('#99e9f2', '#0c8599', '#095c6b');
                break;

            case 'gray' :    
                return array('#e9ecef', '#343a40', '#16191d');
                break;

            case 'green' :    
                return array('#b2f2bb', '#2f9e44', '#237032');
                break;

            case 'lime' :
                return array('#d8f5a2', '#66a80f', '#4c7a0b');
                break;

            case 'orange' :    
                return array('#ffd8a8', '#e8590c', '#bf400d');
                break;

            case 'pink' :    
                return array('#fcc2d7', '#c2255c', '#8c1941');
                break;

            case 'purple' :    
                return array('#eebefa', '#9c36b5', '#702682');
                break;

            case 'red' :    
                return array('#ffc9c9', '#e03131', '#b02525');
                break;

            case 'teal' :    
                return array('#96f2d7', '#099268', '#066649');
                break;

            case 'sand' :
                return array('#d5cfbd', '#5f5746', '#38352d');
                break;

            case 'stone' :
                return array('#ebedef', '#666968', '#3a3a37');
                break;

            case 'violet' :    
                return array('#d0bfff', '#6741d9', '#5235ab');
                break;

            case 'yellow' :    
                return array('#ffec99', '#f08c00', '#b35c00');
                break;
        }
    }

    public static function hex_to_rgb($hex)
    {
        if (\is_array($hex))
        {
            $return = array();
            foreach ($hex as $h)
            {
                $h = str_replace('#', '', $h);
                list($r, $g, $b) = array_map('hexdec', str_split($h, 2));
                $return[] = $r . ',' . $g . ',' . $b;
            }

            return $return;
        }
        
        $hex = str_replace('#', '', $hex);

        list($r, $g, $b) = array_map('hexdec', str_split($hex, 2));

        return $r . ',' . $g . ',' . $b;
    }
}