1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Charcoal\Admin\Template; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* |
7
|
|
|
*/ |
8
|
|
|
trait AuthTemplateTrait |
9
|
|
|
{ |
10
|
|
|
/** |
11
|
|
|
* Retrieve the base URI of the application. |
12
|
|
|
* |
13
|
|
|
* @param mixed $targetPath Optional target path. |
14
|
|
|
* @throws RuntimeException If the base URI is missing. |
15
|
|
|
* @return string|null |
16
|
|
|
*/ |
17
|
|
|
abstract public function baseUrl($targetPath = null); |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* Retrieve the URI of the administration-area. |
21
|
|
|
* |
22
|
|
|
* @param mixed $targetPath Optional target path. |
23
|
|
|
* @throws RuntimeException If the admin URI is missing. |
24
|
|
|
* @return UriInterface|null |
|
|
|
|
25
|
|
|
*/ |
26
|
|
|
abstract public function adminUrl($targetPath = null); |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* Retrieve the admin's configset. |
30
|
|
|
* |
31
|
|
|
* @param string|null $key Optional data key to retrieve from the configset. |
32
|
|
|
* @param mixed|null $default The default value to return if data key does not exist. |
33
|
|
|
* @return mixed|AdminConfig |
|
|
|
|
34
|
|
|
*/ |
35
|
|
|
abstract protected function adminConfig($key = null, $default = null); |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @return string |
39
|
|
|
*/ |
40
|
|
|
public function urlLogin() |
41
|
|
|
{ |
42
|
|
|
return $this->adminUrl('login'); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* @return string |
47
|
|
|
*/ |
48
|
|
|
public function urlLostPassword() |
49
|
|
|
{ |
50
|
|
|
return $this->adminUrl('account/lost-password'); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @return string |
55
|
|
|
*/ |
56
|
|
|
public function urlResetPassword() |
57
|
|
|
{ |
58
|
|
|
return $this->adminUrl('account/reset-password'); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* Get the "Back to website" label. |
63
|
|
|
* |
64
|
|
|
* @return string|boolean The button's label, |
65
|
|
|
* TRUE to use the default label, |
66
|
|
|
* or FALSE to disable the link. |
67
|
|
|
*/ |
68
|
|
|
public function returnToSiteLabel() |
69
|
|
|
{ |
70
|
|
|
$label = $this->adminConfig('login.visit_site'); |
71
|
|
|
if ($label === false) { |
72
|
|
|
return false; |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
if (empty($label) || $label === true) { |
76
|
|
|
$label = $this->translator()->translate('Back to website'); |
|
|
|
|
77
|
|
|
} else { |
78
|
|
|
$label = $this->translator()->translate($label); |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
return '← '.$label; |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* Get the background image, from admin config. |
86
|
|
|
* |
87
|
|
|
* @return string |
88
|
|
|
*/ |
89
|
|
|
public function backgroundImage() |
90
|
|
|
{ |
91
|
|
|
$backdrop = $this->adminConfig('login.background_image'); |
92
|
|
|
if (empty($backdrop)) { |
93
|
|
|
return ''; |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
return $this->baseUrl($backdrop); |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* Get the background video, from admin config. |
101
|
|
|
* |
102
|
|
|
* @return string |
103
|
|
|
*/ |
104
|
|
|
public function backgroundVideo() |
105
|
|
|
{ |
106
|
|
|
$backdrop = $this->adminConfig('login.background_video'); |
107
|
|
|
if (empty($backdrop)) { |
108
|
|
|
return ''; |
109
|
|
|
} |
110
|
|
|
|
111
|
|
|
return $this->baseUrl($backdrop); |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* @return string |
116
|
|
|
*/ |
117
|
|
|
public function avatarImage() |
118
|
|
|
{ |
119
|
|
|
$logo = $this->adminConfig('login.logo') ?: |
120
|
|
|
$this->adminConfig('login_logo', 'assets/admin/images/avatar.jpg'); |
121
|
|
|
|
122
|
|
|
if (empty($logo)) { |
123
|
|
|
return ''; |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
return $this->baseUrl($logo); |
127
|
|
|
} |
128
|
|
|
} |
129
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths