• 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-option-tabs.php
1
<?php
2
/**
3
 * WPSEO plugin file.
4
 *
5
 * @package WPSEO\Admin\Options\Tabs
6
 */
7

8
/**
9
 * Class WPSEO_Option_Tabs.
10
 */
11
class WPSEO_Option_Tabs {
12

13
        /**
14
         * Tabs base.
15
         *
16
         * @var string
17
         */
18
        private $base;
19

20
        /**
21
         * The tabs in this group.
22
         *
23
         * @var array
24
         */
25
        private $tabs = [];
26

27
        /**
28
         * Name of the active tab.
29
         *
30
         * @var string
31
         */
32
        private $active_tab = '';
33

34
        /**
35
         * WPSEO_Option_Tabs constructor.
36
         *
37
         * @codeCoverageIgnore
38
         *
39
         * @param string $base       Base of the tabs.
40
         * @param string $active_tab Currently active tab.
41
         */
42
        public function __construct( $base, $active_tab = '' ) {
43
                $this->base = sanitize_title( $base );
44

45
                // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.
46
                $tab              = isset( $_GET['tab'] ) && is_string( $_GET['tab'] ) ? sanitize_text_field( wp_unslash( $_GET['tab'] ) ) : '';
47
                $this->active_tab = empty( $tab ) ? $active_tab : $tab;
48
        }
49

50
        /**
51
         * Get the base.
52
         *
53
         * @return string
54
         */
UNCOV
55
        public function get_base() {
×
UNCOV
56
                return $this->base;
×
57
        }
58

59
        /**
60
         * Add a tab.
61
         *
62
         * @param WPSEO_Option_Tab $tab Tab to add.
63
         *
64
         * @return $this
65
         */
UNCOV
66
        public function add_tab( WPSEO_Option_Tab $tab ) {
×
UNCOV
67
                $this->tabs[] = $tab;
×
68

UNCOV
69
                return $this;
×
70
        }
71

72
        /**
73
         * Get active tab.
74
         *
75
         * @return WPSEO_Option_Tab|null Get the active tab.
76
         */
UNCOV
77
        public function get_active_tab() {
×
UNCOV
78
                if ( empty( $this->active_tab ) ) {
×
UNCOV
79
                        return null;
×
80
                }
81

UNCOV
82
                $active_tabs = array_filter( $this->tabs, [ $this, 'is_active_tab' ] );
×
UNCOV
83
                if ( ! empty( $active_tabs ) ) {
×
UNCOV
84
                        $active_tabs = array_values( $active_tabs );
×
UNCOV
85
                        if ( count( $active_tabs ) === 1 ) {
×
UNCOV
86
                                return $active_tabs[0];
×
87
                        }
88
                }
89

UNCOV
90
                return null;
×
91
        }
92

93
        /**
94
         * Is the tab the active tab.
95
         *
96
         * @param WPSEO_Option_Tab $tab Tab to check for active tab.
97
         *
98
         * @return bool
99
         */
UNCOV
100
        public function is_active_tab( WPSEO_Option_Tab $tab ) {
×
UNCOV
101
                return ( $tab->get_name() === $this->active_tab );
×
102
        }
103

104
        /**
105
         * Get all tabs.
106
         *
107
         * @return WPSEO_Option_Tab[]
108
         */
UNCOV
109
        public function get_tabs() {
×
UNCOV
110
                return $this->tabs;
×
111
        }
112

113
        /**
114
         * Display the tabs.
115
         *
116
         * @param Yoast_Form $yform Yoast Form needed in the views.
117
         *
118
         * @return void
119
         */
UNCOV
120
        public function display( Yoast_Form $yform ) {
×
UNCOV
121
                $formatter = new WPSEO_Option_Tabs_Formatter();
×
UNCOV
122
                $formatter->run( $this, $yform );
×
123
        }
124
}
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