Execution point for controller actions
188389
public function run()
    {
        if ( $this->mobileDeviceDetect->isEnabled() )
        {
            $this->mobileDeviceDetect->process();

            if ( $this->mobileDeviceDetect->isMobileDevice() )
                $this->mobileDeviceDetect->redirect();
        }

        ob_start();
        $this->requestInit();

        // send header information
        foreach (
            eZHTTPHeader::headerOverrideArray( $this->uri ) +
            array(
                'Expires' => 'Mon, 26 Jul 1997 05:00:00 GMT',
                'Last-Modified' => gmdate( 'D, d M Y H:i:s' ) . ' GMT',
                'Cache-Control' => 'no-cache, must-revalidate',
                'Pragma' => 'no-cache',
                'X-Powered-By' => eZPublishSDK::EDITION,
                'Content-Type' => 'text/html; charset=' . $this->httpCharset,
                'Served-by' => isset( $_SERVER["SERVER_NAME"] ) ? $_SERVER['SERVER_NAME'] : null,
                'Content-language' => $this->languageCode
              ) as $key => $value
        )
        {
            header( $key . ': ' . $value );
        }

        try
        {
            $moduleResult = $this->dispatchLoop();
        }
        catch ( Exception $e )
        {
            $this->shutdown();
            throw $e;
        }

        $ini = eZINI::instance();

        /**
         * Ouput an is_logged_in cookie when users are logged in for use by http cache solutions.
         *
         * @deprecated As of 4.5, since 4.4 added lazy session support (init on use)
         */
        if ( $ini->variable( "SiteAccessSettings", "CheckValidity" ) !== 'true' )
        {
            $wwwDir = eZSys::wwwDir();
            // On host based site accesses this can be empty, causing the cookie to be set for the current dir,
            // but we want it to be set for the whole eZ publish site
            $cookiePath = $wwwDir != '' ? $wwwDir : '/';

            if ( eZUser::isCurrentUserRegistered() )
            {
                // Only set the cookie if it doesnt exist. This way we are not constantly sending the set request in the headers.
                if ( !isset( $_COOKIE['is_logged_in'] ) || $_COOKIE['is_logged_in'] !== 'true' )
                {
                    setcookie( 'is_logged_in', 'true', 0, $cookiePath );
                }
            }
            else if ( isset( $_COOKIE['is_logged_in'] ) )
            {
                setcookie( 'is_logged_in', false, 0, $cookiePath );
            }
        }

        if ( $this->module->exitStatus() == eZModule::STATUS_REDIRECT )
        {
            $this->shutdown();
            return $this->redirect();
        }

        $uiContextName = $this->module->uiContextName();

        // Store the last URI for access history for login redirection
        // Only if user has session and only if there was no error or no redirects happen
        if ( eZSession::hasStarted() && $this->module->exitStatus() == eZModule::STATUS_OK )
        {
            $currentURI = $this->completeRequestedURI;
            if ( strlen( $currentURI ) > 0 && $currentURI[0] !== '/' )
                $currentURI = '/' . $currentURI;

            $lastAccessedURI = "";
            $lastAccessedViewURI = "";

            $http = eZHTTPTool::instance();

            // Fetched stored session variables
            if ( $http->hasSessionVariable( "LastAccessesURI" ) )
            {
                $lastAccessedViewURI = $http->sessionVariable( "LastAccessesURI" );
            }
            if ( $http->hasSessionVariable( "LastAccessedModifyingURI" ) )
            {
                $lastAccessedURI = $http->sessionVariable( "LastAccessedModifyingURI" );
            }

            // Update last accessed view page
            if ( $currentURI != $lastAccessedViewURI &&
                 !in_array( $uiContextName, array( 'edit', 'administration', 'ajax', 'browse', 'authentication' ) ) )
            {
                $http->setSessionVariable( "LastAccessesURI", $currentURI );
            }

            // Update last accessed non-view page
            if ( $currentURI != $lastAccessedURI && $uiContextName != 'ajax' )
            {
                $http->setSessionVariable( "LastAccessedModifyingURI", $currentURI );
            }
        }

        eZDebug::addTimingPoint( "Module end '" . $this->module->attribute( 'name' ) . "'" );
        if ( !is_array( $moduleResult ) )
        {
            eZDebug::writeError( 'Module did not return proper result: ' . $this->module->attribute( 'name' ), 'index.php' );
            $moduleResult = array();
            $moduleResult['content'] = false;
        }

        if ( !isset( $moduleResult['ui_context'] ) )
        {
            $moduleResult['ui_context'] = $uiContextName;
        }
        $moduleResult['ui_component'] = $this->module->uiComponentName();
        $moduleResult['is_mobile_device'] = $this->mobileDeviceDetect->isMobileDevice();
        $moduleResult['mobile_device_alias'] = $this->mobileDeviceDetect->getUserAgentAlias();

        $templateResult = null;

        eZDebug::setUseExternalCSS( $this->siteBasics['external-css'] );
        if ( $this->siteBasics['show-page-layout'] )
        {
            $tpl = eZTemplate::factory();
            if ( $tpl->hasVariable( 'node' ) )
                $tpl->unsetVariable( 'node' );

            if ( !isset( $moduleResult['path'] ) )
                $moduleResult['path'] = false;
            $moduleResult['uri'] = eZSys::requestURI();

            $tpl->setVariable( "module_result", $moduleResult );

            $meta = $ini->variable( 'SiteSettings', 'MetaDataArray' );

            if ( !isset( $meta['description'] ) )
            {
                $metaDescription = "";
                if ( isset( $moduleResult['path'] ) && is_array( $moduleResult['path'] ) )
                {
                    foreach ( $moduleResult['path'] as $pathPart )
                    {
                        if ( isset( $pathPart['text'] ) )
                            $metaDescription .= $pathPart['text'] . " ";
                    }
                }
                $meta['description'] = $metaDescription;
            }

            $this->site['uri'] = $this->oldURI;
            $this->site['redirect'] = false;
            $this->site['meta'] = $meta;
            $this->site['version'] = eZPublishSDK::version();
            $this->site['page_title'] = $this->module->title();

            $tpl->setVariable( "site", $this->site );

            if ( $ini->variable( 'DebugSettings', 'DisplayDebugWarnings' ) === 'enabled' )
            {
                // Make sure any errors or warnings are reported
                if ( isset( $GLOBALS['eZDebugError'] ) && $GLOBALS['eZDebugError'] )
                {
                    eZAppendWarningItem(
                        array(
                            'error' => array(
                                'type' => 'error',
                                'number' => 1 ,
                                'count' => $GLOBALS['eZDebugErrorCount']
                            ),
                            'identifier' => 'ezdebug-first-error',
                            'text' => ezpI18n::tr( 'index.php', 'Some errors occurred, see debug for more information.' )
                        )
                    );
                }

                if ( isset( $GLOBALS['eZDebugWarning'] ) && $GLOBALS['eZDebugWarning'] )
                {
                    eZAppendWarningItem(
                        array(
                            'error' => array(
                                'type' => 'warning',
                                'number' => 1,
                                'count' => $GLOBALS['eZDebugWarningCount']
                            ),
                            'identifier' => 'ezdebug-first-warning',
                            'text' => ezpI18n::tr( 'index.php', 'Some general warnings occured, see debug for more information.' )
                        )
                    );
                }
            }

            if ( $this->siteBasics['user-object-required'] )
            {
                $currentUser = eZUser::currentUser();

                $tpl->setVariable( "current_user", $currentUser );
                $tpl->setVariable( "anonymous_user_id", $ini->variable( 'UserSettings', 'AnonymousUserID' ) );
            }
            else
            {
                $tpl->setVariable( "current_user", false );
                $tpl->setVariable( "anonymous_user_id", false );
            }

            $tpl->setVariable( "access_type", $this->access );
            $tpl->setVariable( 'warning_list', !empty( $this->warningList) ? $this->warningList : false );

            $resource = "design:";
            if ( is_string( $this->siteBasics['show-page-layout'] ) )
            {
                if ( strpos( $this->siteBasics['show-page-layout'], ":" ) !== false )
                {
                    $resource = "";
                }
            }
            else
            {
                $this->siteBasics['show-page-layout'] = "pagelayout.tpl";
            }

            // Set the navigation part
            // Check for navigation part settings
            $navigationPartString = 'ezcontentnavigationpart';
            if ( isset( $moduleResult['navigation_part'] ) )
            {
                $navigationPartString = $moduleResult['navigation_part'];

                // Fetch the navigation part
            }
            $navigationPart = eZNavigationPart::fetchPartByIdentifier( $navigationPartString );

            $tpl->setVariable( 'navigation_part', $navigationPart );
            $tpl->setVariable( 'uri_string', $this->uri->uriString() );
            if ( isset( $moduleResult['requested_uri_string'] ) )
            {
                $tpl->setVariable( 'requested_uri_string', $moduleResult['requested_uri_string'] );
            }
            else
            {
                $tpl->setVariable( 'requested_uri_string', $this->actualRequestedURI );
            }

            // Set UI context and component
            $tpl->setVariable( 'ui_context', $moduleResult['ui_context'] );
            $tpl->setVariable( 'ui_component', $moduleResult['ui_component'] );

            $templateResult = $tpl->fetch( $resource . $this->siteBasics['show-page-layout'] );
        }
        else
        {
            $templateResult = $moduleResult['content'];
        }

        eZDebug::addTimingPoint( "Script end" );

        $content = trim( ob_get_clean() );

        ob_start();
        eZDB::checkTransactionCounter();
        eZDisplayResult( $templateResult );
        $content .= ob_get_clean();

        $this->shutdown();

        return new ezpKernelResult( $content, array( 'module_result' => $moduleResult ) );
    }
65479
function executeNodeAction(action, renderer, parent, node, beforeNode) {
    if (action === 0 /* Insert */) {
        isProceduralRenderer(renderer) ?
            renderer.insertBefore(parent, node, beforeNode) :
            parent.insertBefore(node, beforeNode, true);
    }
    else if (action === 1 /* Detach */) {
        isProceduralRenderer(renderer) ?
            renderer.removeChild(parent, node) :
            parent.removeChild(node);
    }
    else if (action === 2 /* Destroy */) {
        ngDevMode && ngDevMode.rendererDestroyNode++;
        renderer.destroyNode(node);
    }
}
935512
private function exec( $controller_name, $args )
	{
		// Process controller
		$compo = explode( '@', $controller_name );

		if ( count( $compo ) <= 1 ) {

			throw new Exception( sprintf( 'Controller action must be defined in %s.', $controller_name ) );

		}

		// Get controller
		require_once(  $this->controllers_path . $compo[0] . '.php' );
		$classname = sprintf( $this->namespace . '\Controllers\%s', $compo[0]);
		$controller = new $classname( $this->view );

		if ( !method_exists( $controller, $compo[1] ) ) {

			throw new Exception( sprintf( 'Controller action "%s" not found in %s.', $compo[1], $compo[0] ) );

		}

		return call_user_func_array( [ $controller, $compo[1] ], $args );
	}
1072078
public function execute()
    {
        // init container.
        $this->initContainer();

        // routing
        $this->routing();

        // action chain.
        while ($action = $this->actionChain->getCurrentAction()) {

            // clear.
            $this->filterChain->clear();
            $this->container->register('errorList', $this->actionChain->getCurrentErrorList());

            $this->filterChain->setAction($action['controller'], $action['action']);
            $this->filterChain->build();
            $this->filterChain->execute();

            $this->actionChain->next();
        }

        // response.
        $this->response->execute();
    }
947045
private void fireControlPress(int index, int controllerIndex) {
		consumed = false;
		for (int i=0;i<controllerListeners.size();i++) {
			ControllerListener listener = (ControllerListener) controllerListeners.get(i);
			if (listener.isAcceptingInput()) {
				switch (index) {
				case LEFT:
					listener.controllerLeftPressed(controllerIndex);
					break;
				case RIGHT:
					listener.controllerRightPressed(controllerIndex);
					break;
				case UP:
					listener.controllerUpPressed(controllerIndex);
					break;
				case DOWN:
					listener.controllerDownPressed(controllerIndex);
					break;
				default:
					// assume button pressed
					listener.controllerButtonPressed(controllerIndex, (index - BUTTON1) + 1);
					break;
				}
				if (consumed) {
					break;
				}
			}
		}
	}
1293000
public function executeAction()
    {
        $moduleClass = $this->get('request')->get('_module.module');
        $actionName = $this->get('request')->get('_module.action');

        $module = $this->get('module_manager')->get($moduleClass);
        foreach ($module->getControllerPreExecutes() as $controllerPreExecute) {
            if (null !== $retval = call_user_func($controllerPreExecute, $module)) {
                return $retval;
            }
        }

        return $module->getAction($actionName)->executeController();
    }
663271
def execute_input_middleware_stream(self, request, controller):
        
        start_request = request
        # either 'http' or 'cmd' or 'irc'
        controller_name = "".join(controller.get_controller_name().split('-')[:1])
        middlewares = list(self.pre_input_middleware) + list(self.input_middleware)
        for m in middlewares:
            to_execute = getattr(m(controller), controller_name)
            if to_execute:
                result = to_execute(request)
                if GiottoControl in type(result).mro():
                    # a middleware class returned a control object (redirection, et al.)
                    # ignore all other middleware classes
                    return request, result
                request = result
        return start_request, request
1253560
function execute(context, action) {
    if (!remote) return fail(context, "Not connected to a server");
    
    // prepare source path
    if (context.args.length < 1) return fail(context, "Remote path missing");
    var path = remote.join(remotePath, context.args[0]);
    action(path);
}
471524
public function process()
    {
        // Your controller name
        $this->controller = Inflector::classify($this->argument('name')).'Controller';

        // By default we will generate basic controller, if resource set then we will generate
        // REST-ful Resource controller
        $this->setControllerType();

        try {
            $this->makeController();
        } catch (\Exception $e) {
            throw $e;
        }

        $this->info('Controller '.$this->controller.' Generated Successfully By Cygnite Cli.');
    }
887316
def get_action_handler(self, controller_name, action_name):
        
        try_actions = [
            controller_name + '/' + action_name,
            controller_name + '/not_found',
            # call Index controller to catch all unhandled pages
            'index/not_found'
        ]
        # search first appropriate action handler
        for path in try_actions:
            if path in self._controllers:
                return self._controllers[path]
        return None
1159338
public function dispatch()
    {
		/**
         * Calling before dispatch listener
         */
		if ( is_object($this->_events_manager) )
        {
            $this->_events_manager->fire( "dispatch:beforeDispatch", $this );
		}

		$finished = false;

		$number_dispatches = 0;

		while ( !$finished )
		{
			$number_dispatches++;

			if ( $number_dispatches == 100 )
            {
                $this->_throwDispatchException( "Dispatch error. Cyclic routing.", self::EXCEPTION_CYCLIC_ROUTING );
				break;
			}

            $controller_name = $this->_route->getControllerName();
            $action_name     = $this->_route->getActionName();
            $params          = $this->_route->getParams();

            if ( !class_exists($controller_name) )
            {
                if ( $this->_throwDispatchException( $controller_name . " controller class cannot be loaded.", self::EXCEPTION_CONTROLLER_NOT_FOUND ) == false )
                {
                    continue;
                }

                break;
            }

            $controller_instance = new $controller_name();

            if ( !method_exists($controller_instance, $action_name) )
            {
                if ( $this->_throwDispatchException( $action_name . "Action action does not exist in " . $controller_name . ".", self::EXCEPTION_ACTION_NOT_FOUND ) == false )
                {
                    continue;
                }

                break;
            }

            /**
             * Calling before execute route listener
             */
            if ( is_object($this->_events_manager) )
            {
                $this->_events_manager->fire( "dispatch:beforeExecuteRoute", $this );

                /**
                 * If there was a forward in the listener
                 */
                if ( $this->_was_forwarded )
                {
                    $this->_was_forwarded = false;
                    continue;
                }
            }

            $controller_instance->setDI( $this->_di );

            $controller_instance->initialize();

			/**
             * Calling action in controller with params
             */
            call_user_func_array( array($controller_instance, $action_name), $params );

			/**
             * If there was a forward in the action
             */
			if ( $this->_was_forwarded )
            {
				$this->_was_forwarded = false;
				continue;
			}

			$finished = true;
		}
    }
1335259
public function exec()
    {
        $name = $this->argument('name');
        $route = $this->argument('route');
        $resource = $this->option('resource');
        $notAliased = $this->option('not_aliased');
        //
        $process = Controller::create($name, $route, $resource);

        if (!$notAliased) {
            $class = ucfirst($name);
            //
            Alias::update('controllers.'.$class, 'App\Controller\\'.$name);
        }
        $this->show($process, $name);
    }
512763
function callHook() {
		global $default; // Should take care of this later.
		$queryString = array();

		if (!isset($this->url)) {

			$controller = $this->routes['default']['controller'];
			$action = $this->routes['default']['action'];
		} else {
			//print "URL: " . $this->url . "<br>";
			$this->routeURL(); // Replace the URL with something else based on preg_matches defined in the routing
			//print "URL: " . $this->url . "<br>";
			$urlArray = array();
			$urlArray = explode("/",$this->url);
			$controller = $urlArray[0];
			array_shift($urlArray); // Pop the first element
			if (!$controller){
				$controller="index";  // Default Controller
			}

			if (isset($urlArray[0])) {
				$action = $urlArray[0];
				array_shift($urlArray); // pop the second element
			} else {
				$action = 'index'; // Default Action
			}
			$queryString = $urlArray;
		}

		$controllerName = ucfirst($controller).'Controller';
		//print "Calling $controllerName with $controller and $action at ";
		$this->runControllerAction($controller, $action, $queryString, $controllerName, $action);

	}
881406
def execute
      return Strings.no_help_commands if @actions.empty?
      actions = @actions.map do |action|
        if action.description.to_s.empty?
          action.name
        else
          "#{action.name} # #{action.description}"
        end
      end
      Strings.help(actions.join("\n"))
    end
1247881
private function executeAction(string $action)
    {
        list($controller, $method) = explode('@', $action);

        $class = '\App\Controllers\\'.ucfirst($controller).'Controller';

        if (!class_exists($class)) {
            throw new ExceptionHandler('Class "'.$class.'" not found.');
        }

        $controllerInstantiate = new $class();

        if (!method_exists($controllerInstantiate, $method)) {
            throw new ExceptionHandler('Method "'.$method.'" not found in '.$class.'.');
        }

        return call_user_func_array([new $controllerInstantiate, $method], []);
    }
1169964
def _process_actions(self, actions, inport, packet):
        '''
        
        '''
        second_stage = []
        for a in actions:
            fn = a(packet=packet, net=self._switchyard_net, controllers=self._controller_connections, inport=inport)
            if (fn):
                second_stage.append(fn)
        for fn in second_stage:
            fn()
799074
def execute_action(self, action_name, **options):
        
        assert action_name in NG_ACTIONS, 'wrong action - {0}'.format(action_name)

        action = NG_ACTIONS[action_name]
        self.loop.run_sync(lambda: action.execute(**options), timeout=self.timeout)