PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / trunk
Yoast SEO – Advanced SEO with real-time guidance and built-in AI vtrunk
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
wordpress-seo / src / llms-txt / user-interface / schedule-population-on-activation-integration.php

schedule-population-on-activation-integration.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI trunk, at src/llms-txt/user-interface/schedule-population-on-activation-integration.php

65 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Yoast\WP\SEO\Llms_Txt\User_Interface;
4
5 use Yoast\WP\SEO\Conditionals\No_Conditionals;
6 use Yoast\WP\SEO\Helpers\Options_Helper;
7 use Yoast\WP\SEO\Integrations\Integration_Interface;
8 use Yoast\WP\SEO\Llms_Txt\Application\File\Llms_Txt_Cron_Scheduler;
9
10 /**
11 * Handles the cron when the plugin is activated.
12 */
13 class Schedule_Population_On_Activation_Integration implements Integration_Interface {
14
15 use No_Conditionals;
16
17 /**
18 * The options helper.
19 *
20 * @var Options_Helper $options_helper
21 */
22 private $options_helper;
23
24 /**
25 * The scheduler.
26 *
27 * @var Llms_Txt_Cron_Scheduler $scheduler
28 */
29 private $scheduler;
30
31 /**
32 * The constructor.
33 *
34 * @param Llms_Txt_Cron_Scheduler $scheduler The cron scheduler.
35 * @param Options_Helper $options_helper The options helper.
36 */
37 public function __construct(
38 Llms_Txt_Cron_Scheduler $scheduler,
39 Options_Helper $options_helper
40 ) {
41 $this->scheduler = $scheduler;
42 $this->options_helper = $options_helper;
43 }
44
45 /**
46 * Registers the scheduling of the cron to the activation action.
47 *
48 * @return void
49 */
50 public function register_hooks() {
51 \add_action( 'wpseo_activate', [ $this, 'schedule_llms_txt_population' ] );
52 }
53
54 /**
55 * Schedules the cron if the option is turned on.
56 *
57 * @return void
58 */
59 public function schedule_llms_txt_population() {
60 if ( $this->options_helper->get( 'enable_llms_txt', false ) === true ) {
61 $this->scheduler->schedule_quick_llms_txt_population();
62 }
63 }
64 }
65