<commit_before><?php defined('BASEPATH') or exit('No direct script access allowed');
/**
 * snippets  Event Class - this class loads the snippets library when the public
 * controller is called.  Keeps from users having to add to config/autoload
 * 
 * @package		PyroCMS
 * @subpackage	Pyrosnippets
 * @category	events
 * @author		<NAME> - <stephen.cozart [a][t] gmail [dt] com>
 */
class Events_Snippets {
    
    protected $ci;
    
    public $var_snippets = array();
    
    public function __construct()
    {
        $this->ci =& get_instance();
        
        //register the public controller event
        Events::register('public_controller', array($this, 'load_snippets'));
    }
    
    public function load_snippets()
    {
		// -------------------------------------
		// Get snippets
		// -------------------------------------
		
		$this->ci->load->model('snippets/snippets_m');
		
		$snippets = $this->ci->snippets_m->get_snippets();
		
		// -------------------------------------
		// Prep snippets
		// -------------------------------------

		foreach( $snippets as $snippet ):
		
				$this->var_snippets[$snippet->slug] = $this->ci->snippets_m->process_type( $snippet->type, $snippet->content, 'outgoing' );
			
		endforeach;
		
		// -------------------------------------
		// Commit snippets to ci vars
		// -------------------------------------
		
		$this->ci->load->vars('snippet', $this->var_snippets);
		
		// Legacy
		$this->ci->load->vars('chunk', $this->var_snippets);
    }
}
/* End of file addons/modules/snippets/events.php */<commit_msg>Updating events to grab the snippets in the new way.<commit_after><?php defined('BASEPATH') or exit('No direct script access allowed');
/**
 * snippets  Event Class - this class loads the snippets library when the public
 * controller is called.  Keeps from users having to add to config/autoload
 * 
 * @package		PyroCMS
 * @subpackage	Pyrosnippets
 * @category	events
 * @author		<NAME> - <stephen.cozart [a][t] gmail [dt] com>
 */
class Events_Snippets {
    
    protected $ci;
    
    public $var_snippets = array();
    
    public function __construct()
    {
        $this->ci =& get_instance();
        
        //register the public controller event
        Events::register('public_controller', array($this, 'load_snippets'));
    }
    
    public function load_snippets()
    {
		// -------------------------------------
		// Get snippets
		// -------------------------------------
		
		$this->ci->load->model('snippets/snippets_m');
		
		$snippets = $this->ci->snippets_m->get_snippets();
		
		// -------------------------------------
		// Prep snippets
		// -------------------------------------

		foreach( $snippets as $snippet ):
		
			if( method_exists($this->ci->snippets_m->snippets->{$snippet->type}, 'pre_output') ):
		
				// Run through pre_output
				$this->var_snippets[$snippet->slug] = $this->ci->snippets_m->snippets->{$snippet->type}->pre_output($snippet->content, $snippet->params);
			
			else:
				
				// Don't do anything to the content
				$this->var_snippets[$snippet->slug] = $snippet->content;
			
			endif;
			
		endforeach;
		
		// -------------------------------------
		// Commit snippets to ci vars
		// -------------------------------------
		
		$this->ci->load->vars('snippet', $this->var_snippets);
		
		// Legacy
		$this->ci->load->vars('chunk', $this->var_snippets);
    }
}
/* End of file addons/modules/snippets/events.php */
{'fraction_non_alphanumeric': 0.2624709976798144, 'fraction_numerical': 0.0, 'mean_word_length': 1.7904530744336569, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 62, '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': '6570168', 'n_tokens_mistral': 1149, 'n_tokens_neox': 982, 'n_words': 219}