Detect the action for a path
@return string 'create', 'update', 'edit', ....
431585
public function detectAction()
    {

        // If the path ends in one of the special actions, use that as the action
        // as long as the verb is a GET
        if (preg_match('#[a-z-]+$#i', $this->path, $matches)) {
            $action = $matches[0];

            // If posting to the create/edit route, treat as a 'post' route rather than
            // a 'create/edit' one.  This is a shorthand so the create forms can
            // post to themselves
            if ($action == 'create' && $this->verb == 'POST') {
                return 'store';
            } elseif ($action == 'edit' && $this->verb == 'POST') {
                return 'update';
            }

            // ... otherwise, use the route explicitly
            elseif (in_array($action, $this->actions)) {
                return $action;
            }
        }

        // If the path ends in a number, the verb defines what it is
        if (preg_match('#\d+$#', $this->path)) {
            switch ($this->verb) {
                case 'PUT':
                case 'POST':
                    return 'update';

                case 'DELETE':
                    return 'destroy';

                default:
                    return false;
            }
        }

        // Else, it must end with the controller name
        switch ($this->verb) {
            case 'POST':
                return 'store';

            case 'GET':
                return 'index';
        }

        // Must have been an erorr if we got here
        return false;
    }
430178
public function detectAndExecute()
    {
        // Get the controller
        if (!($controller = $this->detectController())) {
            return false;
        }

        // Get the action
        $action = $this->detectAction();
        if (!$action || !method_exists($controller, $action)) {
            return false;
        }

        // Get the id
        $id = $this->detectId();

        // Tell other classes what was found
        $event = Event::fire('wildcard.detection', [
            $controller, $action, $id
        ]);

        // Instantiate controller
        $controller = new $controller();
        if ($parent = $this->detectParent()) {
            list($parent_slug, $parent_id) = $parent;
            $parent_model = 'App\\'.Str::singular(Str::studly($parent_slug));
            $controller->parent($parent_model::findOrFail($parent_id));
        }

        // Execute the request
        $params = $id ? [$id] : [];
        return $controller->callAction($action, $params);
    }
489879
protected function createAction()
    {
        if (strtolower($this->option('type')) == 'regular' || $this->option('type') == null) {
            return $this->createView();
        }
        if (strtolower($this->option('type')) == 'controller') {
            return $this->createController();
        }
        return $this->createResourceController();
    }
781561
protected function alterAction(
        /*# string */ $destination,
        /*# string */ $action
    )/*# : bool */ {
        if (!$this->exists() || !$this->isFilesystemWritable($this->full)) {
            return false;
        }

        if ($this->isDir($destination)) {
            $destination = rtrim($destination, '/') . '/' . basename($this->path);
        }

        $res = $this->getDriver()->{$action}($this->path, $destination);
        $this->resetError();
        return (bool) $res;
    }
716604
public function run()
    {
        foreach ($this->routes as $path => $action) {
            if ($this->uri == $path) {
                return $this->executeAction($action);
            }
        }

        return $this->executeError404();
    }
280679
protected function _actionCheck()
    {
        $actions = $this->getConfig('actions');
        if (is_bool($actions)) {
            return $actions;
        }

        return in_array($this->request->getParam('action'), (array)$actions, true);
    }
1064154
public function getPathInfo()
    {
        if ($this->pathInfo === null) {
            $end = strpos($this->uri, '?');

            if ($end === false) {
                $this->pathInfo = $this->uri;
            }else{
                $this->pathInfo = substr($this->uri, 0, $end);
            }

            if (empty($this->pathInfo)) {
                $this->pathInfo = '/';
            }
        }
        
        return $this->pathInfo;
    }
1019336
public function editUrl()
    {
        try {
            return route('admin::edit-attribute', [$this->attribute_group_id, $this->id]);
        } catch (InvalidArgumentException $e) {
            Log::error($e->getMessage());
        }
    }
1100453
public function addAction()
    {
        $parent = $this->params()->fromRoute('parent');
        if (! is_numeric($parent)) {
            $this->flashMessenger()->addMessage(
                $this->scTranslate('The category location was not specified.')
            );
            return $this->redirect()
                ->toRoute('sc-admin/content-manager')
                ->setStatusCode(303);
        }
        try {
            $categoryId = $this->getCategoryService()->makeCategory($parent);
        } catch (RuntimeException $e) {
            $this->flashMessenger()->addMessage($e->getMessage());
            return $this->redirect()
                ->toRoute('sc-admin/content-manager')
                ->setStatusCode(303);
        }
        return $this->redirect()->toRoute(
            'sc-admin/category/edit',
            ['id' => $categoryId]
        );
    }
299570
public function directoryAction($path)
    {
        try {
            $this->setPath($path);
        } catch (NotFoundException $e) {
            throw $e;
        }

        $dbfile = new WDBFile($this->getpath());
        if ($dbfile->isFile()) {
            return $this->fileAction($this->getPath());
        }

        $readme_content = $dir_content = '';

        $index = $dbfile->findIndex();
        if (file_exists($index)) {
            return $this->fileAction($index);
        }

        $tpl_params = array(
            'page'          => $dbfile->getWDBFullStack(),
            'dirscan'       => $dbfile->getWDBScanStack(),
            'breadcrumbs'   => TemplateHelper::getBreadcrumbs($this->getPath()),
            'title'         => TemplateHelper::buildPageTitle($this->getPath()),
        );
        if (empty($tpl_params['title'])) {
            if (!empty($tpl_params['breadcrumbs'])) {
                $tpl_params['title'] = TemplateHelper::buildPageTitle(end($tpl_params['breadcrumbs']));
            } else {
                $tpl_params['title'] = _T('Home');
            }
        }

        $readme = $dbfile->findReadme();
        if (file_exists($readme)) {
            $this->wdb->setInputFile($readme);
            $readme_dbfile  = new WDBFile($readme);
            $readme_content = $readme_dbfile->viewFileInfos();
        }
        $tpl_params['inpage_menu']  = !empty($readme_content) ? 'true' : 'false';

        $dir_content = $this->wdb
            ->display('', 'dirindex', $tpl_params);

        return array('default', $dir_content.$readme_content, $tpl_params);
    }
1099310
function createAction() {
    if( !isset( $this->action['value'] ))
      return;
    $attributes = $this->_createParams( $this->action['params'] );
    return $this->_createElement( 'ACTION', $attributes, $this->action['value'] );
  }
54898
public function update()
    {
        $this->setUpVersion();
        $connection = $this->getConnection();
        foreach ($this->folders as $name => $path) {
            $folder = new FolderImpl($path);
            if (!$folder->exists()) {
                continue;
            }
            /** @var File[] $files */
            $files = $folder->listFolder(Folder::LIST_FOLDER_FILES);

            usort($files, function (File $a, File $b) {
                return $this->leadingNumber($a->getFilename()) - $this->leadingNumber($b->getFilename());
            });
            $lastFile = null;
            $version = $this->getVersion($name);
            foreach ($files as $file) {
                if ($file->getExtension() != 'sql') {
                    continue;
                }

                if ($this->leadingNumber($file->getFilename()) <= $version) {
                    continue;
                }

                $stmt = $connection->prepare($file->getContents());
                $stmt->execute();

                while ($stmt->nextRowset()) ; //Polling row sets

                $lastFile = $file;
            }
            if ($lastFile == null) {
                continue;
            }
            $this->setVersion($name, $this->leadingNumber($lastFile->getFilename()));

        }
    }
86652
public function checkPath($path = null)
    {
        if (is_null($path)) {
            $path = $this->getDir();
        }

        $real_path = realpath($path);
        if (!$real_path) {
            $real_path = realpath(dirname($path));
        }
        $upload_path = realpath($this->getUploadPath());

        if (strcasecmp($real_path, $upload_path) > 0) {
            return true;
        } else {
            throw new \Exception("Directory is not in the upload path", 403);
        }
    }
1366044
public function getPathInfo()
    {
        if ($this->pathInfo === null) {
            $this->pathInfo = $this->detectPathInfo();
        }
        return $this->pathInfo;
    }
578836
public function editAction()
    {
        if(method_exists($this, 'getEditForm'))
        {
            $form = $this->getEditForm();
        }
        else
        {
            $form = $this->getForm();
        }

        $id = $this->getEvent()
                ->getRouteMatch()
                ->getParam('id', 0);

        $form->add([
            'type'       => 'Zend\Form\Element\Hidden',
            'name'       => 'id',
            'attributes' => [
                'id'    => 'id',
                'value' => $id,
            ],
            'filters'    => [
                [
                    'name' => 'Int',
                ],
            ],
            'validators' => [
                [
                    'name' => 'Digits',
                ],
            ],
        ]);

        $em            = $this->getEntityManager();
        $objRepository = $em->getRepository($this->getEntityClass());
        $entity        = $objRepository->find($id);
        $form->bind($entity);

        $redirectUrl = $this->url()->fromRoute($this->getActionRoute(), [], true);
        $prg         = $this->fileprg($form, $redirectUrl, true);

        if($prg instanceof Response)
        {
            return $prg;
        }
        elseif($prg === false)
        {
            $this->getEventManager()->trigger('getForm', $this, [
                'form'        => $form,
                'entityClass' => $this->getEntityClass(),
                'id'          => $id,
                'entity'      => $entity,
            ]);

            return [
                'entityForm' => $form,
                'entity'     => $entity,
            ];
        }

        $this->getEventManager()->trigger('getForm', $this, [
            'form'        => $form,
            'entityClass' => $this->getEntityClass(),
            'id'          => $id,
            'entity'      => $entity,
        ]);

        $savedEntity = $this->getEntityService()->save($form, $entity);

        if(!$savedEntity)
        {
            return [
                'entityForm' => $form,
                'entity'     => $entity,
            ];
        }

        $this->flashMessenger()->addSuccessMessage($this->getServiceLocator()
                        ->get('translator')
                        ->translate($this->successEditMessage));

        return $this->redirect()->toRoute($this->getActionRoute('list'), [], true);
    }
313827
protected function checkPath( $path ) {
		$iterator = new RecursiveIteratorIterator(
			new RecursiveCallbackFilterIterator(
				new RecursiveDirectoryIterator( $path ),
				[ $this, 'filterDirs' ]
			)
		);
		$bad = [];
		/** @var SplFileInfo $file */
		foreach ( $iterator as $file ) {
			// Skip directories
			if ( !$file->isFile() ) {
				continue;
			}

			// Skip whitelisted files
			if ( in_array( $file->getPathname(), $this->ignoredFiles ) ) {
				$this->progress( 'S' );
				continue;
			}

			if ( !$file->isExecutable() ) {
				$this->progress( '.' );
				continue;
			}

			if ( !$this->checkFile( $file ) ) {
				$this->progress( 'E' );
				$bad[] = $file;
			} else {
				$this->progress( '.' );
			}
		}

		return $bad;
	}
462044
public function editAction()
    {
        $id = (int) $this->params()->fromRoute('id', null);

        $request = $this->getRequest();
        $service = $this->getService();
        $entity  = $service->getById($id);

        $form     = $this->getEditForm();
        $form->bind($entity);

        if ($request->getQuery()->get('redirect')) {
            $redirect = $request->getQuery()->get('redirect');
        } else {
            $redirect = false;
        }

        $redirectUrl = $this->url()->fromRoute($this->getEditActionRoute(), array('id' => $id)) . ($redirect ? '?redirect=' . $redirect : '');
        $prg = $this->prg($redirectUrl, true);

        if ($prg instanceof Response) {
            return $prg;
        } elseif ($prg === false) {
            return array(
                'options'  => $this->getOptions(),
                'id'       => $id,
                'form'     => $form,
                'redirect' => $redirect,
            );
        }

        $post   = $prg;
        $entity = $service->update($id, $post);

        $redirect = isset($prg['redirect']) ? $prg['redirect'] : null;

        if (!$entity) {
            return array(
                'options'  => $this->getOptions(),
                'id'       => $id,
                'form'     => $form,
                'redirect' => $redirect,
            );
        }

        return $this->redirect()->toUrl($this->url()->fromRoute($this->getRouteIdentifierPrefix()) . ($redirect ? '?redirect='.$redirect : ''));
    }