Set page suffix
Handler for yii\web\View::beginPage
517561
public static function updateTitle()
    {
        if (Yii::$app instanceof Application === true && Yii::$app->request->get('page') !== null) {
            Yii::$app->view->title .= Yii::t(
                'plugin',
                ' - Page {page}',
                ['page' => (int)Yii::$app->request->get('page')]
            );
        }
    }
1049456
public function init() {
        //close csrf
        Yii::$app->request->enableCsrfValidation = false;
        //默认设置

       // $this->php_path =  dirname(__FILE__) . '/';
        $this->php_path =  $_SERVER['DOCUMENT_ROOT'] . '/';
        $this->php_url =  '/';
//根目录路径，可以指定绝对路径，比如 /var/www/attached/
        $this->root_path = $this->php_path . 'upload/';
//根目录URL，可以指定绝对路径，比如 http://www.yoursite.com/attached/
        $this->root_url = $this->php_url . 'upload/';
//图片扩展名
//            $ext_arr = ['gif', 'jpg', 'jpeg', 'png', 'bmp'],
//文件保存目录路径
        $this->save_path = $this->php_path . 'upload/';
//文件保存目录URL
        $this->save_url = $this->php_url . 'upload/';
//定义允许上传的文件扩展名
//            $ext_arr = array(
//                'image' => array('gif', 'jpg', 'jpeg', 'png', 'bmp'),
//                'flash' => array('swf', 'flv'),
//                'media' => array('swf', 'flv', 'mp3', 'wav', 'wma', 'wmv', 'mid', 'avi', 'mpg', 'asf', 'rm', 'rmvb'),
//                'file' => array('doc', 'docx', 'xls', 'xlsx', 'ppt', 'htm', 'html', 'txt', 'zip', 'rar', 'gz', 'bz2'),
//            ),
//最大文件大小
        $this->max_size = 1000000;
        $this->save_path = realpath($this->save_path) . '/';

        //load config file

        parent::init();
    }
978681
public function actionIndex($page = 1)
    {
        $sort = [];
        $params = Yii::$app->request->queryParams;
        if (empty($params['sort'])) {
            $sort['defaultOrder'] = ['parent_uid' => SORT_ASC, 'module_id' => SORT_ASC];
        } else {
            if($params['sort'] == 'module_id') {
                $sort['defaultOrder'] = ['parent_uid' => SORT_ASC, 'module_id' => SORT_ASC];
                unset($params['sort']);
            } else if ($params['sort'] == '-module_id') {
                $sort['defaultOrder'] = ['parent_uid' => SORT_DESC, 'module_id' => SORT_DESC];
                unset($params['sort']);
            }
            Yii::$app->request->setQueryParams($params);
        }

        $dataProvider = new ActiveDataProvider([
            'query' => Modmgr::find(),
            'sort' => $sort,
        ]);

        $pager = $dataProvider->getPagination();
        $pager->pageSize = $this->pageSize;
        $pager->page = $page - 1; //! from 0

        return $this->render('index', [
            'dataProvider' => $dataProvider,
        ]);
    }
565761
public function __HANDLER($nav = 0, $page = 1)
    {
        // Render view
        m()->view('index')
            ->html(CMSField::renderTable($nav, $page))
            ->title('Дополнительные поля');
    }
797584
public function init()
	{
		if($this->header===null)
			$this->header=Yii::t('yii','Go to page: ');
		if(!isset($this->htmlOptions['id']))
			$this->htmlOptions['id']=$this->getId();
		if($this->promptText!==null)
			$this->htmlOptions['prompt']=$this->promptText;
		if(!isset($this->htmlOptions['onchange']))
			$this->htmlOptions['onchange']="if(this.value!='') {window.location=this.value;};";
	}
861216
public function actionValue ()
		{
			if (Yii::$app->request->isAjax)
			{
				$setting = Setting::findOne([ 'name' => Yii::$app->request->post('name') ]);
				if ($setting !== null)
				{
					echo Json::encode($setting->value);
				}
			}
			Yii::$app->end();
		}
728037
public function init()
    {
        $path = Yii::getAlias($this->configFile);
        if (file_exists($path)) {
            $config = (include($path));
            foreach ($config as $name => $closure) {
                if (is_array($closure)) {
                    $this->addElement($name, $closure[0], $closure[1]);
                } else {
                    $this->addElement($name, $closure);
                }
            }
        }
    }
43191
public function init()
    {
        // Autoload the models and components directory 
        $this->setImport(array(
            'api.models.*',
            'api.components.*',
        ));
        
        // Disable layout rendering
        $this->layout = false;
        
        // Disable logging for the API
        foreach(Yii::app()->log->routes as $k=>$v)
        {
            if (get_class($v) == 'CWebLogRoute' || get_class($v) == "CProfileLogRoute")
                Yii::app()->log->routes[$k]->enabled = false; 
        }
        
        // Set default components and routes
        Yii::app()->setComponents(array(
            'errorHandler' => array(
                'errorAction'  => 'api/default/error',
            ),
            'messages' => array(
                'class' => 'cii.components.CiiPHPMessageSource',
                'basePath' => Yii::getPathOfAlias('application.modules.api')
            )
        ));
    }
463885
protected static function initRouterMemberVar()
    {
        if (self::$router_url === null) {
            self::initRouterUrl();
        }

        $router_str = trim(self::$router_url, "/");

        $arr = explode("/", $router_str);
        $arr_cnt = count($arr);

        self::$prefix = "";
        self::$controller = "";
        self::$method = "";

        switch ($arr_cnt) {
            case 1 :
                self::$method = "index";
                self::$controller = $arr[0];
                if($arr[0] == ""){
                    self::$controller = "index";
                }
                break;
            case 2 :
                self::$controller = $arr[0];
                self::$method = $arr[1];
                break;
            default :
                self::$method = $arr[$arr_cnt - 1];
                self::$controller = $arr[$arr_cnt - 2];
                unset($arr[$arr_cnt - 1],$arr[$arr_cnt - 2]);
                self::$prefix = implode('/',$arr);
                break;
        }
    }
1190931
public function actionPattern()
	{
		$this->pageTitle = Yii::t('phrase', 'Pattern Template | Dora. - Coming Soon Page Template');
		$this->pageDescription = '';
		$this->pageMeta = '';
		$this->render('/dora/template/front_pattern');
	}
249886
public function render( $view, $view_suffix = '' ) {
		$this->view        = $view;
		$this->view_suffix = $view_suffix;

		if ( is_singular() ) {
			$this->_render_loop();
		} else {
			$this->_render_direct();
		}
	}
834374
public function actionList($sort = '', $page = 1, $limit = 20)
    {
        $user_id = \Yii::$app->request->get('user_id');
        $username = \Yii::$app->request->get('username');
        $nickname = \Yii::$app->request->get('nickname');
        $group_ids = array_filter((array)\Yii::$app->request->get('group_ids'));
        $is_group_access = \Yii::$app->request->get('is_group_access');
        $is_user_access = \Yii::$app->request->get('is_user_access');
        $is_system = \Yii::$app->request->get('is_system');
        $note = \Yii::$app->request->get('note');
        $status = \Yii::$app->request->get('status');
        $limit = intval($limit);
        $order = ExtHelpers::getOrder($sort, [
            'user_id',
            'username',
            'nickname',
            'is_system',
            'note',
            'status'
        ], [], 'user_id DESC');

        $condition = '1';
        $params = [];
        if ($user_id) {
            $condition .= ' and user_id=:user_id';
            $params[':user_id'] = $user_id;
        }
        if ($username) {
            $condition .= ' and username=:username';
            $params[':username'] = $username;
        }
        if (is_numeric($is_group_access)) {
            $condition .= ' and is_group_access=:is_group_access';
            $params[':is_group_access'] = $is_group_access;
        }
        if (is_numeric($is_user_access)) {
            $condition .= ' and is_user_access=:is_user_access';
            $params[':is_user_access'] = $is_user_access;
        }
        if (is_numeric($is_system)) {
            $condition .= ' and is_system=:is_system';
            $params[':is_system'] = $is_system;
        }
        if ($note) {
            $condition .= ' and note like :note';
            $params[':note'] = '%' . $note . '%';
        }
        if ($nickname) {
            $condition .= ' and nickname like :nickname';
            $params[':nickname'] = '%' . $nickname . '%';
        }
        if ($group_ids && is_array($group_ids)) {
            $group_ids = array_filter($group_ids, function ($value) {
                return is_numeric($value);
            });
            $condition .= ' and group_ids in (' . join(',', $group_ids) . ')';
        }
        if (is_numeric($status)) {
            $condition .= ' and status=:status';
            $params[':status'] = $status;
        }
        $condition .= ' and user_id!=1';
        $data = DpAdminUser::getListByCondition($condition, $params, $order, $page, $limit);
        $list = [];
        if ($data['list']) {
            foreach ($data['list'] as $item) {
                $groupIds = StringHelper::explode($item['group_ids'], ',', true, true);
                asort($groupIds);
                $groupNames = [];
                foreach ($groupIds as $groupId) {
                    $group = DpAdminGroup::getByGroupId($groupId);
                    if ($group) {
                        $groupNames[] = $group['name'];
                    }
                }
                $list[] = [
                    'user_id' => $item['user_id'],
                    'username' => $item['username'],
                    'nickname' => $item['nickname'],
                    'group_ids' => join(',', $groupIds),
                    'group_names' => join(',', $groupNames),
                    'is_group_access' => $item['is_group_access'],
                    'is_user_access' => $item['is_user_access'],
                    'is_system' => $item['is_system'],
                    'note' => $item['note'],
                    'status' => $item['status'],
                ];
            }
        }

        return [
            'total' => $data['pagination']['totalCount'],
            'list' => $list,
        ];
    }
727133
function getEndBody(): string {
    /** @var \yii\web\View|null $view */
    $view = \Yii::$app->view;
    if (!$view || !$view->hasMethod('endBody')) return '';
    return $this->captureOutput([$view, 'endBody']);
  }
110235
public function actionHandleWebhook()
    {
        $payload = json_decode(Yii::$app->request->getRawBody(), true);

        if (!$this->eventExistsOnStripe($payload['id'])) {
            return;
        }

        $method = 'handle' . Inflector::camelize(str_replace('.', '_', $payload['type']));

        if (method_exists($this, $method)) {
            return $this->{$method}($payload);
        }

        return $this->missingMethod();
    }
354018
public function init()
    {
        // if set use CKEditor configurations from settings module else use default configuration.
        $json = \Yii::$app->settings->get('ckeditor.config', 'widgets');
        $ckeditorConfiguration = isset($json->scalar) ? $json->scalar : "{}";
        $script = "window.CKCONFIG = {$ckeditorConfiguration};";
        \Yii::$app->view->registerJs($script, \yii\web\View::POS_HEAD);


        if ($this->name === null && !$this->hasModel() && $this->selector === null) {
            throw new InvalidConfigException("Either 'name', or 'model' and 'attribute' properties must be specified.");
        }

        if (null === $this->schema) {
            throw new InvalidConfigException("You must specify 'schema' property.");
        }

        if ($this->hasModel() && !isset($this->options['id'])) {
            $this->options['id'] = Html::getInputId($this->model, $this->attribute);
        }

        if ($this->hasModel()) {
            $this->name  = empty($this->options['name']) ? Html::getInputName($this->model, $this->attribute) : $this->options['name'];
            $this->value = Html::getAttributeValue($this->model, $this->attribute);
        }

        if (!isset($this->containerOptions['id'])) {
            $this->containerOptions['id'] = ($this->hasModel() ? Html::getInputId($this->model, $this->attribute) : $this->getId()) . '-container';
        }

        if ($this->inputId === null) {
            $this->inputId = $this->options['id'];
        } else {
            $this->_renderInput = false;
        }

        parent::init();
        JsonEditorAsset::register($this->getView());
        JsonEditorPluginsAsset::register($this->getView());
    }
1179683
private function _initialize()
    {
        $params = $this->getParameters();
        $n = count($params);

        if ($params !== null) {
            for ($i = 0; $i < $n; $i++) {
                if ($params[$i] !== null) {
                    $name = $params[$i]->getName();
                    switch ($name) {
                        case 'begintoken':
                            $this->_beginToken = $params[$i]->getValue();
                            break;
                        case 'endtoken':
                            $this->_endToken = $params[$i]->getValue();
                            break;
                        case 'dir':
                            $this->_dir = $params[$i]->getValue();
                            break;
                        case 'prefix':
                            $this->_prefix = $params[$i]->getValue();
                            break;
                        case 'postfix':
                            $this->_postfix = $params[$i]->getValue();
                            break;
                        case 'translatehtml':
                            $this->_translatehtml = $params[$i]->getValue();
                            break;
                    }
                }
            }
        }
    }
704572
protected function renderSearchButton()
    {
        $view = $this->getView();
        $defaultOptions = [
            'title' => Yii::t('adminlte', 'Search'),
            'url' => 'search',
            'params' => ['referer' => $this->boxUrl],
            'searchLabel' => Yii::t('adminlte', 'Search'),
            'closeLabel' => Yii::t('adminlte', 'Close') . '(Esc)',
            'resetLabel' => Yii::t('adminlte', 'Reset'),
            'size' => 'size-wide',
        ];
        $options = array_replace_recursive($defaultOptions, $this->searchOptions);
        $searchDialogId = $this->options['id'] . '-search-dialog';

        // 打开搜索模态框时删除`_toggle`,`page`,`per-page`参数，以免[[Controller::display]]无法正确渲染视图
        $params = "var boxUrl=$('#{$this->options['id']}').attr('data-box-url');" .
            "boxUrl=wn.url.deleteQueryString(boxUrl, 'page');" .
            "boxUrl=wn.url.deleteQueryString(boxUrl, 'per-page');" .
            "boxUrl=wn.url.deleteQueryString(boxUrl, '_toggle');" .
            "var boxParams=((pos=boxUrl.indexOf('?')) !== -1)?boxUrl.substring(pos+1):'';";
        $bdAjaxOpts = Json::encode([
            'type' => 'get',
            'url' => Url::toRoute(array_merge((array)ArrayHelper::remove($options, 'url'), ArrayHelper::remove($options, 'params'))),
            'data' => new JsExpression('boxParams'), // 添加搜索条件或其他附加参数
            'timeout' => "4000",
            'dataType' => "HTML",
            'success' => new JsExpression("function(data){addToDialog(data, dialog, '{$searchDialogId}');}"),
            'error' => new JsExpression("function(XMLHttpRequest, textStatus, errorThrown){errorResponse(XMLHttpRequest, errorThrown);}"),
        ]);
        $opts = Json::encode([
            'title' => ArrayHelper::remove($options, 'title'),
            'size' => ArrayHelper::remove($options, 'size'),
            'message' => new JsExpression("function(dialog){{$params}$.ajax($bdAjaxOpts);}"),
            'buttons' => [
                [
                    'id' => 'submit',
                    'label' => ArrayHelper::remove($options, 'searchLabel'),
                    'cssClass' => 'btn-success',
                    'action' => new JsExpression('function(){$("#search_div").trigger("submit");}'),
                ],
                [
                    'id' => 'reset',
                    'label' => ArrayHelper::remove($options, 'resetLabel'),
                    'action' => new JsExpression('function(){$("#search_div").trigger("reset");}'),
                ],
                [
                    'id' => 'close',
                    'label' => ArrayHelper::remove($options, 'closeLabel'),
                    'action' => new JsExpression('function(dialogRef){dialogRef.close();}'),
                ],
            ],
        ]);

        $widgetSearchOpts = 'wnSearchOpts_' . hash('crc32', $opts);
        $view->registerJs("var {$widgetSearchOpts}={$opts}", View::POS_HEAD);

        $widgetSearch = 'wnSearchWidget_' . hash('crc32', "#{$this->options['id']} [data-widget=search]");
        $opts = Json::encode([
            'boxId' => $this->options['id'],
            'dialogId' => $searchDialogId,
            'widgetSearch' => new JsExpression("{$widgetSearch}"),
        ]);
        $view->registerJs("var {$widgetSearch}=new BootstrapDialog({$widgetSearchOpts});\nwnSearchWidget({$opts});");

        GridSearchAsset::register($view);

        return Html::button(FA::i(FA::_SEARCH), [
            'class' => 'btn btn-box-tool',
            'data-widget' => 'search',
            'data-toggle' => 'tooltip',
            'title' => $defaultOptions['title'],
        ]);
    }