PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 11.1.0
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v11.1.0
11.1.1 11.1.0 11.0.5 11.0.4 11.0.3 11.0.2 11.0.1 11.0.0 10.11.1 10.11.0 10.10.2 10.10.1 10.10.0 10.9.1 trunk 10.0.0 10.0.1 10.1.0 10.1.1 10.1.2 10.1.3 10.1.4 10.2.0 10.2.1 10.2.2 All 62 releases
← All changes | back/Helpers/global/query.php +10 -9 10.1.4 → 11.1.0 View file →
@@ -1,10 +1,11 @@
1 1 <?php
2 +defined('ABSPATH') || die('Restricted Access');
2 3
3 -function acym_getTables()
4 +function acym_getTables(bool $reload = false): array
4 5 {
5 6 static $tables = null;
6 - if (empty($tables)) {
7 + if (empty($tables) || $reload) {
7 8 $tables = acym_loadResultArray('SHOW TABLES');
8 9 }
9 10
10 11 return $tables;
@@ -9,9 +10,9 @@
9 10
10 11 return $tables;
11 12 }
12 13
13 -function acym_getColumns(string $table, bool $acyTable = true, bool $addPrefix = true)
14 +function acym_getColumns(string $table, bool $acyTable = true, bool $addPrefix = true): array
14 15 {
15 16 if ($addPrefix) {
16 17 $prefix = $acyTable ? '#__acym_' : '#__';
17 18 $table = $prefix.$table;
@@ -21,21 +22,21 @@
21 22 if (empty($columns[$table])) {
22 23 $columns[$table] = acym_loadResultArray('SHOW COLUMNS FROM '.acym_secureDBColumn($table));
23 24 }
24 25
25 - return $columns[$table];
26 + return $columns[$table] ?? [];
26 27 }
27 28
28 -function acym_secureDBColumn($fieldName)
29 +function acym_secureDBColumn(string $fieldName): string
29 30 {
30 - if (!is_string($fieldName) || preg_match('|[^a-z0-9#_.-]|i', $fieldName) !== 0) {
31 - die('field, table or database "'.acym_escape($fieldName).'" not secured');
31 + if (preg_match('|[^a-z0-9#_.-]|i', $fieldName) !== 0) {
32 + die('field, table or database "'.esc_html($fieldName).'" not secured');
32 33 }
33 34
34 35 return $fieldName;
35 36 }
36 37
37 -function acym_getDatabases()
38 +function acym_getDatabases(): array
38 39 {
39 40 try {
40 41 $allDatabases = acym_loadResultArray('SHOW DATABASES');
41 42 } catch (Exception $exception) {
@@ -50,9 +51,9 @@
50 51
51 52 return $databases;
52 53 }
53 54
54 -function acym_addLimit(string &$query, int $limit = 1, ?int $offset = null)
55 +function acym_addLimit(string &$query, int $limit = 1, ?int $offset = null): void
55 56 {
56 57 if (strpos($query, 'LIMIT ') !== false) {
57 58 return;
58 59 }