• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

miaoxing / app / 6756064869

04 Nov 2023 04:44PM UTC coverage: 2.381% (-0.2%) from 2.614%
6756064869

push

github

twinh
ci: add PHP 8, remove PHP 7.2, 7.3

4 of 168 relevant lines covered (2.38%)

0.04 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/AppPlugin.php
1
<?php
2

3
namespace Miaoxing\App;
4

5
use Miaoxing\App\Middleware\CheckAppStatus;
6
use Miaoxing\App\Middleware\LogRequest;
7
use Miaoxing\Plugin\BasePage;
8
use Miaoxing\Services\Middleware\Auth;
9
use Wei\BaseController;
10

11
class AppPlugin extends \Miaoxing\Plugin\BasePlugin
12
{
13
    protected $name = '应用';
14

15
    protected $description = '';
16

17
    protected $code = 202;
18

19
    public function onLinkToGetLinks(&$links, &$types)
20
    {
21
        $types['site'] = [
×
22
            'name' => '官网',
×
23
            'sort' => 900,
×
24
        ];
×
25

26
        $links[] = [
×
27
            'typeId' => 'site',
×
28
            'name' => '首页',
×
29
            'url' => '',
×
30
        ];
×
31
    }
32

33
    /**
34
     * 限制命令行控制器,只有在命令行下或超级管理员才可以访问
35
     *
36
     * @param BaseController $controller
37
     */
38
    public function onControllerInit(BaseController $controller)
39
    {
40
        $controller->middleware(Auth::class);
×
41
        $controller->middleware(LogRequest::class);
×
42

43
        // 除去 admin/login 页面
44
        if (0 === strpos($this->app->getController(), 'admin/')) {
×
45
            $controller->middleware(CheckAppStatus::class);
×
46
        }
47
    }
48

49
    public function onPageInit(BasePage $page)
50
    {
51
        $this->onControllerInit($page);
×
52
    }
53

54
    public function onBeforeScript()
55
    {
56
        wei()->page->addJsVar('miaoxing', [
×
57
            'baseUrl' => wei()->req->getBaseUrl(),
×
58
        ]);
×
59
    }
60
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc