Handle the incoming request.
@param $action
@param $actionParams
@return \b8\b8\Http\Response|Response
344054
public function handleAction($action, $actionParams)
    {
        $this->setView($action);
        $response = parent::handleAction($action, $actionParams);

        if ($response instanceof Response) {
            return $response;
        }

        if (is_string($response)) {
            $this->controllerView->content = $response;
        } elseif (isset($this->view)) {
            $this->controllerView->content = $this->view->render();
        }

        $this->response->setContent($this->controllerView->render());

        return $this->response;
    }
895301
public function handleEvent(ActionEvent $event)
    {
        if (!$this->scopeDeterminator->currentScopeIsBackend()) {
            return;
        }

        $environment = $event->getEnvironment();
        $basic       = $environment->getDataDefinition()->getBasicDefinition();
        $action      = $event->getAction();

        if (null !== $event->getResponse()
            || ('showAll' !== $action->getName())
            || !$this->wantToHandle($basic->getMode(), $action)
        ) {
            return;
        }

        if (false !== ($response = $this->process($action, $environment))) {
            $event->setResponse($response);
        }
    }
445999
public function postRequest( $action, array $params, EditInfo $editInfo = null ) {
		if ( $editInfo !== null ) {
			$params = array_merge( $this->getEditInfoParams( $editInfo ), $params );
		}

		$params['token'] = $this->api->getToken();
		return $this->api->postRequest( new SimpleRequest( $action, $params ) );
	}
1234223
protected function fire($action, $params)
    {
        if(!isset($this->events[$action])){
            throw new HandlerException('Action handler not exists', HandlerException::ACTION_HANDLER_NOT_EXISTS);
        }

        // prepare params array for handler
        // we provide a client library as a param for further requests
        $callbackParams = $params;
        $callbackParams['client'] = $this->getClient();
        $callbackParams = new \ArrayObject($callbackParams, \ArrayObject::STD_PROP_LIST);

        // fire handlers for every event
        foreach($this->events[$action] as $e){
            $result = call_user_func($e, $callbackParams);
            if(!$result){
                break;
            }
        }

    }
127708
protected function getApiUrl($action, $queryParams)
    {
        $baseUrl = strtr($this->urlTemplate, [
            '{subdomain}' => $this->subdomain
        ]) . $action;

        if (!empty($queryParams)) {
            return  $baseUrl . '?' . http_build_query($queryParams);
        } else {
            return $baseUrl;
        }
    }
321006
public function invokeAction($action, $params = [])
    {

        //var_dump($this->request->getAttributes());

        //Will throw an exception if the method does not exists;
        $method = new ReflectionMethod($this, $action);

        if (!$method->isPublic()) {
            throw new Exception('Attempting to call a private method');
        }

        return $method->invokeArgs($this, $params);

    }
144024
function delete($action,$params = array(),$options = array()){
		$options["method"] = "DELETE";
		return $this->_doRequest($action,$params,$options);
	}
210450
protected function handleAction($request, $action)
	{
		$module = $this->findModule();
		
		if(!$module) {
			return parent::handleAction($request, $action);
		}
		
		$data = [];
		
		if($this->isGreenPage()) {
			$data = $this->data()->toViewableData();
		}
		elseif($module->getDataSource()) {
			$data = $module->getDataSource()->toDBObject();
		}

		$module->loadRequirements();
		$viewer = $this->getViewer($action);					
		$viewer->setTemplateFile('Layout', $module->getLayoutTemplateFile());

		$main = $module->getMainTemplateFile();
		if($main) {
			$viewer->setTemplateFile('main', $main);
		}
		
		return $viewer->process($this->customise($data));
	}
893764
protected function buildFormParams(array $params, $action)
    {
        $params = $this->addCommonParams($params, $action);

        return $this->addSignature($params);
    }
785389
public function get($action, $queryParams = [])
    {
        return \GuzzleHttp\json_decode($this->getGuzzle()->get($this->getApiUrl($action, $queryParams))->getBody(), true);
    }
529115
function post($action,$params = array(),$options = array()){
		$options["method"] = "POST";
		return $this->_doRequest($action,$params,$options);
	}
120938
protected function handleAction(Config\Action $action) : void
    {
        $this->io->write(['', 'Action: <comment>' . $action->getAction() . '</comment>']);

        if (!$this->doConditionsApply($action->getConditions())) {
            $this->io->write(
                ['', 'Skipped due to failing conditions']
            );
            return;
        }

        $execMethod = self::getExecMethod(Util::getExecType($action->getAction()));
        $this->{$execMethod}($action);
    }
135261
public function handleAction($request, $action)
    {
        $handles = parent::allowedActions(false);
        $defaultMapping = $this->stat('allowed_actions');
        $handles['index'] = 'handleIndex';
        $siteConfig = SiteConfig::current_site_config();
        foreach ($defaultMapping as $key) {
            $map = ucfirst($key . 'Action');
            if ($siteConfig->$map) {
                $handles[$siteConfig->$map] = $key;
            }
            if (!array_key_exists($key, $handles)) {
                $handles[$key] = $key;
            }
        }
        self::$url_handlers = $handles;
        $this->needsRedirect();

        return parent::handleAction($request, $handles[$action]);
    }
881729
public function invoke($class, $action="index", $params=[]) {

        $controller = new $class($this);

        return \method_exists($controller, $action) && \is_callable([$controller, $action])
                ? \call_user_func_array([$controller,$action], $params)
                : false;
    }
111923
protected function request($action = '', array $params = [])
    {

        $params['Token'] = $this->config['api']['token'];
        if ($action !== '') {
            $params['Action'] = $action;
        }

        $query = http_build_query($params);
        $url   = $this->config['api']['url'];

        $ch = curl_init();

        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $query);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
        curl_setopt($ch, CURLOPT_TIMEOUT, 60);

        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);

        $result = curl_exec($ch);
        curl_close($ch);

        if (!$result) {

            throw new Exception('Connection failed. Reason unknown.');
        }

        return $result;
    }
1031811
public function execute($actionContext) {
        $response = $actionContext->getHttpContext()->getResponse();
        $response->addHeader('Content-Type', (!empty($this->contentType) ? $this->contentType : 'text/plain'));
        $response->write($this->content);
        $response->end();
    }
776464
public function run($action = null, $params = [])
    {
        $this->action = $action;
        $this->params = $params;

        /*
         * Check security token.
         */
        if (!$this->verifyCsrfToken()) {
            return Response::make(Lang::get('backend::lang.page.invalid_token.label'), 403);
        }

        /*
         * Check forced HTTPS protocol.
         */
        if (!$this->verifyForceSecure()) {
            return Redirect::secure(Request::path());
        }

        /*
         * Determine if this request is a public action.
         */
        $isPublicAction = in_array($action, $this->publicActions);

        /*
         * Check that user is logged in and has permission to view this page
         */
        if (!$isPublicAction) {

            /*
             * Not logged in, redirect to login screen or show ajax error.
             */
            if (!BackendAuth::check()) {
                return Request::ajax()
                    ? Response::make(Lang::get('backend::lang.page.access_denied.label'), 403)
                    : Backend::redirectGuest('backend/auth');
            }

            /*
             * Check access groups against the page definition
             */
            if ($this->requiredPermissions && !$this->user->hasAnyAccess($this->requiredPermissions)) {
                return Response::make(View::make('backend::access_denied'), 403);
            }
        }

        /*
         * Extensibility
         */
        if ($event = $this->fireSystemEvent('backend.page.beforeDisplay', [$action, $params])) {
            return $event;
        }

        /*
         * Set the admin preference locale
         */
        BackendPreference::setAppLocale();
        BackendPreference::setAppFallbackLocale();

        /*
         * Execute AJAX event
         */
        if ($ajaxResponse = $this->execAjaxHandlers()) {
            return $ajaxResponse;
        }

        /*
         * Execute postback handler
         */
        if (
            ($handler = post('_handler')) &&
            ($handlerResponse = $this->runAjaxHandler($handler)) &&
            $handlerResponse !== true
        ) {
            return $handlerResponse;
        }

        /*
         * Execute page action
         */
        $result = $this->execPageAction($action, $params);

        if (!is_string($result)) {
            return $result;
        }

        return Response::make($result, $this->statusCode);
    }