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

Yoast / wordpress-seo / 6987097851

25 Nov 2023 04:49AM UTC coverage: 49.206% (-0.1%) from 49.302%
6987097851

push

github

web-flow
Merge pull request #20878 from Yoast/JRF/ghactions-minor-tweak

GH Actions: update a few links in inline comments

15305 of 31104 relevant lines covered (49.21%)

4.03 hits per line

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

0.0
/admin/metabox/class-metabox-section-react.php
1
<?php
2
/**
3
 * WPSEO plugin file.
4
 *
5
 * @package WPSEO\Admin
6
 */
7

8
/**
9
 * Generates and displays the React root element for a metabox section.
10
 */
11
class WPSEO_Metabox_Section_React implements WPSEO_Metabox_Section {
12

13
        /**
14
         * Name of the section, used as an identifier in the HTML.
15
         *
16
         * @var string
17
         */
18
        public $name;
19

20
        /**
21
         * Content to use before the React root node.
22
         *
23
         * @var string
24
         */
25
        public $content;
26

27
        /**
28
         * Content to use to display the button to open this content block.
29
         *
30
         * @var string
31
         */
32
        private $link_content;
33

34
        /**
35
         * Class to add to the link.
36
         *
37
         * @var string
38
         */
39
        private $link_class;
40

41
        /**
42
         * Aria label to use for the link.
43
         *
44
         * @var string
45
         */
46
        private $link_aria_label;
47

48
        /**
49
         * Additional html content to be displayed within the section.
50
         *
51
         * @var string
52
         */
53
        private $html_after;
54

55
        /**
56
         * Constructor.
57
         *
58
         * @param string $name         The name of the section, used as an identifier in the html.
59
         *                             Can only contain URL safe characters.
60
         * @param string $link_content The text content of the section link.
61
         * @param string $content      Optional. Content to use above the React root element.
62
         * @param array  $options      Optional link attributes.
63
         */
64
        public function __construct( $name, $link_content, $content = '', array $options = [] ) {
×
65
                $this->name    = $name;
×
66
                $this->content = $content;
×
67

68
                $default_options = [
×
69
                        'link_class'      => '',
×
70
                        'link_aria_label' => '',
×
71
                        'html_after'      => '',
×
72
                ];
×
73

74
                $options = wp_parse_args( $options, $default_options );
×
75

76
                $this->link_content    = $link_content;
×
77
                $this->link_class      = $options['link_class'];
×
78
                $this->link_aria_label = $options['link_aria_label'];
×
79
                $this->html_after      = $options['html_after'];
×
80
        }
81

82
        /**
83
         * Outputs the section link.
84
         *
85
         * @return void
86
         */
87
        public function display_link() {
×
88
                printf(
×
89
                        '<li role="presentation"><a role="tab" href="#wpseo-meta-section-%1$s" id="wpseo-meta-tab-%1$s" aria-controls="wpseo-meta-section-%1$s" class="wpseo-meta-section-link %2$s"%3$s>%4$s</a></li>',
×
90
                        esc_attr( $this->name ),
×
91
                        esc_attr( $this->link_class ),
×
92
                        ( $this->link_aria_label !== '' ) ? ' aria-label="' . esc_attr( $this->link_aria_label ) . '"' : '',
×
93
                        wp_kses_post( $this->link_content )
×
94
                );
×
95
        }
96

97
        /**
98
         * Outputs the section content.
99
         *
100
         * @return void
101
         */
102
        public function display_content() {
×
103
                add_filter( 'wp_kses_allowed_html', [ 'WPSEO_Utils', 'extend_kses_post_with_forms' ] );
×
104
                add_filter( 'wp_kses_allowed_html', [ 'WPSEO_Utils', 'extend_kses_post_with_a11y' ] );
×
105

106
                printf(
×
107
                        '<div role="tabpanel" id="wpseo-meta-section-%1$s" aria-labelledby="wpseo-meta-tab-%1$s" tabindex="0" class="wpseo-meta-section">',
×
108
                        esc_attr( $this->name )
×
109
                );
×
110
                echo wp_kses_post( $this->content );
×
111
                echo '<div id="wpseo-metabox-root" class="wpseo-metabox-root"></div>';
×
112
                echo wp_kses_post( $this->html_after );
×
113
                echo '</div>';
×
114

115
                remove_filter( 'wp_kses_allowed_html', [ 'WPSEO_Utils', 'extend_kses_post_with_forms' ] );
×
116
                remove_filter( 'wp_kses_allowed_html', [ 'WPSEO_Utils', 'extend_kses_post_with_a11y' ] );
×
117
        }
118
}
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