-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBootstrapBusinessTheme.php
More file actions
85 lines (75 loc) · 2.53 KB
/
Copy pathBootstrapBusinessTheme.php
File metadata and controls
85 lines (75 loc) · 2.53 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
<?php
declare(strict_types=1);
namespace Theme\BootstrapBusiness;
use App\Application\Devflow;
use App\Infrastructure\Services\Theme;
use App\Shared\Services\Registry;
use Qubus\EventDispatcher\ActionFilter\Action;
use Qubus\EventDispatcher\ActionFilter\Filter;
use Qubus\Exception\Exception;
use ReflectionException;
use function App\Shared\Helpers\compare_releases;
use function App\Shared\Helpers\theme_root;
use function App\Shared\Helpers\theme_url;
use function basename;
use function dirname;
use function get_class;
use function Qubus\Security\Helpers\t__;
final class BootstrapBusinessTheme extends Theme
{
/**
* @inheritDoc
* @throws ReflectionException|Exception
*/
public function meta(): array
{
$theme = [
'name' => t__(msgid: 'Bootstrap Business', domain: 'bootstrap-business'),
'id' => 'bootstrap-business',
'slug' => 'BootstrapBusiness',
'author' => 'Joshua Parker',
'version' => '2.0.1',
'description' => t__(
msgid: 'A multipurpose Bootstrap full website template ported from Start Bootstrap.',
domain: 'bootstrap-business'
),
'basename' => basename(dirname(__FILE__)),
'path' => theme_root(__FILE__),
'url' => theme_url('', __CLASS__),
'themeUri' => 'https://github.com/getdevflow/bootstrap-business',
'authorUri' => 'https://joshuaparker.dev/',
'className' => get_class($this),
'screenshot' => theme_url('BootstrapBusiness/images/screenshot.png'),
];
Registry::getInstance()->set('bootstrap-business', $theme);
return $theme;
}
/**
* @inheritDoc
* @throws Exception
* @throws ReflectionException
*/
public function handle(): void
{
if (compare_releases(Devflow::release(), '2.3.0', '<')) {
$this->registerAdminNotice();
return;
}
Filter::getInstance()->addFilter('pagebuilder.support', fn() => true);
}
/**
* @return void
* @throws ReflectionException
*/
private function registerAdminNotice(): void
{
Action::getInstance()->addAction('admin_notices', function () {
echo '<div class="alert dismissable alert-danger center sticky">' .
t__(
'You must upgrade your system to at least v2.3 in order to use the new Bootstrap Business theme.',
$this->id()
) .
'</div>';
});
}
}