PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 19.0
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v19.0
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 / tracking / class-tracking-settings-data.php

class-tracking-settings-data.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 19.0, at admin/tracking/class-tracking-settings-data.php

227 lines 5.3 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\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 'person_name',
30 'person_logo',
31 'person_logo_id',
32 'company_logo_id',
33 'facebook_site',
34 'instagram_url',
35 'linkedin_url',
36 'myspace_url',
37 'og_default_image',
38 'og_default_image_id',
39 'og_frontpage_title',
40 'og_frontpage_desc',
41 'og_frontpage_image',
42 'og_frontpage_image_id',
43 'open_graph_frontpage_title',
44 'open_graph_frontpage_desc',
45 'open_graph_frontpage_image',
46 'open_graph_frontpage_image_id',
47 'other_social_urls',
48 'pinterest_url',
49 'pinterestverify',
50 'twitter_site',
51 'youtube_url',
52 'wikipedia_url',
53 'semrush_tokens',
54 'zapier_api_key',
55 'wincher_tokens',
56 'wincher_website_id',
57 ];
58
59 /**
60 * The options we want to track.
61 *
62 * @var array The option_names for the options we want to track.
63 */
64 private $include_list = [
65 'ms_defaults_set',
66 'version',
67 'disableadvanced_meta',
68 'ryte_indexability',
69 'baiduverify',
70 'googleverify',
71 'msverify',
72 'yandexverify',
73 'site_type',
74 'has_multiple_authors',
75 'environment_type',
76 'content_analysis_active',
77 'keyword_analysis_active',
78 'enable_admin_bar_menu',
79 'enable_cornerstone_content',
80 'enable_xml_sitemap',
81 'enable_text_link_counter',
82 'show_onboarding_notice',
83 'first_activated_on',
84 'myyoast-oauth',
85 'dynamic_permalinks',
86 'website_name',
87 'alternate_website_name',
88 'company_logo',
89 'company_name',
90 'company_or_person',
91 'person_name',
92 'forcerewritetitle',
93 'separator',
94 'title-home-wpseo',
95 'title-author-wpseo',
96 'title-archive-wpseo',
97 'title-search-wpseo',
98 'title-404-wpseo',
99 'metadesc-home-wpseo',
100 'metadesc-author-wpseo',
101 'metadesc-archive-wpseo',
102 'rssbefore',
103 'rssafter',
104 'noindex-author-wpseo',
105 'noindex-author-noposts-wpseo',
106 'noindex-archive-wpseo',
107 'disable-author',
108 'disable-date',
109 'disable-post_format',
110 'disable-attachment',
111 'breadcrumbs-404crumb',
112 'breadcrumbs-display-blog-page',
113 'breadcrumbs-boldlast',
114 'breadcrumbs-archiveprefix',
115 'breadcrumbs-enable',
116 'breadcrumbs-home',
117 'breadcrumbs-prefix',
118 'breadcrumbs-searchprefix',
119 'breadcrumbs-sep',
120 'person_logo',
121 'person_logo_id',
122 'company_logo_id',
123 'company_or_person_user_id',
124 'stripcategorybase',
125 'noindex-post',
126 'display-metabox-pt-post',
127 'noindex-page',
128 'display-metabox-pt-page',
129 'noindex-attachment',
130 'display-metabox-pt-attachment',
131 'display-metabox-tax-category',
132 'noindex-tax-category',
133 'display-metabox-tax-post_tag',
134 'noindex-tax-post_tag',
135 'display-metabox-tax-post_format',
136 'noindex-tax-post_format',
137 'taxonomy-category-ptparent',
138 'taxonomy-post_tag-ptparent',
139 'taxonomy-post_format-ptparent',
140 'breadcrumbs-blog-remove',
141 'hideeditbox-post',
142 'hideeditbox-page',
143 'hideeditbox-attachment',
144 'hideeditbox-tax-category',
145 'hideeditbox-tax-post_tag',
146 'hideeditbox-tax-post_format',
147 'facebook_site',
148 'instagram_url',
149 'linkedin_url',
150 'myspace_url',
151 'og_default_image',
152 'og_default_image_id',
153 'og_frontpage_title',
154 'og_frontpage_desc',
155 'og_frontpage_image',
156 'og_frontpage_image_id',
157 'open_graph_frontpage_title',
158 'open_graph_frontpage_desc',
159 'open_graph_frontpage_image',
160 'open_graph_frontpage_image_id',
161 'opengraph',
162 'pinterest_url',
163 'pinterestverify',
164 'twitter',
165 'twitter_site',
166 'twitter_card_type',
167 'youtube_url',
168 'wikipedia_url',
169 'indexables_indexing_completed',
170 'semrush_integration_active',
171 'semrush_tokens',
172 'semrush_country_code',
173 'enable_enhanced_slack_sharing',
174 'zapier_integration_active',
175 'zapier_api_key',
176 'enable_metabox_insights',
177 'enable_link_suggestions',
178 'workouts',
179 'wincher_integration_active',
180 'wincher_tokens',
181 'wincher_website_id',
182 'wincher_automatically_add_keyphrases',
183 'first_time_install',
184 'other_social_urls',
185 'remove_feed_post_comments',
186 ];
187
188 /**
189 * Returns the collection data.
190 *
191 * @return array The collection data.
192 */
193 public function get() {
194 /**
195 * Filter: 'wpseo_tracking_settings_include_list' - Allow filtering the settings included in tracking.
196 *
197 * @api string $include_list the list with included setting names.
198 */
199 $this->include_list = apply_filters( 'wpseo_tracking_settings_include_list', $this->include_list );
200
201 $options = WPSEO_Options::get_all();
202 // Returns the settings of which the keys intersect with the values of the include list.
203 $options = array_intersect_key( $options, array_flip( $this->include_list ) );
204
205 return [
206 'settings' => $this->anonymize_settings( $options ),
207 ];
208 }
209
210 /**
211 * Anonimizes the WPSEO_Options array by replacing all $anonymous_settings values to 'used'.
212 *
213 * @param array $settings The settings.
214 *
215 * @return array The anonymized settings.
216 */
217 private function anonymize_settings( $settings ) {
218 foreach ( $this->anonymous_settings as $setting ) {
219 if ( ! empty( $settings[ $setting ] ) ) {
220 $settings[ $setting ] = 'used';
221 }
222 }
223
224 return $settings;
225 }
226 }
227