<commit_before><?php

namespace Core;

use Zend\Authentication\AuthenticationService;
use Zend\Mvc\MvcEvent;
use Zend\Permissions\Acl\Acl;
use Zend\View\Helper\Navigation;

use Core\Model\User;

class Module
{
	public function onBootstrap(MvcEvent $event)
	{
		// Check if the user is logged in
		$auth = new AuthenticationService();
		
		if ($user = $auth->getIdentity()) {
			// Grab the user's info from the db to ensure it's fresh
			$usersTable = $event->getApplication()->getServiceManager()->get('UsersTable');
			$user = $usersTable->getUser($user->userid);

			$storage = $auth->getStorage();
			$storage->write($user);
		}

		// Initialize the ACL	
		$this->initAcl($event, $user);
	}

	public function getConfig()
	{	
		return include __DIR__ . '/module.config.php';
	}

	public function getAutoloaderConfig()
	{
		return array(
			'Zend\Loader\StandardAutoloader' => array(
				'namespaces' => array(
					__NAMESPACE__ => __DIR__,
				),
			),
		);
	}

	public function getServiceConfig()
	{
		return array(
			'factories' => array(
				'AclResourcesTable' => 'Core\Db\AclResourcesTableFactory',
				'AclRulesTable'     => 'Core\Db\AclRulesTableFactory',
				'NavigationTable'   => 'Core\Db\NavigationTableFactory',
				'UsersTable'        => 'Core\Db\UsersTableFactory',<commit_msg>Added View Helper Config<commit_after><?php

namespace Core;

use Zend\Authentication\AuthenticationService;
use Zend\Mvc\MvcEvent;
use Zend\Permissions\Acl\Acl;
use Zend\View\Helper\Navigation;
use Zend\View\ViewEvent;
use Zend\View\Renderer\PhpRenderer;

use Core\Model\User;

class Module
{
	public function onBootstrap(MvcEvent $event)
	{
		// Check if the user is logged in
		$auth = new AuthenticationService();
		
		if ($user = $auth->getIdentity()) {
			// Grab the user's info from the db to ensure it's fresh
			$usersTable = $event->getApplication()->getServiceManager()->get('UsersTable');
			$user = $usersTable->getUser($user->userid);

			$storage = $auth->getStorage();
			$storage->write($user);
		}

		// Initialize the ACL	
		$this->initAcl($event, $user);
		
		// Configure the Format View Helpers
		$events = $event->getApplication()->getEventManager();
		$sharedEvents = $events->getSharedManager();

		$sharedEvents->attach('Zend\View\View', ViewEvent::EVENT_RENDERER_POST, function($event) {
			$renderer = $event->getRenderer();

			if ($renderer instanceof PhpRenderer) {
				$renderer->plugin("currencyFormat")->setCurrencyCode("USD")->setLocale('en_US');
				$renderer->plugin("dateFormat")->setTimezone("America/Chicago")->setLocale("en_US");
			}
		});
	}

	public function getConfig()
	{	
		return include __DIR__ . '/module.config.php';
	}

	public function getAutoloaderConfig()
	{
		return array(
			'Zend\Loader\StandardAutoloader' => array(
				'namespaces' => array(
					__NAMESPACE__ => __DIR__,
				),
			),
		);
	}

	public function getServiceConfig()
	{
		return array(
			'factories' => array(
				'AclResourcesTable' => 'Core\Db\AclResourcesTableFactory',
				'AclRulesTable'     => 'Core\Db\AclRulesTableFactory',
				'NavigationTable'   => 'Core\Db\NavigationTableFactory',
				'UsersTable'        => 'Core\Db\UsersTableFactory',
{'fraction_non_alphanumeric': 0.15074109113844214, 'fraction_numerical': 0.0, 'mean_word_length': 4.059011164274322, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 48, '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': '6307007', 'n_tokens_mistral': 1160, 'n_tokens_neox': 1024, 'n_words': 202}