<commit_before><?php

namespace app\modules\plugin;
use yii;
class Module extends \yii\base\Module
{
    public $controllerNamespace = '';

	public $pluginid = "";
	
    public function init()
    {
        parent::init();
        //reset controllerNamespace
        $route = Yii::$app->requestedRoute;
		$array = explode("/",trim($route,"/"));
		$this->pluginid = $array[1];
        $this->controllerNamespace = 'app\modules\plugin\src\\' . strtolower($this->pluginid) ;
    }
	
	public function beforeAction($action)
	{
		$this->setPluginViewPath();
	    if (!parent::beforeAction($action)) {
	        return false;
	    }
	
	    return true; // or false to not run the action
	}
	
	public function setPluginViewPath()
	{
		$path = dirname(__FILE__).DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.$this->pluginid.DIRECTORY_SEPARATOR.'views';
		if(is_dir($path)){
			$this->setViewPath($path);
			Yii::setAlias("@pluginView",$path);
		}
			
	}
}<commit_msg>Fix Bug<commit_after><?php

namespace app\modules\plugin;
use yii;
class Module extends \yii\base\Module
{
    public $controllerNamespace = '';

	public $pluginid = "";
	
	public $realRoute = "";
	
    public function init()
    {
        parent::init();
		$route = Yii::$app->requestedRoute;
		$array = explode("/",trim($route,"/"));
		$pluginid = isset($array[1]) ? explode(":", $array[1]) : $array[1];
		$namespace = join("\\",$pluginid);
	    $this->controllerNamespace = 'app\modules\plugin\src\\' . strtolower($namespace) ;
		$this->pluginid = $pluginid[0];
		if(count($pluginid)>1){
			unset($array[0]);
			unset($array[1]);
			$this->realRoute = join("/",$array);
		}
    }
	
	//重写module的controller加载方式
	public function createController($route)
	{
		return parent::createController($this->realRoute ? $this->realRoute : $route);
	}
	
	public function beforeAction($action)
	{
		$this->setPluginViewPath();
	    if (!parent::beforeAction($action)) {
	        return false;
	    }
	
	    return true; // or false to not run the action
	}
	
	public function setPluginViewPath()
	{
		$path = dirname(__FILE__).DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.$this->pluginid.DIRECTORY_SEPARATOR.'views';
		if(is_dir($path)){
			$this->setViewPath($path);
			Yii::setAlias("@pluginView",$path);
		}
			
	}
}
{'fraction_non_alphanumeric': 0.176158940397351, 'fraction_numerical': 0.003532008830022075, 'mean_word_length': 3.7012448132780085, 'pattern_counts': {'":': 1, '<': 5, '<?xml version=': 0, '>': 20, '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': '216901', 'n_tokens_mistral': 810, 'n_tokens_neox': 749, 'n_words': 127}