-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathPlugin.php
More file actions
88 lines (81 loc) · 2.89 KB
/
Plugin.php
File metadata and controls
88 lines (81 loc) · 2.89 KB
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php namespace Bombozama\LinkCheck;
use Bombozama\LinkCheck\Models\BrokenLink;
use System\Classes\PluginBase;
use Bombozama\LinkCheck\Models\Settings;
use Backend;
use Lang;
/**
* LinkCheck Plugin Information File
*/
class Plugin extends PluginBase
{
/**
* Returns information about this plugin.
*
* @return array
*/
public function pluginDetails()
{
return [
'name' => 'bombozama.linkcheck::lang.details.name',
'description' => 'bombozama.linkcheck::lang.details.description',
'author' => 'Gonzalo Henríquez',
'icon' => 'icon-chain-broken',
'homepage' => 'https://github.com/bombozama/linkcheck'
];
}
public function registerPermissions()
{
return [
'bombozama.linkcheck.manage' => [
'tab' => 'bombozama.linkcheck::lang.plugin.tab',
'label' => 'bombozama.linkcheck::lang.plugin.manage',
],
'bombozama.linkcheck.view' => [
'tab' => 'bombozama.linkcheck::lang.plugin.tab',
'label' => 'bombozama.linkcheck::lang.plugin.view',
],
];
}
public function registerSettings()
{
return [
'settings' => [
'label' => 'bombozama.linkcheck::lang.menu.settings.label',
'description' => 'bombozama.linkcheck::lang.menu.settings.description',
'category' => 'bombozama.linkcheck::lang.plugin.category',
'icon' => 'icon-chain-broken',
'class' => 'Bombozama\LinkCheck\Models\Settings',
'order' => 410,
'permissions' => ['bombozama.linkcheck.manage']
],
'brokenlinks' => [
'label' => 'bombozama.linkcheck::lang.menu.brokenlinks.label',
'description' => 'bombozama.linkcheck::lang.menu.brokenlinks.description',
'category' => 'bombozama.linkcheck::lang.plugin.category',
'icon' => 'icon-list',
'url' => Backend::url('bombozama/linkcheck/brokenlinks'),
'order' => 411,
'permissions' => ['bombozama.linkcheck.view']
],
];
}
public function registerListColumnTypes()
{
return [
'httpstatus' => [$this, 'httpStatus'],
];
}
public function httpStatus($value, $column, $record)
{
return '<span title="' . Lang::get('bombozama.linkcheck::lang.codes.' . $value ) . '">' . $value . '</span>';
}
// Please do https://octobercms.com/docs/setup/installation#crontab-setup
public function registerSchedule($schedule)
{
$settings = Settings::instance();
$schedule->call(function(){
BrokenLink::processLinks();
})->cron($settings->time);
}
}