预下单
@return string
773160
public function actionIndex()
    {
        $model = new Payment();
        if ($model->load(Yii::$app->request->post()) && $model->save()) {
            return $this->redirect(['/payment/default/pay', 'id' => $model->id]);
        }
        return $this->render('index', ['model' => $model]);
    }
1362126
public function actionThumb()
    {
        if (!Yii::$app->request->isAjax) {
            return $this->redirect(['forum/index']);
        }

        $data = [
            'error' => 1,
            'msg' => Html::tag('span',
                Html::tag('span', '', ['class' => 'glyphicon glyphicon-warning-sign'])
                . ' ' . Yii::t('podium/view', 'Error while voting on this post!'),
                ['class' => 'text-danger']
            ),
        ];

        if ($this->module->user->isGuest) {
            $data['msg'] = Html::tag('span',
                Html::tag('span', '', ['class' => 'glyphicon glyphicon-warning-sign'])
                . ' ' . Yii::t('podium/view', 'Please sign in to vote on this post'),
                ['class' => 'text-info']
            );
            return Json::encode($data);
        }

        $postId = Yii::$app->request->post('post');
        $thumb = Yii::$app->request->post('thumb');

        if (is_numeric($postId) && $postId > 0 && in_array($thumb, ['up', 'down'])) {
            $post = Post::find()->where(['id' => $postId])->limit(1)->one();
            if ($post) {
                if ($post->thread->locked) {
                    $data['msg'] = Html::tag('span',
                        Html::tag('span', '', ['class' => 'glyphicon glyphicon-warning-sign'])
                        . ' ' . Yii::t('podium/view', 'This thread is locked.'),
                        ['class' => 'text-info']
                    );
                    return Json::encode($data);
                }

                if ($post->author_id == User::loggedId()) {
                    $data['msg'] = Html::tag('span',
                        Html::tag('span', '', ['class' => 'glyphicon glyphicon-warning-sign'])
                        . ' ' . Yii::t('podium/view', 'You can not vote on your own post!'),
                        ['class' => 'text-info']
                    );
                    return Json::encode($data);
                }

                $count = 0;
                $votes = $this->module->podiumCache->get('user.votes.' . User::loggedId());
                if ($votes !== false) {
                    if ($votes['expire'] < time()) {
                        $votes = false;
                    } elseif ($votes['count'] >= 10) {
                        $data['msg'] = Html::tag('span',
                            Html::tag('span', '', ['class' => 'glyphicon glyphicon-warning-sign'])
                            . ' ' . Yii::t('podium/view', '{max} votes per hour limit reached!', ['max' => 10]),
                            ['class' => 'text-danger']
                        );
                        return Json::encode($data);
                    } else {
                        $count = $votes['count'];
                    }
                }

                if ($post->podiumThumb($thumb == 'up', $count)) {
                    $data = [
                        'error' => 0,
                        'likes' => '+' . $post->likes,
                        'dislikes' => '-' . $post->dislikes,
                        'summ' => $post->likes - $post->dislikes,
                        'msg' => Html::tag('span',
                            Html::tag('span', '', ['class' => 'glyphicon glyphicon-ok-circle'])
                            . ' ' . Yii::t('podium/view', 'Your vote has been saved!'),
                            ['class' => 'text-success']
                        ),
                    ];
                }
            }
        }
        return Json::encode($data);
    }
1367331
protected function categoryMenus()
    {
        $menus = [];
        $categories = $this->getCategories();
        foreach ($categories as $key => $label) {
            $menus[$key] = [
                'label' => $label,
                'items' => array_key_exists($key, $this->defaultCateMenus) ? $this->defaultCateMenus[$key] : []
            ];
        }

        $class = $this->moduleModelClass;
        foreach ($class::models() as $model) { // 安装的扩展模块(开启后台功能)
            if (!$model['admin'] || !array_key_exists($model['category'], $categories)) {
                continue;
            }
            $menus[$model['category']]['items'][] = [
                'label' => $model['name'],
                'url' => ModuleHelper::getAdminHomeUrl($model['id'])
            ];
        }

        return $menus;
    }
166566
public function toString()
    {
        if ($this->hidden) {
            return '';
        }
        
        $result = trim($this->getName() . ' ' . (!empty($this->version) && !$this->version->hidden ? $this->getVersion() : ''));

        if (empty($result) && isset($this->using)) {
            return $this->using->toString();
        }

        return $result;
    }
1126728
public function actionDel()
    {
        $ids = \Yii::$app->request->post('ids');
        foreach (StringHelper::explode($ids, ',', true, true) as $id) {
            $obj = DpAdminMenuUrl::find()
                ->findByUrlId($id)
                ->one();
            if ($obj) {
                $obj->status = DpAdminMenuUrl::STATUS_DELETE;
                $obj->save();
            }
        }

        return $this->renderSuccess('删除成功');
    }
704398
public function toSend()
    {
        if($this->getAttributeName() != '' && stripos($this->__toString(),'array') !== false)
            return $this->_get($this->getAttributeName());
        else
            return null;
    }
245390
private function get_sequence() {
        if (!empty($this->modinfo->sections[$this->_section])) {
            return implode(',', $this->modinfo->sections[$this->_section]);
        } else {
            return '';
        }
    }
1369783
public function renderNav()
    {
        $adminNavId = $this->getAdminNavId();
        $categories = $this->getCategories();

        // 高亮当前页面对应的父菜单
        foreach ($categories as $id => &$category) {
            if (($adminNavId && $adminNavId == $id)
                || $this->isInCategories($category)
            ) {
                $category['active'] = true;
                $this->curSubCategories = $category['navs'];
                break;
            }
        }

        // 默认显示第一个菜单
        if (!$this->curSubCategories && $categories) {
            reset($categories);
            $key = key($categories);
            $categories[$key]['active'] = true;
            $this->curSubCategories = $categories[$key]['navs'];
        }

        return $this->view->render('@admin/admin/nav.php', get_defined_vars());
    }
52085
public function actionDrop()
    {
        $formModel = new DpAdminMenuForm();
        $formModel->setScenario($formModel::SCENARIO_UPDATE_SORT);
        if ($formModel->load(Yii::$app->request->post(), '')) {
            if ($formModel->updateSort()) {
                return $this->renderSuccess('排序调整成功');
            }
            foreach ($formModel->errors as $field) {
                foreach ($field as $message) {
                    return $this->renderError($message);
                }
            }
        }

        return $this->renderError('未知错误');
    }
682898
public function getPathinfo()
    {
        //pathinfo已经被重写过
        if ($this->_pathinfo !== null) {
            return $this->_pathinfo;
        }
        $pathinfo = $this->get('PATH_INFO');
        if (!$pathinfo) {
            //兼容模式
            $vitex = Vitex::getInstance();
            if ($vitex->getConfig('router.compatible')) {
                $pathinfo = isset($_GET['u']) ? $_GET['u'] : '';
            }
        }
        return $pathinfo;
    }
1330204
protected function getMergedContent(): string
    {
        $content = $this->getTemplateSource();
        // 处理include合并
        // /
        // /{include mobile/header}
        // /
        $this->processIncludeTag($content);
        // 处理动态包含
        // /
        // /{template mobile/header}
        // /
        $this->processDynamicTag($content);
        // 处理扩展
        if ($this->hasExtendRule()) {
            $this->extendTemplate($content);
        }
        // 处理变量输出
        // /
        // /{$a}
        // /
        $this->processVars($content);
        // 处理变量输出(过滤特殊符号)
        // /
        // /{text $a}
        // /
        $this->processTextVars($content);
        // /处理url标签
        // /
        // /{url image}path/to/image.png{/url}
        // /
        $this->processUrlTag($content);
        // 处理php标签
        // /
        // /{php}echo hello world;{/php}
        // /
        $this->processPhpTag($content);
        // 处理block
        $this->processBlocks($content);
        // 处理注释
        // /
        // /{info this is a comment}
        // /
        $this->processComment($content);
        // 处理if标签
        // /
        // /{if true}
        // /
        $this->processIfCondition($content);
        // 处理elseif标签
        // /
        // /{elseif true}
        // /
        $this->processElseifCondition($content);
        // 处理else标签
        // /
        // /{else}
        // /
        $this->processElseCondition($content);
        // 处理条件结束标签
        // /
        // /{/if}
        // /
        // /
        // /{/loop}
        // /
        $this->processEndCondition($content);
        // 处理loop循环标签
        // /
        // /{loop $arr $val}
        // /
        // /
        // /{loop $arr $key $val}
        // /
        $this->processLoop($content);
        // 编译时间记录
        // /
        // /{build_time}
        // /
        $this->processBuildTime($content);
        // 处理不转换的标签
        // /
        // /{!}{$val}
        // /
        $this->processNoConvert($content);
        // /合并PHP标签
        $this->mergePhpContent($content);
        return $content;
    }
1274995
public function getPath(): string
    {

        $query = http_build_query(
            [
                'q'      => $this->query,
                'show'   => ($this->page !== 1) ? 50 * ($this->page - 1) : null,
                'letter' => $this->char,
                'type'   => $this->type,
                'score'  => $this->score,
                'status' => $this->status,
                'p'      => $this->producer,
                'r'      => $this->rated,
                'sd'     => $this->startDate[0],
                'sm'     => $this->startDate[1],
                'sy'     => $this->startDate[2],
                'ed'     => $this->endDate[0],
                'em'     => $this->endDate[1],
                'ey'     => $this->endDate[2],
                'gx'     => (int)$this->genreExclude,
                'o'      => $this->orderBy,
                'w'      => $this->sort
            ]
        );

        // Add genre[]=
        if (!empty($this->genre)) {
            foreach ($this->genre as $genre) {
                $query .= '&genre[]='.$genre;
            }
        }

        return sprintf(
            'https://myanimelist.net/anime.php?%s&c[]=a&c[]=b&c[]=c&c[]=f&c[]=d&c[]=e&c[]=g',
            $query
        );
    }
169597
public function getFullSlug() : string
    {
        $categories = Category::with('ancestors')->ancestorsAndSelf($this->category->id);

        $slug = "";

        foreach ($categories as $category) {
            $translation = $category->translations->where('locale', $this->locale)->first();
            $slug .= $translation->slug . '/';
        }

        $slug = substr($slug, 0, -1);

        return $slug;
    }
373405
public function getSubDirName()
    {
        substr(self::$urlParams['root'], -1) != '/' && self::$urlParams['root'] .= '/';
        substr(self::$urlParams['root'], 0, 1) != '/' && self::$urlParams['root'] = '/' . self::$urlParams['root'];
        return self::$urlParams['root'];
    }
418279
protected function getAdminNavId()
    {
        // 1. 从当前视图获取(控制器或行为中的变量)
        $adminNavId = $this->view['adminNavId'];
        if ($adminNavId) {
            return $adminNavId;
        }

        // 2. 从插件配置中获取
        $pluginId = $this->app->getPlugin();
        if ($pluginId) {
            return $this->plugin->getOneById($pluginId)->getOption('adminNavId');
        }

        return null;
    }
320904
public function get()
    {
        //获取保存值
        $raw = parent::getRaw();
        if (is_null($raw)) {
            return null;
        }

        //JSON解码
        $decoded = json_decode($raw);

        //如果解码失败,返回原始内容
        if (is_null($decoded)) {
            return $raw;
        }

        return $decoded;
    }
672520
public function getSlug()
    {
        $name = $this->getName();
        if (!isset($this->slugs[$name])) {
            $slug = Str::snake($name, '-');
            $this->slugs[$name] = Str::slug($slug);
        }

        return $this->slugs[$name];
    }