Execute an action

@param  string|Action  $action   Action classname or object
@param  array   $options Action options
@return Form
8622
public function action($action, $options = [])
    {
        if ($this->shouldValidate) $this->validate();
        if ($this->shouldCallGuard) $this->guard();
        if ($this->shouldFallThrough) return $this;

        if (is_string($action) && !class_exists($action)) {
            throw new Exception("{$action} does not exist.");
        }

        if (!is_subclass_of($action, Action::class)) {
            throw new Exception('Actions must extend '.Action::class.'.');
        }

        if (is_string($action)) {
            $action = new $action($this, $options);
        }

        $this->perform($action);

        return $this;
    }
1205499
public function openFormActions($options = array())
    {
        $options = $this->appendClassToOptions('form-actions', $options);

        return '<div' . $this->html->attributes($options) . '>';
    }
403981
protected function getControllerAction($options)
    {
        if (is_array($options)) {
            return $this->url->action($options[0], array_slice($options, 1));
        }

        return $this->url->action($options);
    }
1085392
public function executeStep($stepAction, &$stepActionParams, &$options, array &$context)
    {
        return $this->getConfHelper()->executeStep($stepAction, $stepActionParams, $options, $context);
    }
529115
function post($action,$params = array(),$options = array()){
		$options["method"] = "POST";
		return $this->_doRequest($action,$params,$options);
	}
977268
public function exec_action($action)
    {
        if (isset($this->actions[$action])) {
            call_user_func($this->actions[$action]);
        }
        else if (rcube::get_instance()->action != 'refresh') {
            rcube::raise_error(array('code' => 524, 'type' => 'php',
                'file' => __FILE__, 'line' => __LINE__,
                'message' => "No handler found for action $action"), true, true);
        }
    }
780523
private function execute($ns, $action)
    {
        // filter out (secret, server, timeout) from construct config
        $config = array_filter($this->config['config'], function ($key) {
            return !in_array($key, ['secret', 'server', 'timeout']);
        }, ARRAY_FILTER_USE_KEY);

        // init component
        $component = new $ns($config);

        // call method, if exception return exception class
        try {
            if (method_exists($component, $action)) {
                $response = call_user_func_array(
                    [
                        $component,
                        $action
                    ],
                    $this->input["params"]
                );
            } else {
                $response = sprintf(Server::ERROR_ACTION, $action, $ns);
            }
            // Catch exception and return Exception\Server - PHP 5.6 compat
        } catch (\Exception $e) {
            return new Exception\Server($e->getMessage());
        } catch (Exception\Server $e) {
            return new Exception\Server($e->getMessage());
        }

        return $response;
    }
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);
    }
631875
public function apiGet($action, $data = [ ], $method = 'GET', $options = [ ]) {
        return $this->httpRequest($action, $this->prepareJsonPayload($data), $method, $options);
    }
340598
protected static function getAction(array $options)
    {
        //check if action is URL
        if (array_has($options, 'url')) {
            return 'http://'.array_get($options, 'url');
        }

        //check if action is secure for HTTPS
        if (array_has($options, 'secure')) {
            return 'https://'.array_get($options, 'secure');
        }

        //check if action is route
        if (array_has($options, 'route')) {
            return path().array_get($options, 'route');
        }
    }
488318
protected function o_action($id, $action, $options = '')
    {
        if ($action !== 'new') {
            $o = &$this->objects[$id];
        }

        switch ($action) {
            case 'new':
                if (is_array($options)) {
                    $this->objects[$id] = array('t' => 'action', 'info' => $options, 'type' => $options['type']);
                } else {
                    // then assume a URI action
                    $this->objects[$id] = array('t' => 'action', 'info' => $options, 'type' => 'URI');
                }
                break;

            case 'out':
                if ($this->encrypted) {
                    $this->encryptInit($id);
                }

                $res = "\n$id 0 obj\n<< /Type /Action";
                switch ($o['type']) {
                    case 'ilink':
                        if (!isset($this->destinations[(string)$o['info']['label']])) {
                            break;
                        }

                        // there will be an 'label' setting, this is the name of the destination
                        $res .= "\n/S /GoTo\n/D " . $this->destinations[(string)$o['info']['label']] . " 0 R";
                        break;

                    case 'URI':
                        $res .= "\n/S /URI\n/URI (";
                        if ($this->encrypted) {
                            $res .= $this->filterText($this->ARC4($o['info']), false, false);
                        } else {
                            $res .= $this->filterText($o['info'], false, false);
                        }

                        $res .= ")";
                        break;
                }

                $res .= "\n>>\nendobj";

                return $res;
        }

        return null;
    }
697146
public function call ($action, array $args = [])
    {
        $method = $action;
        $class = null;

        if (is_string($action)) {
            list($class, $method) = explode('@', $action);
        }
        elseif (is_array($action)) {
            list($class, $method) = $action; 

            if (!is_object($class)) {
                throw new ContainerException('$class must be an object');
            }

            if (!is_string($method)) {
                throw new ContainerException('$action must be a string');
            }
        }

        $reflection = $this->getActionReflection($method, $class);
        $args       = $this->getParametersDictionary($args);
        $parameters = $this->getParameters($reflection, $args);

        if (is_callable($method)) {
            return $method(...$parameters);
        }

        if(!is_object($class)) {
            $class = $this->build($class);
        }

        return $class->{$method}(...$parameters);
    }
566985
public function invokeMethod($action, array $vars = array()) {
        Factory::timer()->record('controller start');
		$this->action = $action;
		if (!$this->hasMethod($action)) {
			return $this->throwErrorMethod($action);
		}
		if (true !==
            ($arg = $this->canInvoke($action))) {
			return $arg;
		}
		if (array_key_exists($action, $this->actions())) {
			return $this->runClassMethod($action);
		}
		$this->prepare();
		$result = $this->runActionMethod($this->getActionName($action), $vars);
		$this->finalize();
        Factory::timer()->record('controller end');
		return $result;
	}
714664
protected function runAction($action, array $options = array())
    {
        switch ($action) {
            case 'merge':
                return $this->runMergeAction($options);

            case 'tag':
                return $this->runTagAction($options);

            case 'pull':
                return $this->runPullAction($options);

            case 'push':
                return $this->runPushAction($options);
        }


        return false;
    }
579758
public function action($action = null)
    {
        if (!is_null($action)) {
            $this->action = $action;
            return $this;
        } else {
            return $this->action ?: '';
        }
    }
440920
public function addAction(Action $action): Editbox
    {

        switch ($action->getType()) {
            case Action::SAVE:
                $this->actions[0] = $action;
                break;

            case Action::CANCEL:
                $this->actions[1] = $action;
                break;

            case Action::CONTEXT:
            default:
                if (empty($this->actions[2])) {
                    $this->actions[2] = [];
                }

                $this->actions[2][] = $action;

                break;

        }

        return $this;
    }
863483
protected function executePhpAction(Config\Action $action) : void
    {
        $this->beforeAction();
        $runner = new Action\PHP();
        $runner->execute($this->config, $this->io, $this->repository, $action);
        $this->afterAction();
    }