| 1 |
<?php |
| 2 |
|
| 3 |
namespace WP_Defender\Model; |
| 4 |
|
| 5 |
use WP_Defender\DB; |
| 6 |
|
| 7 |
class Email_Track extends DB { |
| 8 |
protected $table = 'defender_email_log'; |
| 9 |
|
| 10 |
/** |
| 11 |
* @var int |
| 12 |
* @defender_property |
| 13 |
*/ |
| 14 |
public $id; |
| 15 |
/** |
| 16 |
* @var int |
| 17 |
* @defender_property |
| 18 |
*/ |
| 19 |
public $timestamp; |
| 20 |
/** |
| 21 |
* @var string |
| 22 |
* @defender_property |
| 23 |
*/ |
| 24 |
public $source; |
| 25 |
/** |
| 26 |
* @var string |
| 27 |
* @defender_property |
| 28 |
*/ |
| 29 |
public $to; |
| 30 |
|
| 31 |
/** |
| 32 |
* @param $source |
| 33 |
* @param $email |
| 34 |
* @param $date_from |
| 35 |
* @param $date_to |
| 36 |
* |
| 37 |
* @return string|null |
| 38 |
*/ |
| 39 |
public static function count( $source, $email, $date_from, $date_to ) { |
| 40 |
$orm = self::get_orm(); |
| 41 |
|
| 42 |
return $orm->get_repository( self::class )->where( 'source', $source ) |
| 43 |
->where( 'to', $email )->where( 'timestamp', '>=', $date_from ) |
| 44 |
->where( 'timestamp', '<=', $date_to )->count(); |
| 45 |
} |
| 46 |
} |