This repository has been archived by the owner on Jul 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPlugin.php
74 lines (63 loc) · 1.96 KB
/
Plugin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php
/** @noinspection PhpMissingParentCallCommonInspection */
/** @noinspection PhpIncludeInspection */
declare(strict_types=1);
namespace Vdlp\Phast;
use App;
use System\Classes\PluginBase;
use Vdlp\Phast\Console;
use Vdlp\Phast\ReportWidgets;
final class Plugin extends PluginBase
{
public function pluginDetails(): array
{
return [
'name' => 'Phast',
'description' => 'Boost your OctoberCMS powered website load speed and rank better in search engines!',
'author' => 'Van der Let & Partners',
'icon' => 'icon-link',
'homepage' => 'https://octobercms.com/plugin/vdlp-phast',
];
}
public function boot(): void
{
if (!App::runningInConsole()
&& !App::runningUnitTests()
&& !App::runningInBackend()
) {
$pluginLevel = __DIR__ . '/vendor/kiboit/phast/src/html-filters.php';
$projectLevel = __DIR__ . '/../../../vendor/kiboit/phast/src/html-filters.php';
if (file_exists($pluginLevel)) {
require $pluginLevel;
} elseif (file_exists($projectLevel)) {
require $projectLevel;
}
}
}
public function register(): void
{
$this->app->register(ServiceProvider::class);
$this->registerConsoleCommand(Console\ClearCache::class, Console\ClearCache::class);
}
public function registerPermissions(): array
{
return [
'vdlp.phast.clear_cache' => [
'label' => 'Allowed to clear Phast Cache.',
'tab' => 'Phast',
],
];
}
public function registerReportWidgets(): array
{
return [
ReportWidgets\ClearCache::class => [
'label' => 'Clear Phast Cache',
'context' => 'dashboard',
'permissions' => [
'vdlp.phast.clear_cache'
],
],
];
}
}