Yoast SEO - Version 14.6

Version Description

Release Date: July 21st, 2020

We have a new release for you: Yoast SEO 14.6. This release has some pretty cool enhancements. For example, weve added another helpful indicator in the editor that shows you your scores for a particular post quickly. Read more about those changes in our release post!

Enhancements:

  • Improves the editing experience in the Social tab, and gives it a dab of fresh paint.
  • In the sharing metadata used for Facebook, Twitter, Pinterest, LinkedIn and many other sites, we now output the post title instead of the SEO title. This prevents the brand name from being added in most cases, which is better on those platforms. You can still set a specific sharing title on the Social tab of the Yoast SEO post settings.
  • Makes the plugin icon in the editor reflect the SEO and Readability score.
  • Improves keyphrase counting in Indonesian by not counting '-' as a word boundary.
  • Improves the feedback text for the keyphrase in title assessment to make clear that an exact keyphrase match is necessary.
  • Improves the recognition of keywords in the slug if they contain a hyphen (for example: re-duplicated, on-the-go).
  • Improves the transition words analysis for Russian.
  • Noindexes the xmlrpc.php file and all possible ways to request it, removing them from Googles search results.

Bugfixes:

  • Fixes a bug where the comment count would be output for Articles that did not accept comments. Props to gr8shivam.
  • Fixes a bug where the social previews did not reflect the og:image tag correctly in situations where the first image in the content was used as a fallback.
  • Fixes a bug where slashes in titles and open graph titles were removed before they were used as a replacement variable. Props to Jon Christopher.
  • Fixes a bug where a get_plugins() undefined error would be thrown if there was already a plugin.php loaded via the init hook by another plugin. Props to Krishna Kant.
  • Fixes a bug where there was no border on the bottom of metabox tabs without any collapsible sections.

Other:

  • Removes functions, class variables and classes that were deprecated prior to version 11.5.
  • Yoast SEO had many scripts that relied on many localized objects. In an effort to improve maintainability we have combined all those objects into one: wpseoScriptData. wpseoPostScraperL10n and wpseoTermScraperL10n remain available for backward compatibility. Plugins that tap into our objects will need to update their code.
Download this release

Release Info

Developer Yoast
Plugin Icon 128x128 Yoast SEO
Version 14.6
Comparing to
See all releases

Code changes from version 14.5 to 14.6

Files changed (108) hide show
  1. admin/ajax.php +0 -38
  2. admin/class-admin-asset-analysis-worker-location.php +1 -1
  3. admin/class-admin-asset-manager.php +46 -106
  4. admin/class-admin-asset-yoast-components-l10n.php +1 -0
  5. admin/class-admin-utils.php +0 -15
  6. admin/class-admin.php +0 -38
  7. admin/class-asset.php +0 -19
  8. admin/class-config.php +32 -43
  9. admin/class-gutenberg-compatibility.php +2 -2
  10. admin/class-primary-term-admin.php +1 -1
  11. admin/class-social-admin.php +0 -266
  12. admin/class-yoast-form.php +0 -22
  13. admin/config-ui/class-configuration-options-adapter.php +0 -19
  14. admin/config-ui/class-configuration-translations.php +2 -1
  15. admin/config-ui/components/class-component-suggestions.php +1 -1
  16. admin/formatter/class-metabox-formatter.php +8 -0
  17. admin/formatter/class-post-metabox-formatter.php +6 -6
  18. admin/formatter/class-term-metabox-formatter.php +8 -8
  19. admin/google_search_console/class-gsc.php +0 -13
  20. admin/import/plugins/class-abstract-plugin-importer.php +6 -4
  21. admin/import/plugins/class-import-rankmath.php +1 -0
  22. admin/import/plugins/class-import-squirrly.php +7 -2
  23. admin/links/class-link-storage.php +0 -9
  24. admin/metabox/class-metabox.php +84 -108
  25. admin/services/class-file-size.php +1 -1
  26. admin/taxonomy/class-taxonomy-metabox.php +24 -53
  27. admin/taxonomy/class-taxonomy-social-fields.php +9 -18
  28. admin/taxonomy/class-taxonomy.php +36 -52
  29. admin/tracking/class-tracking-server-data.php +1 -0
  30. admin/views/tabs/dashboard/dashboard.php +1 -11
  31. config/composer/actions.php +44 -2
  32. config/dependency-injection/custom-loader.php +4 -2
  33. css/dist/{admin-global-1450-rtl.css → admin-global-1460-rtl.css} +0 -0
  34. css/dist/{admin-global-1450.css → admin-global-1460.css} +0 -0
  35. css/dist/{adminbar-1450-rtl.css → adminbar-1460-rtl.css} +0 -0
  36. css/dist/{adminbar-1450.css → adminbar-1460.css} +0 -0
  37. css/dist/{alerts-1450-rtl.css → alerts-1460-rtl.css} +0 -0
  38. css/dist/{alerts-1450.css → alerts-1460.css} +0 -0
  39. css/dist/{dashboard-1450-rtl.css → dashboard-1460-rtl.css} +0 -0
  40. css/dist/{dashboard-1450.css → dashboard-1460.css} +0 -0
  41. css/dist/{edit-page-1450-rtl.css → edit-page-1460-rtl.css} +0 -0
  42. css/dist/{edit-page-1450.css → edit-page-1460.css} +0 -0
  43. css/dist/{featured-image-1450-rtl.css → featured-image-1460-rtl.css} +0 -0
  44. css/dist/{featured-image-1450.css → featured-image-1460.css} +0 -0
  45. css/dist/{filter-explanation-1450-rtl.css → filter-explanation-1460-rtl.css} +0 -0
  46. css/dist/{filter-explanation-1450.css → filter-explanation-1460.css} +0 -0
  47. css/dist/{icons-1450-rtl.css → icons-1460-rtl.css} +0 -0
  48. css/dist/{icons-1450.css → icons-1460.css} +0 -0
  49. css/dist/{inside-editor-1450-rtl.css → inside-editor-1460-rtl.css} +0 -0
  50. css/dist/{inside-editor-1450.css → inside-editor-1460.css} +0 -0
  51. css/dist/{metabox-1450-rtl.css → metabox-1460-rtl.css} +1 -1
  52. css/dist/{metabox-1450.css → metabox-1460.css} +1 -1
  53. css/dist/{metabox-primary-category-1450-rtl.css → metabox-primary-category-1460-rtl.css} +0 -0
  54. css/dist/{metabox-primary-category-1450.css → metabox-primary-category-1460.css} +0 -0
  55. css/dist/monorepo-1450-rtl.css +0 -1
  56. css/dist/monorepo-1450.css +0 -1
  57. css/dist/monorepo-1460-rtl.css +1 -0
  58. css/dist/monorepo-1460.css +1 -0
  59. css/dist/{notifications-1450-rtl.css → notifications-1460-rtl.css} +0 -0
  60. css/dist/{notifications-1450.css → notifications-1460.css} +0 -0
  61. css/dist/{score_icon-1450-rtl.css → score_icon-1460-rtl.css} +0 -0
  62. css/dist/{score_icon-1450.css → score_icon-1460.css} +0 -0
  63. css/dist/{search-appearance-1450-rtl.css → search-appearance-1460-rtl.css} +0 -0
  64. css/dist/{search-appearance-1450.css → search-appearance-1460.css} +0 -0
  65. css/dist/{structured-data-blocks-1450-rtl.css → structured-data-blocks-1460-rtl.css} +0 -0
  66. css/dist/{structured-data-blocks-1450.css → structured-data-blocks-1460.css} +0 -0
  67. css/dist/{toggle-switch-1450-rtl.css → toggle-switch-1460-rtl.css} +0 -0
  68. css/dist/{toggle-switch-1450.css → toggle-switch-1460.css} +0 -0
  69. css/dist/{wpseo-dismissible-1450-rtl.css → wpseo-dismissible-1460-rtl.css} +0 -0
  70. css/dist/{wpseo-dismissible-1450.css → wpseo-dismissible-1460.css} +0 -0
  71. css/dist/{yoast-components-1450-rtl.css → yoast-components-1460-rtl.css} +0 -0
  72. css/dist/{yoast-components-1450.css → yoast-components-1460.css} +0 -0
  73. css/dist/{yoast-extensions-1450-rtl.css → yoast-extensions-1460-rtl.css} +1 -1
  74. css/dist/{yoast-extensions-1450.css → yoast-extensions-1460.css} +1 -1
  75. css/dist/{yst_plugin_tools-1450-rtl.css → yst_plugin_tools-1460-rtl.css} +0 -0
  76. css/dist/{yst_plugin_tools-1450.css → yst_plugin_tools-1460.css} +0 -0
  77. css/dist/{yst_seo_score-1450-rtl.css → yst_seo_score-1460-rtl.css} +0 -0
  78. css/dist/{yst_seo_score-1450.css → yst_seo_score-1460.css} +0 -0
  79. css/src/metabox.css +32 -5
  80. deprecated/admin/class-social-admin.php +105 -0
  81. deprecated/admin/config-ui/fields/class-field-profile-url-googleplus.php +0 -38
  82. deprecated/class-cornerstone.php +0 -61
  83. deprecated/class-recalibration-beta-notification.php +0 -52
  84. deprecated/class-recalibration-beta.php +0 -248
  85. deprecated/class-submenu-hider.php +0 -39
  86. deprecated/class-wpseo-advanced-settings.php +0 -49
  87. deprecated/class-wpseo-option-internallinks.php +0 -119
  88. deprecated/class-wpseo-option-permalinks.php +0 -67
  89. deprecated/class-yoast-modal.php +0 -81
  90. deprecated/frontend/abstract-class-deprecated-schema-piece.php +4 -4
  91. deprecated/frontend/class-opengraph.php +0 -29
  92. deprecated/frontend/schema/class-schema-person.php +0 -1
  93. images/Yoast_icon_kader.svg +0 -1
  94. inc/class-addon-manager.php +17 -5
  95. inc/class-upgrade.php +5 -2
  96. inc/class-wpseo-content-images.php +0 -28
  97. inc/class-wpseo-meta.php +3 -25
  98. inc/class-wpseo-replace-vars.php +1 -1
  99. inc/class-wpseo-utils.php +1 -41
  100. inc/options/class-wpseo-options.php +5 -14
  101. inc/sitemaps/class-post-type-sitemap-provider.php +0 -10
  102. inc/sitemaps/class-sitemaps-admin.php +0 -22
  103. inc/sitemaps/class-sitemaps.php +3 -1
  104. inc/sitemaps/class-taxonomy-sitemap-provider.php +0 -12
  105. inc/wpseo-functions-deprecated.php +0 -30
  106. inc/wpseo-non-ajax-functions.php +0 -154
  107. js/dist/admin-global-1460.js +1 -0
  108. js/dist/analysis-1450.js +0 -21
admin/ajax.php CHANGED
@@ -339,44 +339,6 @@ new Yoast_Dismissable_Notice_Ajax( 'recalculate', Yoast_Dismissable_Notice_Ajax:
339
 
340
  /* ********************* DEPRECATED FUNCTIONS ********************* */
341
 
342
- /**
343
- * Removes stopword from the sample permalink that is generated in an AJAX request.
344
- *
345
- * @deprecated 6.3
346
- * @codeCoverageIgnore
347
- */
348
- function wpseo_remove_stopwords_sample_permalink() {
349
- _deprecated_function( __FUNCTION__, 'WPSEO 6.3', 'This method is deprecated.' );
350
-
351
- wpseo_ajax_json_echo_die( '' );
352
- }
353
-
354
- /**
355
- * Function used to delete blocking files, dies on exit.
356
- *
357
- * @deprecated 7.0
358
- * @codeCoverageIgnore
359
- */
360
- function wpseo_kill_blocking_files() {
361
- _deprecated_function( __FUNCTION__, 'WPSEO 7.0', 'This method is deprecated.' );
362
-
363
- wpseo_ajax_json_echo_die( '' );
364
- }
365
-
366
- /**
367
- * Handles the posting of a new FB admin.
368
- *
369
- * @deprecated 7.1
370
- * @codeCoverageIgnore
371
- */
372
- function wpseo_add_fb_admin() {
373
- if ( ! current_user_can( 'manage_options' ) ) {
374
- die( '-1' );
375
- }
376
- _deprecated_function( __FUNCTION__, 'WPSEO 7.0', 'This method is deprecated.' );
377
- wpseo_ajax_json_echo_die( '' );
378
- }
379
-
380
  /**
381
  * Used in the editor to replace vars for the snippet preview.
382
  *
339
 
340
  /* ********************* DEPRECATED FUNCTIONS ********************* */
341
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
342
  /**
343
  * Used in the editor to replace vars for the snippet preview.
344
  *
admin/class-admin-asset-analysis-worker-location.php CHANGED
@@ -36,7 +36,7 @@ final class WPSEO_Admin_Asset_Analysis_Worker_Location implements WPSEO_Admin_As
36
  $flat_version = $asset_manager->flatten_version( WPSEO_VERSION );
37
  }
38
 
39
- $analysis_worker = 'wp-seo-' . $name . '-' . $flat_version;
40
 
41
  $this->asset_location = WPSEO_Admin_Asset_Manager::create_default_location();
42
  $this->asset = new WPSEO_Admin_Asset(
36
  $flat_version = $asset_manager->flatten_version( WPSEO_VERSION );
37
  }
38
 
39
+ $analysis_worker = $name . '-' . $flat_version;
40
 
41
  $this->asset_location = WPSEO_Admin_Asset_Manager::create_default_location();
42
  $this->asset = new WPSEO_Admin_Asset(
admin/class-admin-asset-manager.php CHANGED
@@ -219,7 +219,7 @@ class WPSEO_Admin_Asset_Manager {
219
  ],
220
  [
221
  'name' => 'yoast-modal',
222
- 'src' => 'wp-seo-modal-' . $flat_version,
223
  'deps' => [
224
  'jquery',
225
  'wp-element',
@@ -229,38 +229,33 @@ class WPSEO_Admin_Asset_Manager {
229
  ],
230
  ],
231
  [
232
- 'name' => 'admin-script',
233
- 'src' => 'wp-seo-admin-' . $flat_version,
234
  'deps' => [
235
  'lodash',
236
  'jquery',
237
  'jquery-ui-core',
238
  'jquery-ui-progressbar',
 
 
 
239
  self::PREFIX . 'select2',
240
  self::PREFIX . 'select2-translations',
241
- self::PREFIX . 'commons',
242
- ],
243
- ],
244
- [
245
- 'name' => 'admin-media',
246
- 'src' => 'wp-seo-admin-media-' . $flat_version,
247
- 'deps' => [
248
- 'jquery',
249
- 'jquery-ui-core',
250
- self::PREFIX . 'commons',
251
  ],
252
  ],
253
  [
254
  'name' => 'network-admin-script',
255
- 'src' => 'wp-seo-network-admin-' . $flat_version,
256
  'deps' => [
257
  'jquery',
 
 
258
  self::PREFIX . 'commons',
259
  ],
260
  ],
261
  [
262
  'name' => 'bulk-editor',
263
- 'src' => 'wp-seo-bulk-editor-' . $flat_version,
264
  'deps' => [
265
  'jquery',
266
  self::PREFIX . 'commons',
@@ -268,7 +263,7 @@ class WPSEO_Admin_Asset_Manager {
268
  ],
269
  [
270
  'name' => 'admin-global-script',
271
- 'src' => 'wp-seo-admin-global-' . $flat_version,
272
  'deps' => [
273
  'jquery',
274
  self::PREFIX . 'commons',
@@ -276,100 +271,55 @@ class WPSEO_Admin_Asset_Manager {
276
  'in_footer' => false,
277
  ],
278
  [
279
- 'name' => 'metabox',
280
- 'src' => 'wp-seo-metabox-' . $flat_version,
281
  'deps' => [
282
  'jquery',
283
- 'wp-element',
284
- 'wp-i18n',
285
- 'wp-data',
286
- 'wp-components',
287
- self::PREFIX . 'select2',
288
- self::PREFIX . 'select2-translations',
289
- self::PREFIX . 'commons',
290
- ],
291
- 'in_footer' => false,
292
- ],
293
- [
294
- 'name' => 'featured-image',
295
- 'src' => 'wp-seo-featured-image-' . $flat_version,
296
- 'deps' => [
297
- 'jquery',
298
- self::PREFIX . 'commons',
299
- ],
300
- ],
301
- [
302
- 'name' => 'admin-gsc',
303
- 'src' => 'wp-seo-admin-gsc-' . $flat_version,
304
- 'deps' => [
305
- 'wp-element',
306
- 'wp-i18n',
307
- self::PREFIX . 'styled-components',
308
- self::PREFIX . 'components',
309
- self::PREFIX . 'commons',
310
- ],
311
- 'in_footer' => false,
312
- ],
313
- [
314
- 'name' => 'post-scraper',
315
- 'src' => 'wp-seo-post-scraper-' . $flat_version,
316
- 'deps' => [
317
- 'wp-util',
318
  'wp-api',
319
- 'wp-sanitize',
320
- 'wp-element',
321
- 'wp-i18n',
322
- 'wp-data',
323
  'wp-api-fetch',
324
- 'wp-annotations',
325
  'wp-compose',
 
 
 
326
  'wp-is-shallow-equal',
 
 
 
327
  self::PREFIX . 'redux',
328
- self::PREFIX . 'replacevar-plugin',
329
- self::PREFIX . 'shortcode-plugin',
330
  self::PREFIX . 'analysis',
331
  self::PREFIX . 'components',
332
  self::PREFIX . 'commons',
 
 
333
  ],
 
334
  ],
335
  [
336
- 'name' => 'term-scraper',
337
- 'src' => 'wp-seo-term-scraper-' . $flat_version,
338
  'deps' => [
 
339
  'wp-sanitize',
340
  'wp-element',
341
  'wp-i18n',
342
  'wp-data',
343
  'wp-api-fetch',
 
344
  'wp-compose',
345
  'wp-is-shallow-equal',
346
  self::PREFIX . 'redux',
347
- self::PREFIX . 'replacevar-plugin',
348
  self::PREFIX . 'analysis',
349
  self::PREFIX . 'components',
350
  self::PREFIX . 'commons',
351
- ],
352
- ],
353
- [
354
- 'name' => 'replacevar-plugin',
355
- 'src' => 'wp-seo-replacevar-plugin-' . $flat_version,
356
- 'deps' => [
357
- self::PREFIX . 'analysis',
358
- self::PREFIX . 'components',
359
- self::PREFIX . 'commons',
360
- ],
361
- ],
362
- [
363
- 'name' => 'shortcode-plugin',
364
- 'src' => 'wp-seo-shortcode-plugin-' . $flat_version,
365
- 'deps' => [
366
- self::PREFIX . 'analysis',
367
- self::PREFIX . 'commons',
368
  ],
369
  ],
370
  [
371
  'name' => 'recalculate',
372
- 'src' => 'wp-seo-recalculate-' . $flat_version,
373
  'deps' => [
374
  'jquery',
375
  'jquery-ui-core',
@@ -379,23 +329,6 @@ class WPSEO_Admin_Asset_Manager {
379
  self::PREFIX . 'commons',
380
  ],
381
  ],
382
- [
383
- 'name' => 'primary-category',
384
- 'src' => 'wp-seo-metabox-category-' . $flat_version,
385
- 'deps' => [
386
- 'jquery',
387
- 'wp-url',
388
- 'wp-util',
389
- 'wp-element',
390
- 'wp-i18n',
391
- 'wp-components',
392
- 'wp-data',
393
- 'wp-url',
394
- self::PREFIX . 'analysis',
395
- self::PREFIX . 'components',
396
- self::PREFIX . 'commons',
397
- ],
398
- ],
399
  [
400
  'name' => 'select2',
401
  'src' => 'select2/select2.full',
@@ -429,7 +362,7 @@ class WPSEO_Admin_Asset_Manager {
429
  ],
430
  [
431
  'name' => 'reindex-links',
432
- 'src' => 'wp-seo-reindex-links-' . $flat_version,
433
  'deps' => [
434
  'jquery',
435
  'jquery-ui-core',
@@ -439,7 +372,7 @@ class WPSEO_Admin_Asset_Manager {
439
  ],
440
  [
441
  'name' => 'indexation',
442
- 'src' => 'wp-seo-indexation-' . $flat_version,
443
  'deps' => [
444
  'jquery',
445
  'jquery-ui-core',
@@ -450,7 +383,7 @@ class WPSEO_Admin_Asset_Manager {
450
  ],
451
  [
452
  'name' => 'edit-page-script',
453
- 'src' => 'wp-seo-edit-page-' . $flat_version,
454
  'deps' => [
455
  'jquery',
456
  self::PREFIX . 'commons',
@@ -458,7 +391,7 @@ class WPSEO_Admin_Asset_Manager {
458
  ],
459
  [
460
  'name' => 'quick-edit-handler',
461
- 'src' => 'wp-seo-quick-edit-handler-' . $flat_version,
462
  'deps' => [
463
  'jquery',
464
  self::PREFIX . 'commons',
@@ -467,7 +400,7 @@ class WPSEO_Admin_Asset_Manager {
467
  ],
468
  [
469
  'name' => 'api',
470
- 'src' => 'wp-seo-api-' . $flat_version,
471
  'deps' => [
472
  'wp-api',
473
  'jquery',
@@ -476,7 +409,7 @@ class WPSEO_Admin_Asset_Manager {
476
  ],
477
  [
478
  'name' => 'dashboard-widget',
479
- 'src' => 'wp-seo-dashboard-widget-' . $flat_version,
480
  'deps' => [
481
  self::PREFIX . 'api',
482
  'jquery',
@@ -488,7 +421,7 @@ class WPSEO_Admin_Asset_Manager {
488
  ],
489
  [
490
  'name' => 'filter-explanation',
491
- 'src' => 'wp-seo-filter-explanation-' . $flat_version,
492
  'deps' => [
493
  'jquery',
494
  self::PREFIX . 'commons',
@@ -511,11 +444,14 @@ class WPSEO_Admin_Asset_Manager {
511
  self::PREFIX . 'analysis',
512
  self::PREFIX . 'styled-components',
513
  self::PREFIX . 'commons',
 
 
 
514
  ],
515
  ],
516
  [
517
  'name' => 'structured-data-blocks',
518
- 'src' => 'wp-seo-structured-data-blocks-' . $flat_version,
519
  'deps' => [
520
  'wp-blocks',
521
  'wp-i18n',
@@ -550,6 +486,10 @@ class WPSEO_Admin_Asset_Manager {
550
  'wp-i18n',
551
  ],
552
  ],
 
 
 
 
553
  ];
554
  }
555
 
219
  ],
220
  [
221
  'name' => 'yoast-modal',
222
+ 'src' => 'modal-' . $flat_version,
223
  'deps' => [
224
  'jquery',
225
  'wp-element',
229
  ],
230
  ],
231
  [
232
+ 'name' => 'settings',
233
+ 'src' => 'settings-' . $flat_version,
234
  'deps' => [
235
  'lodash',
236
  'jquery',
237
  'jquery-ui-core',
238
  'jquery-ui-progressbar',
239
+ 'wp-api',
240
+ self::PREFIX . 'commons',
241
+ self::PREFIX . 'components',
242
  self::PREFIX . 'select2',
243
  self::PREFIX . 'select2-translations',
 
 
 
 
 
 
 
 
 
 
244
  ],
245
  ],
246
  [
247
  'name' => 'network-admin-script',
248
+ 'src' => 'network-admin-' . $flat_version,
249
  'deps' => [
250
  'jquery',
251
+ 'wp-element',
252
+ 'wp-i18n',
253
  self::PREFIX . 'commons',
254
  ],
255
  ],
256
  [
257
  'name' => 'bulk-editor',
258
+ 'src' => 'bulk-editor-' . $flat_version,
259
  'deps' => [
260
  'jquery',
261
  self::PREFIX . 'commons',
263
  ],
264
  [
265
  'name' => 'admin-global-script',
266
+ 'src' => 'admin-global-' . $flat_version,
267
  'deps' => [
268
  'jquery',
269
  self::PREFIX . 'commons',
271
  'in_footer' => false,
272
  ],
273
  [
274
+ 'name' => 'post-edit',
275
+ 'src' => 'post-edit-' . $flat_version,
276
  'deps' => [
277
  'jquery',
278
+ 'wp-annotations',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
279
  'wp-api',
 
 
 
 
280
  'wp-api-fetch',
281
+ 'wp-components',
282
  'wp-compose',
283
+ 'wp-data',
284
+ 'wp-element',
285
+ 'wp-i18n',
286
  'wp-is-shallow-equal',
287
+ 'wp-sanitize',
288
+ 'wp-url',
289
+ 'wp-util',
290
  self::PREFIX . 'redux',
 
 
291
  self::PREFIX . 'analysis',
292
  self::PREFIX . 'components',
293
  self::PREFIX . 'commons',
294
+ self::PREFIX . 'select2',
295
+ self::PREFIX . 'select2-translations',
296
  ],
297
+ 'in_footer' => false,
298
  ],
299
  [
300
+ 'name' => 'term-edit',
301
+ 'src' => 'term-edit-' . $flat_version,
302
  'deps' => [
303
+ 'jquery',
304
  'wp-sanitize',
305
  'wp-element',
306
  'wp-i18n',
307
  'wp-data',
308
  'wp-api-fetch',
309
+ 'wp-components',
310
  'wp-compose',
311
  'wp-is-shallow-equal',
312
  self::PREFIX . 'redux',
 
313
  self::PREFIX . 'analysis',
314
  self::PREFIX . 'components',
315
  self::PREFIX . 'commons',
316
+ self::PREFIX . 'select2',
317
+ self::PREFIX . 'select2-translations',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
318
  ],
319
  ],
320
  [
321
  'name' => 'recalculate',
322
+ 'src' => 'recalculate-' . $flat_version,
323
  'deps' => [
324
  'jquery',
325
  'jquery-ui-core',
329
  self::PREFIX . 'commons',
330
  ],
331
  ],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
332
  [
333
  'name' => 'select2',
334
  'src' => 'select2/select2.full',
362
  ],
363
  [
364
  'name' => 'reindex-links',
365
+ 'src' => 'reindex-links-' . $flat_version,
366
  'deps' => [
367
  'jquery',
368
  'jquery-ui-core',
372
  ],
373
  [
374
  'name' => 'indexation',
375
+ 'src' => 'indexation-' . $flat_version,
376
  'deps' => [
377
  'jquery',
378
  'jquery-ui-core',
383
  ],
384
  [
385
  'name' => 'edit-page-script',
386
+ 'src' => 'edit-page-' . $flat_version,
387
  'deps' => [
388
  'jquery',
389
  self::PREFIX . 'commons',
391
  ],
392
  [
393
  'name' => 'quick-edit-handler',
394
+ 'src' => 'quick-edit-handler-' . $flat_version,
395
  'deps' => [
396
  'jquery',
397
  self::PREFIX . 'commons',
400
  ],
401
  [
402
  'name' => 'api',
403
+ 'src' => 'api-client-' . $flat_version,
404
  'deps' => [
405
  'wp-api',
406
  'jquery',
409
  ],
410
  [
411
  'name' => 'dashboard-widget',
412
+ 'src' => 'dashboard-widget-' . $flat_version,
413
  'deps' => [
414
  self::PREFIX . 'api',
415
  'jquery',
421
  ],
422
  [
423
  'name' => 'filter-explanation',
424
+ 'src' => 'filter-explanation-' . $flat_version,
425
  'deps' => [
426
  'jquery',
427
  self::PREFIX . 'commons',
444
  self::PREFIX . 'analysis',
445
  self::PREFIX . 'styled-components',
446
  self::PREFIX . 'commons',
447
+ self::PREFIX . 'draft-js',
448
+ 'wp-a11y',
449
+ 'wp-dom-ready',
450
  ],
451
  ],
452
  [
453
  'name' => 'structured-data-blocks',
454
+ 'src' => 'structured-data-blocks-' . $flat_version,
455
  'deps' => [
456
  'wp-blocks',
457
  'wp-i18n',
486
  'wp-i18n',
487
  ],
488
  ],
489
+ [
490
+ 'name' => 'draft-js',
491
+ 'src' => 'draft-js-' . $flat_version,
492
+ ],
493
  ];
494
  }
495
 
admin/class-admin-asset-yoast-components-l10n.php CHANGED
@@ -36,6 +36,7 @@ final class WPSEO_Admin_Asset_Yoast_Components_L10n {
36
 
37
  $file = plugin_dir_path( WPSEO_FILE ) . 'languages/' . $component . '-' . $locale . '.json';
38
  if ( file_exists( $file ) ) {
 
39
  $file = file_get_contents( $file );
40
  if ( is_string( $file ) && $file !== '' ) {
41
  return json_decode( $file, true );
36
 
37
  $file = plugin_dir_path( WPSEO_FILE ) . 'languages/' . $component . '-' . $locale . '.json';
38
  if ( file_exists( $file ) ) {
39
+ // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents -- Retrieving a local file.
40
  $file = file_get_contents( $file );
41
  if ( is_string( $file ) && $file !== '' ) {
42
  return json_decode( $file, true );
admin/class-admin-utils.php CHANGED
@@ -78,19 +78,4 @@ class WPSEO_Admin_Utils {
78
  esc_html__( '(Opens in a new browser tab)', 'wordpress-seo' )
79
  );
80
  }
81
-
82
- /* ********************* DEPRECATED METHODS ********************* */
83
-
84
- /**
85
- * Determines whether or not the user has an invalid version of PHP installed.
86
- *
87
- * @deprecated 8.1
88
- * @codeCoverageIgnore
89
- *
90
- * @return bool Whether or not PHP 5.2 or lower is installed.
91
- */
92
- public static function is_supported_php_version_installed() {
93
- // Intentionally left blank.
94
- return true;
95
- }
96
  }
78
  esc_html__( '(Opens in a new browser tab)', 'wordpress-seo' )
79
  );
80
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  }
admin/class-admin.php CHANGED
@@ -439,42 +439,4 @@ class WPSEO_Admin {
439
  $helpscout_settings['ask_consent']
440
  );
441
  }
442
-
443
- /* ********************* DEPRECATED METHODS ********************* */
444
-
445
- /**
446
- * Cleans stopwords out of the slug, if the slug hasn't been set yet.
447
- *
448
- * @deprecated 7.0
449
- * @codeCoverageIgnore
450
- *
451
- * @return void
452
- */
453
- public function remove_stopwords_from_slug() {
454
- _deprecated_function( __METHOD__, 'WPSEO 7.0' );
455
- }
456
-
457
- /**
458
- * Filter the stopwords from the slug.
459
- *
460
- * @deprecated 7.0
461
- * @codeCoverageIgnore
462
- *
463
- * @return void
464
- */
465
- public function filter_stopwords_from_slug() {
466
- _deprecated_function( __METHOD__, 'WPSEO 7.0' );
467
- }
468
-
469
- /**
470
- * Initializes WHIP to show a notice for outdated PHP versions.
471
- *
472
- * @deprecated 8.1
473
- * @codeCoverageIgnore
474
- *
475
- * @return void
476
- */
477
- public function check_php_version() {
478
- // Intentionally left empty.
479
- }
480
  }
439
  $helpscout_settings['ask_consent']
440
  );
441
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
442
  }
admin/class-asset.php CHANGED
@@ -247,23 +247,4 @@ class WPSEO_Admin_Asset {
247
  public function get_suffix() {
248
  return $this->suffix;
249
  }
250
-
251
- /**
252
- * Returns the full URL for this asset based on the path to the plugin file.
253
- *
254
- * @deprecated 6.2
255
- * @codeCoverageIgnore
256
- *
257
- * @param string $type Type of asset.
258
- * @param string $plugin_file Absolute path to the plugin file.
259
- *
260
- * @return string The full URL to the asset.
261
- */
262
- public function get_url( $type, $plugin_file ) {
263
- _deprecated_function( __CLASS__ . '::get_url', '6.2', 'WPSEO_Admin_Asset_SEO_Location::get_url' );
264
-
265
- $asset_location = new WPSEO_Admin_Asset_SEO_Location( $plugin_file );
266
-
267
- return $asset_location->get_url( $this, $type );
268
- }
269
  }
247
  public function get_suffix() {
248
  return $this->suffix;
249
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
250
  }
admin/class-config.php CHANGED
@@ -56,23 +56,44 @@ class WPSEO_Admin_Pages {
56
  wp_enqueue_style( 'global' );
57
  wp_enqueue_style( 'wp-admin' );
58
  $this->asset_manager->enqueue_style( 'select2' );
59
-
60
  $this->asset_manager->enqueue_style( 'admin-css' );
 
 
 
 
 
61
  }
62
 
63
  /**
64
  * Loads the required scripts for the config page.
65
  */
66
  public function config_page_scripts() {
67
- $this->asset_manager->enqueue_script( 'admin-script' );
 
 
 
 
 
 
68
 
69
  $page = filter_input( INPUT_GET, 'page' );
70
 
71
  if ( $page === 'wpseo_titles' ) {
72
- wp_localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'search-appearance', 'wpseoReplaceVarsL10n', $this->localize_replace_vars_script() );
73
- wp_localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'search-appearance', 'wpseoSearchAppearance', $this->localize_search_appearance_script() );
74
- $this->asset_manager->enqueue_script( 'search-appearance' );
75
- $this->asset_manager->enqueue_style( 'search-appearance' );
 
 
 
 
 
 
 
 
 
 
 
76
  /**
77
  * Remove the emoji script as it is incompatible with both React and any
78
  * contenteditable fields.
@@ -83,32 +104,19 @@ class WPSEO_Admin_Pages {
83
  $yoast_components_l10n->localize_script( 'search-appearance' );
84
  }
85
 
86
- wp_enqueue_script( 'dashboard' );
87
- wp_enqueue_script( 'thickbox' );
88
-
89
- wp_localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'admin-script', 'wpseoSelect2Locale', WPSEO_Language_Utils::get_language( WPSEO_Language_Utils::get_user_locale() ) );
90
-
91
  if ( in_array( $page, [ 'wpseo_social', WPSEO_Admin::PAGE_IDENTIFIER, 'wpseo_titles' ], true ) ) {
92
  wp_enqueue_media();
93
 
94
- $this->asset_manager->enqueue_script( 'admin-media' );
95
- wp_localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'admin-media', 'wpseoMediaL10n', $this->localize_media_script() );
 
96
  }
97
 
98
  if ( $page === 'wpseo_tools' ) {
99
  $this->enqueue_tools_scripts();
100
  }
101
- }
102
 
103
- /**
104
- * Retrieves some variables that are needed for the upload module in JS.
105
- *
106
- * @return array The upload module variables.
107
- */
108
- public function localize_media_script() {
109
- return [
110
- 'choose_image' => __( 'Use Image', 'wordpress-seo' ),
111
- ];
112
  }
113
 
114
  /**
@@ -116,7 +124,7 @@ class WPSEO_Admin_Pages {
116
  *
117
  * @return array The replacement and recommended replacement variables.
118
  */
119
- public function localize_replace_vars_script() {
120
  $replace_vars = new WPSEO_Replace_Vars();
121
  $recommended_replace_vars = new WPSEO_Admin_Recommended_Replace_Vars();
122
  $editor_specific_replace_vars = new WPSEO_Admin_Editor_Specific_Replace_Vars();
@@ -130,25 +138,6 @@ class WPSEO_Admin_Pages {
130
  ];
131
  }
132
 
133
- /**
134
- * Retrieves some variables that are needed for the search appearance in JS.
135
- *
136
- * @return array The search appearance variables.
137
- */
138
- public function localize_search_appearance_script() {
139
- $search_appearance_l10n = [
140
- 'isRtl' => is_rtl(),
141
- 'userEditUrl' => add_query_arg( 'user_id', '{user_id}', admin_url( 'user-edit.php' ) ),
142
- 'brushstrokeBackgroundURL' => plugins_url( 'images/brushstroke_background.svg', WPSEO_FILE ),
143
- 'showLocalSEOUpsell' => $this->should_show_local_seo_upsell(),
144
- 'localSEOUpsellURL' => WPSEO_Shortlinker::get( 'https://yoa.st/3mp' ),
145
- ];
146
-
147
- $search_appearance_l10n['knowledgeGraphCompanyInfoMissing'] = WPSEO_Language_Utils::get_knowledge_graph_company_info_missing_l10n();
148
-
149
- return $search_appearance_l10n;
150
- }
151
-
152
  /**
153
  * Determines whether the Local SEO upsell should be shown.
154
  *
56
  wp_enqueue_style( 'global' );
57
  wp_enqueue_style( 'wp-admin' );
58
  $this->asset_manager->enqueue_style( 'select2' );
 
59
  $this->asset_manager->enqueue_style( 'admin-css' );
60
+
61
+ $page = filter_input( INPUT_GET, 'page' );
62
+ if ( $page === 'wpseo_titles' ) {
63
+ $this->asset_manager->enqueue_style( 'search-appearance' );
64
+ }
65
  }
66
 
67
  /**
68
  * Loads the required scripts for the config page.
69
  */
70
  public function config_page_scripts() {
71
+ $this->asset_manager->enqueue_script( 'settings' );
72
+ wp_enqueue_script( 'dashboard' );
73
+ wp_enqueue_script( 'thickbox' );
74
+
75
+ $script_data = [
76
+ 'userLanguageCode' => WPSEO_Language_Utils::get_language( WPSEO_Language_Utils::get_user_locale() ),
77
+ ];
78
 
79
  $page = filter_input( INPUT_GET, 'page' );
80
 
81
  if ( $page === 'wpseo_titles' ) {
82
+ $script_data['analysis'] = [
83
+ 'plugins' => [
84
+ 'replaceVars' => $this->get_replace_vars_script_data(),
85
+ ],
86
+ ];
87
+
88
+ $script_data['searchAppearance'] = [
89
+ 'isRtl' => is_rtl(),
90
+ 'userEditUrl' => add_query_arg( 'user_id', '{user_id}', admin_url( 'user-edit.php' ) ),
91
+ 'brushstrokeBackgroundURL' => plugins_url( 'images/brushstroke_background.svg', WPSEO_FILE ),
92
+ 'showLocalSEOUpsell' => $this->should_show_local_seo_upsell(),
93
+ 'localSEOUpsellURL' => WPSEO_Shortlinker::get( 'https://yoa.st/3mp' ),
94
+ 'knowledgeGraphCompanyInfoMissing' => WPSEO_Language_Utils::get_knowledge_graph_company_info_missing_l10n(),
95
+ ];
96
+
97
  /**
98
  * Remove the emoji script as it is incompatible with both React and any
99
  * contenteditable fields.
104
  $yoast_components_l10n->localize_script( 'search-appearance' );
105
  }
106
 
 
 
 
 
 
107
  if ( in_array( $page, [ 'wpseo_social', WPSEO_Admin::PAGE_IDENTIFIER, 'wpseo_titles' ], true ) ) {
108
  wp_enqueue_media();
109
 
110
+ $script_data['media'] = [
111
+ 'choose_image' => __( 'Use Image', 'wordpress-seo' ),
112
+ ];
113
  }
114
 
115
  if ( $page === 'wpseo_tools' ) {
116
  $this->enqueue_tools_scripts();
117
  }
 
118
 
119
+ wp_localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'settings', 'wpseoScriptData', $script_data );
 
 
 
 
 
 
 
 
120
  }
121
 
122
  /**
124
  *
125
  * @return array The replacement and recommended replacement variables.
126
  */
127
+ public function get_replace_vars_script_data() {
128
  $replace_vars = new WPSEO_Replace_Vars();
129
  $recommended_replace_vars = new WPSEO_Admin_Recommended_Replace_Vars();
130
  $editor_specific_replace_vars = new WPSEO_Admin_Editor_Specific_Replace_Vars();
138
  ];
139
  }
140
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
141
  /**
142
  * Determines whether the Local SEO upsell should be shown.
143
  *
admin/class-gutenberg-compatibility.php CHANGED
@@ -15,14 +15,14 @@ class WPSEO_Gutenberg_Compatibility {
15
  *
16
  * @var string
17
  */
18
- const CURRENT_RELEASE = '8.4.0';
19
 
20
  /**
21
  * The minimally supported version of Gutenberg by the plugin.
22
  *
23
  * @var string
24
  */
25
- const MINIMUM_SUPPORTED = '8.4.0';
26
 
27
  /**
28
  * Holds the current version.
15
  *
16
  * @var string
17
  */
18
+ const CURRENT_RELEASE = '8.5.1';
19
 
20
  /**
21
  * The minimally supported version of Gutenberg by the plugin.
22
  *
23
  * @var string
24
  */
25
+ const MINIMUM_SUPPORTED = '8.5.1';
26
 
27
  /**
28
  * Holds the current version.
admin/class-primary-term-admin.php CHANGED
@@ -131,7 +131,7 @@ class WPSEO_Primary_Term_Admin implements WPSEO_WordPress_Integration {
131
  $data = [
132
  'taxonomies' => $mapped_taxonomies,
133
  ];
134
- wp_localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'primary-category', 'wpseoPrimaryCategoryL10n', $data );
135
  }
136
 
137
  /**
131
  $data = [
132
  'taxonomies' => $mapped_taxonomies,
133
  ];
134
+ wp_localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'post-edit', 'wpseoPrimaryCategoryL10n', $data );
135
  }
136
 
137
  /**
admin/class-social-admin.php DELETED
@@ -1,266 +0,0 @@
1
- <?php
2
- /**
3
- * WPSEO plugin file.
4
- *
5
- * @package WPSEO\Admin
6
- */
7
-
8
- /**
9
- * This class adds the Social tab to the Yoast SEO metabox and makes sure the settings are saved.
10
- */
11
- class WPSEO_Social_Admin extends WPSEO_Metabox {
12
-
13
- /**
14
- * Class constructor.
15
- */
16
- public function __construct() {
17
- self::translate_meta_boxes();
18
- add_filter( 'wpseo_save_metaboxes', [ $this, 'save_meta_boxes' ], 10, 1 );
19
- add_action( 'wpseo_save_compare_data', [ $this, 'og_data_compare' ], 10, 1 );
20
- }
21
-
22
- /**
23
- * Translate text strings for use in the meta box.
24
- *
25
- * IMPORTANT: if you want to add a new string (option) somewhere, make sure you add that array key to
26
- * the main meta box definition array in the class WPSEO_Meta() as well!!!!
27
- */
28
- public static function translate_meta_boxes() {
29
- /* translators: %s expands to the social network's name. */
30
- $title_text = __( 'If you don\'t want to use the post title for sharing the post on %s but instead want another title there, write it here.', 'wordpress-seo' );
31
-
32
- /* translators: %s expands to the social network's name. */
33
- $description_text = __( 'If you don\'t want to use the meta description for sharing the post on %s but want another description there, write it here.', 'wordpress-seo' );
34
-
35
- /* translators: %s expands to the social network's name. */
36
- $image_text = __( 'If you want to override the image used on %s for this post, upload / choose an image here.', 'wordpress-seo' );
37
-
38
- /* translators: %1$s expands to the social network, %2$s to the recommended image size. */
39
- $image_size_text = __( 'The recommended image size for %1$s is %2$s pixels.', 'wordpress-seo' );
40
-
41
- $social_networks = [
42
- 'opengraph' => __( 'Facebook', 'wordpress-seo' ),
43
- 'twitter' => __( 'Twitter', 'wordpress-seo' ),
44
- ];
45
-
46
- // Source: https://blog.bufferapp.com/ideal-image-sizes-social-media-posts.
47
- $recommended_image_sizes = [
48
- /* translators: %1$s expands to the image recommended width, %2$s to its height. */
49
- 'opengraph' => sprintf( __( '%1$s by %2$s', 'wordpress-seo' ), '1200', '630' ),
50
- // Source: https://developers.facebook.com/docs/sharing/best-practices#images.
51
- /* translators: %1$s expands to the image recommended width, %2$s to its height. */
52
- 'twitter' => sprintf( __( '%1$s by %2$s', 'wordpress-seo' ), '1024', '512' ),
53
- ];
54
-
55
- foreach ( $social_networks as $network => $label ) {
56
- if ( WPSEO_Options::get( $network, false ) === true ) {
57
- /* translators: %s expands to the name of a social network. */
58
- WPSEO_Meta::$meta_fields['social'][ $network . '-title' ]['title'] = sprintf( __( '%s Title', 'wordpress-seo' ), $label );
59
- WPSEO_Meta::$meta_fields['social'][ $network . '-title' ]['description'] = sprintf( $title_text, $label );
60
-
61
- /* translators: %s expands to the name of a social network. */
62
- WPSEO_Meta::$meta_fields['social'][ $network . '-description' ]['title'] = sprintf( __( '%s Description', 'wordpress-seo' ), $label );
63
- WPSEO_Meta::$meta_fields['social'][ $network . '-description' ]['description'] = sprintf( $description_text, $label );
64
-
65
- /* translators: %s expands to the name of a social network. */
66
- WPSEO_Meta::$meta_fields['social'][ $network . '-image' ]['title'] = sprintf( __( '%s Image', 'wordpress-seo' ), $label );
67
- WPSEO_Meta::$meta_fields['social'][ $network . '-image' ]['description'] = sprintf( $image_text, $label ) . ' ' . sprintf( $image_size_text, $label, $recommended_image_sizes[ $network ] );
68
- }
69
- }
70
- }
71
-
72
- /**
73
- * Returns the metabox section for the social settings.
74
- *
75
- * @return WPSEO_Metabox_Collapsibles_Sections
76
- */
77
- public function get_meta_section() {
78
- $tabs = [];
79
- $social_meta_fields = WPSEO_Meta::get_meta_field_defs( 'social' );
80
-
81
- $opengraph = WPSEO_Options::get( 'opengraph' );
82
- $twitter = WPSEO_Options::get( 'twitter' );
83
-
84
- if ( $opengraph === true && $twitter === true ) {
85
- $single = null;
86
- }
87
-
88
- wp_nonce_field( 'yoast_free_metabox_social', 'yoast_free_metabox_social_nonce' );
89
-
90
- if ( $opengraph === true ) {
91
- $tabs[] = new WPSEO_Metabox_Collapsible(
92
- 'facebook',
93
- $this->get_social_tab_content( 'opengraph', $social_meta_fields ),
94
- __( 'Facebook', 'wordpress-seo' )
95
- );
96
- }
97
-
98
- if ( $twitter === true ) {
99
- $tabs[] = new WPSEO_Metabox_Collapsible(
100
- 'twitter',
101
- $this->get_social_tab_content( 'twitter', $social_meta_fields ),
102
- __( 'Twitter', 'wordpress-seo' )
103
- );
104
- }
105
-
106
- return new WPSEO_Metabox_Collapsibles_Sections(
107
- 'social',
108
- '<span class="dashicons dashicons-share"></span>' . __( 'Social', 'wordpress-seo' ),
109
- $tabs
110
- );
111
- }
112
-
113
- /**
114
- * Generates the html for a social settings tab for one of the supported social media.
115
- *
116
- * @param string $medium Medium. Can be 'opengraph' or 'twitter'.
117
- * @param array $meta_field_defs The social meta field definitions.
118
- *
119
- * @return string
120
- */
121
- private function get_social_tab_content( $medium, $meta_field_defs ) {
122
- $field_names = [
123
- $medium . '-title',
124
- $medium . '-description',
125
- $medium . '-image',
126
- $medium . '-image-id',
127
- ];
128
-
129
- $tab_content = $this->get_premium_notice( $medium );
130
-
131
- foreach ( $field_names as $field_name ) {
132
- $tab_content .= $this->do_meta_box( $meta_field_defs[ $field_name ], $field_name );
133
- }
134
-
135
- /**
136
- * If premium hide the form to show the social preview instead, we still need the fields to be output because
137
- * the values of the social preview are saved in the hidden field.
138
- */
139
- $features = new WPSEO_Features();
140
- if ( $features->is_premium() ) {
141
- return $this->hide_form( $tab_content );
142
- }
143
-
144
- return $tab_content;
145
- }
146
-
147
- /**
148
- * Hides the given output when rendered to HTML.
149
- *
150
- * @param string $tab_content The social tab content.
151
- *
152
- * @return string The content.
153
- */
154
- private function hide_form( $tab_content ) {
155
- return '<div class="hidden">' . $tab_content . '</div>';
156
- }
157
-
158
- /**
159
- * Returns the Upgrade to Premium notice.
160
- *
161
- * @param string $network The social network.
162
- *
163
- * @return string The notice HTML on the free version, empty string on premium.
164
- */
165
- public function get_premium_notice( $network ) {
166
- $features = new WPSEO_Features();
167
- if ( $features->is_premium() ) {
168
- return '';
169
- }
170
-
171
- $network_name = __( 'Facebook', 'wordpress-seo' );
172
-
173
- if ( $network === 'twitter' ) {
174
- $network_name = __( 'Twitter', 'wordpress-seo' );
175
- }
176
-
177
- return sprintf(
178
- '<div class="notice inline yoast-notice yoast-notice-go-premium">
179
- <p>%1$s</p>
180
- <p><a href="%2$s" target="_blank">%3$s</a></p>
181
- </div>',
182
- sprintf(
183
- /* translators: %1$s expands to the social network's name, %2$s to Yoast SEO Premium. */
184
- esc_html__( 'Do you want to preview what it will look like if people share this post on %1$s? You can, with %2$s.', 'wordpress-seo' ),
185
- esc_html( $network_name ),
186
- '<strong>Yoast SEO Premium</strong>'
187
- ),
188
- esc_url( WPSEO_Shortlinker::get( 'https://yoa.st/179' ) ),
189
- sprintf(
190
- /* translators: %s expands to Yoast SEO Premium. */
191
- esc_html__( 'Find out why you should upgrade to %s', 'wordpress-seo' ),
192
- 'Yoast SEO Premium'
193
- )
194
- );
195
- }
196
-
197
- /**
198
- * Filter over the meta boxes to save, this function adds the Social meta boxes.
199
- *
200
- * @param array $field_defs Array of metaboxes to save.
201
- *
202
- * @return array
203
- */
204
- public function save_meta_boxes( $field_defs ) {
205
- if ( ! isset( $_POST['yoast_free_metabox_social_nonce'] ) || ! wp_verify_nonce( $_POST['yoast_free_metabox_social_nonce'], 'yoast_free_metabox_social' ) ) {
206
- return $field_defs;
207
- }
208
-
209
- return array_merge( $field_defs, WPSEO_Meta::get_meta_field_defs( 'social' ) );
210
- }
211
-
212
- /**
213
- * This method will compare opengraph fields with the posted values.
214
- *
215
- * When fields are changed, the facebook cache will be purged.
216
- *
217
- * @param WP_Post $post Post instance.
218
- */
219
- public function og_data_compare( $post ) {
220
- if ( empty( $_POST ) ) {
221
- return;
222
- }
223
-
224
- if ( empty( $post->ID ) || $post->post_status !== 'publish' ) {
225
- return;
226
- }
227
-
228
- if ( ! isset( $_POST['yoast_free_metabox_social_nonce'] ) || ! wp_verify_nonce( $_POST['yoast_free_metabox_social_nonce'], 'yoast_free_metabox_social' ) ) {
229
- return;
230
- }
231
-
232
- if ( ! isset( $_POST['original_post_status'] ) || $_POST['original_post_status'] !== 'publish' ) {
233
- return;
234
- }
235
-
236
- $fields_to_compare = [
237
- 'opengraph-title',
238
- 'opengraph-description',
239
- 'opengraph-image',
240
- ];
241
-
242
- $reset_facebook_cache = false;
243
-
244
- foreach ( $fields_to_compare as $field_to_compare ) {
245
- $old_value = WPSEO_Meta::get_value( $field_to_compare, $post->ID );
246
-
247
- $new_value = '';
248
- $post_key = WPSEO_Meta::$form_prefix . $field_to_compare;
249
- if ( isset( $_POST[ $post_key ] ) ) {
250
- $new_value = sanitize_text_field( wp_unslash( $_POST[ $post_key ] ) );
251
- }
252
-
253
- if ( $old_value !== $new_value ) {
254
- $reset_facebook_cache = true;
255
- break;
256
- }
257
- }
258
- unset( $old_value, $new_value );
259
-
260
- if ( $reset_facebook_cache ) {
261
- wp_remote_get(
262
- 'https://graph.facebook.com/?id=' . get_permalink( $post->ID ) . '&scrape=true&method=post'
263
- );
264
- }
265
- }
266
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/class-yoast-form.php CHANGED
@@ -792,26 +792,4 @@ class Yoast_Form {
792
 
793
  return '<p class="disabled-note">' . esc_html__( 'This feature has been disabled by the network admin.', 'wordpress-seo' ) . '</p>';
794
  }
795
-
796
- /* ********************* DEPRECATED METHODS ********************* */
797
-
798
- /**
799
- * Retrieve options based on whether we're on multisite or not.
800
- *
801
- * @since 1.2.4
802
- * @since 2.0 Moved to this class.
803
- * @deprecated 8.4
804
- * @codeCoverageIgnore
805
- *
806
- * @return array The option's value.
807
- */
808
- public function get_option() {
809
- _deprecated_function( __METHOD__, 'WPSEO 8.4' );
810
-
811
- if ( is_network_admin() ) {
812
- return get_site_option( $this->option_name );
813
- }
814
-
815
- return get_option( $this->option_name );
816
- }
817
  }
792
 
793
  return '<p class="disabled-note">' . esc_html__( 'This feature has been disabled by the network admin.', 'wordpress-seo' ) . '</p>';
794
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
795
  }
admin/config-ui/class-configuration-options-adapter.php CHANGED
@@ -202,23 +202,4 @@ class WPSEO_Configuration_Options_Adapter {
202
 
203
  return $this->lookup[ $class_name ]['option'];
204
  }
205
-
206
- /* ********************* DEPRECATED METHODS ********************* */
207
-
208
- /**
209
- * Add a lookup for a Yoast option.
210
- *
211
- * @deprecated 7.0
212
- * @codeCoverageIgnore
213
- *
214
- * @param string $class_name Class to bind to the lookup.
215
- * @param string $option Option group to use.
216
- * @param string $key Key in the option group to bind to.
217
- *
218
- * @throws InvalidArgumentException Thrown when invalid input is provided.
219
- */
220
- public function add_yoast_lookup( $class_name, $option, $key ) {
221
- _deprecated_function( __METHOD__, 'WPSEO 7.0', 'WPSEO_Configuration_Options_Adapter::add_option_lookup' );
222
- $this->add_option_lookup( $class_name, $key );
223
- }
224
  }
202
 
203
  return $this->lookup[ $class_name ]['option'];
204
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
205
  }
admin/config-ui/class-configuration-translations.php CHANGED
@@ -27,7 +27,7 @@ class WPSEO_Configuration_Translations {
27
  /**
28
  * Sets the translations based on the file.
29
  *
30
- * @param string $locale The locale to retreive the translations for.
31
  */
32
  public function __construct( $locale ) {
33
  $this->locale = $locale;
@@ -52,6 +52,7 @@ class WPSEO_Configuration_Translations {
52
 
53
  $file = plugin_dir_path( WPSEO_FILE ) . 'languages/yoast-components-' . $this->locale . '.json';
54
  if ( file_exists( $file ) ) {
 
55
  $file = file_get_contents( $file );
56
  if ( is_string( $file ) && $file !== '' ) {
57
  return json_decode( $file, true );
27
  /**
28
  * Sets the translations based on the file.
29
  *
30
+ * @param string $locale The locale to retrieve the translations for.
31
  */
32
  public function __construct( $locale ) {
33
  $this->locale = $locale;
52
 
53
  $file = plugin_dir_path( WPSEO_FILE ) . 'languages/yoast-components-' . $this->locale . '.json';
54
  if ( file_exists( $file ) ) {
55
+ // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents -- Retrieving a local file.
56
  $file = file_get_contents( $file );
57
  if ( is_string( $file ) && $file !== '' ) {
58
  return json_decode( $file, true );
admin/config-ui/components/class-component-suggestions.php CHANGED
@@ -81,7 +81,7 @@ class WPSEO_Config_Component_Suggestions implements WPSEO_Config_Component {
81
  [
82
  'label' => 'Local SEO',
83
  'type' => 'link',
84
- 'url' => WPSEO_Shortlinker::get( 'https://yoa.st/wizard-suggestion-localseo' ),
85
  ],
86
  [
87
  'url' => WPSEO_Shortlinker::get( 'https://yoa.st/video-localseo' ),
81
  [
82
  'label' => 'Local SEO',
83
  'type' => 'link',
84
+ 'href' => WPSEO_Shortlinker::get( 'https://yoa.st/wizard-suggestion-local-seo' ),
85
  ],
86
  [
87
  'url' => WPSEO_Shortlinker::get( 'https://yoa.st/video-localseo' ),
admin/formatter/class-metabox-formatter.php CHANGED
@@ -48,6 +48,9 @@ class WPSEO_Metabox_Formatter {
48
  $analysis_readability = new WPSEO_Metabox_Analysis_Readability();
49
 
50
  return [
 
 
 
51
  'language' => WPSEO_Language_Utils::get_site_language_name(),
52
  'settings_link' => $this->get_settings_link(),
53
  'search_url' => '',
@@ -71,6 +74,10 @@ class WPSEO_Metabox_Formatter {
71
  'addKeywordUpsell' => $this->get_add_keyword_upsell_translations(),
72
  'wordFormRecognitionActive' => YoastSEO()->helpers->language->is_word_form_recognition_active( WPSEO_Language_Utils::get_language( get_locale() ) ),
73
  'siteIconUrl' => get_site_icon_url(),
 
 
 
 
74
 
75
  /**
76
  * Filter to determine if the markers should be enabled or not.
@@ -228,6 +235,7 @@ class WPSEO_Metabox_Formatter {
228
 
229
  $file = plugin_dir_path( WPSEO_FILE ) . 'languages/wordpress-seo-' . $locale . '.json';
230
  if ( file_exists( $file ) ) {
 
231
  $file = file_get_contents( $file );
232
  if ( is_string( $file ) && $file !== '' ) {
233
  return json_decode( $file, true );
48
  $analysis_readability = new WPSEO_Metabox_Analysis_Readability();
49
 
50
  return [
51
+ 'author_name' => get_the_author_meta( 'display_name' ),
52
+ 'site_name' => get_bloginfo( 'name' ),
53
+ 'sitewide_social_image' => WPSEO_Options::get( 'og_default_image' ),
54
  'language' => WPSEO_Language_Utils::get_site_language_name(),
55
  'settings_link' => $this->get_settings_link(),
56
  'search_url' => '',
74
  'addKeywordUpsell' => $this->get_add_keyword_upsell_translations(),
75
  'wordFormRecognitionActive' => YoastSEO()->helpers->language->is_word_form_recognition_active( WPSEO_Language_Utils::get_language( get_locale() ) ),
76
  'siteIconUrl' => get_site_icon_url(),
77
+ 'showSocial' => [
78
+ 'facebook' => WPSEO_Options::get( 'opengraph', false ),
79
+ 'twitter' => WPSEO_Options::get( 'twitter', false ),
80
+ ],
81
 
82
  /**
83
  * Filter to determine if the markers should be enabled or not.
235
 
236
  $file = plugin_dir_path( WPSEO_FILE ) . 'languages/wordpress-seo-' . $locale . '.json';
237
  if ( file_exists( $file ) ) {
238
+ // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents -- Retrieving a local file.
239
  $file = file_get_contents( $file );
240
  if ( is_string( $file ) && $file !== '' ) {
241
  return json_decode( $file, true );
admin/formatter/class-post-metabox-formatter.php CHANGED
@@ -60,11 +60,11 @@ class WPSEO_Post_Metabox_Formatter implements WPSEO_Metabox_Formatter_Interface
60
 
61
  if ( $this->post instanceof WP_Post ) {
62
  $values_to_set = [
63
- 'keyword_usage' => $this->get_focus_keyword_usage(),
64
- 'title_template' => $this->get_title_template(),
65
- 'metadesc_template' => $this->get_metadesc_template(),
66
- 'metaDescriptionDate' => $this->get_metadesc_date(),
67
- 'social_preview_image_url' => $this->get_image_url(),
68
  ];
69
 
70
  $values = ( $values_to_set + $values );
@@ -83,7 +83,7 @@ class WPSEO_Post_Metabox_Formatter implements WPSEO_Metabox_Formatter_Interface
83
 
84
  if ( has_post_thumbnail( $post_id ) ) {
85
  $featured_image_info = wp_get_attachment_image_src( get_post_thumbnail_id( $post_id ), 'thumbnail' );
86
- return $featured_image_info[0];
87
  }
88
 
89
  return WPSEO_Image_Utils::get_first_usable_content_image_for_post( $post_id );
60
 
61
  if ( $this->post instanceof WP_Post ) {
62
  $values_to_set = [
63
+ 'keyword_usage' => $this->get_focus_keyword_usage(),
64
+ 'title_template' => $this->get_title_template(),
65
+ 'metadesc_template' => $this->get_metadesc_template(),
66
+ 'metaDescriptionDate' => $this->get_metadesc_date(),
67
+ 'first_content_image' => $this->get_image_url(),
68
  ];
69
 
70
  $values = ( $values_to_set + $values );
83
 
84
  if ( has_post_thumbnail( $post_id ) ) {
85
  $featured_image_info = wp_get_attachment_image_src( get_post_thumbnail_id( $post_id ), 'thumbnail' );
86
+ return isset( $featured_image_info[0] ) ? $featured_image_info[0] : null;
87
  }
88
 
89
  return WPSEO_Image_Utils::get_first_usable_content_image_for_post( $post_id );
admin/formatter/class-term-metabox-formatter.php CHANGED
@@ -53,14 +53,14 @@ class WPSEO_Term_Metabox_Formatter implements WPSEO_Metabox_Formatter_Interface
53
  // Todo: a column needs to be added on the termpages to add a filter for the keyword, so this can be used in the focus keyphrase doubles.
54
  if ( is_object( $this->term ) && property_exists( $this->term, 'taxonomy' ) ) {
55
  $values = [
56
- 'search_url' => $this->search_url(),
57
- 'post_edit_url' => $this->edit_url(),
58
- 'base_url' => $this->base_url_for_js(),
59
- 'taxonomy' => $this->term->taxonomy,
60
- 'keyword_usage' => $this->get_focus_keyword_usage(),
61
- 'title_template' => $this->get_title_template(),
62
- 'metadesc_template' => $this->get_metadesc_template(),
63
- 'social_preview_image_url' => $this->get_image_url(),
64
  ];
65
  }
66
 
53
  // Todo: a column needs to be added on the termpages to add a filter for the keyword, so this can be used in the focus keyphrase doubles.
54
  if ( is_object( $this->term ) && property_exists( $this->term, 'taxonomy' ) ) {
55
  $values = [
56
+ 'search_url' => $this->search_url(),
57
+ 'post_edit_url' => $this->edit_url(),
58
+ 'base_url' => $this->base_url_for_js(),
59
+ 'taxonomy' => $this->term->taxonomy,
60
+ 'keyword_usage' => $this->get_focus_keyword_usage(),
61
+ 'title_template' => $this->get_title_template(),
62
+ 'metadesc_template' => $this->get_metadesc_template(),
63
+ 'first_content_image' => $this->get_image_url(),
64
  ];
65
  }
66
 
admin/google_search_console/class-gsc.php CHANGED
@@ -125,17 +125,4 @@ class WPSEO_GSC implements WPSEO_WordPress_Integration {
125
  public function set_help() {
126
  _deprecated_function( __METHOD__, 'WPSEO 12.5' );
127
  }
128
-
129
- /**
130
- * Run init logic.
131
- *
132
- * @codeCoverageIgnore
133
- *
134
- * @deprecated 9.5
135
- *
136
- * @return void
137
- */
138
- public function init() {
139
- _deprecated_function( __METHOD__, 'WPSEO 9.5' );
140
- }
141
  }
125
  public function set_help() {
126
  _deprecated_function( __METHOD__, 'WPSEO 12.5' );
127
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
128
  }
admin/import/plugins/class-abstract-plugin-importer.php CHANGED
@@ -156,14 +156,16 @@ abstract class WPSEO_Plugin_Importer {
156
  protected function detect() {
157
  global $wpdb;
158
 
159
- $meta_keys = wp_list_pluck( $this->clone_keys, 'old_key' );
160
- $placeholders = implode( ', ', array_fill( 0, count( $meta_keys ), '%s' ) );
161
- $result = $wpdb->get_var(
162
  $wpdb->prepare(
163
- "SELECT COUNT(*) AS `count` FROM {$wpdb->postmeta} WHERE meta_key IN ( $placeholders )",
 
 
164
  $meta_keys
165
  )
166
  );
 
167
  if ( $result === '0' ) {
168
  return false;
169
  }
156
  protected function detect() {
157
  global $wpdb;
158
 
159
+ $meta_keys = wp_list_pluck( $this->clone_keys, 'old_key' );
160
+ $result = $wpdb->get_var(
 
161
  $wpdb->prepare(
162
+ "SELECT COUNT(*) AS `count`
163
+ FROM {$wpdb->postmeta}
164
+ WHERE meta_key IN ( " . implode( ', ', array_fill( 0, count( $meta_keys ), '%s' ) ) . ' )',
165
  $meta_keys
166
  )
167
  );
168
+
169
  if ( $result === '0' ) {
170
  return false;
171
  }
admin/import/plugins/class-import-rankmath.php CHANGED
@@ -114,6 +114,7 @@ class WPSEO_Import_RankMath extends WPSEO_Plugin_Importer {
114
  global $wpdb;
115
  $post_metas = $wpdb->get_results( "SELECT post_id, meta_value FROM $wpdb->postmeta WHERE meta_key = 'rank_math_robots'" );
116
  foreach ( $post_metas as $post_meta ) {
 
117
  $robots_values = unserialize( $post_meta->meta_value );
118
  foreach ( [ 'noindex', 'nofollow' ] as $directive ) {
119
  $directive_key = array_search( $directive, $robots_values, true );
114
  global $wpdb;
115
  $post_metas = $wpdb->get_results( "SELECT post_id, meta_value FROM $wpdb->postmeta WHERE meta_key = 'rank_math_robots'" );
116
  foreach ( $post_metas as $post_meta ) {
117
+ // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions -- Reason: We can't control the form in which Rankmath sends the data.
118
  $robots_values = unserialize( $post_meta->meta_value );
119
  foreach ( [ 'noindex', 'nofollow' ] as $directive ) {
120
  $directive_key = array_search( $directive, $robots_values, true );
admin/import/plugins/class-import-squirrly.php CHANGED
@@ -187,11 +187,16 @@ class WPSEO_Import_Squirrly extends WPSEO_Plugin_Importer {
187
  if ( ! is_numeric( $post_identifier ) ) {
188
  $query_where = 'URL = %s';
189
  }
 
 
 
 
 
 
190
  $data = $wpdb->get_var(
191
  $wpdb->prepare(
192
  "SELECT seo FROM {$this->table_name} WHERE blog_id = %d AND " . $query_where,
193
- get_current_blog_id(),
194
- $post_identifier
195
  )
196
  );
197
  if ( ! $data || is_wp_error( $data ) ) {
187
  if ( ! is_numeric( $post_identifier ) ) {
188
  $query_where = 'URL = %s';
189
  }
190
+
191
+ $replacements = [
192
+ get_current_blog_id(),
193
+ $post_identifier,
194
+ ];
195
+
196
  $data = $wpdb->get_var(
197
  $wpdb->prepare(
198
  "SELECT seo FROM {$this->table_name} WHERE blog_id = %d AND " . $query_where,
199
+ $replacements
 
200
  )
201
  );
202
  if ( ! $data || is_wp_error( $data ) ) {
admin/links/class-link-storage.php CHANGED
@@ -24,15 +24,6 @@ class WPSEO_Link_Storage implements WPSEO_Installable {
24
  */
25
  protected $database_proxy;
26
 
27
- /**
28
- * Holds the prefix of the database table.
29
- *
30
- * @deprecated 7.4
31
- *
32
- * @var null|string
33
- */
34
- protected $table_prefix;
35
-
36
  /**
37
  * Initializes the database table.
38
  *
24
  */
25
  protected $database_proxy;
26
 
 
 
 
 
 
 
 
 
 
27
  /**
28
  * Initializes the database table.
29
  *
admin/metabox/class-metabox.php CHANGED
@@ -13,11 +13,11 @@ use Yoast\WP\SEO\Presenters\Admin\Alert_Presenter;
13
  class WPSEO_Metabox extends WPSEO_Meta {
14
 
15
  /**
16
- * An instance of the Social Admin class.
17
  *
18
- * @var WPSEO_Social_Admin
19
  */
20
- protected $social_admin;
21
 
22
  /**
23
  * An instance of the Metabox Analysis SEO class.
@@ -56,14 +56,11 @@ class WPSEO_Metabox extends WPSEO_Meta {
56
  add_action( 'add_attachment', [ $this, 'save_postdata' ] );
57
  add_action( 'admin_init', [ $this, 'translate_meta_boxes' ] );
58
 
59
- // Check if one of the social settings is checked in the options, if so, initialize the social_admin object.
60
- if ( WPSEO_Options::get( 'opengraph', false ) || WPSEO_Options::get( 'twitter', false ) ) {
61
- $this->social_admin = new WPSEO_Social_Admin();
62
- }
63
-
64
  $this->editor = new WPSEO_Metabox_Editor();
65
  $this->editor->register_hooks();
66
 
 
 
67
  $this->analysis_seo = new WPSEO_Metabox_Analysis_SEO();
68
  $this->analysis_readability = new WPSEO_Metabox_Analysis_Readability();
69
  }
@@ -245,7 +242,7 @@ class WPSEO_Metabox extends WPSEO_Meta {
245
  *
246
  * @return array
247
  */
248
- public function localize_post_scraper_script() {
249
  $post = $this->get_metabox_post();
250
  $permalink = '';
251
 
@@ -269,19 +266,6 @@ class WPSEO_Metabox extends WPSEO_Meta {
269
  return $values;
270
  }
271
 
272
- /**
273
- * Passes some variables to js for replacing variables.
274
- */
275
- public function localize_replace_vars_script() {
276
- return [
277
- 'no_parent_text' => __( '(no parent)', 'wordpress-seo' ),
278
- 'replace_vars' => $this->get_replace_vars(),
279
- 'recommended_replace_vars' => $this->get_recommended_replace_vars(),
280
- 'scope' => $this->determine_scope(),
281
- 'has_taxonomies' => $this->current_post_type_has_taxonomies(),
282
- ];
283
- }
284
-
285
  /**
286
  * Determines whether or not the current post type has registered taxonomies.
287
  *
@@ -309,18 +293,6 @@ class WPSEO_Metabox extends WPSEO_Meta {
309
  return 'post';
310
  }
311
 
312
- /**
313
- * Passes some variables to js for the edit / post page overview, etc.
314
- *
315
- * @return array
316
- */
317
- public function localize_shortcode_plugin_script() {
318
- return [
319
- 'wpseo_filter_shortcodes_nonce' => wp_create_nonce( 'wpseo-filter-shortcodes' ),
320
- 'wpseo_shortcode_tags' => $this->get_valid_shortcode_tags(),
321
- ];
322
- }
323
-
324
  /**
325
  * Outputs the meta box.
326
  */
@@ -362,9 +334,9 @@ class WPSEO_Metabox extends WPSEO_Meta {
362
  $content_sections[] = $this->get_readability_meta_section();
363
  }
364
 
365
- // Check if social_admin is an instance of WPSEO_Social_Admin.
366
- if ( $this->social_admin instanceof WPSEO_Social_Admin ) {
367
- $content_sections[] = $this->social_admin->get_meta_section();
368
  }
369
 
370
  $content_sections = array_merge( $content_sections, $this->get_additional_meta_sections() );
@@ -372,6 +344,28 @@ class WPSEO_Metabox extends WPSEO_Meta {
372
  return $content_sections;
373
  }
374
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
375
  /**
376
  * Returns the metabox section for the seo analysis.
377
  *
@@ -721,8 +715,18 @@ class WPSEO_Metabox extends WPSEO_Meta {
721
 
722
  do_action( 'wpseo_save_compare_data', $post );
723
 
 
 
 
 
 
724
  $meta_boxes = apply_filters( 'wpseo_save_metaboxes', [] );
725
- $meta_boxes = array_merge( $meta_boxes, WPSEO_Meta::get_meta_field_defs( 'general', $post->post_type ), WPSEO_Meta::get_meta_field_defs( 'advanced' ) );
 
 
 
 
 
726
 
727
  foreach ( $meta_boxes as $key => $meta_box ) {
728
 
@@ -824,36 +828,11 @@ class WPSEO_Metabox extends WPSEO_Meta {
824
  $asset_manager->enqueue_style( 'select2' );
825
  $asset_manager->enqueue_style( 'monorepo' );
826
 
827
- $asset_manager->enqueue_script( 'metabox' );
828
- $asset_manager->enqueue_script( 'admin-media' );
829
-
830
- $asset_manager->enqueue_script( 'post-scraper' );
831
- $asset_manager->enqueue_script( 'replacevar-plugin' );
832
- $asset_manager->enqueue_script( 'shortcode-plugin' );
833
-
834
- $asset_manager->enqueue_script( 'admin-script' );
835
  $asset_manager->enqueue_style( 'admin-css' );
836
 
837
- wp_localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'admin-media', 'wpseoMediaL10n', $this->localize_media_script() );
838
- wp_localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'post-scraper', 'wpseoPostScraperL10n', $this->localize_post_scraper_script() );
839
  $yoast_components_l10n = new WPSEO_Admin_Asset_Yoast_Components_L10n();
840
- $yoast_components_l10n->localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'post-scraper' );
841
-
842
- $analysis_worker_location = new WPSEO_Admin_Asset_Analysis_Worker_Location( $asset_manager->flatten_version( WPSEO_VERSION ) );
843
- $used_keywords_assessment_location = new WPSEO_Admin_Asset_Analysis_Worker_Location( $asset_manager->flatten_version( WPSEO_VERSION ), 'used-keywords-assessment' );
844
-
845
- $localization_data = [
846
- 'url' => $analysis_worker_location->get_url( $analysis_worker_location->get_asset(), WPSEO_Admin_Asset::TYPE_JS ),
847
- 'keywords_assessment_url' => $used_keywords_assessment_location->get_url( $used_keywords_assessment_location->get_asset(), WPSEO_Admin_Asset::TYPE_JS ),
848
- 'log_level' => WPSEO_Utils::get_analysis_worker_log_level(),
849
- // We need to make the feature flags separately available inside of the analysis web worker.
850
- 'enabled_features' => WPSEO_Utils::retrieve_enabled_features(),
851
- ];
852
- wp_localize_script(
853
- WPSEO_Admin_Asset_Manager::PREFIX . 'post-scraper',
854
- 'wpseoAnalysisWorkerL10n',
855
- $localization_data
856
- );
857
 
858
  /**
859
  * Removes the emoji script as it is incompatible with both React and any
@@ -861,33 +840,54 @@ class WPSEO_Metabox extends WPSEO_Meta {
861
  */
862
  remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
863
 
864
- wp_localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'replacevar-plugin', 'wpseoReplaceVarsL10n', $this->localize_replace_vars_script() );
865
- wp_localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'shortcode-plugin', 'wpseoShortcodePluginL10n', $this->localize_shortcode_plugin_script() );
866
 
867
- wp_localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'metabox', 'wpseoAdminL10n', WPSEO_Utils::get_admin_l10n() );
868
- wp_localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'metabox', 'wpseoSelect2Locale', WPSEO_Language_Utils::get_language( WPSEO_Language_Utils::get_user_locale() ) );
869
 
870
- wp_localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'metabox', 'wpseoFeaturesL10n', WPSEO_Utils::retrieve_enabled_features() );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
871
 
872
  if ( post_type_supports( get_post_type(), 'thumbnail' ) ) {
873
  $asset_manager->enqueue_style( 'featured-image' );
874
 
875
- $asset_manager->enqueue_script( 'featured-image' );
876
-
877
- $featured_image_l10 = [ 'featured_image_notice' => __( 'SEO issue: The featured image should be at least 200 by 200 pixels to be picked up by Facebook and other social media sites.', 'wordpress-seo' ) ];
878
- wp_localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'metabox', 'wpseoFeaturedImageL10n', $featured_image_l10 );
879
  }
880
- }
881
 
882
- /**
883
- * Passes some variables to js for upload module.
884
- *
885
- * @return array
886
- */
887
- public function localize_media_script() {
888
- return [
889
- 'choose_image' => __( 'Use Image', 'wordpress-seo' ),
890
- ];
891
  }
892
 
893
  /**
@@ -1088,30 +1088,6 @@ class WPSEO_Metabox extends WPSEO_Meta {
1088
 
1089
  /* ********************* DEPRECATED METHODS ********************* */
1090
 
1091
- /**
1092
- * Outputs the page analysis score in the Publish Box.
1093
- *
1094
- * @deprecated 9.6
1095
- * @codeCoverageIgnore
1096
- *
1097
- * @return void
1098
- */
1099
- public function publish_box() {
1100
- _deprecated_function( __METHOD__, 'WPSEO 9.6' );
1101
- }
1102
-
1103
- /**
1104
- * Sets up all the functionality related to the prominence of the page analysis functionality.
1105
- *
1106
- * @deprecated 9.6
1107
- * @codeCoverageIgnore
1108
- *
1109
- * @return void
1110
- */
1111
- public function setup_page_analysis() {
1112
- _deprecated_function( __METHOD__, 'WPSEO 9.6' );
1113
- }
1114
-
1115
  /**
1116
  * Outputs a tab in the Yoast SEO Metabox.
1117
  *
13
  class WPSEO_Metabox extends WPSEO_Meta {
14
 
15
  /**
16
+ * Whether or not the social tab is enabled for this metabox.
17
  *
18
+ * @var bool
19
  */
20
+ private $social_is_enabled;
21
 
22
  /**
23
  * An instance of the Metabox Analysis SEO class.
56
  add_action( 'add_attachment', [ $this, 'save_postdata' ] );
57
  add_action( 'admin_init', [ $this, 'translate_meta_boxes' ] );
58
 
 
 
 
 
 
59
  $this->editor = new WPSEO_Metabox_Editor();
60
  $this->editor->register_hooks();
61
 
62
+ $this->social_is_enabled = WPSEO_Options::get( 'opengraph', false ) || WPSEO_Options::get( 'twitter', false );
63
+
64
  $this->analysis_seo = new WPSEO_Metabox_Analysis_SEO();
65
  $this->analysis_readability = new WPSEO_Metabox_Analysis_Readability();
66
  }
242
  *
243
  * @return array
244
  */
245
+ public function get_metabox_script_data() {
246
  $post = $this->get_metabox_post();
247
  $permalink = '';
248
 
266
  return $values;
267
  }
268
 
 
 
 
 
 
 
 
 
 
 
 
 
 
269
  /**
270
  * Determines whether or not the current post type has registered taxonomies.
271
  *
293
  return 'post';
294
  }
295
 
 
 
 
 
 
 
 
 
 
 
 
 
296
  /**
297
  * Outputs the meta box.
298
  */
334
  $content_sections[] = $this->get_readability_meta_section();
335
  }
336
 
337
+ // Whether social is enabled.
338
+ if ( $this->social_is_enabled ) {
339
+ $content_sections[] = $this->get_social_meta_section();
340
  }
341
 
342
  $content_sections = array_merge( $content_sections, $this->get_additional_meta_sections() );
344
  return $content_sections;
345
  }
346
 
347
+ /**
348
+ * Returns the social section for the social previews.
349
+ *
350
+ * @return WPSEO_Metabox_Section
351
+ */
352
+ private function get_social_meta_section() {
353
+ $content = '';
354
+
355
+ $content .= $this->get_tab_content( 'social' );
356
+
357
+ // Add react target.
358
+ $content .= '<div id="wpseo-section-social"></div>';
359
+
360
+ $link_content = '<span class="dashicons dashicons-share"></span>' . __( 'Social', 'wordpress-seo' );
361
+
362
+ return new WPSEO_Metabox_Section_React(
363
+ 'social',
364
+ $link_content,
365
+ $content
366
+ );
367
+ }
368
+
369
  /**
370
  * Returns the metabox section for the seo analysis.
371
  *
715
 
716
  do_action( 'wpseo_save_compare_data', $post );
717
 
718
+ $social_fields = [];
719
+ if ( $this->social_is_enabled ) {
720
+ $social_fields = WPSEO_Meta::get_meta_field_defs( 'social' );
721
+ }
722
+
723
  $meta_boxes = apply_filters( 'wpseo_save_metaboxes', [] );
724
+ $meta_boxes = array_merge(
725
+ $meta_boxes,
726
+ WPSEO_Meta::get_meta_field_defs( 'general', $post->post_type ),
727
+ WPSEO_Meta::get_meta_field_defs( 'advanced' ),
728
+ $social_fields
729
+ );
730
 
731
  foreach ( $meta_boxes as $key => $meta_box ) {
732
 
828
  $asset_manager->enqueue_style( 'select2' );
829
  $asset_manager->enqueue_style( 'monorepo' );
830
 
831
+ $asset_manager->enqueue_script( 'post-edit' );
 
 
 
 
 
 
 
832
  $asset_manager->enqueue_style( 'admin-css' );
833
 
 
 
834
  $yoast_components_l10n = new WPSEO_Admin_Asset_Yoast_Components_L10n();
835
+ $yoast_components_l10n->localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'post-edit' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
836
 
837
  /**
838
  * Removes the emoji script as it is incompatible with both React and any
840
  */
841
  remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
842
 
843
+ wp_localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'post-edit', 'wpseoAdminL10n', WPSEO_Utils::get_admin_l10n() );
844
+ wp_localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'post-edit', 'wpseoFeaturesL10n', WPSEO_Utils::retrieve_enabled_features() );
845
 
846
+ $analysis_worker_location = new WPSEO_Admin_Asset_Analysis_Worker_Location( $asset_manager->flatten_version( WPSEO_VERSION ) );
847
+ $used_keywords_assessment_location = new WPSEO_Admin_Asset_Analysis_Worker_Location( $asset_manager->flatten_version( WPSEO_VERSION ), 'used-keywords-assessment' );
848
 
849
+ $script_data = [
850
+ 'analysis' => [
851
+ 'plugins' => [
852
+ 'replaceVars' => [
853
+ 'no_parent_text' => __( '(no parent)', 'wordpress-seo' ),
854
+ 'replace_vars' => $this->get_replace_vars(),
855
+ 'recommended_replace_vars' => $this->get_recommended_replace_vars(),
856
+ 'scope' => $this->determine_scope(),
857
+ 'has_taxonomies' => $this->current_post_type_has_taxonomies(),
858
+ ],
859
+ 'shortcodes' => [
860
+ 'wpseo_filter_shortcodes_nonce' => wp_create_nonce( 'wpseo-filter-shortcodes' ),
861
+ 'wpseo_shortcode_tags' => $this->get_valid_shortcode_tags(),
862
+ ],
863
+ ],
864
+ 'worker' => [
865
+ 'url' => $analysis_worker_location->get_url( $analysis_worker_location->get_asset(), WPSEO_Admin_Asset::TYPE_JS ),
866
+ 'keywords_assessment_url' => $used_keywords_assessment_location->get_url( $used_keywords_assessment_location->get_asset(), WPSEO_Admin_Asset::TYPE_JS ),
867
+ 'log_level' => WPSEO_Utils::get_analysis_worker_log_level(),
868
+ // We need to make the feature flags separately available inside of the analysis web worker.
869
+ 'enabled_features' => WPSEO_Utils::retrieve_enabled_features(),
870
+ ],
871
+ ],
872
+ 'media' => [
873
+ // @todo replace this translation with JavaScript translations.
874
+ 'choose_image' => __( 'Use Image', 'wordpress-seo' ),
875
+ ],
876
+ 'metabox' => $this->get_metabox_script_data(),
877
+ 'userLanguageCode' => WPSEO_Language_Utils::get_language( WPSEO_Language_Utils::get_user_locale() ),
878
+ 'isPost' => true,
879
+ ];
880
 
881
  if ( post_type_supports( get_post_type(), 'thumbnail' ) ) {
882
  $asset_manager->enqueue_style( 'featured-image' );
883
 
884
+ // @todo replace this translation with JavaScript translations.
885
+ $script_data['featuredImage'] = [
886
+ 'featured_image_notice' => __( 'SEO issue: The featured image should be at least 200 by 200 pixels to be picked up by Facebook and other social media sites.', 'wordpress-seo' ),
887
+ ];
888
  }
 
889
 
890
+ wp_localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'post-edit', 'wpseoScriptData', $script_data );
 
 
 
 
 
 
 
 
891
  }
892
 
893
  /**
1088
 
1089
  /* ********************* DEPRECATED METHODS ********************* */
1090
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1091
  /**
1092
  * Outputs a tab in the Yoast SEO Metabox.
1093
  *