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

Yoast / wordpress-seo / 6af147e1132c0ec4c7a08552f951e6f71850163a

03 Sep 2025 07:01AM UTC coverage: 52.894% (-0.4%) from 53.318%
6af147e1132c0ec4c7a08552f951e6f71850163a

Pull #22541

github

web-flow
Merge a93bcc244 into e918c1ab5
Pull Request #22541: Start of some health check unit tests

8044 of 14881 branches covered (54.06%)

Branch coverage included in aggregate %.

31239 of 59386 relevant lines covered (52.6%)

40205.5 hits per line

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

0.0
/admin/tracking/class-tracking-settings-data.php
1
<?php
2
/**
3
 * WPSEO plugin file.
4
 *
5
 * @package WPSEO\Admin\Tracking
6
 */
7

8
/**
9
 * Collects anonymized settings data.
10
 */
11
class WPSEO_Tracking_Settings_Data implements WPSEO_Collection {
12

13
        /**
14
         * The options that need to be anonymized before they can be sent elsewhere.
15
         *
16
         * @var array All of the option_names which need to be
17
         * anonymized before they can be sent elsewhere.
18
         */
19
        private $anonymous_settings = [
20
                'baiduverify',
21
                'googleverify',
22
                'msverify',
23
                'yandexverify',
24
                'myyoast-oauth',
25
                'website_name',
26
                'alternate_website_name',
27
                'company_logo',
28
                'company_name',
29
                'company_alternate_name',
30
                'person_name',
31
                'person_logo',
32
                'person_logo_id',
33
                'company_logo_id',
34
                'facebook_site',
35
                'instagram_url',
36
                'linkedin_url',
37
                'myspace_url',
38
                'og_default_image',
39
                'og_default_image_id',
40
                'og_frontpage_title',
41
                'og_frontpage_desc',
42
                'og_frontpage_image',
43
                'og_frontpage_image_id',
44
                'open_graph_frontpage_title',
45
                'open_graph_frontpage_desc',
46
                'open_graph_frontpage_image',
47
                'open_graph_frontpage_image_id',
48
                'other_social_urls',
49
                'mastodon_url',
50
                'pinterest_url',
51
                'pinterestverify',
52
                'twitter_site',
53
                'youtube_url',
54
                'wikipedia_url',
55
                'semrush_tokens',
56
                'wincher_tokens',
57
                'wincher_website_id',
58
                'least_readability_ignore_list',
59
                'least_seo_score_ignore_list',
60
                'most_linked_ignore_list',
61
                'least_linked_ignore_list',
62
                'indexables_page_reading_list',
63
                'publishing_principles_id',
64
                'ownership_funding_info_id',
65
                'actionable_feedback_policy_id',
66
                'corrections_policy_id',
67
                'ethics_policy_id',
68
                'diversity_policy_id',
69
                'diversity_staffing_report_id',
70
        ];
71

72
        /**
73
         * The options we want to track.
74
         *
75
         * @var array The option_names for the options we want to track.
76
         */
77
        private $include_list = [
78
                'ms_defaults_set',
79
                'version',
80
                'disableadvanced_meta',
81
                'ryte_indexability',
82
                'baiduverify',
83
                'googleverify',
84
                'msverify',
85
                'yandexverify',
86
                'site_type',
87
                'has_multiple_authors',
88
                'environment_type',
89
                'content_analysis_active',
90
                'keyword_analysis_active',
91
                'inclusive_language_analysis_active',
92
                'enable_admin_bar_menu',
93
                'enable_cornerstone_content',
94
                'enable_xml_sitemap',
95
                'enable_text_link_counter',
96
                'show_onboarding_notice',
97
                'first_activated_on',
98
                'myyoast-oauth',
99
                'dynamic_permalinks',
100
                'website_name',
101
                'alternate_website_name',
102
                'company_logo',
103
                'company_name',
104
                'company_or_person',
105
                'person_name',
106
                'forcerewritetitle',
107
                'separator',
108
                'title-home-wpseo',
109
                'title-author-wpseo',
110
                'title-archive-wpseo',
111
                'title-search-wpseo',
112
                'title-404-wpseo',
113
                'metadesc-home-wpseo',
114
                'metadesc-author-wpseo',
115
                'metadesc-archive-wpseo',
116
                'rssbefore',
117
                'rssafter',
118
                'noindex-author-wpseo',
119
                'noindex-author-noposts-wpseo',
120
                'noindex-archive-wpseo',
121
                'disable-author',
122
                'disable-date',
123
                'disable-post_format',
124
                'disable-attachment',
125
                'breadcrumbs-404crumb',
126
                'breadcrumbs-display-blog-page',
127
                'breadcrumbs-boldlast',
128
                'breadcrumbs-archiveprefix',
129
                'breadcrumbs-enable',
130
                'breadcrumbs-home',
131
                'breadcrumbs-prefix',
132
                'breadcrumbs-searchprefix',
133
                'breadcrumbs-sep',
134
                'person_logo',
135
                'person_logo_id',
136
                'company_logo_id',
137
                'company_or_person_user_id',
138
                'stripcategorybase',
139
                'noindex-post',
140
                'display-metabox-pt-post',
141
                'noindex-page',
142
                'display-metabox-pt-page',
143
                'noindex-attachment',
144
                'display-metabox-pt-attachment',
145
                'display-metabox-tax-category',
146
                'noindex-tax-category',
147
                'display-metabox-tax-post_tag',
148
                'noindex-tax-post_tag',
149
                'display-metabox-tax-post_format',
150
                'noindex-tax-post_format',
151
                'taxonomy-category-ptparent',
152
                'taxonomy-post_tag-ptparent',
153
                'taxonomy-post_format-ptparent',
154
                'breadcrumbs-blog-remove',
155
                'hideeditbox-post',
156
                'hideeditbox-page',
157
                'hideeditbox-attachment',
158
                'hideeditbox-tax-category',
159
                'hideeditbox-tax-post_tag',
160
                'hideeditbox-tax-post_format',
161
                'facebook_site',
162
                'instagram_url',
163
                'linkedin_url',
164
                'myspace_url',
165
                'og_default_image',
166
                'og_default_image_id',
167
                'og_frontpage_title',
168
                'og_frontpage_desc',
169
                'og_frontpage_image',
170
                'og_frontpage_image_id',
171
                'open_graph_frontpage_title',
172
                'open_graph_frontpage_desc',
173
                'open_graph_frontpage_image',
174
                'open_graph_frontpage_image_id',
175
                'opengraph',
176
                'pinterest_url',
177
                'pinterestverify',
178
                'twitter',
179
                'twitter_site',
180
                'twitter_card_type',
181
                'youtube_url',
182
                'wikipedia_url',
183
                'mastodon_url',
184
                'indexables_indexing_completed',
185
                'semrush_integration_active',
186
                'semrush_tokens',
187
                'semrush_country_code',
188
                'enable_enhanced_slack_sharing',
189
                'enable_metabox_insights',
190
                'enable_link_suggestions',
191
                'enable_index_now',
192
                'enable_ai_generator',
193
                'workouts',
194
                'wincher_integration_active',
195
                'wincher_tokens',
196
                'wincher_website_id',
197
                'wincher_automatically_add_keyphrases',
198
                'first_time_install',
199
                'other_social_urls',
200
                'remove_feed_global',
201
                'remove_feed_global_comments',
202
                'remove_feed_post_comments',
203
                'remove_feed_authors',
204
                'remove_feed_categories',
205
                'remove_feed_tags',
206
                'remove_feed_custom_taxonomies',
207
                'remove_feed_post_types',
208
                'remove_feed_search',
209
                'remove_atom_rdf_feeds',
210
                'remove_shortlinks',
211
                'remove_rest_api_links',
212
                'remove_rsd_wlw_links',
213
                'remove_oembed_links',
214
                'remove_generator',
215
                'remove_emoji_scripts',
216
                'remove_powered_by_header',
217
                'remove_pingback_header',
218
                'clean_campaign_tracking_urls',
219
                'clean_permalinks',
220
                'clean_permalinks_extra_variables',
221
                'search_cleanup',
222
                'search_cleanup_emoji',
223
                'search_cleanup_patterns',
224
                'search_character_limit',
225
                'redirect_search_pretty_urls',
226
                'indexables_overview_state',
227
                'deny_search_crawling',
228
                'deny_wp_json_crawling',
229
                'deny_adsbot_crawling',
230
                'deny_ccbot_crawling',
231
                'deny_google_extended_crawling',
232
                'deny_gptbot_crawling',
233
                'last_known_no_unindexed',
234
                'site_kit_connected',
235
                'site_kit_tracking_setup_widget_loaded',
236
                'site_kit_tracking_first_interaction_stage',
237
                'site_kit_tracking_last_interaction_stage',
238
                'site_kit_tracking_setup_widget_temporarily_dismissed',
239
                'site_kit_tracking_setup_widget_permanently_dismissed',
240
                'google_site_kit_feature_enabled',
241
                'ai_free_sparks_started_on',
242
                'enable_llms_txt',
243
                'llms_txt_selection_mode',
244
        ];
245

246
        /**
247
         * Returns the collection data.
248
         *
249
         * @return array The collection data.
250
         */
251
        public function get() {
×
252
                /**
253
                 * Filter: 'wpseo_tracking_settings_include_list' - Allow filtering the settings included in tracking.
254
                 *
255
                 * @param string $include_list The list with included setting names.
256
                 */
257
                $this->include_list = apply_filters( 'wpseo_tracking_settings_include_list', $this->include_list );
×
258

259
                $options = WPSEO_Options::get_all();
×
260
                // Returns the settings of which the keys intersect with the values of the include list.
261
                $options = array_intersect_key( $options, array_flip( $this->include_list ) );
×
262

263
                return [
×
264
                        'settings' => $this->anonymize_settings( $options ),
×
265
                ];
×
266
        }
267

268
        /**
269
         * Anonimizes the WPSEO_Options array by replacing all $anonymous_settings values to 'used'.
270
         *
271
         * @param array $settings The settings.
272
         *
273
         * @return array The anonymized settings.
274
         */
275
        private function anonymize_settings( $settings ) {
×
276
                foreach ( $this->anonymous_settings as $setting ) {
×
277
                        if ( ! empty( $settings[ $setting ] ) ) {
×
278
                                $settings[ $setting ] = 'used';
×
279
                        }
280
                }
281

282
                return $settings;
×
283
        }
284
}
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