PluginProbe
Defender Security – Malware Scanner, Login Security & Firewall / 5.6.1
Defender Security – Malware Scanner, Login Security & Firewall v5.6.1
6.3.0 6.2.3 6.2.4 6.2.0 6.2.1 6.2.2 6.1.0 5.3.1 5.4.0 5.4.1 5.5.0 5.5.1 5.6.0 5.6.1 5.6.2 5.7.0 5.7.1 5.7.2 5.8.0 5.8.1 5.9.0 6.0.0 6.0.1 3.0.1 3.1.0 All 141 releases
defender-security / src / model / class-email-track.php

class-email-track.php in Defender Security – Malware Scanner, Login Security & Firewall 5.6.1, at src/model/class-email-track.php

74 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Handles interactions with the database table for email tracking.
4 *
5 * @package WP_Defender\Model
6 */
7
8 namespace WP_Defender\Model;
9
10 use WP_Defender\DB;
11
12 /**
13 * Model for the email tracking table.
14 */
15 class Email_Track extends DB {
16
17 /**
18 * Table name.
19 *
20 * @var string
21 */
22 protected $table = 'defender_email_log';
23
24 /**
25 * Primary key column.
26 *
27 * @var int
28 * @defender_property
29 */
30 public $id;
31 /**
32 * Table column for timestamp.
33 *
34 * @var int
35 * @defender_property
36 */
37 public $timestamp;
38 /**
39 * Table column for source.
40 *
41 * @var string
42 * @defender_property
43 */
44 public $source;
45 /**
46 * Table column for to.
47 *
48 * @var string
49 * @defender_property
50 */
51 public $to;
52
53 /**
54 * Count the number of records in the database table based on the provided filters.
55 *
56 * @param mixed $source The source to filter by.
57 * @param mixed $email The email to filter by.
58 * @param mixed $date_from The start date for the date range filter.
59 * @param mixed $date_to The end date for the date range filter.
60 *
61 * @return int|null The number of records matching the provided filters, or null if an error occurred.
62 */
63 public static function count( $source, $email, $date_from, $date_to ) {
64 $orm = self::get_orm();
65
66 return $orm->get_repository( self::class )
67 ->where( 'source', $source )
68 ->where( 'to', $email )
69 ->where( 'timestamp', '>=', $date_from )
70 ->where( 'timestamp', '<=', $date_to )
71 ->count();
72 }
73 }
74