• 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/taxonomy/class-taxonomy-fields.php
1
<?php
2
/**
3
 * WPSEO plugin file.
4
 *
5
 * @package WPSEO\Admin
6
 */
7

8
/**
9
 * Class WPSEO_Taxonomy_Tab.
10
 *
11
 * Contains the basics for each class extending this one.
12
 */
13
class WPSEO_Taxonomy_Fields {
14

15
        /**
16
         * Returns the taxonomy fields.
17
         *
18
         * @param string $field_group The field group.
19
         *
20
         * @return array
21
         */
22
        public function get( $field_group ) {
×
23
                $fields = [];
×
24

25
                switch ( $field_group ) {
26
                        case 'content':
×
27
                                $fields = $this->get_content_fields();
×
28
                                break;
×
29
                        case 'settings':
×
30
                                $fields = $this->get_settings_fields();
×
31
                                break;
×
32
                        case 'social':
×
33
                                $fields = $this->get_social_fields();
×
34
                                break;
×
35
                }
36

37
                return $this->filter_hidden_fields( $fields );
×
38
        }
39

40
        /**
41
         * Returns array with the fields for the general tab.
42
         *
43
         * @return array
44
         */
45
        protected function get_content_fields() {
×
46
                $fields = [
×
47
                        'title' => [
×
48
                                'label'       => '',
×
49
                                'description' => '',
×
50
                                'type'        => 'hidden',
×
51
                                'options'     => '',
×
52
                                'hide'        => false,
×
53
                        ],
×
54
                        'desc' => [
×
55
                                'label'       => '',
×
56
                                'description' => '',
×
57
                                'type'        => 'hidden',
×
58
                                'options'     => '',
×
59
                                'hide'        => false,
×
60
                        ],
×
61
                        'linkdex' => [
×
62
                                'label'       => '',
×
63
                                'description' => '',
×
64
                                'type'        => 'hidden',
×
65
                                'options'     => '',
×
66
                                'hide'        => false,
×
67
                        ],
×
68
                        'content_score' => [
×
69
                                'label'       => '',
×
70
                                'description' => '',
×
71
                                'type'        => 'hidden',
×
72
                                'options'     => '',
×
73
                                'hide'        => false,
×
74
                        ],
×
75
                        'inclusive_language_score' => [
×
76
                                'label'       => '',
×
77
                                'description' => '',
×
78
                                'type'        => 'hidden',
×
79
                                'options'     => '',
×
80
                                'hide'        => false,
×
81
                        ],
×
82
                        'focuskw' => [
×
83
                                'label'       => '',
×
84
                                'description' => '',
×
85
                                'type'        => 'hidden',
×
86
                                'options'     => '',
×
87
                                'hide'        => false,
×
88
                        ],
×
89
                        'is_cornerstone' => [
×
90
                                'label'       => '',
×
91
                                'description' => '',
×
92
                                'type'        => 'hidden',
×
93
                                'options'     => '',
×
94
                                'hide'        => false,
×
95
                        ],
×
96
                ];
×
97

98
                /**
99
                 * Filter: 'wpseo_taxonomy_content_fields' - Adds the possibility to register additional content fields.
100
                 *
101
                 * @api array - The additional fields.
102
                 */
103
                $additional_fields = apply_filters( 'wpseo_taxonomy_content_fields', [] );
×
104

105
                return array_merge( $fields, $additional_fields );
×
106
        }
107

108
        /**
109
         * Returns array with the fields for the settings tab.
110
         *
111
         * @return array
112
         */
113
        protected function get_settings_fields() {
×
114
                return [
×
115
                        'noindex' => [
×
116
                                'label'       => '',
×
117
                                'description' => '',
×
118
                                'type'        => 'hidden',
×
119
                                'options'     => '',
×
120
                                'hide'        => false,
×
121
                        ],
×
122
                        'bctitle' => [
×
123
                                'label'       => '',
×
124
                                'description' => '',
×
125
                                'type'        => 'hidden',
×
126
                                'options'     => '',
×
127
                                'hide'        => ( WPSEO_Options::get( 'breadcrumbs-enable' ) !== true ),
×
128
                        ],
×
129
                        'canonical' => [
×
130
                                'label'       => '',
×
131
                                'description' => '',
×
132
                                'type'        => 'hidden',
×
133
                                'options'     => '',
×
134
                                'hide'        => false,
×
135
                        ],
×
136
                ];
×
137
        }
138

139
        /**
140
         * Returning the fields for the social media tab.
141
         *
142
         * @return array
143
         */
144
        protected function get_social_fields() {
×
145
                $fields = [];
×
146

147
                if ( WPSEO_Options::get( 'opengraph', false ) === true ) {
×
148
                        $fields = [
×
149
                                'opengraph-title'       => [
×
150
                                        'label'       => '',
×
151
                                        'description' => '',
×
152
                                        'type'        => 'hidden',
×
153
                                        'options'     => '',
×
154
                                        'hide'        => false,
×
155
                                ],
×
156
                                'opengraph-description' => [
×
157
                                        'label'       => '',
×
158
                                        'description' => '',
×
159
                                        'type'        => 'hidden',
×
160
                                        'options'     => '',
×
161
                                        'hide'        => false,
×
162
                                ],
×
163
                                'opengraph-image'       => [
×
164
                                        'label'       => '',
×
165
                                        'description' => '',
×
166
                                        'type'        => 'hidden',
×
167
                                        'options'     => '',
×
168
                                        'hide'        => false,
×
169
                                ],
×
170
                                'opengraph-image-id'    => [
×
171
                                        'label'       => '',
×
172
                                        'description' => '',
×
173
                                        'type'        => 'hidden',
×
174
                                        'options'     => '',
×
175
                                        'hide'        => false,
×
176
                                ],
×
177
                        ];
×
178
                }
179

180
                if ( WPSEO_Options::get( 'twitter', false ) === true ) {
×
181
                        $fields = array_merge(
×
182
                                $fields,
×
183
                                [
×
184
                                        'twitter-title'       => [
×
185
                                                'label'       => '',
×
186
                                                'description' => '',
×
187
                                                'type'        => 'hidden',
×
188
                                                'options'     => '',
×
189
                                                'hide'        => false,
×
190
                                        ],
×
191
                                        'twitter-description' => [
×
192
                                                'label'       => '',
×
193
                                                'description' => '',
×
194
                                                'type'        => 'hidden',
×
195
                                                'options'     => '',
×
196
                                                'hide'        => false,
×
197
                                        ],
×
198
                                        'twitter-image'       => [
×
199
                                                'label'       => '',
×
200
                                                'description' => '',
×
201
                                                'type'        => 'hidden',
×
202
                                                'options'     => '',
×
203
                                                'hide'        => false,
×
204
                                        ],
×
205
                                        'twitter-image-id'    => [
×
206
                                                'label'       => '',
×
207
                                                'description' => '',
×
208
                                                'type'        => 'hidden',
×
209
                                                'options'     => '',
×
210
                                                'hide'        => false,
×
211
                                        ],
×
212
                                ]
×
213
                        );
×
214
                }
215

216
                return $fields;
×
217
        }
218

219
        /**
220
         * Filter the hidden fields.
221
         *
222
         * @param array $fields Array with the form fields that has will be filtered.
223
         *
224
         * @return array
225
         */
226
        protected function filter_hidden_fields( array $fields ) {
×
227
                foreach ( $fields as $field_name => $field_options ) {
×
228
                        if ( ! empty( $field_options['hide'] ) ) {
×
229
                                unset( $fields[ $field_name ] );
×
230
                        }
231
                }
232

233
                return $fields;
×
234
        }
235
}
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