← All changes
|
Inc/Core/Analytics/QueryBuilders/BaseQueryStrategy.php
+9
-14
trunk
→
3.1.5
View file →
| @@ -1,8 +1,8 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * @package FireBox |
| 4 | - * @version 3.1.13 Free | |
| 4 | + * @version 3.1.5 Free | |
| 5 | 5 | * |
| 6 | 6 | * @author FirePlugins <info@fireplugins.com> |
| 7 | 7 | * @link https://www.fireplugins.com |
| 8 | 8 | * @copyright Copyright © 2026 FirePlugins All Rights Reserved |
| @@ -42,10 +42,10 @@ | ||
| 42 | 42 | */ |
| 43 | 43 | public function getWherePeriod(): string |
| 44 | 44 | { |
| 45 | 45 | $options = $this->metric->getOptions(); |
| 46 | - | |
| 47 | - if (empty($options['start_date']) || empty($options['end_date'])) | |
| 46 | + | |
| 47 | + if (!$options['start_date'] ?? null || !$options['end_date'] ?? null) | |
| 48 | 48 | { |
| 49 | 49 | return ''; |
| 50 | 50 | } |
| 51 | 51 | |
| @@ -51,10 +51,10 @@ | ||
| 51 | 51 | |
| 52 | 52 | $dateColumn = $this->getDateColumn(); |
| 53 | 53 | $startDate = $options['start_date']; |
| 54 | 54 | $endDate = $options['end_date']; |
| 55 | - | |
| 56 | - return $this->metric->getWpdb()->prepare(" AND {$dateColumn} BETWEEN %s AND %s", $startDate, $endDate); | |
| 55 | + | |
| 56 | + return " AND {$dateColumn} BETWEEN '{$startDate}' AND '{$endDate}'"; | |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /** |
| 60 | 60 | * Get the filters clause for the query |
| @@ -72,15 +72,10 @@ | ||
| 72 | 72 | // Build filters using the FilterBuilder with correct table aliases |
| 73 | 73 | $table_aliases = $this->getTableAliases(); |
| 74 | 74 | $filter_builder = new \FireBox\Core\Analytics\Filters\FilterBuilder([], $table_aliases); |
| 75 | 75 | $result = $filter_builder->build($filters); |
| 76 | - | |
| 77 | - if (empty($result['sql']) || empty($result['placeholders'])) | |
| 78 | - { | |
| 79 | - return $result['sql']; | |
| 80 | - } | |
| 81 | - | |
| 82 | - return $this->metric->getWpdb()->prepare($result['sql'], $result['placeholders']); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.PreparedSQLPlaceholders.ReplacementsWrongNumber | |
| 76 | + | |
| 77 | + return $result['sql']; | |
| 83 | 78 | } |
| 84 | 79 | |
| 85 | 80 | /** |
| 86 | 81 | * Get table aliases for FilterBuilder |
| @@ -125,9 +120,9 @@ | ||
| 125 | 120 | { |
| 126 | 121 | return ''; |
| 127 | 122 | } |
| 128 | 123 | |
| 129 | - return $this->metric->getWpdb()->prepare("LIMIT %d", $limit); | |
| 124 | + return "LIMIT {$limit}"; | |
| 130 | 125 | } |
| 131 | 126 | |
| 132 | 127 | /** |
| 133 | 128 | * Get the OFFSET clause |
| @@ -140,9 +135,9 @@ | ||
| 140 | 135 | { |
| 141 | 136 | return ''; |
| 142 | 137 | } |
| 143 | 138 | |
| 144 | - return $this->metric->getWpdb()->prepare("OFFSET %d", $offset); | |
| 139 | + return "OFFSET {$offset}"; | |
| 145 | 140 | } |
| 146 | 141 | |
| 147 | 142 | /** |
| 148 | 143 | * Default HAVING implementation - can be overridden |