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

Yoast / wordpress-seo / d5c0395617268a4e44627c6847bf3faa0a6cc695

15 Apr 2025 07:12AM UTC coverage: 52.454% (-2.1%) from 54.595%
d5c0395617268a4e44627c6847bf3faa0a6cc695

push

github

web-flow
Merge pull request #22077 from Yoast/feature/drop-php-7.2-7.3

Drop compatibility with PHP 7.2 and 7.3

7826 of 13877 branches covered (56.4%)

Branch coverage included in aggregate %.

29028 of 56382 relevant lines covered (51.48%)

42273.52 hits per line

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

0.0
/admin/views/partial-notifications-template.php
1
<?php
2
/**
3
 * WPSEO plugin file.
4
 *
5
 * @package WPSEO\Admin
6
 *
7
 * @uses    string $yoast_seo_type
8
 * @uses    string $yoast_seo_dashicon
9
 * @uses    string $yoast_seo_i18n_title
10
 * @uses    string $yoast_seo_i18n_issues
11
 * @uses    string $yoast_seo_i18n_no_issues
12
 * @uses    string $yoast_seo_i18n_muted_issues_title
13
 * @uses    int    $yoast_seo_active_total
14
 * @uses    int    $yoast_seo_dismissed_total
15
 * @uses    int    $yoast_seo_total
16
 * @uses    array  $yoast_seo_active
17
 * @uses    array  $yoast_seo_dismissed
18
 */
19

20
if ( ! function_exists( '_yoast_display_notifications' ) ) {
×
21
        /**
22
         * Create the notifications HTML with restore/dismiss button.
23
         *
24
         * @param array  $notifications_list List of notifications.
25
         * @param string $status             Status of the notifications (active/dismissed).
26
         *
27
         * @return string The output to render.
28
         */
29
        function _yoast_display_notifications( $notifications_list, $status ) {
30
                $notifications = '';
×
31

32
                foreach ( $notifications_list as $notification ) {
×
33

34
                        switch ( $status ) {
35
                                case 'active':
×
36
                                        $button = sprintf(
×
37
                                                '<button type="button" class="button dismiss"><span class="screen-reader-text">%1$s</span><span class="dashicons dashicons-hidden"></span></button>',
×
38
                                                /* translators: Hidden accessibility text. */
39
                                                esc_html__( 'Hide this item.', 'wordpress-seo' )
×
40
                                        );
×
41
                                        break;
×
42

43
                                case 'dismissed':
×
44
                                        $button = sprintf(
×
45
                                                '<button type="button" class="button restore"><span class="screen-reader-text">%1$s</span><span class="dashicons yoast-svg-icon-eye"></span></button>',
×
46
                                                /* translators: Hidden accessibility text. */
47
                                                esc_html__( 'Show this item.', 'wordpress-seo' )
×
48
                                        );
×
49
                                        break;
×
50
                        }
51

52
                        $notifications .= sprintf(
×
53
                                '<div class="yoast-notification-holder" id="%1$s" data-nonce="%2$s" data-json="%3$s">%4$s%5$s</div>',
×
54
                                esc_attr( $notification->get_id() ),
×
55
                                esc_attr( $notification->get_nonce() ),
×
56
                                esc_attr( $notification->get_json() ),
×
57
                                // This needs to be fixed in https://github.com/Yoast/wordpress-seo-premium/issues/2548.
58
                                $notification,
×
59
                                // Note: $button is properly escaped above.
60
                                $button
×
61
                        );
×
62
                }
63

64
                return $notifications;
×
65
        }
66
}
67

68
$wpseo_i18n_summary = $yoast_seo_i18n_issues;
×
69
if ( ! $yoast_seo_active ) {
×
70
        $yoast_seo_dashicon = 'yes';
×
71
        $wpseo_i18n_summary = $yoast_seo_i18n_no_issues;
×
72
}
73

74
?>
75
<h3 class="yoast-notifications-header" id="<?php echo esc_attr( 'yoast-' . $yoast_seo_type . '-header' ); ?>">
×
76
        <span class="dashicons <?php echo esc_attr( 'dashicons-' . $yoast_seo_dashicon ); ?>"></span>
×
77
        <?php echo esc_html( $yoast_seo_i18n_title ); ?> (<?php echo (int) $yoast_seo_active_total; ?>)
×
78
</h3>
79

80
<div id="<?php echo esc_attr( 'yoast-' . $yoast_seo_type ); ?>">
×
81

82
        <?php if ( $yoast_seo_total ) : ?>
×
83
                <p><?php echo esc_html( $wpseo_i18n_summary ); ?></p>
×
84

85
                <div class="container yoast-notifications-active" id="<?php echo esc_attr( 'yoast-' . $yoast_seo_type . '-active' ); ?>">
×
86
                        <?php
87
                        // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: _yoast_display_notifications() as declared above is safe.
88
                        echo _yoast_display_notifications( $yoast_seo_active, 'active' );
×
89
                        ?>
90
                </div>
×
91

92
                <?php
×
93
                if ( $yoast_seo_dismissed ) {
×
94
                        $dismissed_paper = new WPSEO_Paper_Presenter(
×
95
                                esc_html( $yoast_seo_i18n_muted_issues_title ),
×
96
                                null,
×
97
                                [
×
98
                                        'paper_id'                 => esc_attr( $yoast_seo_type . '-dismissed' ),
×
99
                                        'paper_id_prefix'          => 'yoast-',
×
100
                                        'class'                    => 'yoast-notifications-dismissed',
×
101
                                        'content'                  => _yoast_display_notifications( $yoast_seo_dismissed, 'dismissed' ),
×
102
                                        'collapsible'              => true,
×
103
                                        'collapsible_header_class' => 'yoast-notification',
×
104
                                ]
×
105
                        );
×
106
                        // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: get_output() output is properly escaped.
107
                        echo $dismissed_paper->get_output();
×
108
                }
109
                ?>
110

111
        <?php else : ?>
×
112

113
                <p><?php echo esc_html( $yoast_seo_i18n_no_issues ); ?></p>
×
114

115
        <?php endif; ?>
116
</div>
×
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

© 2026 Coveralls, Inc