-
Notifications
You must be signed in to change notification settings - Fork 1
/
Plugin.php
107 lines (94 loc) · 3.03 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<?php namespace Uxms\Sharecount;
use Backend;
use System\Classes\PluginBase;
use System\Classes\SettingsManager;
use Illuminate\Foundation\AliasLoader;
use Uxms\Sharecount\Models\Configs;
use Uxms\Sharecount\Components\ShareCount;
class Plugin extends PluginBase
{
public function pluginDetails()
{
return [
'name' => 'uxms.sharecount::lang.app.name',
'description' => 'uxms.sharecount::lang.app.desc',
'author' => 'uXMs Devs',
'icon' => 'icon-group',
'homepage' => 'https://uxms.net/'
];
}
public function registerPermissions()
{
return [
'uxms.sharecount.address' => [
'label' => 'Access Webpages',
'tab' => 'Share Count'
]
];
}
public function registerComponents()
{
return [
'Uxms\Sharecount\Components\ShareCount' => 'shareCount'
];
}
public function registerSettings()
{
return [
'config' => [
'label' => 'uxms.sharecount::lang.app.name',
'description' => 'uxms.sharecount::lang.app.setting_desc',
'icon' => 'icon-group',
'class' => 'Uxms\Sharecount\Models\Configs',
'category' => SettingsManager::CATEGORY_SOCIAL,
'order' => 998
]
];
}
/**
* Not yet working in v1.0.0
*/
public function registerSchedule($schedule)
{
$schedule->call(function() {
// TODO: Will be fixed
// ShareCount::instance()->updateShareCounts();
})->everyFiveMinutes();
}
public function registerNavigation()
{
return [
'sharecount' => [
'label' => 'uxms.sharecount::lang.app.menu_label',
'url' => Backend::url('uxms/sharecount/address'),
'icon' => 'icon-group',
'permissions' => ['uxms.sharecount.*'],
'order' => 998,
'sideMenu' => [
'address' => [
'label' => 'uxms.sharecount::lang.addresses.page_title',
'icon' => 'icon-connectdevelop',
'url' => Backend::url('uxms/sharecount/address'),
'permissions' => ['uxms.sharecount.address']
]
]
]
];
}
/**
* The boot() method is called right before a request is routed
*/
public function boot()
{
if ( Configs::get('cache_time_out') == null ) {
Configs::set('cache_time_out', 'daily');
}
if ( Configs::get('fetch_with_cron') == null ) {
Configs::set('fetch_with_cron', '1');
}
if ( Configs::get('timezone') == null ) {
Configs::set('timezone', 'America/Los_Angeles');
}
date_default_timezone_set(Configs::get('timezone'));
}
}