| 1 |
<?php |
| 2 |
/** |
| 3 |
* Malware Scanning report notification stub for free version. |
| 4 |
* |
| 5 |
* @package WP_Defender\Model\Notification |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace WP_Defender\Model\Notification; |
| 9 |
|
| 10 |
/** |
| 11 |
* Malware Scanning – Reporting. |
| 12 |
*/ |
| 13 |
class Malware_Report extends Free_Report { |
| 14 |
|
| 15 |
/** |
| 16 |
* Table name. |
| 17 |
* |
| 18 |
* @var string |
| 19 |
*/ |
| 20 |
protected $table = 'wd_malware_scanning_report'; |
| 21 |
|
| 22 |
/** |
| 23 |
* Slug identifier for the malware report. |
| 24 |
* |
| 25 |
* @var string |
| 26 |
*/ |
| 27 |
public const SLUG = 'malware-report'; |
| 28 |
|
| 29 |
/** |
| 30 |
* Sets default values. |
| 31 |
*/ |
| 32 |
protected function before_load(): void { |
| 33 |
$this->import( |
| 34 |
array_merge( |
| 35 |
$this->base_defaults(), |
| 36 |
array( |
| 37 |
'slug' => self::SLUG, |
| 38 |
'title' => esc_html__( 'Issue - Reporting', 'defender-security' ), |
| 39 |
'description' => esc_html__( |
| 40 |
'Automatically run regular scans of your website and email you reports.', |
| 41 |
'defender-security' |
| 42 |
), |
| 43 |
'configs' => array( |
| 44 |
'always_send' => false, |
| 45 |
'error_send' => false, |
| 46 |
'template' => array(), |
| 47 |
), |
| 48 |
) |
| 49 |
) |
| 50 |
); |
| 51 |
} |
| 52 |
|
| 53 |
/** |
| 54 |
* Define settings labels. |
| 55 |
* |
| 56 |
* @return array |
| 57 |
*/ |
| 58 |
public function labels(): array { |
| 59 |
return array( |
| 60 |
'report' => esc_html__( 'Issue - Reporting', 'defender-security' ), |
| 61 |
'always_send' => esc_html__( 'Send alerts when no issues are detected', 'defender-security' ), |
| 62 |
'report_subscribers' => esc_html__( 'Recipients', 'defender-security' ), |
| 63 |
'day' => esc_html__( 'Day of', 'defender-security' ), |
| 64 |
'day_n' => esc_html__( 'Day of', 'defender-security' ), |
| 65 |
'time' => esc_html__( 'Time of day', 'defender-security' ), |
| 66 |
'frequency' => esc_html__( 'Frequency', 'defender-security' ), |
| 67 |
); |
| 68 |
} |
| 69 |
|
| 70 |
/** |
| 71 |
* Returns 'Never' — report cannot run in the free version. |
| 72 |
* |
| 73 |
* @return string |
| 74 |
*/ |
| 75 |
public function get_next_run_for_hub(): string { |
| 76 |
return esc_html__( 'Never', 'defender-security' ); |
| 77 |
} |
| 78 |
|
| 79 |
/** |
| 80 |
* Additional converting rules. |
| 81 |
* |
| 82 |
* @param array $configs The configuration data. |
| 83 |
* |
| 84 |
* @return array The type-casted configuration data. |
| 85 |
*/ |
| 86 |
public function type_casting( $configs ): array { |
| 87 |
$configs['always_send'] = (bool) ( $configs['always_send'] ?? false ); |
| 88 |
$configs['error_send'] = (bool) ( $configs['error_send'] ?? false ); |
| 89 |
|
| 90 |
return $configs; |
| 91 |
} |
| 92 |
} |
| 93 |
|