Strip API version.

@since 160625 ReST utils.

@param string $action Action identifier.

@return string Action w/o the API version.
358734
protected function stripApiVersion(string $action): string
    {
        if (mb_strpos($action, 'api-v') === 0) {
            $action = preg_replace('/^api\-v[0-9]+[0-9.]*\./u', 'api.', $action);
        }
        return $action; // Without an API version.
    }
1215328
public function getFullAction(string $action = ''): array
    {
        // 初始化默认值
        $moduleName = $this->routeInfo->moduleName;
        $controllerName = $this->routeInfo->controllerName;
        $actionName = $this->routeInfo->actionName;
        // 分割
        if ($action != '') {
            $arr = explode('/', $action);
            $arrLength = count($arr);
            if ($arrLength == 1) {
                list ($actionName) = $arr;
            } elseif ($arrLength == 2) {
                list ($controllerName, $actionName) = $arr;
            } elseif ($arrLength == 3) {
                list ($moduleName, $controllerName, $actionName) = $arr;
            }
        }
        return [
            $moduleName,
            $controllerName,
            $actionName
        ];
    }
1073678
private static function getActionName(string $action): string
    {
        if ($action === '') {
            return 'index';
        }

        if (in_array(strtolower($action), self::$magicActionMethods)) {
            return '_' . $action;
        }

        return $action;
    }
584485
public function forward($action)
    {
        if (is_string($action)) {
            $parts = explode('/', ltrim($action, '/'));
            if (count($parts) == 1) {
                array_unshift($parts, $this->dispatcher->getControllerName());
            }
            $action = array('controller' => $parts[0], 'action' => $parts[1]);
        }
        return $this->dispatcher->forward($action);
    }
226990
public static function parseAction($action)
    {
        $action = explode('/', $action);

        if (count($action) < 2) {
            throw new DCException('invalid url format');
        }
        $action_name = array_pop($action);
        $controller_name = join("_", $action);

        return array($controller_name, $action_name);
    }
786104
public function filter($action = 'set') {
        $role = $this->Roles->newEntity();
        if ($this->request->session()->check('Roles')) {
            $session = $this->request->session()->read('Roles');
            $role = $this->Roles->patchEntity($role,  $session);
        }
        if ($this->request->is(['patch', 'post', 'put'])) {
            if ($action == 'unset') {
                $this->request->session()->delete('Roles');
            } else {
                $this->request->session()->write('Roles', $this->request->data);
            }
            $this->Flash->success(__('The role has been saved.'));
            return $this->redirect(['action' => 'index']);
        }
        $this->set(compact('role'));
        $this->set('_serialize', ['role']);
    }
784114
public function actionify($action)
    {
        if (false !== ($pos = strrpos($action, '.'))) {
            $action = substr($action, $pos + 1);
        }

        // if this is a service rather than just a controller name, the suffix
        // Action is not automatically appended to the method name
        if (false === strpos($this->baseControllerName, ':')) {
            $action .= 'Action';
        }

        return lcfirst(str_replace(' ', '', ucwords(strtr($action, '_-', '  '))));
    }
32938
public static function getCorrectActionName($action)
		{
			$action = strtolower($action);
			$action = str_replace(array('-','.'),' ',$action);
			$action = str_replace(' ','',ucwords($action));

			//$action = (string)(strtolower(substr($action,0,1)).substr($action,1));
			return lcfirst($action);
		}
860381
protected function actionReferencesController($action)
    {
        if (! $action instanceof Closure) {
            return is_string($action) || (isset($action['uses']) && is_string($action['uses']));
        }

        return false;
    }
579758
public function action($action = null)
    {
        if (!is_null($action)) {
            $this->action = $action;
            return $this;
        } else {
            return $this->action ?: '';
        }
    }
93218
public function getByAction($action)
	{
		return isset($this->actionList[$action]) ? $this->actionList[$action] : null;
	}
581289
public function Link($action=null) {
        $link = Controller::join_links(
            $this->stat('url_base', true),
            $this->stat('url_segment', true), // in case we want to change the segment
            '/', // trailing slash needed if $action is null!
            "$action"
        );
        
        $this->extend('updateLink', $link);
        return $link;
    }
1239345
protected function getAliasesForAction($action)
    {
        $actions = [];

        foreach ($this->manager->getAliases() as $aliasName => $alias) {
            if ($alias->hasAction($action)) {
                $actions[] = $aliasName;
            }
        }

        return $actions;
    }
676702
public function beforeAction($action)
	{
		// Redirect to SSL if this is set in the dashboard
		if (!Yii::app()->getRequest()->isSecureConnection && Cii::getConfig('forceSecureSSL', false))
            $this->redirect('https://' . Yii::app()->getRequest()->serverName . Yii::app()->getRequest()->requestUri);

        Yii::app()->setTheme(NULL);
        return parent::beforeAction($action);
	}
1009554
public function seeCurrentActionIs($action)
    {
        $this->getRouteByAction($action); // Fails if route does not exists
        $currentRoute = $this->app->request->route();
        $currentAction = $currentRoute ? $currentRoute->getActionName() : '';
        $currentAction = ltrim(str_replace($this->getRootControllerNamespace(), "", $currentAction), '\\');

        if ($currentAction != $action) {
            $this->fail("Current action is \"$currentAction\"");
        }
    }
811347
protected function normalizeAction($action)
    {
        $constantName = 'static::' . str_replace(' ', '_', strtoupper(trim($action)));
        if (!defined($constantName)) {
            throw new \InvalidArgumentException('Unknown action passed: ' . $action);
        }

        return constant($constantName);
    }
27166
protected function _forward($action)
    {
        $controller = $this->_request->getController();

        $viewPath = 'application/packages/' . str_replace('\\', DIRECTORY_SEPARATOR, $this->_package) . '/views/scripts/' . implode('/', array_slice(explode('\\', $this->_namespace), 1)) . '/';
        $this->_view->setFile($viewPath . $controller . DIRECTORY_SEPARATOR . $action . '.phtml');

        $actionName = $action . 'Action';

        return $this->$actionName();
    }