<commit_before><?php
namespace application\nutsNBolts\controller
{
	use application\nutsNBolts\base\Controller;
	use nutshell\helper\ObjectHelper;
	use \DateTime;

	class Index extends Controller
	{
		
		private $validZones=array
		(
			'template',
			'node',
			'nav',
			'widget'
		);
		
		public $page		=null;
		public $pageType	=null;
		public $viewPath	=null;
		public $nodes		=null;
		private $site		=null;
		public $cache		=true;
		
		public function index()
		{
			$binding		=$this->application->NutsNBolts->getSiteBinding($this->getSiteRef());
			$applicationName=strtolower(ObjectHelper::getBaseClassName(get_class($binding['application'])));
			$path			=$this->getPath();
			$page			=$this->model->PageMap->getPageFromPath($path);


			if(isset($page['ref']))
			{
				$pageRef=str_replace('/', '_', $page['ref']);
				$this->loadHooks($pageRef);
				$this->loadCustomWidgets($pageRef);
			}
			

			if ($page)
			{
				$this->page		=$page;
				$this->pageType	=$this->model->PageType->read(array('id'=>$this->page['page_type_id']))[0];
				$this->nodes	=$this->model->NodeMap->getNodesForPath($path);
				$this->viewPath	='..'._DS_.'..'._DS_.$applicationName._DS_.'view'._DS_;

				$this->execHook('onInitPage',$this->page);
				$this->view->setTemplate($this->viewPath.'page'._DS_.$this->pageType['ref']._DS_.'index');
				$this->view->setVar('page',$this->page);
				$this->view->setVar('NS_ENV',NS_ENV);
				$this->view->setVar('SITEPATH','/sites/'.$this->getSite()['ref'].'/');
				$this->view->setVar('URI',$this->request->getNodes());
				$this->view->setVar('node',$this->nodes);
				
				$scope		=$this->view;
				$viewPath	=$this->viewPath;
				$this->view->getContext()->registerCallback
				(
					'loadView',
					function($viewName,$viewKeyVals=array(),$print=true) use ($scope,$viewPath)
					{
						$template=$scope->plugin->Template($scope->buildViewPath($viewPath.$viewName));
						$scope->templateContext->setKeyValArray($viewKeyVals);
						$template->setContext($scope->templateContext);
						if ($print)
						{
							print $template->compile();
						}
						else
						{
							return $template->compile();
						}
					}
				)->registerCallback
				(
					'defineZone',
					function($config)
					{
						print $this->defineZone($config);
					}
				)->registerCallback
				(
					'getNode',
					function($filter)
					{
						return $this->getNode($filter);
					}
				)->registerCallback
				(
					'getComments',
					function($nodeId,$limit)
					{
						return $this->getComments($nodeId,$limit);
					}
				)->registerCallback
				(
					'getTags',
					function($nodeId)
					{
						return $this->getTags($nodeId);
					}
				)->registerCallback
				(
					'getNodesByTag',
					function($tags,$limit)
					{
						return $this->getNodesByTag($tags,$limit);
					}
				)->registerCallback
				(
					'getFacebookConfig',
					function()
					{
						return $this->getFacebookConfig();
					}
				)->registerCallback
				(
					'getBlogArticle',
					function($id)
					{
						return $this->plugin->Blog->getBlogArticle($id);
					}
				)->registerCallback
				(
					'getNextBlogArticle',
					function($blogId)
					{
						return $this->plugin->Blog->getNextBlogArticle($blogId);
					}
				)->registerCallback
				(
					'getPreviousBlogArticle',
					function($blogId)
					{
						return $this->plugin->Blog->getPreviousBlogArticle($blogId);
					}
				)->registerCallback
				(
					'getBlogger',
					function($id)
					{
						return $this->plugin->Blog->getBlogger($id);
					}
				)->registerCallback
				(
					'getBloggerCategories',
					function($id)
					{
						return $this->plugin->Blog->getBloggerCategories($id);
					}
				)->registerCallback
				(
					'getRecent',
					function($id,$limit)
					{
						return $this->plugin->Blog->getRecent($id,$limit);
					}
				)->registerCallback
				(
					'getBlogsByBlogger',
					function($bloggerId, $category, $min, $max)
					{
						return $this->plugin->Blog->getBlogsByBlogger($bloggerId, $category, $min, $max);
					}
				)->registerCallback
				(
					'countAllBlogs',
					function($id)
					{
						return $this->plugin->Blog->countAllBlogs($id);
					}
				)->registerCallback
				(
					'getAllDates',
					function($id)
					{
						return $this->getAllDates($id);
					}
				);
				$context=$this->view->getContext();
				$this->execHook('bindViewCallbacks',$context);
			}
			else
			{
				$this->view->setTemplate('site/404');<commit_msg>registered callbacks and removed the other headers<commit_after><?php
namespace application\nutsNBolts\controller
{
	use application\nutsNBolts\base\Controller;
	use nutshell\helper\ObjectHelper;
	use \DateTime;

	class Index extends Controller
	{
		
		private $validZones=array
		(
			'template',
			'node',
			'nav',
			'widget'
		);
		
		public $page		=null;
		public $pageType	=null;
		public $viewPath	=null;
		public $nodes		=null;
		private $site		=null;
		public $cache		=true;
		
		public function index()
		{
			$binding		=$this->application->NutsNBolts->getSiteBinding($this->getSiteRef());
			$applicationName=strtolower(ObjectHelper::getBaseClassName(get_class($binding['application'])));
			$path			=$this->getPath();
			$page			=$this->model->PageMap->getPageFromPath($path);


			if(isset($page['ref']))
			{
				$pageRef=str_replace('/', '_', $page['ref']);
				$this->loadHooks($pageRef);
				$this->loadCustomWidgets($pageRef);
			}
			

			if ($page)
			{
				$this->page		=$page;
				$this->pageType	=$this->model->PageType->read(array('id'=>$this->page['page_type_id']))[0];
				$this->nodes	=$this->model->NodeMap->getNodesForPath($path);
				$this->viewPath	='..'._DS_.'..'._DS_.$applicationName._DS_.'view'._DS_;

				$this->execHook('onInitPage',$this->page);
				$this->view->setTemplate($this->viewPath.'page'._DS_.$this->pageType['ref']._DS_.'index');
				$this->view->setVar('page',$this->page);
				$this->view->setVar('NS_ENV',NS_ENV);
				$this->view->setVar('SITEPATH','/sites/'.$this->getSite()['ref'].'/');
				$this->view->setVar('URI',$this->request->getNodes());
				$this->view->setVar('node',$this->nodes);
				
				$scope		=$this->view;
				$viewPath	=$this->viewPath;
				$this->view->getContext()->registerCallback
				(
					'loadView',
					function($viewName,$viewKeyVals=array(),$print=true) use ($scope,$viewPath)
					{
						$template=$scope->plugin->Template($scope->buildViewPath($viewPath.$viewName));
						$scope->templateContext->setKeyValArray($viewKeyVals);
						$template->setContext($scope->templateContext);
						if ($print)
						{
							print $template->compile();
						}
						else
						{
							return $template->compile();
						}
					}
				)->registerCallback
				(
					'defineZone',
					function($config)
					{
						print $this->defineZone($config);
					}
				)->registerCallback
				(
					'getNode',
					function($filter)
					{
						return $this->getNode($filter);
					}
				)->registerCallback
				(
					'getComments',
					function($nodeId,$limit)
					{
						return $this->getComments($nodeId,$limit);
					}
				)->registerCallback
				(
					'getTags',
					function($nodeId)
					{
						return $this->getTags($nodeId);
					}
				)->registerCallback
				(
					'getNodesByTag',
					function($tags,$limit)
					{
						return $this->getNodesByTag($tags,$limit);
					}
				)->registerCallback
				(
					'getFacebookConfig',
					function()
					{
						return $this->getFacebookConfig();
					}
				)->registerCallback
				(
					'getBlogArticle',
					function($id)
					{
						return $this->plugin->Blog->getBlogArticle($id);
					}
				)->registerCallback
				(
					'getNextBlogArticle',
					function($blogId)
					{
						return $this->plugin->Blog->getNextBlogArticle($blogId);
					}
				)->registerCallback
				(
					'getPreviousBlogArticle',
					function($blogId)
					{
						return $this->plugin->Blog->getPreviousBlogArticle($blogId);
					}
				)->registerCallback
				(
					'getBlogger',
					function($id)
					{
						return $this->plugin->Blog->getBlogger($id);
					}
				)->registerCallback
				(
					'getBloggerCategories',
					function($id)
					{
						return $this->plugin->Blog->getBloggerCategories($id);
					}
				)->registerCallback
				(
					'getRecent',
					function($id,$limit)
					{
						return $this->plugin->Blog->getRecent($id,$limit);
					}
				)->registerCallback
				(
					'getBlogsByBlogger',
					function($bloggerId, $category, $min, $max)
					{
						return $this->plugin->Blog->getBlogsByBlogger($bloggerId, $category, $min, $max);
					}
				)->registerCallback
				(
					'countAllBlogs',
					function($id)
					{
						return $this->plugin->Blog->countAllBlogs($id);
					}
				)->registerCallback
				(
					'getAllDates',
					function($id)
					{
						return $this->getAllDates($id);
					}
				)->registerCallback
				(
					'isAuthenticated',
					function()
					{
						return $this->plugin->UserAuth->isAuthenticated();
					}
				);

				$context=$this->view->getContext();
				$this->execHook('bindViewCallbacks',$context);
			}
			else
			{
				$this->view->setTemplate('site/404');
{'fraction_non_alphanumeric': 0.1831634330812233, 'fraction_numerical': 0.0008769045270196207, 'mean_word_length': 2.8111946532999164, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 223, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '726970', 'n_tokens_mistral': 4279, 'n_tokens_neox': 2969, 'n_words': 356}