• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Yoast / wordpress-seo / dd6e866a9e6d253114633104d9e3858d807178ba

19 Jun 2024 10:03AM UTC coverage: 48.628% (-4.3%) from 52.936%
dd6e866a9e6d253114633104d9e3858d807178ba

push

github

web-flow
Merge pull request #21431 from Yoast/21429-update-copy-in-the-introduction-and-consent-modals

Updates the copy for the introduction and consent modals

7441 of 13454 branches covered (55.31%)

Branch coverage included in aggregate %.

0 of 3 new or added lines in 2 files covered. (0.0%)

3718 existing lines in 107 files now uncovered.

25100 of 53464 relevant lines covered (46.95%)

62392.47 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/admin/class-schema-person-upgrade-notification.php
1
<?php
2
/**
3
 * WPSEO plugin file.
4
 *
5
 * @package WPSEO\Admin
6
 */
7

8
/**
9
 * Notifies the user to update the Search Appearance settings when the site is set to represent a Person,
10
 * but no person (name) has been chosen.
11
 */
12
class WPSEO_Schema_Person_Upgrade_Notification implements WPSEO_WordPress_Integration {
13

14
        /**
15
         * Registers all hooks to WordPress
16
         *
17
         * @return void
18
         */
19
        public function register_hooks() {
×
20
                add_action( 'admin_init', [ $this, 'handle_notification' ] );
×
21
        }
22

23
        /**
24
         * Handles if the notification should be added or removed.
25
         *
26
         * @return void
27
         */
UNCOV
28
        public function handle_notification() {
×
UNCOV
29
                $company_or_person_user_id = WPSEO_Options::get( 'company_or_person_user_id', false );
×
UNCOV
30
                if ( WPSEO_Options::get( 'company_or_person' ) === 'person' && empty( $company_or_person_user_id ) ) {
×
UNCOV
31
                        $this->add_notification();
×
UNCOV
32
                        return;
×
33
                }
34

UNCOV
35
                $this->remove_notification();
×
36
        }
37

38
        /**
39
         * Adds a notification to the notification center.
40
         *
41
         * @return void
42
         */
43
        protected function add_notification() {
×
44
                $notification_center = Yoast_Notification_Center::get();
×
45
                $notification_center->add_notification( $this->get_notification() );
×
46
        }
47

48
        /**
49
         * Removes a notification to the notification center.
50
         *
51
         * @return void
52
         */
53
        protected function remove_notification() {
×
54
                $notification_center = Yoast_Notification_Center::get();
×
55
                $notification_center->remove_notification( $this->get_notification() );
×
56
        }
57

58
        /**
59
         * Gets the notification object.
60
         *
61
         * @return Yoast_Notification
62
         */
63
        protected function get_notification() {
×
64
                $message = sprintf(
×
65
                        /* translators: %1$s is a link start tag to the Search Appearance settings, %2$s is the link closing tag. */
66
                        __( 'You have previously set your site to represent a person. We’ve improved our functionality around Schema and the Knowledge Graph, so you should go in and %1$scomplete those settings%2$s.', 'wordpress-seo' ),
×
67
                        '<a href="' . esc_url( admin_url( 'admin.php?page=wpseo_page_settings#/site-representation' ) ) . '">',
×
68
                        '</a>'
×
69
                );
70

71
                $notification = new Yoast_Notification(
×
72
                        $message,
×
73
                        [
74
                                'type'         => Yoast_Notification::WARNING,
×
75
                                'id'           => 'wpseo-schema-person-upgrade',
76
                                'capabilities' => 'wpseo_manage_options',
77
                                'priority'     => 0.8,
78
                        ]
79
                );
80

81
                return $notification;
×
82
        }
83
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc