PluginProbe
HurryTimer – An Scarcity and Urgency Countdown Timer for WordPress & WooCommerce / 2.2.16
HurryTimer – An Scarcity and Urgency Countdown Timer for WordPress & WooCommerce v2.2.16
2.15.0 trunk 1.0.0 1.0.1 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.1.2 2.1.3 2.1.5 2.1.6 2.1.7 2.1.8 2.10.0 All 62 releases
← All changes | includes/IPDetection.php +26 -3 2.1.72.2.16 View file →
@@ -162,18 +162,41 @@
162 162
163 163 /**
164 164 * Delete given countdown and IP entry.
165 165 *
166 - * @param $countdown_id
166 + * @param $campaignId
167 + * @param null|string $ipAddress
167 168 *
168 169 * @return void
169 170 */
170 - public function forget($countdown_id)
171 + public function forget($campaignId, $ipAddress = null)
171 172 {
172 173 global $wpdb;
174 + $where = [
175 + 'countdown_id' => $campaignId,
176 + ];
177 + if ($ipAddress !== null) {
178 + $where['client_ip_address'] = $ipAddress;
179 + }
180 + $wpdb->delete($this->table, $where);
181 + if ($ipAddress === null) {
182 + if ( ! $this->has_entries()) {
183 + $this->clear_scheduled_destroy();
184 + }
185 + }
173 186
174 - $delete = $wpdb->delete($this->table, compact('countdown_id'));
187 + }
175 188
189 + function forgetAll($ipAddress = null)
190 + {
191 + global $wpdb;
192 + if ($ipAddress !== null) {
193 + $where['client_ip_address'] = $ipAddress;
194 + $wpdb->delete($this->table, $where);
195 + }
196 + else{
197 + $wpdb->query("delete from {$this->table}");
198 + }
176 199 if ( ! $this->has_entries()) {
177 200 $this->clear_scheduled_destroy();
178 201 }
179 202 }