Repository navigation
Expand file tree
/
Copy pathExtension.php
More file actions
executable file
·123 lines (104 loc) · 3.08 KB
/
Copy pathExtension.php
File metadata and controls
executable file
·123 lines (104 loc) · 3.08 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<?php namespace Babel\NotFound;
use System\Classes\BaseExtension;
use Babel\NotFound\Models\Page404Settings;
use System\Models\Themes_model;
use File;
/**
* NotFound Extension Information File
*/
class Extension extends BaseExtension
{
/**
* Returns information about this extension.
*
* @return array
*/
/*public function extensionMeta()
{
return [
'name' => 'NotFound',
'author' => 'Babel',
'description' => 'No description provided yet...',
'icon' => 'fa-plug',
'version' => '1.0.0'
];
}*/
/**
* Register method, called when the extension is first registered.
*
* @return void
*/
public function register()
{
}
/**
* Boot method, called right before the request route.
*
* @return void
*/
public function boot()
{
$this->checkStatus();
}
public function checkStatus() {
$isEnabled = Page404Settings::get('status');
Themes_model::syncAll();
$themes = Themes_model::all();
$pagesAdded = [];
if ($isEnabled){
/** @var \System\Models\Themes_model */
foreach ($themes as $theme) {
//$themeDirectory = theme_path($theme->themeClass->getDirName());
//$pagesPath = $themeDirectory . '/_pages/not_found.blade.php';
//File::copy(__DIR__.'/views/not_found.blade.php', $pagesPath);
//$pagesAdded[] = $pagesPath;
}
}elseif (!$isEnabled){
foreach ($themes as $theme) {
//$themeDirectory = theme_path($theme->themeClass->getDirName());
//File::delete( $themeDirectory . '/_pages/not_found.blade.php' );
}
}
}
/**
* Registers any front-end components implemented in this extension.
*
* @return array
*/
public function registerComponents()
{
return [
'Babel\NotFound\Components\NotFoundPage' => [
'code' => 'NotFoundPage',
'name' => 'Page 404 Settings',
'description' => 'Page 404 Settings Component',
],
];
}
/**
* Registers any admin permissions used by this extension.
*
* @return array
*/
public function registerPermissions()
{
return [
'Babel.notFound.edit404Page' => [
'description' => 'Modify 404 Error Page',
'group' => 'module',
],
];
}
public function registerSettings()
{
return [
'settings' => [
'label' => '404 Error Page Settings',
'description' => 'Modify 404 Error Page.',
'icon' => 'fas fa-toilet-paper-slash',
'model' => 'Babel\NotFound\Models\Page404Settings',
'permissions' => ['Module.edit404Page'],
],
];
}
}