| 1 |
<?php |
| 2 |
/** |
| 3 |
* Initialize Automatic Scanning. |
| 4 |
* |
| 5 |
* Free base of the Automatic Scanning feature: schedules recurring scans |
| 6 |
* (Monthly on Free; Weekly unlocked by Pro), reuses the existing scan engine, |
| 7 |
* and powers change detection + scan history. Pro extends this module with |
| 8 |
* Weekly frequency, email digests, auto-apply and the compliance guard. |
| 9 |
* |
| 10 |
* @package SureCookie\Inc\Modules\AutomaticScanning |
| 11 |
* @since 1.2.0 |
| 12 |
*/ |
| 13 |
|
| 14 |
namespace SureCookie\Inc\Modules\AutomaticScanning; |
| 15 |
|
| 16 |
use SureCookie\Inc\Traits\GetInstance; |
| 17 |
|
| 18 |
if ( ! defined( 'ABSPATH' ) ) { |
| 19 |
exit; // Exit if accessed directly. |
| 20 |
} |
| 21 |
|
| 22 |
/** |
| 23 |
* Init |
| 24 |
* |
| 25 |
* @since 1.2.0 |
| 26 |
*/ |
| 27 |
class Init { |
| 28 |
use GetInstance; |
| 29 |
|
| 30 |
/** |
| 31 |
* Constructor. |
| 32 |
* |
| 33 |
* @since 1.2.0 |
| 34 |
*/ |
| 35 |
private function __construct() { |
| 36 |
Scheduler::get_instance(); |
| 37 |
Runner::get_instance(); |
| 38 |
History::get_instance(); |
| 39 |
|
| 40 |
add_filter( 'surecookie_api_controllers', [ $this, 'register_api_controller' ] ); |
| 41 |
} |
| 42 |
|
| 43 |
/** |
| 44 |
* Register the module's REST controller with the core API router. |
| 45 |
* |
| 46 |
* @param array<int, string> $controllers Registered controller class names. |
| 47 |
* @since 1.2.0 |
| 48 |
* @return array<int, string> |
| 49 |
*/ |
| 50 |
public function register_api_controller( $controllers = [] ) { |
| 51 |
if ( is_array( $controllers ) ) { |
| 52 |
$controllers[] = Api::class; |
| 53 |
} |
| 54 |
|
| 55 |
return $controllers; |
| 56 |
} |
| 57 |
} |
| 58 |
|