<commit_before><?
class RouteVirtualModulesHook{
	public static function RouteVirtualModules(){

		if(Router::$controller){
			return;
		}

		Kohana::log('info', 'Attempting Virtual Module Routing');

		$virtualModule = Router::$rsegments[0];

		//what we'll try doing is to look up the class in cms.php and create the module
		$modules = array();
		foreach(mop::config('backend', '//template/elements/*') as $module){
			if($module->tagName=='module'){ 
				//there could be other type of virtual modules
				//this is a total hack
				$modules[$module->getAttribute('modulename')] = $block;
			} else if ($module->tagName=='list'){
			//	$modules[$module->getAttribute('class')] = $block;
				$modules[$module->getAttribute('family')]['controllertype'] = 'list';
			}
		}

		if(in_array($virtualModule, array_keys($modules) )){
			$module = $modules[$virtualModule];
			$includeclass = 'class '.$virtualModule.'_Controller extends '.$module['controllertype'].'_Controller { } ';
			eval($includeclass);

			Router::$controller = $virtualModule;
			Router::$controller_path = 'modules/mop/controllers/virtual.php';
			Router::$method = Router::$rsegments[1];
			$segments = array_slice(Router::$rsegments, 2);
			Router::$arguments = $segments;
			Kohana::log('info', 'Routed Virtual Module');

		}

	}

}

//add this event at the end of the routing chain

<commit_msg>modules: back to virtual module view in hook updated<commit_after><?
class RouteVirtualModulesHook{
	public static function RouteVirtualModules(){

		if(Router::$controller){
			return;
		}

		Kohana::log('info', 'Attempting Virtual Module Routing');

		$virtualModule = Router::$rsegments[0];

		//what we'll try doing is to look up the class in cms.php and create the module
		$modules = array();
		foreach(mop::config('backend', '//template/elements/*') as $module){
			if($module->tagName=='module'){ 
				//there could be other type of virtual modules
				//this is a total hack
				$modules[$module->getAttribute('modulename')] = $block;
			} else if ($module->tagName=='list'){
			//	$modules[$module->getAttribute('class')] = $block;
				$modules[$module->getAttribute('family')]['controllertype'] = 'list';
			}
		}

		if(in_array($virtualModule, array_keys($modules) )){
			$module = $modules[$virtualModule];
			$includeclass = 'class '.$virtualModule.'_Controller extends '.$module['controllertype'].'_Controller { } ';
			eval($includeclass);

			Router::$controller = $virtualModule;
			Router::$controller_path = 'modules/mopmvc/controllers/virtual.php';
			Router::$method = Router::$rsegments[1];
			$segments = array_slice(Router::$rsegments, 2);
			Router::$arguments = $segments;
			Kohana::log('info', 'Routed Virtual Module');

		}

	}

}

//add this event at the end of the routing chain


{'fraction_non_alphanumeric': 0.16858375269590223, 'fraction_numerical': 0.002156721782890007, 'mean_word_length': 4.69120654396728, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '4138567', 'n_tokens_mistral': 972, 'n_tokens_neox': 860, 'n_words': 200}