获取已上传的文件列表
@param $action
@return array
13500
protected function lists($action)
    {
        //查询实例
        $query = Attachment::find()->where(['user_id' => Yii::$app->user->id])->orderBy(['id' => SORT_DESC]);
        /* 判断类型 */
        switch ($action) {
            /* 列出文件 */
            case 'list-file':
                $query->andWhere(['ext' => explode(',', Yii::$app->settings->get('fileAllowFiles', 'attachment'))]);
                break;
            /* 列出图片 */
            case 'list-image':
            default:
                $query->andWhere(['ext' => explode(',', Yii::$app->settings->get('imageAllowFiles', 'attachment'))]);
        }
        $offset = Yii::$app->request->get('start', 0);
        $limit = Yii::$app->request->get('size', $this->options['imageManagerListSize']);
        $total = $query->count();
        if ($total > 0) {
            $files = $query->limit($limit)->offset($offset)->asArray()->all();
            $lists = [];
            foreach ($files as $file) {
                array_push($lists, [
                    'original' => $file['filename'],
                    'url' => $this->getSetting('storeUrl') . $file['path'],
                    'mtime' => $file['created_at']
                ]);
            }
            return ["state" => "SUCCESS", "list" => $lists, "start" => 0, "total" => $total];
        } else {
            return ["state" => "no match file", "list" => [], "start" => $offset, "total" => $total];
        }
    }
166123
public function getTemplatesFor($action)
    {
        $templates = SSViewer::get_templates_by_class(static::class, "_{$action}", __CLASS__);

        return array_merge(
            $templates,
            [
                "Security_{$action}",
                "Security",
                $this->config()->get("template_main"),
                "BlankPage"
            ]
        );
    }
1048694
public function getActionUrl($action)
    {
        if (is_array($action->urlData) && $this->isOpenNewWindow)
        {
            $action->url = BackendUrlHelper::createByParams($action->urlData)
                ->enableEmptyLayout()
                ->enableNoActions()
                ->params
            ;
        };

        return $action->url;
    }
390839
private function postData($action)
    {
        $xml = $this->xml->__toString();
        $xml = str_replace('<?xml version="1.0" encoding="UTF-8"?>', null, $xml);
        $xml = str_replace("\n", null, $xml);
        $digest = $this->calculateDigest($xml);
        $xml .= '<Digest>'.$digest.'</Digest>';
        $content = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><VPOS xmlns="http://www.modirum.com/schemas">%s</VPOS>';

        return sprintf($content, $xml);
    }
548640
protected function matchTypeAndDestination($action)
    {
        if (preg_match('#^([a-zA-Z0-9_]+):(.+)?$#', $action, $matches)) {
            $actionType = $matches[1];
            $actionValue = isset($matches[2]) ? $matches[2] : false;

            switch ($actionType) {
                case 'eznode':
                    $type = UrlAlias::LOCATION;
                    $destination = $actionValue;
                    break;

                case 'module':
                    $type = UrlAlias::RESOURCE;
                    $destination = $actionValue;
                    break;

                case 'nop':
                    $type = UrlAlias::VIRTUAL;
                    $destination = null;
                    break;

                default:
                    // @todo log message
                    throw new \RuntimeException("Action type '{$actionType}' is unknown");
            }
        } else {
            // @todo log message
            throw new \RuntimeException("Action '{$action}' is not valid");
        }

        return array($type, $destination);
    }
527258
public static function compress($action = '')
    {
        // merge framework files
        $destFile = Registry::get('applicationPath') . '/cache/nf.all.php';
        if (is_file($destFile)) {
            unlink($destFile);
        }
        // get the actual folder of Nf in the app's settings
        $includedFiles = get_included_files();
        $folder = null;
        
        foreach ($includedFiles as $includedFile) {
            if (preg_match('%Nf\/Autoloader\.php$%', $includedFile, $regs)) {
                $folder = str_replace('/Autoloader.php', '', $includedFile);
                $allFiles = self::getAllFiles($folder);
                // sort by depth for include
                uasort($allFiles, array(
                    'self',
                    'orderFilesByDepth'
                ));
                $bigInclude = '<?' . 'php' . "\n";
                foreach ($allFiles as $file) {
                    if (substr($file, - 4) == '.php') {
                        $bigInclude .= "\n" . str_replace('<?' . 'php', '', file_get_contents($file));
                    }
                }
                file_put_contents($destFile, $bigInclude);
                
                // merge routes files
                $destRoutesFile = Registry::get('applicationPath') . '/cache/routes.all.php';
                if (is_file($destRoutesFile)) {
                    unlink($destRoutesFile);
                }
                $router = \Nf\Router::getInstance();
                $router->setRootRoutes();
                $router->setRoutesFromFiles();
                $router->addAllRoutes();
                $allRoutes = $router->getAllRoutes();
                $bigInclude = '<?' . 'php' . "\n return ";
                $bigInclude .= var_export($allRoutes, true);
                $bigInclude .= ";";
                file_put_contents($destRoutesFile, $bigInclude);
                break;
            }
        }
        
        if ($folder === null) {
            die('The cache already exists, remove the generated files before in /cache (nf.all.php and routes.all.php)' . PHP_EOL);
        }
    }
530337
public static function getFilesArray($root)
	{
		$alias=array();
		$directories=array();
		$last_letter=$root[strlen($root)-1];
		$root= ($last_letter=='\\' || $last_letter=='/')? $root : $root.DIRECTORY_SEPARATOR;

		$directories[]=$root;

		while (sizeof($directories)) {
			$dir=array_pop($directories);
			if ($handle=opendir($dir)) {
				while (FALSE!==($file=readdir($handle))) {
					if ($file=='.' || $file=='..') {
						continue;
						}
					$file=$dir.$file;
					if (is_dir($file)) {
						$directory_path=$file.DIRECTORY_SEPARATOR;
						array_push($directories, $directory_path);
						}
					elseif (is_file($file)) {
						$key=basename($file);
						$alias[substr($key, 1, strpos($key, '.')-1)]=$file;
						}
					}
				closedir($handle);
				}
			}

		return $alias;
	}
371696
private function generatePostParams($action)
  {
    $params = [];

    if (!empty($action->postParams))
    {
      foreach ($action->postParams as $param => $type)
      {
        $params[] = new ParameterGenerator($param, $type);
      }
    }

    return $params;
  }
1073678
private static function getActionName(string $action): string
    {
        if ($action === '') {
            return 'index';
        }

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

        return $action;
    }
266056
private function getFileContents($file)
    {
        if (!isset($this->filesContent[$file])) {
            $this->filesContent[$file] = file_exists($file) ? file($file) : [];
        }

        return $this->filesContent[$file];
    }
645173
private function getActionFromParam($action)
    {
        $action = str_replace("-", "_", $action);
        if (substr($action, -1) === "/") {
            $action = substr($action, 0, -1);
        }

        return lcfirst(Inflector::camelize($action));
    }
570890
public function view_page($action) {
        if ($action == 'uploadfiles') {
            $users = required_param('selectedusers', PARAM_SEQUENCE);
            return $this->view_batch_upload_files(explode(',', $users));
        }
        if ($action == 'uploadzip') {
            return $this->view_upload_zip();
        }

        return '';
    }
908849
public function getAction($action)
	{
		//Получаем заказ по id пользователя и номеру заказа
		$order_id = Input::get('order_id');
		$order = Order::whereUserId(Config::get('ff-qiwi-shop::user_id'))
			->find($order_id);

		if (!$order) {
			return $this->resultMessage('Нет такого заказа');
		}

		// вызываем метод по названию переменной (data-action кнопки на странице)
		return $this->$action($order);
	}
138278
protected static function convertFile($file)
    {
        $error = $file->getError();
        $tmpName = '';
        if ($error === UPLOAD_ERR_OK) {
            $tmpName = $file->getStream()->getMetadata('uri');
        }

        return [
            'name' => $file->getClientFilename(),
            'type' => $file->getClientMediaType(),
            'tmp_name' => $tmpName,
            'error' => $error,
            'size' => $file->getSize(),
        ];
    }
122601
public function update(string $action)
    {
        $action = mb_strtolower($action);

        if (! in_array($action, ['enable', 'disable'])) {
            return $this->respondsWithError(trans('globals.action_not_allowed'));
        }

        Auth::user()->$action();

    	return $this->respondsWithSuccess(trans('user.success'));
    }
579758
public function action($action = null)
    {
        if (!is_null($action)) {
            $this->action = $action;
            return $this;
        } else {
            return $this->action ?: '';
        }
    }
297927
protected function getActionPath(string $action): string
    {
        $modelName = $this->getModelName();
        $nameSpace = ucfirst($modelName);

        $className = ucfirst(Str::camel($action)).'Request';

        return app_path('Http/Requests/Api/Admin/'.$nameSpace.'/'.$className.'.php');
    }