-
Notifications
You must be signed in to change notification settings - Fork 451
/
notice.php
59 lines (50 loc) · 1.54 KB
/
notice.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
<?php
namespace Concrete\Controller\Element\Production;
use Concrete\Core\Config\Repository\Repository;
use Concrete\Core\Controller\ElementController;
use Concrete\Core\Feature\Features;
use Concrete\Core\Feature\Traits\HandleRequiredFeaturesTrait;
use Concrete\Core\Feature\UsesFeatureInterface;
use Concrete\Core\Page\Page;
use Concrete\Core\Production\Modes;
use Concrete\Core\User\User;
class Notice extends ElementController implements UsesFeatureInterface
{
use HandleRequiredFeaturesTrait;
/**
* @var User
*/
protected $user;
/**
* @var Repository
*/
protected $config;
public function getRequiredFeatures(): array
{
return [Features::STAGING];
}
public function getElement()
{
return 'production/notice';
}
public function __construct(Repository $config, User $user)
{
$this->config = $config;
$this->user = $user;
}
public function view()
{
$showStagingBar = false;
if ($this->config->get('concrete.security.production.mode') === Modes::MODE_STAGING) {
if ($this->user->isRegistered() || $this->config->get(
'concrete.security.production.staging.show_notification_to_unregistered_users'
)) {
$c = Page::getCurrentPage();
$theme = $c->getCollectionThemeObject();
$showStagingBar = true;
$this->handleRequiredFeatures($this, $theme);
}
}
$this->set('showStagingBar', $showStagingBar);
}
}