PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 27.7
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v27.7
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 / admin / views / partial-notifications-template.php

partial-notifications-template.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 27.7, at admin/views/partial-notifications-template.php

117 lines 3.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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>
117