| 1 |
<?php |
| 2 |
|
| 3 |
namespace Yoast\WP\SEO\Integrations\Admin; |
| 4 |
|
| 5 |
use Yoast\WP\SEO\Conditionals\Admin_Conditional; |
| 6 |
use Yoast\WP\SEO\Helpers\Date_Helper; |
| 7 |
use Yoast\WP\SEO\Integrations\Integration_Interface; |
| 8 |
|
| 9 |
/** |
| 10 |
* Cron_Integration class. |
| 11 |
*/ |
| 12 |
class Cron_Integration implements Integration_Interface { |
| 13 |
|
| 14 |
/** |
| 15 |
* The indexing notification integration. |
| 16 |
* |
| 17 |
* @var Date_Helper |
| 18 |
*/ |
| 19 |
protected $date_helper; |
| 20 |
|
| 21 |
/** |
| 22 |
* {@inheritDoc} |
| 23 |
*/ |
| 24 |
public static function get_conditionals() { |
| 25 |
return [ Admin_Conditional::class ]; |
| 26 |
} |
| 27 |
|
| 28 |
/** |
| 29 |
* Cron_Integration constructor |
| 30 |
* |
| 31 |
* @param Date_Helper $date_helper The date helper. |
| 32 |
*/ |
| 33 |
public function __construct( |
| 34 |
Date_Helper $date_helper |
| 35 |
) { |
| 36 |
$this->date_helper = $date_helper; |
| 37 |
} |
| 38 |
|
| 39 |
/** |
| 40 |
* {@inheritDoc} |
| 41 |
*/ |
| 42 |
public function register_hooks() { |
| 43 |
if ( ! \wp_next_scheduled( Indexing_Notification_Integration::NOTIFICATION_ID ) ) { |
| 44 |
\wp_schedule_event( |
| 45 |
$this->date_helper->current_time(), |
| 46 |
'daily', |
| 47 |
Indexing_Notification_Integration::NOTIFICATION_ID |
| 48 |
); |
| 49 |
} |
| 50 |
} |
| 51 |
} |
| 52 |
|