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

Yoast / wordpress-seo / 99ff5821fbe8444b259463501ff00132570d3061

25 Mar 2025 09:23AM UTC coverage: 52.446% (+3.7%) from 48.71%
99ff5821fbe8444b259463501ff00132570d3061

Pull #21958

github

web-flow
Merge d493347a3 into facbdded4
Pull Request #21958: Improve function words list for Farsi

7990 of 14101 branches covered (56.66%)

Branch coverage included in aggregate %.

20 of 20 new or added lines in 1 file covered. (100.0%)

1567 existing lines in 41 files now uncovered.

29816 of 57984 relevant lines covered (51.42%)

41124.2 hits per line

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

23.08
/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
         */
28
        public function handle_notification() {
6✔
29
                $company_or_person_user_id = WPSEO_Options::get( 'company_or_person_user_id', false );
6✔
30
                if ( WPSEO_Options::get( 'company_or_person' ) === 'person' && empty( $company_or_person_user_id ) ) {
6✔
31
                        $this->add_notification();
2✔
32
                        return;
2✔
33
                }
34

35
                $this->remove_notification();
4✔
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,
×
UNCOV
75
                                'id'           => 'wpseo-schema-person-upgrade',
×
UNCOV
76
                                'capabilities' => 'wpseo_manage_options',
×
UNCOV
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