<commit_before><?php
/*
 *	Made by Samerton
 *  https://github.com/NamelessMC/Nameless/
 *  NamelessMC version 2.0.0-pr8
 *
 *  License: MIT
 *
 *  Base template class
 */

abstract class TemplateBase {
    
    protected $_name = '', $_version = '', $_nameless_version = '', $_author = '', $_settings = '', $_css = array(), $_js = array();

    public function __construct($name, $version, $nameless_version, $author) {
        $this->_name = $name;
        $this->_version = $version;
        $this->_nameless_version = $nameless_version;
        $this->_author = $author;
    }

    public abstract function onPageLoad();

    public function addCSSFiles($files) {
        if (is_array($files) && count($files)) {
            foreach ($files as $href => $file) {
                $this->_css[] = '<link rel="stylesheet" href="' . $href . '"' . (isset($file['integrity']) ? ' integrity="' . $file['integrity'] . '"' : '') . (isset($file['crossorigin']) ? ' crossorigin="' . $file['crossorigin'] . '"' : '') . '>';
            }
        }
    }

    public function addCSSStyle($style = null) {
        if ($style) {
            $this->_css[] = '<style>' . $style . '</style>';
        }
    }

    public function addJSFiles($files) {
        if (is_array($files) && count($files)) {
            foreach ($files as $href => $file) {
                $this->_js[] = '<script type="text/javascript" src="' . $href . '"' . (isset($file['integrity']) ? ' integrity="' . $file['integrity'] . '"' : '') . (isset($file['crossorigin']) ? ' crossorigin="' . $file['crossorigin'] . '"' : '') . '></script>';
            }
        }
    }

    public function addJSScript($script = null) {
        if ($script) {
            $this->_js[] = '<script type="text/javascript">' . $script . '</script>';
        }
    }

    public function getCSS() {
        return $this->_css;
    }

    public function getJS() {
        return $this->_js;
    }

    public function getName() {
        return $this->_name;
    }

    public function getVersion() {
        return $this->_version;
    }<commit_msg>Add extra attributes to CSS/JS<commit_after><?php
/*
 *	Made by Samerton
 *  https://github.com/NamelessMC/Nameless/
 *  NamelessMC version 2.0.0-pr8
 *
 *  License: MIT
 *
 *  Base template class
 */

abstract class TemplateBase {
    
    protected $_name = '', $_version = '', $_nameless_version = '', $_author = '', $_settings = '', $_css = array(), $_js = array();

    public function __construct($name, $version, $nameless_version, $author) {
        $this->_name = $name;
        $this->_version = $version;
        $this->_nameless_version = $nameless_version;
        $this->_author = $author;
    }

    public abstract function onPageLoad();

    public function addCSSFiles($files) {
        if (is_array($files) && count($files)) {
            foreach ($files as $href => $file) {
                $this->_css[] = '
                <link rel="stylesheet" 
                href="' . $href . '"' .
                    (isset($file['integrity']) ? ' integrity="' . $file['integrity'] . '"' : '') .
                    (isset($file['crossorigin']) ? ' crossorigin="' . $file['crossorigin'] . '"' : '') .
                    (isset($file['rel']) ? ' rel="' . $file['rel'] . '"' : '') .
                    (isset($file['as']) ? ' as="' . $file['as'] . '"' : '') .
                    (isset($file['onload']) ? ' onload="' . $file['onload'] . '"' : '') .
                '>';
            }
        }
    }

    public function addCSSStyle($style = null) {
        if ($style) {
            $this->_css[] = '<style>' . $style . '</style>';
        }
    }

    public function addJSFiles($files) {
        if (is_array($files) && count($files)) {
            foreach ($files as $href => $file) {
            	echo '<pre>', print_r($file), '</pre>';
                $this->_js[] = '
                <script type="text/javascript" 
                    src="' . $href . '"' .
                    (isset($file['integrity']) ? ' integrity="' . $file['integrity'] . '"' : '') .
                    (isset($file['crossorigin']) ? 'crossorigin="' . $file['crossorigin'] . '"' : '') .
                    ((isset($file['defer']) && $file['defer']) ? ' defer' : '') .
                    ((isset($file['async']) && $file['async']) ? ' async' : '') .
                '></script>';
            }
        }
    }

    public function addJSScript($script = null) {
        if ($script) {
            $this->_js[] = '<script type="text/javascript">' . $script . '</script>';
        }
    }

    public function getCSS() {
        return $this->_css;
    }

    public function getJS() {
        return $this->_js;
    }

    public function getName() {
        return $this->_name;
    }

    public function getVersion() {
        return $this->_version;
    }
{'fraction_non_alphanumeric': 0.2024793388429752, 'fraction_numerical': 0.001652892561983471, 'mean_word_length': 1.9717618170656845, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 47, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4485853', 'n_tokens_mistral': 1468, 'n_tokens_neox': 1410, 'n_words': 283}