-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode.power
More file actions
65 lines (59 loc) · 1.61 KB
/
code.power
File metadata and controls
65 lines (59 loc) · 1.61 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
/**
* Hold a Input object for easier access to the input variables.
*
* @var Input
* @since 3.2.0
*/
protected Input $input;
/**
* The Params
*
* @var JoomlaRegistry
* @since 3.2.0
*/
protected JoomlaRegistry $params;
/**
* Constructor
*
* @param Input|null $input Input
* @param Registry|null $params The component parameters
*
* @throws \Exception
* @since 3.2.0
*/
public function __construct(?Input $input = null, ?JoomlaRegistry $params = null)
{
$this->input = $input ?: Factory::getApplication()->getInput();
$this->params = $params ?: Helper::getParams('com_###component###');
}
/**
* Get a config value.
*
* @param string $path Registry path (e.g. joomla_content_showauthor)
* @param mixed $default Optional default value, returned if the internal value is null.
*
* @return mixed Value of entry or null
*
* @since 5.1.4
*/
public function get(string $path, $default = null): mixed
{
// check if it has been set
if (($value = parent::get($path, '__N0T_S3T_Y3T_')) !== '__N0T_S3T_Y3T_')
{
return $value;
}
// check if we have a parameter in the component of this path
elseif (($value = $this->params->get($path, '__N0T_S3T_Y3T_')) !== '__N0T_S3T_Y3T_')
{
$this->set($path, $value);
return $value;
}
// check if we have a input value of this path (only STRING values allowed)
elseif (($value = $this->input->get($path, '__N0T_S3T_Y3T_', 'STRING')) !== '__N0T_S3T_Y3T_')
{
$this->set($path, $value);
return $value;
}
return $default;
}