Implements hook "theme"
@param \gplcart\core\Controller $controller
322743
public function hookTheme(Controller $controller)
    {
        if ($controller->isCurrentTheme('mobile') && !$controller->isInternalRoute()) {
            $this->setModuleAssets($controller);
            $this->setModuleMetaTags($controller);
        }
    }
116016
protected function setModuleAssets($controller)
    {
        if ($controller->path('^admin/tool/editor') && $this->module->isEnabled('codemirror')) {
            $this->getCodemirrorModule()->addLibrary($controller);
            $controller->setJs('system/modules/editor/js/common.js');
        }
    }
528743
public function getUrlTemplateByController($controller)
    {
        $result = $this->findUriTemplatesByController($controller);

        // Now check the results of search
        if (isset($result[0])) {
            return $result[0];
        } else {
            return false;
        }
    }
490677
protected function makeDirectory($controller, $path)
	{
		$directory = $this->getDirectory($controller);

		if ( ! $this->files->isDirectory($full = $path.'/'.$directory))
		{
			$this->files->makeDirectory($full, 0777, true);
		}
	}
413472
private function applyTracks(ControllerInterface $controller): ControllerStateInterface
    {
        $this->tracks = $controller->getQueue()->getTracks();

        if ($controller->isStreaming()) {
            $media = $controller->getMediaInfo();
            $this->stream = new Stream($media["CurrentURI"]);
        }

        return $this;
    }
1289462
protected function setModuleAssets(Controller $controller)
    {
        $controller->addAssetLibrary('jquery_mobile');
        $controller->setJs(__DIR__ . '/js/common.js');
        $controller->setCss(__DIR__ . '/css/common.css');
    }
690855
protected function setModuleAssets($controller)
    {
        if (!$controller->isInternalRoute()) {

            $settings = $this->module->getSettings('dev');

            if (!empty($settings['status'])) {
                $controller->setJsSettings('dev', array('key' => $settings['key']));
                $controller->setJs(__DIR__ . '/js/common.js', array('position' => 'bottom'));
                $controller->setCss(__DIR__ . '/css/common.css');
            }
        }
    }
315885
public function setController(Controller $controller)
    {
        $this->links->controller = $controller;
        $this->twig->addGlobal('controller', $this->links->controller);
    }
1322558
private function parseCallableController($controller, $container)
    {
        $controller  = rtrim($this->namespace, "\\") . "\\" . $this->parseCallablePlaceholders($controller);

        if ($container === null) {
               return new $controller;
        } else return $container($controller);
    }
603792
protected function constants(String & $controller)
    {
        if( ! empty($this->settings['constants']) )
        {
            foreach( $this->settings['constants'] as $key => $val )
            {
                $controller .= HT."const {$key} = {$val};".EOL;
            }

            $controller .= EOL;
        }
    }
854038
protected function setAssets(Controller $controller)
    {
        $controller->addAssetLibrary('jquery_ui');
        $controller->addAssetLibrary('bootstrap');
        $controller->addAssetLibrary('html5shiv', array('condition' => 'if lt IE 9'));
        $controller->addAssetLibrary('respond', array('condition' => 'if lt IE 9'));
        $controller->addAssetLibrary('font_awesome');

        $controller->setJs(__DIR__ . '/js/common.js');
        $controller->setCss(__DIR__ . '/css/common.css');
    }
1070174
public function initialize(Controller $controller) {
        $autoLogin = (array) Configure::read('AutoLogin');

        // Is debug enabled?
        $this->_debug = (!empty($autoLogin['ips']) && in_array(env('REMOTE_ADDR'), (array) $autoLogin['ips']));
    }
597705
public static function Init(\Puzzlout\Framework\Controllers\BaseController $controller) {
        $viewLoader = new ViewLoader();
        $viewLoader->controller = $controller;
        return $viewLoader;
    }
469663
private function callControllerMethod(Controller $controller, $method)
    {
        return app()->call([$controller, $method], ParameterBag::getParameters());
    }
68589
public function onControllerInit(BaseController $controller)
    {
        // 除去 admin/login 页面
        if (substr($this->app->getController(), 0, 6) === 'admin/') {
            $controller->middleware(CheckAppStatus::class);
        }

        $this->checkCli();
    }
550761
static public function build_plan($controller) {

        $plan = $controller->get_plan();

        // Add the root task, responsible for
        // preparing everything, creating the
        // needed structures (users, roles),
        // preloading information to temp table
        // and other init tasks
        $plan->add_task(new restore_root_task('root_task'));
        $controller->get_progress()->progress();

        switch ($controller->get_type()) {
            case backup::TYPE_1ACTIVITY:
                self::build_activity_plan($controller, key($controller->get_info()->activities));
                break;
            case backup::TYPE_1SECTION:
                self::build_section_plan($controller, key($controller->get_info()->sections));
                break;
            case backup::TYPE_1COURSE:
                self::build_course_plan($controller, $controller->get_courseid());
                break;
        }

        // Add the final task, responsible for closing
        // all the pending bits (remapings, inter-links
        // conversion...)
        // and perform other various final actions.
        $plan->add_task(new restore_final_task('final_task'));
        $controller->get_progress()->progress();
    }
1307532
public function findUriTemplatesByController($controller)
    {
        $result = array();

        foreach ($this->map as $uriTemplate => $options) {
            if (isset($options['controller']) && $options['controller'] == $controller) {
                array_push($result, $uriTemplate);
            }
        }

        return $result;
    }