-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode.power
More file actions
63 lines (56 loc) · 1.09 KB
/
code.power
File metadata and controls
63 lines (56 loc) · 1.09 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
/**
* Function to quote values
*
* @since 5.1.1
*/
use QuoteTrait;
/**
* Database object to query local DB
*
* @var JoomlaDatabase
* @since 3.2.0
*/
protected JoomlaDatabase $db;
/**
* Current component code name
*
* @var string
* @since 5.1.1
*/
protected string $componentCode;
/**
* Core Component Table Name
*
* @var string
* @since 3.2.0
*/
protected string $table;
/**
* Constructor
*
* @throws \Exception
* @since 3.2.0
*/
public function __construct(?JoomlaDatabase $db = null)
{
$this->db = $db ?: Factory::getContainer()->get(JoomlaDatabase::class);
$this->componentCode = Helper::getCode();
$this->table = '#__' . $this->componentCode;
}
/**
* Set a table name, adding the
* core component as needed
*
* @param string $table The table string
*
* @return string
* @since 3.2.0
**/
protected function getTable(string $table): string
{
if (strpos($table, '#__') === false)
{
return $this->table . '_' . $table;
}
return $table;
}