PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 28.2
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v28.2
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 / integrations / watchers / auto-update-watcher.php

auto-update-watcher.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 28.2, at src/integrations/watchers/auto-update-watcher.php

59 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\Integrations\Watchers;
4
5 use Yoast\WP\SEO\Conditionals\No_Conditionals;
6 use Yoast\WP\SEO\Integrations\Integration_Interface;
7 use Yoast_Notification_Center;
8
9 /**
10 * Shows a notification for users who have WordPress auto updates enabled but not Yoast SEO auto updates.
11 */
12 class Auto_Update_Watcher implements Integration_Interface {
13
14 use No_Conditionals;
15
16 /**
17 * The notification ID.
18 */
19 public const NOTIFICATION_ID = 'wpseo-auto-update';
20
21 /**
22 * The Yoast notification center.
23 *
24 * @var Yoast_Notification_Center
25 */
26 protected $notification_center;
27
28 /**
29 * Auto_Update constructor.
30 *
31 * @param Yoast_Notification_Center $notification_center The notification center.
32 */
33 public function __construct( Yoast_Notification_Center $notification_center ) {
34 $this->notification_center = $notification_center;
35 }
36
37 /**
38 * Initializes the integration.
39 *
40 * On admin_init, it is checked whether the notification to auto-update Yoast SEO needs to be shown or removed.
41 * This is also done when major WP core updates are being enabled or disabled,
42 * and when automatic updates for Yoast SEO are being enabled or disabled.
43 *
44 * @return void
45 */
46 public function register_hooks() {
47 \add_action( 'admin_init', [ $this, 'remove_notification' ] );
48 }
49
50 /**
51 * Removes the notification from the notification center, if it exists.
52 *
53 * @return void
54 */
55 public function remove_notification() {
56 $this->notification_center->remove_notification_by_id( self::NOTIFICATION_ID );
57 }
58 }
59