Download file(s)
@param \gplcart\core\Controller $controller
201
public function submit($controller)
    {
        set_time_limit(0);

        // Download method calls exit() so clean session here
        $this->session->delete('file_manager_selected');

        $destination = $this->file->getTempFile();
        $files = $controller->getSubmitted('files');

        /* @var $file \SplFileInfo */
        $file = reset($files);

        $path = $file->getRealPath();
        $filename = $file->getBasename();

        if ($file->isFile()) {
            $result = $this->zip->file($path, $destination);
        } else if ($file->isDir()) {
            $result = $this->zip->directory($path, $destination, $filename);
        }

        if (!empty($result)) {
            $controller->download($destination, "$filename.zip");
        }
    }
560181
public function resource($uri, $controller, array $options = [])
    {
        $this->get($uri, "$controller@index", $options);
        $this->post($uri, "$controller@store", $options);
        $this->get("$uri/{placeholder}", "$controller@show", $options);
        $this->put("$uri/{placeholder}", "$controller@update", $options);
        $this->delete("$uri/{placeholder}", "$controller@delete", $options);
    }
126933
protected function callController($controller)
    {
        if (is_string($controller) && strpos($controller, self::SEPARATOR) !== false) {
            list($controller, $action) = explode(self::SEPARATOR, $controller);
            $response = $this->callClassController($controller, $action);
        } elseif (is_callable($controller)) {
            $response = $this->callCallableController($controller);
        } else {
            throw new AppException(sprintf('Invalid controller type, got "%s"', $this->getType($controller)));
        }

        if (!$response) {
            throw new AppException(sprintf('There was no response returned from the controller handling "%s"', $this->request()->uri(true)));
        }

        if (!$response instanceof ResponseInterface) {
            throw new AppException(sprintf('Invalid response returned from handling "%s", expected ResponseInterface, got "%s"', $this->request()->uri(true), $this->getType($response)));
        }

        return $response;
    }
267961
protected function getApiEndpoint($controller)
    {
        $url = $this->options['sandbox'] ? self::URL_DEV : self::URL_PROD;

        return $url.'/'.self::VERSION.'/'.$controller;
    }
569770
public function setController($controller)
        {
            if (null !== $controller && !is_string($controller)) {
                throw new Exception(
                    'Invalid argument: $controller must be a string or null'
                );
            }

            $this->_controller = $controller;
            $this->_hrefCache  = null;

            return $this;
        }
1274448
function downloadManager_open(controller, shortcut) {
    if (shortcut) {
      if (mozmill.isLinux) {
        var cmdKey = utils.getEntity(this.getDtds(), "downloadsUnix.commandkey");
        controller.keypress(null, cmdKey, {ctrlKey: true, shiftKey: true});
      } else {
        var cmdKey = utils.getEntity(this.getDtds(), "downloads.commandkey");
        controller.keypress(null, cmdKey, {accelKey: true});
      }
    } else {
      controller.click(new elementslib.Elem(controller.menus["tools-menu"].menu_openDownloads));
    }

    controller.sleep(500);
    this.waitForOpened(controller);
  }
504487
protected function makeController($controller)
    {
        Controller::setRouter($this->router);

        $controller = $this->container->make($controller);

        if ( ! $controller instanceof AdminPageController)
        {
            if ($this->container->isShared('post'))
            {
                $controller->setPost($this->container['post']);
            }

            $controller->setQuery($this->container['query']);
        }

        if (method_exists($controller, 'boot'))
        {
            $this->container->call([$controller, 'boot']);
        }

        return $controller;
    }
642906
protected function forward($controller)
    {
        $path['_controller'] = $controller;
        $subRequest = $this->container->get('request_stack')->getCurrentRequest()->duplicate(null, null, $path);

        return $this->container->get('http_kernel')->handle($subRequest, HttpKernelInterface::SUB_REQUEST);
    }
556099
protected function configureController(Controller $controller)
    {
        parent::configureController($controller);
        $controller[] = new Entity($this->entityName);
    }
42725
protected function findFile(): void
    {
        $path = Application::getInstance()->getPath();
        $file = "$path/modules/{$this->module}/controllers/{$this->controller}.php";

        if (!file_exists($file)) {
            throw new ControllerException("Controller file not found '{$this->module}/{$this->controller}'", 404);
        }

        $this->file = $file;
    }
160758
public function contentcontrollerInit($controller)
    {

        // If we've accessed the homepage as /home/, then we should redirect to /.
        if ($controller->dataRecord && $controller->dataRecord instanceof SiteTree && MultisitesRootController::should_be_on_root($controller->dataRecord)
            && (!isset($controller->urlParams['Action']) || !$controller->urlParams['Action'] ) && !$_POST && !$_FILES && !$controller->redirectedTo()) {
            $getVars = $_GET;
            unset($getVars['url']);
            if ($getVars) $url     = "?".http_build_query($getVars);
            else $url     = "";
            $controller->redirect($url, 301);
            return;
        }
    }
637874
public static function registerController($controller)
    {
        $uri = '/';

        $routable = (new ControllerInspector)
                            ->getRoutable($controller, $uri);

        // When a controller is routed using this method, we use Reflection to parse
        // out all of the routable methods for the controller, then register each
        // route explicitly for the developers, so reverse routing is possible.
        foreach ($routable as $method => $routes) {
            foreach ($routes as $route) {
                $action = ['uses' => $controller.'@'.$method];

                \Route::{$route['verb']}($route['uri'], $action);
            }
        }

        \Route::any($uri.'/{_missing}', $controller.'@missingMethod');
    }
908898
private function cleanController($controller, $class)
  {
    if ($class == '') {
      if ($this->resource == true) {
        $contents = str_replace('
use Modulus\Http\Request;
use App\Http\Controllers\Controller;
', '
use Modulus\Http\Request;
', file_get_contents($controller));

        return file_put_contents($controller, $contents);
      }

      $contents = str_replace('

use App\Http\Controllers\Controller;', '', file_get_contents($controller));

      return file_put_contents($controller, $contents);
    }
  }
763270
public static function contentcontrollerInit($controller)
    {
        $subsite = Subsite::currentSubsite();

        if ($subsite && $subsite->Theme) {
            SSViewer::add_themes([$subsite->Theme]);
        }

        if ($subsite && i18n::getData()->validate($subsite->Language)) {
            i18n::set_locale($subsite->Language);
        }
    }
1001953
public function initialize(Controller $controller) {
		$this->_controller = $controller;
		$isAppInstalled = $this->isAppInstalled();
		if (($this->_controller->request->param('plugin') !== 'cake_installer') ||
			($this->_controller->request->param('controller') !== 'check') ||
			($this->_controller->request->param('action') !== 'index')) {
			if (!$isAppInstalled) {
				$urlRedirect = ['controller' => 'check', 'action' => 'index', 'plugin' => 'cake_installer'];
				$this->_controller->redirect($urlRedirect);
			}
		}
	}
997913
private function createController($controller)
    {
        if (false === strpos($controller, '::'))
        {
            $count = substr_count($controller, ':');
            if (2 == $count)
            {
                // controller in the a:b:c notation then
                $controller = $this->parser->parse($controller);
            }
            elseif (1 == $count)
            {
                // controller in the service:method notation
                list($service, $method) = explode(':', $controller, 2);
                return array($this->kernel->getContainer()->get($service), $method);
            }
            else
            {
                throw new \LogicException(sprintf('Unable to parse the controller name "%s".', $controller));
            }
        }
        list($class, $method) = explode('::', $controller, 2);
        $method .= 'Action';
        if (!class_exists($class))
        {
            throw new \InvalidArgumentException(sprintf('Class "%s" does not exist.', $class));
        }
        if (!method_exists($class, $method))
        {
            throw new \InvalidArgumentException(sprintf('Method "%s" of "%s" class does not exist.', $method, $class));
        }
        $controller = new $class();
        if ($controller instanceof \Fulgurio\LightCMSBundle\Controller\FrontPageController)
        {
            $controller->setContainer($this->kernel->getContainer());
            $controller->setPage($this->page);
        }
        return array($controller, $method);
    }
398228
public function revertController($controller)
    {
        if (!$controller->is_destroy) {
            $controller->destroy();
        }
        $this->pool[$controller->core_name]->push($controller);
    }