<commit_before><?php
namespace HodgePodge\Template;

use HodgePodge\Interfaces\Templater;

class Smarty extends \Smarty implements Templater
{
    /* INTERFACE METHODS */
    public static function page($template, $data = array())
    {
        $tpl = new static();
        $tpl->assign('data', $data);
        echo $tpl->render($template);
    }

    // Assign function dictated by Templater interface provided by underlying \Smarty class
    #public function assign($name, $value)
    
    public function render($template)
    {
        return $this->fetch($template . '.tpl');
    }
    
    //////////
    
    public function __construct()
    {
        global $config;
        // Class Constructor.
        
        parent::__construct();
        
        $this->template_dir = ROOT.'/templates';
        $this->compile_dir  = ROOT.'/templates_c';
        $this->config_dir   = ROOT.'/config';
        $this->cache_dir    = ROOT.'/cache';
        
        $this->registerPlugin('modifier', 'currency', array('\\HodgePodge\\Template\\Smarty', 'smartyModifierCurrency'));
        $this->registerPlugin('modifier', 'safe', array('\\HodgePodge\\Template\\Smarty', 'smartyModifierSafe'));
        $this->registerPlugin('modifier', 'datetime', array('\\HodgePodge\\Template\\Smarty', 'smartyModifierReformatDate'));
        
        $this->assign('config', $config);
    }
    
    // Format money.  e.g  {$amount|currency} will print out 12.30   if $amount = 12.3
    public function smartyModifierCurrency($string, $currency = 'GBP')
    {
        // If this is not a number then don't modify the input
        if (!is_numeric($string)) return $string;
        
        switch($currency) {
            case 'GBP':
                $currency_symbol = '&pound;';
                break;
            case 'USD':
                $currency_symbol = '$';
                break;<commit_msg>Fix for latest version of Smarty enforcing use of accessor methods for config.<commit_after><?php
namespace HodgePodge\Template;

use HodgePodge\Interfaces\Templater;

class Smarty extends \Smarty implements Templater
{
    /* INTERFACE METHODS */
    public static function page($template, $data = array())
    {
        $tpl = new static();
        $tpl->assign('data', $data);
        echo $tpl->render($template);
    }

    // Assign function dictated by Templater interface provided by underlying \Smarty class
    #public function assign($name, $value)
    
    public function render($template)
    {
        return $this->fetch($template . '.tpl');
    }
    
    //////////
    
    public function __construct()
    {
        global $config;
        // Class Constructor.
        
        parent::__construct();
        
        $this->setTemplateDir(ROOT.'/templates');
        $this->setCompileDir(ROOT.'/templates_c');
        $this->setConfigDir(ROOT.'/config');
        $this->setCacheDir(ROOT.'/cache');
        
        $this->registerPlugin('modifier', 'currency', array('\\HodgePodge\\Template\\Smarty', 'smartyModifierCurrency'));
        $this->registerPlugin('modifier', 'safe', array('\\HodgePodge\\Template\\Smarty', 'smartyModifierSafe'));
        $this->registerPlugin('modifier', 'datetime', array('\\HodgePodge\\Template\\Smarty', 'smartyModifierReformatDate'));
        
        $this->assign('config', $config);
    }
    
    // Format money.  e.g  {$amount|currency} will print out 12.30   if $amount = 12.3
    public function smartyModifierCurrency($string, $currency = 'GBP')
    {
        // If this is not a number then don't modify the input
        if (!is_numeric($string)) return $string;
        
        switch($currency) {
            case 'GBP':
                $currency_symbol = '&pound;';
                break;
            case 'USD':
                $currency_symbol = '$';
                break;
{'fraction_non_alphanumeric': 0.14487079091620986, 'fraction_numerical': 0.0036543983294179067, 'mean_word_length': 2.258503401360544, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 25, 'https://': 0, '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': '3726915', 'n_tokens_mistral': 1105, 'n_tokens_neox': 1072, 'n_words': 243}