Yoast SEO - Version 9.7

Version Description

Download this release

Release Info

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

Code changes from version 9.6 to 9.7

Files changed (136) hide show
  1. admin/ajax/class-yoast-dismissable-notice.php +9 -3
  2. admin/class-admin-asset-analysis-worker-location.php +19 -1
  3. admin/class-admin-asset-dev-server-location.php +4 -0
  4. admin/class-admin-asset-manager.php +3 -1
  5. admin/class-admin.php +2 -3
  6. admin/class-export.php +4 -0
  7. admin/class-gutenberg-compatibility.php +6 -2
  8. admin/class-license-page-manager.php +6 -2
  9. admin/class-meta-columns.php +1 -1
  10. admin/class-meta-storage.php +5 -0
  11. admin/class-meta-table-accessible.php +8 -1
  12. admin/class-my-yoast-proxy.php +247 -0
  13. admin/class-plugin-availability.php +9 -9
  14. admin/class-product-upsell-notice.php +6 -0
  15. admin/class-remote-request.php +8 -1
  16. admin/class-social-admin.php +11 -11
  17. admin/class-yoast-alerts.php +3 -0
  18. admin/class-yoast-dashboard-widget.php +3 -0
  19. admin/class-yoast-network-admin.php +4 -0
  20. admin/config-ui/class-configuration-page.php +3 -0
  21. admin/config-ui/components/class-component-mailchimp-signup.php +3 -0
  22. admin/config-ui/fields/class-field-multiple-authors.php +1 -1
  23. admin/config-ui/fields/class-field-site-name.php +1 -1
  24. admin/courses-overview.php +10 -1
  25. admin/endpoints/class-endpoint-indexable.php +16 -2
  26. admin/filters/class-abstract-post-filter.php +3 -0
  27. admin/filters/class-cornerstone-filter.php +2 -0
  28. admin/google_search_console/class-gsc-count.php +6 -2
  29. admin/google_search_console/class-gsc-table.php +3 -0
  30. admin/google_search_console/class-gsc.php +2 -0
  31. admin/import/class-import-settings.php +6 -0
  32. admin/links/class-link-columns.php +17 -4
  33. admin/links/class-link-compatibility-notifier.php +3 -0
  34. admin/links/class-link-notifier.php +3 -0
  35. admin/links/class-link-reindex-post-endpoint.php +10 -0
  36. admin/links/class-link-storage.php +5 -0
  37. admin/links/class-link-table-accessible-notifier.php +3 -0
  38. admin/links/class-link-table-accessible.php +8 -1
  39. admin/links/class-link.php +7 -0
  40. admin/metabox/class-metabox.php +116 -106
  41. admin/my-yoast-proxy.php +0 -26
  42. admin/onpage/class-onpage-option.php +28 -5
  43. admin/onpage/class-onpage.php +2 -0
  44. admin/statistics/class-statistics-service.php +3 -0
  45. admin/taxonomy/class-taxonomy-columns.php +1 -1
  46. admin/views/form/fieldset.php +6 -7
  47. admin/views/form/select.php +6 -7
  48. admin/views/paper-collapsible.php +7 -7
  49. admin/views/partial-alerts-errors.php +2 -0
  50. admin/views/partial-alerts-template.php +11 -0
  51. admin/views/partial-alerts-warnings.php +2 -0
  52. admin/views/tabs/dashboard/features.php +2 -4
  53. admin/views/tabs/dashboard/site-analysis.php +2 -4
  54. admin/views/tabs/dashboard/webmaster-tools.php +2 -4
  55. admin/views/tabs/metas/archives/help.php +0 -2
  56. admin/views/tabs/metas/paper-content/author-archive-settings.php +1 -3
  57. admin/views/tabs/metas/paper-content/breadcrumbs-content.php +1 -1
  58. admin/views/tabs/metas/paper-content/date-archives-settings.php +1 -3
  59. admin/views/tabs/metas/paper-content/general/force-rewrite-title.php +1 -1
  60. admin/views/tabs/metas/paper-content/general/homepage.php +1 -1
  61. admin/views/tabs/metas/paper-content/general/knowledge-graph.php +1 -1
  62. admin/views/tabs/metas/paper-content/general/title-separator.php +1 -1
  63. admin/views/tabs/metas/paper-content/media-content.php +1 -1
  64. admin/views/tabs/metas/paper-content/post-type-content.php +5 -5
  65. admin/views/tabs/metas/paper-content/post_type/post-type.php +5 -5
  66. admin/views/tabs/metas/paper-content/post_type/woocommerce-shop-page.php +1 -1
  67. admin/views/tabs/metas/paper-content/rss-content.php +1 -1
  68. admin/views/tabs/metas/paper-content/special-pages.php +1 -1
  69. admin/views/tabs/metas/paper-content/taxonomy-content.php +6 -5
  70. admin/views/tabs/metas/post-types.php +0 -6
  71. admin/views/tabs/metas/taxonomies/category-url.php +1 -1
  72. admin/views/tabs/network/features.php +2 -4
  73. admin/views/tabs/network/general.php +2 -4
  74. admin/views/tabs/network/restore-site.php +2 -4
  75. admin/views/tabs/social/accounts.php +2 -4
  76. admin/views/tabs/social/facebook.php +2 -4
  77. admin/views/tabs/social/google.php +2 -4
  78. admin/views/tabs/social/pinterest.php +2 -4
  79. admin/views/tabs/social/twitterbox.php +3 -4
  80. admin/views/tabs/tool/import-seo.php +0 -5
  81. admin/views/tabs/tool/wpseo-export.php +0 -4
  82. admin/views/tabs/tool/wpseo-import.php +0 -4
  83. admin/views/user-profile.php +2 -0
  84. css/dist/admin-global-960-rtl.min.css +0 -1
  85. css/dist/admin-global-960.min.css +0 -1
  86. css/dist/admin-global-970-rtl.min.css +1 -0
  87. css/dist/admin-global-970.min.css +1 -0
  88. css/dist/{adminbar-960-rtl.min.css → adminbar-970-rtl.min.css} +0 -0
  89. css/dist/{adminbar-960.min.css → adminbar-970.min.css} +0 -0
  90. css/dist/{alerts-960-rtl.min.css → alerts-970-rtl.min.css} +0 -0
  91. css/dist/{alerts-960.min.css → alerts-970.min.css} +0 -0
  92. css/dist/{dashboard-960-rtl.min.css → dashboard-970-rtl.min.css} +0 -0
  93. css/dist/{dashboard-960.min.css → dashboard-970.min.css} +0 -0
  94. css/dist/{edit-page-960-rtl.min.css → edit-page-970-rtl.min.css} +0 -0
  95. css/dist/{edit-page-960.min.css → edit-page-970.min.css} +0 -0
  96. css/dist/{featured-image-960-rtl.min.css → featured-image-970-rtl.min.css} +0 -0
  97. css/dist/{featured-image-960.min.css → featured-image-970.min.css} +0 -0
  98. css/dist/{filter-explanation-960-rtl.min.css → filter-explanation-970-rtl.min.css} +0 -0
  99. css/dist/{filter-explanation-960.min.css → filter-explanation-970.min.css} +0 -0
  100. css/dist/{inside-editor-960-rtl.min.css → inside-editor-970-rtl.min.css} +0 -0
  101. css/dist/{inside-editor-960.min.css → inside-editor-970.min.css} +0 -0
  102. css/dist/{metabox-960-rtl.min.css → metabox-970-rtl.min.css} +0 -0
  103. css/dist/{metabox-960.min.css → metabox-970.min.css} +0 -0
  104. css/dist/{metabox-primary-category-960-rtl.min.css → metabox-primary-category-970-rtl.min.css} +0 -0
  105. css/dist/{metabox-primary-category-960.min.css → metabox-primary-category-970.min.css} +0 -0
  106. css/dist/{search-appearance-960-rtl.min.css → search-appearance-970-rtl.min.css} +0 -0
  107. css/dist/{search-appearance-960.min.css → search-appearance-970.min.css} +0 -0
  108. css/dist/structured-data-blocks-960-rtl.min.css +0 -1
  109. css/dist/structured-data-blocks-960.min.css +0 -1
  110. css/dist/structured-data-blocks-970-rtl.min.css +1 -0
  111. css/dist/structured-data-blocks-970.min.css +1 -0
  112. css/dist/{toggle-switch-960-rtl.min.css → toggle-switch-970-rtl.min.css} +0 -0
  113. css/dist/{toggle-switch-960.min.css → toggle-switch-970.min.css} +0 -0
  114. css/dist/{wpseo-dismissible-960-rtl.min.css → wpseo-dismissible-970-rtl.min.css} +0 -0
  115. css/dist/{wpseo-dismissible-960.min.css → wpseo-dismissible-970.min.css} +0 -0
  116. css/dist/{yoast-components-960-rtl.min.css → yoast-components-970-rtl.min.css} +0 -0
  117. css/dist/{yoast-components-960.min.css → yoast-components-970.min.css} +0 -0
  118. css/dist/{yoast-extensions-960-rtl.min.css → yoast-extensions-970-rtl.min.css} +0 -0
  119. css/dist/{yoast-extensions-960.min.css → yoast-extensions-970.min.css} +0 -0
  120. css/dist/{yst_plugin_tools-960-rtl.min.css → yst_plugin_tools-970-rtl.min.css} +0 -0
  121. css/dist/{yst_plugin_tools-960.min.css → yst_plugin_tools-970.min.css} +0 -0
  122. css/dist/{yst_seo_score-960-rtl.min.css → yst_seo_score-970-rtl.min.css} +0 -0
  123. css/dist/{yst_seo_score-960.min.css → yst_seo_score-970.min.css} +0 -0
  124. deprecated/class-cornerstone.php +6 -0
  125. frontend/class-breadcrumbs.php +32 -9
  126. frontend/class-json-ld.php +1 -0
  127. frontend/class-opengraph-image.php +4 -0
  128. frontend/class-twitter.php +1 -1
  129. inc/class-wpseo-content-images.php +13 -9
  130. inc/class-wpseo-rank.php +22 -3
  131. inc/options/class-wpseo-option-social.php +5 -4
  132. inc/options/class-wpseo-option.php +2 -0
  133. inc/sitemaps/class-sitemaps.php +5 -1
  134. inc/sitemaps/class-taxonomy-sitemap-provider.php +11 -6
  135. inc/sitemaps/interface-sitemap-cache-data.php +15 -3
  136. js/dist/analysis-960.min.js +0 -21
admin/ajax/class-yoast-dismissable-notice.php CHANGED
@@ -12,17 +12,23 @@
12
  class Yoast_Dismissable_Notice_Ajax {
13
 
14
  /**
15
- * @var string Notice type toggle value for user notices.
 
 
16
  */
17
  const FOR_USER = 'user_meta';
18
 
19
  /**
20
- * @var string Notice type toggle value for network notices.
 
 
21
  */
22
  const FOR_NETWORK = 'site_option';
23
 
24
  /**
25
- * @var string Notice type toggle value for site notices.
 
 
26
  */
27
  const FOR_SITE = 'option';
28
 
12
  class Yoast_Dismissable_Notice_Ajax {
13
 
14
  /**
15
+ * Notice type toggle value for user notices.
16
+ *
17
+ * @var string
18
  */
19
  const FOR_USER = 'user_meta';
20
 
21
  /**
22
+ * Notice type toggle value for network notices.
23
+ *
24
+ * @var string
25
  */
26
  const FOR_NETWORK = 'site_option';
27
 
28
  /**
29
+ * Notice type toggle value for site notices.
30
+ *
31
+ * @var string
32
  */
33
  const FOR_SITE = 'option';
34
 
admin/class-admin-asset-analysis-worker-location.php CHANGED
@@ -34,7 +34,14 @@ final class WPSEO_Admin_Asset_Analysis_Worker_Location implements WPSEO_Admin_As
34
 
35
  $analysis_worker = 'wp-seo-' . $name . '-' . $flat_version;
36
  if ( $name === 'analysis-worker' && WPSEO_Recalibration_Beta::is_enabled() ) {
37
- $analysis_worker = plugin_dir_url( WPSEO_FILE ) . 'admin/my-yoast-proxy.php?file=research-webworker';
 
 
 
 
 
 
 
38
  }
39
 
40
  $this->asset_location = WPSEO_Admin_Asset_Manager::create_default_location();
@@ -71,4 +78,15 @@ final class WPSEO_Admin_Asset_Analysis_Worker_Location implements WPSEO_Admin_As
71
 
72
  return $this->asset_location->get_url( $asset, $type );
73
  }
 
 
 
 
 
 
 
 
 
 
 
74
  }
34
 
35
  $analysis_worker = 'wp-seo-' . $name . '-' . $flat_version;
36
  if ( $name === 'analysis-worker' && WPSEO_Recalibration_Beta::is_enabled() ) {
37
+ /*
38
+ * Using a flag to determine whether the local file or the proxy is used.
39
+ * This is for the recalibration development.
40
+ */
41
+ $analysis_worker = 'wp-seo-' . $name . '-recalibration-' . $flat_version;
42
+ if ( ! $this->use_recalibration_local_file() ) {
43
+ $analysis_worker = admin_url( 'admin.php?page=wpseo_myyoast_proxy&file=research-webworker&plugin_version=' . $flat_version );
44
+ }
45
  }
46
 
47
  $this->asset_location = WPSEO_Admin_Asset_Manager::create_default_location();
78
 
79
  return $this->asset_location->get_url( $asset, $type );
80
  }
81
+
82
+ /**
83
+ * Checks if the recalibration beta should use the local file.
84
+ *
85
+ * If false, the my-yoast-proxy should be used.
86
+ *
87
+ * @return bool Whether the local file should be used.
88
+ */
89
+ protected function use_recalibration_local_file() {
90
+ return defined( 'YOAST_SEO_RECALIBRATION_USE_LOCAL_FILE' ) && YOAST_SEO_RECALIBRATION_USE_LOCAL_FILE;
91
+ }
92
  }
admin/class-admin-asset-dev-server-location.php CHANGED
@@ -9,6 +9,10 @@
9
  * Changes the asset paths to dev server paths.
10
  */
11
  final class WPSEO_Admin_Asset_Dev_Server_Location implements WPSEO_Admin_Asset_Location {
 
 
 
 
12
  const DEFAULT_URL = 'http://localhost:8080';
13
 
14
  /**
9
  * Changes the asset paths to dev server paths.
10
  */
11
  final class WPSEO_Admin_Asset_Dev_Server_Location implements WPSEO_Admin_Asset_Location {
12
+
13
+ /**
14
+ * @var string
15
+ */
16
  const DEFAULT_URL = 'http://localhost:8080';
17
 
18
  /**
admin/class-admin-asset-manager.php CHANGED
@@ -16,7 +16,9 @@ class WPSEO_Admin_Asset_Manager {
16
  protected $asset_location;
17
 
18
  /**
19
- * Prefix for naming the assets.
 
 
20
  */
21
  const PREFIX = 'yoast-seo-';
22
 
16
  protected $asset_location;
17
 
18
  /**
19
+ * Prefix for naming the assets.
20
+ *
21
+ * @var string
22
  */
23
  const PREFIX = 'yoast-seo-';
24
 
admin/class-admin.php CHANGED
@@ -96,8 +96,6 @@ class WPSEO_Admin {
96
 
97
  $this->set_upsell_notice();
98
 
99
- $this->check_php_version();
100
-
101
  $this->initialize_cornerstone_content();
102
 
103
  if ( WPSEO_Utils::is_plugin_network_active() ) {
@@ -112,6 +110,7 @@ class WPSEO_Admin {
112
  $integrations[] = new WPSEO_Admin_Gutenberg_Compatibility_Notification();
113
  $integrations[] = new WPSEO_Expose_Shortlinks();
114
  $integrations[] = new WPSEO_Recalibration_Beta();
 
115
  $integrations[] = $this->admin_features['google_search_console'];
116
  $integrations = array_merge( $integrations, $this->initialize_seo_links(), $this->initialize_cornerstone_content() );
117
 
@@ -537,7 +536,7 @@ class WPSEO_Admin {
537
  }
538
 
539
  /**
540
- * Initializes Whip to show a notice for outdated PHP versions.
541
  *
542
  * @deprecated 8.1
543
  * @codeCoverageIgnore
96
 
97
  $this->set_upsell_notice();
98
 
 
 
99
  $this->initialize_cornerstone_content();
100
 
101
  if ( WPSEO_Utils::is_plugin_network_active() ) {
110
  $integrations[] = new WPSEO_Admin_Gutenberg_Compatibility_Notification();
111
  $integrations[] = new WPSEO_Expose_Shortlinks();
112
  $integrations[] = new WPSEO_Recalibration_Beta();
113
+ $integrations[] = new WPSEO_MyYoast_Proxy();
114
  $integrations[] = $this->admin_features['google_search_console'];
115
  $integrations = array_merge( $integrations, $this->initialize_seo_links(), $this->initialize_cornerstone_content() );
116
 
536
  }
537
 
538
  /**
539
+ * Initializes WHIP to show a notice for outdated PHP versions.
540
  *
541
  * @deprecated 8.1
542
  * @codeCoverageIgnore
admin/class-export.php CHANGED
@@ -11,6 +11,10 @@
11
  * Class with functionality to export the WP SEO settings
12
  */
13
  class WPSEO_Export {
 
 
 
 
14
  const NONCE_ACTION = 'wpseo_export';
15
 
16
  /**
11
  * Class with functionality to export the WP SEO settings
12
  */
13
  class WPSEO_Export {
14
+
15
+ /**
16
+ * @var string
17
+ */
18
  const NONCE_ACTION = 'wpseo_export';
19
 
20
  /**
admin/class-gutenberg-compatibility.php CHANGED
@@ -12,13 +12,17 @@ class WPSEO_Gutenberg_Compatibility {
12
 
13
  /**
14
  * The currently released version of Gutenberg.
 
 
15
  */
16
- const CURRENT_RELEASE = '5.0.0';
17
 
18
  /**
19
  * The minimally supported version of Gutenberg by the plugin.
 
 
20
  */
21
- const MINIMUM_SUPPORTED = '5.0.0';
22
 
23
  /**
24
  * @var string
12
 
13
  /**
14
  * The currently released version of Gutenberg.
15
+ *
16
+ * @var string
17
  */
18
+ const CURRENT_RELEASE = '5.1.1';
19
 
20
  /**
21
  * The minimally supported version of Gutenberg by the plugin.
22
+ *
23
+ * @var string
24
  */
25
+ const MINIMUM_SUPPORTED = '5.1.1';
26
 
27
  /**
28
  * @var string
admin/class-license-page-manager.php CHANGED
@@ -11,12 +11,16 @@
11
  class WPSEO_License_Page_Manager implements WPSEO_WordPress_Integration {
12
 
13
  /**
14
- * @var string Version number for License Page Manager.
 
 
15
  */
16
  const VERSION_LEGACY = '1';
17
 
18
  /**
19
- * @var string Version number for License Page Manager.
 
 
20
  */
21
  const VERSION_BACKWARDS_COMPATIBILITY = '2';
22
 
11
  class WPSEO_License_Page_Manager implements WPSEO_WordPress_Integration {
12
 
13
  /**
14
+ * Version number for License Page Manager.
15
+ *
16
+ * @var string
17
  */
18
  const VERSION_LEGACY = '1';
19
 
20
  /**
21
+ * Version number for License Page Manager.
22
+ *
23
+ * @var string
24
  */
25
  const VERSION_BACKWARDS_COMPATIBILITY = '2';
26
 
admin/class-meta-columns.php CHANGED
@@ -727,7 +727,7 @@ class WPSEO_Meta_Columns {
727
  $title = $rank->get_label();
728
  }
729
 
730
- return '<div aria-hidden="true" title="' . esc_attr( $title ) . '" class="wpseo-score-icon ' . esc_attr( $rank->get_css_class() ) . '"></div><span class="screen-reader-text">' . $title . '</span>';
731
  }
732
 
733
  /**
727
  $title = $rank->get_label();
728
  }
729
 
730
+ return '<div aria-hidden="true" title="' . esc_attr( $title ) . '" class="wpseo-score-icon ' . esc_attr( $rank->get_css_class() ) . '"></div><span class="screen-reader-text wpseo-score-text">' . $title . '</span>';
731
  }
732
 
733
  /**
admin/class-meta-storage.php CHANGED
@@ -10,6 +10,11 @@
10
  */
11
  class WPSEO_Meta_Storage implements WPSEO_Installable {
12
 
 
 
 
 
 
13
  const TABLE_NAME = 'yoast_seo_meta';
14
 
15
  /**
10
  */
11
  class WPSEO_Meta_Storage implements WPSEO_Installable {
12
 
13
+ /**
14
+ * Table name for the meta storage.
15
+ *
16
+ * @var string
17
+ */
18
  const TABLE_NAME = 'yoast_seo_meta';
19
 
20
  /**
admin/class-meta-table-accessible.php CHANGED
@@ -10,7 +10,14 @@
10
  */
11
  class WPSEO_Meta_Table_Accessible {
12
 
13
- const ACCESSIBLE = '0';
 
 
 
 
 
 
 
14
  const INACCESSBILE = '1';
15
 
16
  /**
10
  */
11
  class WPSEO_Meta_Table_Accessible {
12
 
13
+ /**
14
+ * @var string
15
+ */
16
+ const ACCESSIBLE = '0';
17
+
18
+ /**
19
+ * @var string
20
+ */
21
  const INACCESSBILE = '1';
22
 
23
  /**
admin/class-my-yoast-proxy.php ADDED
@@ -0,0 +1,247 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WPSEO plugin file.
4
+ *
5
+ * @package WPSEO\Admin
6
+ */
7
+
8
+ /**
9
+ * @class WPSEO_MyYoast_Proxy Loads the MyYoast proxy.
10
+ *
11
+ * This class registers a proxy page on `admin.php`. Which is reached with the `page=PAGE_IDENTIFIER` parameter.
12
+ * It will read external files and serves them like they are located locally.
13
+ */
14
+ class WPSEO_MyYoast_Proxy implements WPSEO_WordPress_Integration {
15
+
16
+ /**
17
+ * The page identifier used in WordPress to register the MyYoast proxy page.
18
+ *
19
+ * @var string
20
+ */
21
+ const PAGE_IDENTIFIER = 'wpseo_myyoast_proxy';
22
+
23
+ /**
24
+ * The cache control's max age. Used in the header of a successful proxy response.
25
+ *
26
+ * @var int
27
+ */
28
+ const CACHE_CONTROL_MAX_AGE = DAY_IN_SECONDS;
29
+
30
+ /**
31
+ * Registers the hooks when the user is on the right page.
32
+ *
33
+ * @codeCoverageIgnore
34
+ *
35
+ * @return void
36
+ */
37
+ public function register_hooks() {
38
+ if ( ! $this->is_proxy_page() ) {
39
+ return;
40
+ }
41
+
42
+ // Register the page for the proxy.
43
+ add_action( 'admin_menu', array( $this, 'add_proxy_page' ) );
44
+ add_action( 'admin_init', array( $this, 'handle_proxy_page' ) );
45
+ }
46
+
47
+ /**
48
+ * Registers the proxy page. It does not actually add a link to the dashboard.
49
+ *
50
+ * @codeCoverageIgnore
51
+ *
52
+ * @return void
53
+ */
54
+ public function add_proxy_page() {
55
+ add_dashboard_page( '', '', 'read', self::PAGE_IDENTIFIER, '' );
56
+ }
57
+
58
+ /**
59
+ * Renders the requested proxy page and exits to prevent the WordPress UI from loading.
60
+ *
61
+ * @codeCoverageIgnore
62
+ *
63
+ * @return void
64
+ */
65
+ public function handle_proxy_page() {
66
+ $this->render_proxy_page();
67
+
68
+ // Prevent the WordPress UI from loading.
69
+ exit;
70
+ }
71
+
72
+ /**
73
+ * Renders the requested proxy page.
74
+ *
75
+ * This is separated from the exits to be able to test it.
76
+ *
77
+ * @return void
78
+ */
79
+ public function render_proxy_page() {
80
+ $proxy_options = $this->determine_proxy_options();
81
+ if ( $proxy_options === array() ) {
82
+ // Do not accept any other file than implemented.
83
+ $this->set_header( 'HTTP/1.0 501 Requested file not implemented' );
84
+ return;
85
+ }
86
+
87
+ // Set the headers before serving the remote file.
88
+ $this->set_header( 'Content-Type: ' . $proxy_options['content_type'] );
89
+ $this->set_header( 'Cache-Control: max-age=' . self::CACHE_CONTROL_MAX_AGE );
90
+
91
+ if ( $this->should_load_url_directly() ) {
92
+ /*
93
+ * If an error occurred, fallback to the next proxy method (`wp_remote_get`).
94
+ * Otherwise, we are done here.
95
+ */
96
+ if ( $this->load_url( $proxy_options['url'] ) ) {
97
+ return;
98
+ }
99
+ }
100
+
101
+ try {
102
+ echo $this->get_remote_url_body( $proxy_options['url'] );
103
+ }
104
+ catch ( Exception $e ) {
105
+ /*
106
+ * Reset the file headers because the loading failed.
107
+ *
108
+ * Note: Due to supporting PHP 5.2 `header_remove` can not be used here.
109
+ * Overwrite the headers instead.
110
+ */
111
+ $this->set_header( 'Content-Type: text/plain' );
112
+ $this->set_header( 'Cache-Control: max-age=0' );
113
+
114
+ $this->set_header( 'HTTP/1.0 500 ' . $e->getMessage() );
115
+ }
116
+ }
117
+
118
+ /**
119
+ * Tries to load the given url via `wp_remote_get`.
120
+ *
121
+ * @codeCoverageIgnore
122
+ *
123
+ * @param string $url The url to load.
124
+ *
125
+ * @throws Exception When `wp_remote_get` returned an error.
126
+ * @throws Exception When the response code is not 200.
127
+ *
128
+ * @return string The body of the response.
129
+ */
130
+ protected function get_remote_url_body( $url ) {
131
+ $response = wp_remote_get( $url );
132
+
133
+ if ( $response instanceof WP_Error ) {
134
+ throw new Exception( 'Unable to retrieve file from MyYoast' );
135
+ }
136
+
137
+ if ( wp_remote_retrieve_response_code( $response ) !== 200 ) {
138
+ throw new Exception( 'Received unexpected response from MyYoast' );
139
+ }
140
+
141
+ return wp_remote_retrieve_body( $response );
142
+ }
143
+
144
+ /**
145
+ * Tries to load the given url.
146
+ *
147
+ * @see https://php.net/manual/en/function.readfile.php
148
+ *
149
+ * @codeCoverageIgnore
150
+ *
151
+ * @param string $url The url to load.
152
+ *
153
+ * @return bool False if an error occurred.
154
+ */
155
+ protected function load_url( $url ) {
156
+ return readfile( $url ) !== false;
157
+ }
158
+
159
+ /**
160
+ * Determines the proxy options based on the file and plugin version arguments.
161
+ *
162
+ * When the file is known it returns an array like this:
163
+ * <code>
164
+ * $array = array(
165
+ * 'content_type' => 'the content type'
166
+ * 'url' => 'the url, possibly with the plugin version'
167
+ * )
168
+ * </code>
169
+ *
170
+ * @return array Empty for an unknown file. See format above for known files.
171
+ */
172
+ protected function determine_proxy_options() {
173
+ if ( $this->get_proxy_file() === 'research-webworker' ) {
174
+ return array(
175
+ 'content_type' => 'text/javascript; charset=UTF-8',
176
+ 'url' => 'https://my.yoast.com/api/downloads/file/analysis-worker?plugin_version=' . $this->get_plugin_version(),
177
+ );
178
+ }
179
+
180
+ return array();
181
+ }
182
+
183
+ /**
184
+ * Checks the PHP configuration of allow_url_fopen.
185
+ *
186
+ * @codeCoverageIgnore
187
+ *
188
+ * @see https://php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen
189
+ *
190
+ * @return bool True when the PHP configuration allows for url loading via readfile.
191
+ */
192
+ protected function should_load_url_directly() {
193
+ return ! ! ini_get( 'allow_url_fopen' );
194
+ }
195
+
196
+ /**
197
+ * Checks if the current page is the MyYoast proxy page.
198
+ *
199
+ * @codeCoverageIgnore
200
+ *
201
+ * @return bool True when the page request parameter equals the proxy page.
202
+ */
203
+ protected function is_proxy_page() {
204
+ return filter_input( INPUT_GET, 'page' ) === self::PAGE_IDENTIFIER;
205
+ }
206
+
207
+ /**
208
+ * Returns the proxy file from the HTTP request parameters.
209
+ *
210
+ * @codeCoverageIgnore
211
+ *
212
+ * @return string The sanitized file request parameter.
213
+ */
214
+ protected function get_proxy_file() {
215
+ return filter_input( INPUT_GET, 'file', FILTER_SANITIZE_STRING );
216
+ }
217
+
218
+ /**
219
+ * Returns the plugin version from the HTTP request parameters.
220
+ *
221
+ * @codeCoverageIgnore
222
+ *
223
+ * @return string The sanitized plugin_version request parameter.
224
+ */
225
+ protected function get_plugin_version() {
226
+ $plugin_version = filter_input( INPUT_GET, 'plugin_version', FILTER_SANITIZE_STRING );
227
+ // Replace slashes to secure against requiring a file from another path.
228
+ $plugin_version = str_replace( array( '/', '\\' ), '_', $plugin_version );
229
+
230
+ return $plugin_version;
231
+ }
232
+
233
+ /**
234
+ * Sets the HTTP header.
235
+ *
236
+ * This is a tiny helper function to enable better testing.
237
+ *
238
+ * @codeCoverageIgnore
239
+ *
240
+ * @param string $header The header to set.
241
+ *
242
+ * @return void
243
+ */
244
+ protected function set_header( $header ) {
245
+ header( $header );
246
+ }
247
+ }
admin/class-plugin-availability.php CHANGED
@@ -152,7 +152,7 @@ class WPSEO_Plugin_Availability {
152
  /**
153
  * Checks whether or not a plugin is known within the Yoast SEO collection.
154
  *
155
- * @param {string} $plugin The plugin to search for.
156
  *
157
  * @return bool Whether or not the plugin is exists.
158
  */
@@ -172,7 +172,7 @@ class WPSEO_Plugin_Availability {
172
  /**
173
  * Gets a specific plugin. Returns an empty array if it cannot be found.
174
  *
175
- * @param {string} $plugin The plugin to search for.
176
  *
177
  * @return array The plugin properties.
178
  */
@@ -187,7 +187,7 @@ class WPSEO_Plugin_Availability {
187
  /**
188
  * Gets the version of the plugin.
189
  *
190
- * @param {string} $plugin The plugin to search for.
191
  *
192
  * @return string The version associated with the plugin.
193
  */
@@ -202,7 +202,7 @@ class WPSEO_Plugin_Availability {
202
  /**
203
  * Checks if there are dependencies available for the plugin.
204
  *
205
- * @param {string} $plugin The plugin to search for.
206
  *
207
  * @return bool Whether or not there is a dependency present.
208
  */
@@ -213,7 +213,7 @@ class WPSEO_Plugin_Availability {
213
  /**
214
  * Gets the dependencies for the plugin.
215
  *
216
- * @param {string} $plugin The plugin to search for.
217
  *
218
  * @return array Array containing all the dependencies associated with the plugin.
219
  */
@@ -228,7 +228,7 @@ class WPSEO_Plugin_Availability {
228
  /**
229
  * Checks if all dependencies are satisfied.
230
  *
231
- * @param {string} $plugin The plugin to search for.
232
  *
233
  * @return bool Whether or not the dependencies are satisfied.
234
  */
@@ -246,7 +246,7 @@ class WPSEO_Plugin_Availability {
246
  /**
247
  * Checks whether or not one of the plugins is properly installed and usable.
248
  *
249
- * @param {string} $plugin The plugin to search for.
250
  *
251
  * @return bool Whether or not the plugin is properly installed.
252
  */
@@ -278,7 +278,7 @@ class WPSEO_Plugin_Availability {
278
  /**
279
  * Checks for the availability of the plugin.
280
  *
281
- * @param {string} $plugin The plugin to search for.
282
  *
283
  * @return bool Whether or not the plugin is available.
284
  */
@@ -289,7 +289,7 @@ class WPSEO_Plugin_Availability {
289
  /**
290
  * Checks whether a dependency is available.
291
  *
292
- * @param {string} $dependency The dependency to look for.
293
  *
294
  * @return bool Whether or not the dependency is available.
295
  */
152
  /**
153
  * Checks whether or not a plugin is known within the Yoast SEO collection.
154
  *
155
+ * @param string $plugin The plugin to search for.
156
  *
157
  * @return bool Whether or not the plugin is exists.
158
  */
172
  /**
173
  * Gets a specific plugin. Returns an empty array if it cannot be found.
174
  *
175
+ * @param string $plugin The plugin to search for.
176
  *
177
  * @return array The plugin properties.
178
  */
187
  /**
188
  * Gets the version of the plugin.
189
  *
190
+ * @param array $plugin The information available about the plugin.
191
  *
192
  * @return string The version associated with the plugin.
193
  */
202
  /**
203
  * Checks if there are dependencies available for the plugin.
204
  *
205
+ * @param array $plugin The information available about the plugin.
206
  *
207
  * @return bool Whether or not there is a dependency present.
208
  */
213
  /**
214
  * Gets the dependencies for the plugin.
215
  *
216
+ * @param array $plugin The information available about the plugin.
217
  *
218
  * @return array Array containing all the dependencies associated with the plugin.
219
  */
228
  /**
229
  * Checks if all dependencies are satisfied.
230
  *
231
+ * @param array $plugin The information available about the plugin.
232
  *
233
  * @return bool Whether or not the dependencies are satisfied.
234
  */
246
  /**
247
  * Checks whether or not one of the plugins is properly installed and usable.
248
  *
249
+ * @param array $plugin The information available about the plugin.
250
  *
251
  * @return bool Whether or not the plugin is properly installed.
252
  */
278
  /**
279
  * Checks for the availability of the plugin.
280
  *
281
+ * @param array $plugin The information available about the plugin.
282
  *
283
  * @return bool Whether or not the plugin is available.
284
  */
289
  /**
290
  * Checks whether a dependency is available.
291
  *
292
+ * @param array $dependency The information about the dependency to look for.
293
  *
294
  * @return bool Whether or not the dependency is available.
295
  */
admin/class-product-upsell-notice.php CHANGED
@@ -10,8 +10,14 @@
10
  */
11
  class WPSEO_Product_Upsell_Notice {
12
 
 
 
 
13
  const USER_META_DISMISSED = 'wpseo-remove-upsell-notice';
14
 
 
 
 
15
  const OPTION_NAME = 'wpseo';
16
 
17
  /**
10
  */
11
  class WPSEO_Product_Upsell_Notice {
12
 
13
+ /**
14
+ * @var string
15
+ */
16
  const USER_META_DISMISSED = 'wpseo-remove-upsell-notice';
17
 
18
+ /**
19
+ * @var string
20
+ */
21
  const OPTION_NAME = 'wpseo';
22
 
23
  /**
admin/class-remote-request.php CHANGED
@@ -10,8 +10,15 @@
10
  */
11
  class WPSEO_Remote_Request {
12
 
 
 
 
13
  const METHOD_POST = 'post';
14
- const METHOD_GET = 'get';
 
 
 
 
15
 
16
  /**
17
  * @var string
10
  */
11
  class WPSEO_Remote_Request {
12
 
13
+ /**
14
+ * @var string
15
+ */
16
  const METHOD_POST = 'post';
17
+
18
+ /**
19
+ * @var string
20
+ */
21
+ const METHOD_GET = 'get';
22
 
23
  /**
24
  * @var string
admin/class-social-admin.php CHANGED
@@ -55,16 +55,16 @@ class WPSEO_Social_Admin extends WPSEO_Metabox {
55
  foreach ( $social_networks as $network => $label ) {
56
  if ( true === WPSEO_Options::get( $network, false ) ) {
57
  /* translators: %s expands to the name of a social network. */
58
- self::$meta_fields['social'][ $network . '-title' ]['title'] = sprintf( __( '%s Title', 'wordpress-seo' ), $label );
59
- self::$meta_fields['social'][ $network . '-title' ]['description'] = sprintf( $title_text, $label );
60
 
61
  /* translators: %s expands to the name of a social network. */
62
- self::$meta_fields['social'][ $network . '-description' ]['title'] = sprintf( __( '%s Description', 'wordpress-seo' ), $label );
63
- self::$meta_fields['social'][ $network . '-description' ]['description'] = sprintf( $description_text, $label );
64
 
65
  /* translators: %s expands to the name of a social network. */
66
- self::$meta_fields['social'][ $network . '-image' ]['title'] = sprintf( __( '%s Image', 'wordpress-seo' ), $label );
67
- self::$meta_fields['social'][ $network . '-image' ]['description'] = sprintf( $image_text, $label ) . ' ' . sprintf( $image_size_text, $label, $recommended_image_sizes[ $network ] );
68
  }
69
  }
70
  }
@@ -76,7 +76,7 @@ class WPSEO_Social_Admin extends WPSEO_Metabox {
76
  */
77
  public function get_meta_section() {
78
  $tabs = array();
79
- $social_meta_fields = $this->get_meta_field_defs( 'social' );
80
  $single = true;
81
 
82
  $opengraph = WPSEO_Options::get( 'opengraph' );
@@ -201,7 +201,7 @@ class WPSEO_Social_Admin extends WPSEO_Metabox {
201
  return $field_defs;
202
  }
203
 
204
- return array_merge( $field_defs, self::get_meta_field_defs( 'social' ) );
205
  }
206
 
207
  /**
@@ -237,10 +237,10 @@ class WPSEO_Social_Admin extends WPSEO_Metabox {
237
  $reset_facebook_cache = false;
238
 
239
  foreach ( $fields_to_compare as $field_to_compare ) {
240
- $old_value = self::get_value( $field_to_compare, $post->ID );
241
 
242
  $new_value = '';
243
- $post_key = self::$form_prefix . $field_to_compare;
244
  if ( isset( $_POST[ $post_key ] ) ) {
245
  $new_value = sanitize_text_field( wp_unslash( $_POST[ $post_key ] ) );
246
  }
@@ -250,7 +250,7 @@ class WPSEO_Social_Admin extends WPSEO_Metabox {
250
  break;
251
  }
252
  }
253
- unset( $field_to_compare, $old_value, $new_value );
254
 
255
  if ( $reset_facebook_cache ) {
256
  wp_remote_get(
55
  foreach ( $social_networks as $network => $label ) {
56
  if ( true === WPSEO_Options::get( $network, false ) ) {
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
  }
76
  */
77
  public function get_meta_section() {
78
  $tabs = array();
79
+ $social_meta_fields = WPSEO_Meta::get_meta_field_defs( 'social' );
80
  $single = true;
81
 
82
  $opengraph = WPSEO_Options::get( 'opengraph' );
201
  return $field_defs;
202
  }
203
 
204
+ return array_merge( $field_defs, WPSEO_Meta::get_meta_field_defs( 'social' ) );
205
  }
206
 
207
  /**
237
  $reset_facebook_cache = false;
238
 
239
  foreach ( $fields_to_compare as $field_to_compare ) {
240
+ $old_value = WPSEO_Meta::get_value( $field_to_compare, $post->ID );
241
 
242
  $new_value = '';
243
+ $post_key = WPSEO_Meta::$form_prefix . $field_to_compare;
244
  if ( isset( $_POST[ $post_key ] ) ) {
245
  $new_value = sanitize_text_field( wp_unslash( $_POST[ $post_key ] ) );
246
  }
250
  break;
251
  }
252
  }
253
+ unset( $old_value, $new_value );
254
 
255
  if ( $reset_facebook_cache ) {
256
  wp_remote_get(
admin/class-yoast-alerts.php CHANGED
@@ -10,6 +10,9 @@
10
  */
11
  class Yoast_Alerts {
12
 
 
 
 
13
  const ADMIN_PAGE = 'wpseo_dashboard';
14
 
15
  /**
10
  */
11
  class Yoast_Alerts {
12
 
13
+ /**
14
+ * @var string
15
+ */
16
  const ADMIN_PAGE = 'wpseo_dashboard';
17
 
18
  /**
admin/class-yoast-dashboard-widget.php CHANGED
@@ -10,6 +10,9 @@
10
  */
11
  class Yoast_Dashboard_Widget {
12
 
 
 
 
13
  const CACHE_TRANSIENT_KEY = 'wpseo-dashboard-totals';
14
 
15
  /**
10
  */
11
  class Yoast_Dashboard_Widget {
12
 
13
+ /**
14
+ * @var string
15
+ */
16
  const CACHE_TRANSIENT_KEY = 'wpseo-dashboard-totals';
17
 
18
  /**
admin/class-yoast-network-admin.php CHANGED
@@ -12,11 +12,15 @@ class Yoast_Network_Admin implements WPSEO_WordPress_Integration, WPSEO_WordPres
12
 
13
  /**
14
  * Action identifier for updating plugin network options.
 
 
15
  */
16
  const UPDATE_OPTIONS_ACTION = 'yoast_handle_network_options';
17
 
18
  /**
19
  * Action identifier for restoring a site.
 
 
20
  */
21
  const RESTORE_SITE_ACTION = 'yoast_restore_site';
22
 
12
 
13
  /**
14
  * Action identifier for updating plugin network options.
15
+ *
16
+ * @var string
17
  */
18
  const UPDATE_OPTIONS_ACTION = 'yoast_handle_network_options';
19
 
20
  /**
21
  * Action identifier for restoring a site.
22
+ *
23
+ * @var string
24
  */
25
  const RESTORE_SITE_ACTION = 'yoast_restore_site';
26
 
admin/config-ui/class-configuration-page.php CHANGED
@@ -10,6 +10,9 @@
10
  */
11
  class WPSEO_Configuration_Page {
12
 
 
 
 
13
  const PAGE_IDENTIFIER = 'wpseo_configurator';
14
 
15
  /**
10
  */
11
  class WPSEO_Configuration_Page {
12
 
13
+ /**
14
+ * @var string
15
+ */
16
  const PAGE_IDENTIFIER = 'wpseo_configurator';
17
 
18
  /**
admin/config-ui/components/class-component-mailchimp-signup.php CHANGED
@@ -10,6 +10,9 @@
10
  */
11
  class WPSEO_Config_Component_Mailchimp_Signup implements WPSEO_Config_Component {
12
 
 
 
 
13
  const META_NAME = 'wpseo-has-mailchimp-signup';
14
 
15
  /**
10
  */
11
  class WPSEO_Config_Component_Mailchimp_Signup implements WPSEO_Config_Component {
12
 
13
+ /**
14
+ * @var string
15
+ */
16
  const META_NAME = 'wpseo-has-mailchimp-signup';
17
 
18
  /**
admin/config-ui/fields/class-field-multiple-authors.php CHANGED
@@ -65,7 +65,7 @@ class WPSEO_Config_Field_Multiple_Authors extends WPSEO_Config_Field_Choice {
65
  /**
66
  * Set the data in the options.
67
  *
68
- * @param {string} $data The data to set for the field.
69
  *
70
  * @return bool Returns true or false for successful storing the data.
71
  */
65
  /**
66
  * Set the data in the options.
67
  *
68
+ * @param string $data The data to set for the field.
69
  *
70
  * @return bool Returns true or false for successful storing the data.
71
  */
admin/config-ui/fields/class-field-site-name.php CHANGED
@@ -50,7 +50,7 @@ class WPSEO_Config_Field_Site_Name extends WPSEO_Config_Field {
50
  /**
51
  * Set the data in the options.
52
  *
53
- * @param {string} $data The data to set for the field.
54
  *
55
  * @return bool Returns true or false for successful storing the data.
56
  */
50
  /**
51
  * Set the data in the options.
52
  *
53
+ * @param string $data The data to set for the field.
54
  *
55
  * @return bool Returns true or false for successful storing the data.
56
  */
admin/courses-overview.php CHANGED
@@ -44,6 +44,15 @@ class WPSEO_Courses_Overview implements WPSEO_WordPress_Integration {
44
  */
45
  public function enqueue_scripts() {
46
  wp_enqueue_script( WPSEO_Admin_Asset_Manager::PREFIX . 'courses-overview' );
47
- wp_localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'courses-overview', 'wpseoCoursesOverviewL10n', array( 'version' => $this->get_version(), 'isRtl' => is_rtl() ) );
 
 
 
 
 
 
 
 
 
48
  }
49
  }
44
  */
45
  public function enqueue_scripts() {
46
  wp_enqueue_script( WPSEO_Admin_Asset_Manager::PREFIX . 'courses-overview' );
47
+
48
+ $localizations = array(
49
+ 'version' => $this->get_version(),
50
+ 'isRtl' => is_rtl(),
51
+ );
52
+ wp_localize_script(
53
+ WPSEO_Admin_Asset_Manager::PREFIX . 'courses-overview',
54
+ 'wpseoCoursesOverviewL10n',
55
+ $localizations
56
+ );
57
  }
58
  }
admin/endpoints/class-endpoint-indexable.php CHANGED
@@ -10,11 +10,25 @@
10
  */
11
  class WPSEO_Endpoint_Indexable implements WPSEO_Endpoint, WPSEO_Endpoint_Storable {
12
 
13
- const REST_NAMESPACE = 'yoast/v1';
 
 
 
 
 
 
 
14
  const ENDPOINT_SINGULAR = 'indexables/(?P<object_type>\w+)/(?P<object_id>\d+)';
15
 
 
 
 
16
  const CAPABILITY_RETRIEVE = 'manage_options';
17
- const CAPABILITY_STORE = 'manage_options';
 
 
 
 
18
 
19
  /**
20
  * @var WPSEO_Indexable_Service The indexable service.
10
  */
11
  class WPSEO_Endpoint_Indexable implements WPSEO_Endpoint, WPSEO_Endpoint_Storable {
12
 
13
+ /**
14
+ * @var string
15
+ */
16
+ const REST_NAMESPACE = 'yoast/v1';
17
+
18
+ /**
19
+ * @var string
20
+ */
21
  const ENDPOINT_SINGULAR = 'indexables/(?P<object_type>\w+)/(?P<object_id>\d+)';
22
 
23
+ /**
24
+ * @var string
25
+ */
26
  const CAPABILITY_RETRIEVE = 'manage_options';
27
+
28
+ /**
29
+ * @var string
30
+ */
31
+ const CAPABILITY_STORE = 'manage_options';
32
 
33
  /**
34
  * @var WPSEO_Indexable_Service The indexable service.
admin/filters/class-abstract-post-filter.php CHANGED
@@ -10,6 +10,9 @@
10
  */
11
  abstract class WPSEO_Abstract_Post_Filter implements WPSEO_WordPress_Integration {
12
 
 
 
 
13
  const FILTER_QUERY_ARG = 'yoast_filter';
14
 
15
  /**
10
  */
11
  abstract class WPSEO_Abstract_Post_Filter implements WPSEO_WordPress_Integration {
12
 
13
+ /**
14
+ * @var string
15
+ */
16
  const FILTER_QUERY_ARG = 'yoast_filter';
17
 
18
  /**
admin/filters/class-cornerstone-filter.php CHANGED
@@ -12,6 +12,8 @@ class WPSEO_Cornerstone_Filter extends WPSEO_Abstract_Post_Filter {
12
 
13
  /**
14
  * Name of the meta value.
 
 
15
  */
16
  const META_NAME = 'is_cornerstone';
17
 
12
 
13
  /**
14
  * Name of the meta value.
15
+ *
16
+ * @var string
17
  */
18
  const META_NAME = 'is_cornerstone';
19
 
admin/google_search_console/class-gsc-count.php CHANGED
@@ -11,12 +11,16 @@
11
  class WPSEO_GSC_Count {
12
 
13
  /**
14
- * @var string The name of the option containing the last checked timestamp.
 
 
15
  */
16
  const OPTION_CI_LAST_FETCH = 'wpseo_gsc_last_fetch';
17
 
18
  /**
19
- * @var string The option name where the issues counts are saved.
 
 
20
  */
21
  const OPTION_CI_COUNTS = 'wpseo_gsc_issues_counts';
22
 
11
  class WPSEO_GSC_Count {
12
 
13
  /**
14
+ * The name of the option containing the last checked timestamp.
15
+ *
16
+ * @var string
17
  */
18
  const OPTION_CI_LAST_FETCH = 'wpseo_gsc_last_fetch';
19
 
20
  /**
21
+ * The option name where the issues counts are saved.
22
+ *
23
+ * @var string
24
  */
25
  const OPTION_CI_COUNTS = 'wpseo_gsc_issues_counts';
26
 
admin/google_search_console/class-gsc-table.php CHANGED
@@ -14,6 +14,9 @@ if ( ! class_exists( 'WP_List_Table' ) ) {
14
  */
15
  class WPSEO_GSC_Table extends WP_List_Table {
16
 
 
 
 
17
  const FREE_MODAL_HEIGHT = 140;
18
 
19
  /**
14
  */
15
  class WPSEO_GSC_Table extends WP_List_Table {
16
 
17
+ /**
18
+ * @var int
19
+ */
20
  const FREE_MODAL_HEIGHT = 140;
21
 
22
  /**
admin/google_search_console/class-gsc.php CHANGED
@@ -12,6 +12,8 @@ class WPSEO_GSC implements WPSEO_WordPress_Integration {
12
 
13
  /**
14
  * The option where data will be stored.
 
 
15
  */
16
  const OPTION_WPSEO_GSC = 'wpseo-gsc';
17
 
12
 
13
  /**
14
  * The option where data will be stored.
15
+ *
16
+ * @var string
17
  */
18
  const OPTION_WPSEO_GSC = 'wpseo-gsc';
19
 
admin/import/class-import-settings.php CHANGED
@@ -11,6 +11,12 @@
11
  * Class with functionality to import the Yoast SEO settings.
12
  */
13
  class WPSEO_Import_Settings {
 
 
 
 
 
 
14
  const NONCE_ACTION = 'wpseo-import-settings';
15
 
16
  /**
11
  * Class with functionality to import the Yoast SEO settings.
12
  */
13
  class WPSEO_Import_Settings {
14
+
15
+ /**
16
+ * Nonce action key.
17
+ *
18
+ * @var string
19
+ */
20
  const NONCE_ACTION = 'wpseo-import-settings';
21
 
22
  /**
admin/links/class-link-columns.php CHANGED
@@ -11,12 +11,16 @@
11
  class WPSEO_Link_Columns {
12
 
13
  /**
14
- * @var string Partial column name.
 
 
15
  */
16
  const COLUMN_LINKED = 'linked';
17
 
18
  /**
19
- * @var string Partial column name.
 
 
20
  */
21
  const COLUMN_LINKS = 'links';
22
 
@@ -171,10 +175,19 @@ class WPSEO_Link_Columns {
171
  if ( ! is_array( $columns ) ) {
172
  return $columns;
173
  }
174
- $columns[ 'wpseo-' . self::COLUMN_LINKS ] = '<span class="yoast-linked-to yoast-column-header-has-tooltip" data-label="' . esc_attr__( 'Number of internal links in this post. See "Yoast Columns" text in the help tab for more info.', 'wordpress-seo' ) . '"><span class="screen-reader-text">' . __( '# links in post', 'wordpress-seo' ) . '</span></span>';
 
 
 
 
 
175
 
176
  if ( ! WPSEO_Link_Query::has_unprocessed_posts( $this->public_post_types ) ) {
177
- $columns[ 'wpseo-' . self::COLUMN_LINKED ] = '<span class="yoast-linked-from yoast-column-header-has-tooltip" data-label="' . esc_attr__( 'Number of internal links linking to this post. See "Yoast Columns" text in the help tab for more info.', 'wordpress-seo' ) . '"><span class="screen-reader-text">' . __( '# internal links to', 'wordpress-seo' ) . '</span></span>';
 
 
 
 
178
  }
179
 
180
  return $columns;
11
  class WPSEO_Link_Columns {
12
 
13
  /**
14
+ * Partial column name.
15
+ *
16
+ * @var string
17
  */
18
  const COLUMN_LINKED = 'linked';
19
 
20
  /**
21
+ * Partial column name.
22
+ *
23
+ * @var string
24
  */
25
  const COLUMN_LINKS = 'links';
26
 
175
  if ( ! is_array( $columns ) ) {
176
  return $columns;
177
  }
178
+
179
+ $columns[ 'wpseo-' . self::COLUMN_LINKS ] = sprintf(
180
+ '<span class="yoast-linked-to yoast-column-header-has-tooltip" data-tooltip-text="%1$s"><span class="screen-reader-text">%2$s</span></span>',
181
+ esc_attr__( 'Number of outgoing internal links in this post. See "Yoast Columns" text in the help tab for more info.', 'wordpress-seo' ),
182
+ esc_html__( 'Outgoing internal links', 'wordpress-seo' )
183
+ );
184
 
185
  if ( ! WPSEO_Link_Query::has_unprocessed_posts( $this->public_post_types ) ) {
186
+ $columns[ 'wpseo-' . self::COLUMN_LINKED ] = sprintf(
187
+ '<span class="yoast-linked-from yoast-column-header-has-tooltip" data-tooltip-text="%1$s"><span class="screen-reader-text">%2$s</span></span>',
188
+ esc_attr__( 'Number of internal links linking to this post. See "Yoast Columns" text in the help tab for more info.', 'wordpress-seo' ),
189
+ esc_html__( 'Received internal links', 'wordpress-seo' )
190
+ );
191
  }
192
 
193
  return $columns;
admin/links/class-link-compatibility-notifier.php CHANGED
@@ -10,6 +10,9 @@
10
  */
11
  class WPSEO_Link_Compatibility_Notifier {
12
 
 
 
 
13
  const NOTIFICATION_ID = 'wpseo-links-compatibility';
14
 
15
  /**
10
  */
11
  class WPSEO_Link_Compatibility_Notifier {
12
 
13
+ /**
14
+ * @var string
15
+ */
16
  const NOTIFICATION_ID = 'wpseo-links-compatibility';
17
 
18
  /**
admin/links/class-link-notifier.php CHANGED
@@ -10,6 +10,9 @@
10
  */
11
  class WPSEO_Link_Notifier {
12
 
 
 
 
13
  const NOTIFICATION_ID = 'wpseo-reindex-links';
14
 
15
  /**
10
  */
11
  class WPSEO_Link_Notifier {
12
 
13
+ /**
14
+ * @var string
15
+ */
16
  const NOTIFICATION_ID = 'wpseo-reindex-links';
17
 
18
  /**
admin/links/class-link-reindex-post-endpoint.php CHANGED
@@ -10,9 +10,19 @@
10
  */
11
  class WPSEO_Link_Reindex_Post_Endpoint {
12
 
 
 
 
13
  const REST_NAMESPACE = 'yoast/v1';
 
 
 
 
14
  const ENDPOINT_QUERY = 'reindex_posts';
15
 
 
 
 
16
  const CAPABILITY_RETRIEVE = 'edit_posts';
17
 
18
  /**
10
  */
11
  class WPSEO_Link_Reindex_Post_Endpoint {
12
 
13
+ /**
14
+ * @var string
15
+ */
16
  const REST_NAMESPACE = 'yoast/v1';
17
+
18
+ /**
19
+ * @var string
20
+ */
21
  const ENDPOINT_QUERY = 'reindex_posts';
22
 
23
+ /**
24
+ * @var string
25
+ */
26
  const CAPABILITY_RETRIEVE = 'edit_posts';
27
 
28
  /**
admin/links/class-link-storage.php CHANGED
@@ -10,6 +10,11 @@
10
  */
11
  class WPSEO_Link_Storage implements WPSEO_Installable {
12
 
 
 
 
 
 
13
  const TABLE_NAME = 'yoast_seo_links';
14
 
15
  /**
10
  */
11
  class WPSEO_Link_Storage implements WPSEO_Installable {
12
 
13
+ /**
14
+ * Table name for the link storage.
15
+ *
16
+ * @var string
17
+ */
18
  const TABLE_NAME = 'yoast_seo_links';
19
 
20
  /**
admin/links/class-link-table-accessible-notifier.php CHANGED
@@ -10,6 +10,9 @@
10
  */
11
  class WPSEO_Link_Table_Accessible_Notifier {
12
 
 
 
 
13
  const NOTIFICATION_ID = 'wpseo-links-table-not-accessible';
14
 
15
  /**
10
  */
11
  class WPSEO_Link_Table_Accessible_Notifier {
12
 
13
+ /**
14
+ * @var string
15
+ */
16
  const NOTIFICATION_ID = 'wpseo-links-table-not-accessible';
17
 
18
  /**
admin/links/class-link-table-accessible.php CHANGED
@@ -10,7 +10,14 @@
10
  */
11
  class WPSEO_Link_Table_Accessible {
12
 
13
- const ACCESSIBLE = '0';
 
 
 
 
 
 
 
14
  const INACCESSBILE = '1';
15
 
16
  /**
10
  */
11
  class WPSEO_Link_Table_Accessible {
12
 
13
+ /**
14
+ * @var string
15
+ */
16
+ const ACCESSIBLE = '0';
17
+
18
+ /**
19
+ * @var string
20
+ */
21
  const INACCESSBILE = '1';
22
 
23
  /**
admin/links/class-link.php CHANGED
@@ -10,7 +10,14 @@
10
  */
11
  class WPSEO_Link {
12
 
 
 
 
13
  const TYPE_EXTERNAL = 'external';
 
 
 
 
14
  const TYPE_INTERNAL = 'internal';
15
 
16
  /**
10
  */
11
  class WPSEO_Link {
12
 
13
+ /**
14
+ * @var string
15
+ */
16
  const TYPE_EXTERNAL = 'external';
17
+
18
+ /**
19
+ * @var string
20
+ */
21
  const TYPE_INTERNAL = 'internal';
22
 
23
  /**
admin/metabox/class-metabox.php CHANGED
@@ -25,6 +25,13 @@ class WPSEO_Metabox extends WPSEO_Meta {
25
  */
26
  protected $analysis_readability;
27
 
 
 
 
 
 
 
 
28
  /**
29
  * Class constructor.
30
  */
@@ -34,8 +41,6 @@ class WPSEO_Metabox extends WPSEO_Meta {
34
  add_action( 'wp_insert_post', array( $this, 'save_postdata' ) );
35
  add_action( 'edit_attachment', array( $this, 'save_postdata' ) );
36
  add_action( 'add_attachment', array( $this, 'save_postdata' ) );
37
- add_action( 'post_submitbox_start', array( $this, 'publish_box' ) );
38
- add_action( 'admin_init', array( $this, 'setup_page_analysis' ) );
39
  add_action( 'admin_init', array( $this, 'translate_meta_boxes' ) );
40
 
41
  // Check if one of the social settings is checked in the options, if so, initialize the social_admin object.
@@ -57,43 +62,48 @@ class WPSEO_Metabox extends WPSEO_Meta {
57
  * the main meta box definition array in the class WPSEO_Meta() as well!!!!
58
  */
59
  public static function translate_meta_boxes() {
60
- self::$meta_fields['general']['title']['title'] = __( 'SEO title', 'wordpress-seo' );
61
 
62
- self::$meta_fields['general']['metadesc']['title'] = __( 'Meta description', 'wordpress-seo' );
63
 
64
  /* translators: %s expands to the post type name. */
65
- self::$meta_fields['advanced']['meta-robots-noindex']['title'] = __( 'Allow search engines to show this %s in search results?', 'wordpress-seo' );
66
  if ( '0' === (string) get_option( 'blog_public' ) ) {
67
- self::$meta_fields['advanced']['meta-robots-noindex']['description'] = '<p class="error-message">' . __( 'Warning: even though you can set the meta robots setting here, the entire site is set to noindex in the sitewide privacy settings, so these settings won\'t have an effect.', 'wordpress-seo' ) . '</p>';
68
  }
69
  /* translators: %1$s expands to Yes or No, %2$s expands to the post type name.*/
70
- self::$meta_fields['advanced']['meta-robots-noindex']['options']['0'] = __( 'Default for %2$s, currently: %1$s', 'wordpress-seo' );
71
- self::$meta_fields['advanced']['meta-robots-noindex']['options']['2'] = __( 'Yes', 'wordpress-seo' );
72
- self::$meta_fields['advanced']['meta-robots-noindex']['options']['1'] = __( 'No', 'wordpress-seo' );
73
 
74
  /* translators: %1$s expands to the post type name.*/
75
- self::$meta_fields['advanced']['meta-robots-nofollow']['title'] = __( 'Should search engines follow links on this %1$s?', 'wordpress-seo' );
76
- self::$meta_fields['advanced']['meta-robots-nofollow']['options']['0'] = __( 'Yes', 'wordpress-seo' );
77
- self::$meta_fields['advanced']['meta-robots-nofollow']['options']['1'] = __( 'No', 'wordpress-seo' );
78
 
79
- self::$meta_fields['advanced']['meta-robots-adv']['title'] = __( 'Meta robots advanced', 'wordpress-seo' );
80
- self::$meta_fields['advanced']['meta-robots-adv']['description'] = __( 'Advanced <code>meta</code> robots settings for this page.', 'wordpress-seo' );
81
  /* translators: %s expands to the advanced robots settings default as set in the site-wide settings.*/
82
- self::$meta_fields['advanced']['meta-robots-adv']['options']['-'] = __( 'Site-wide default: %s', 'wordpress-seo' );
83
- self::$meta_fields['advanced']['meta-robots-adv']['options']['none'] = __( 'None', 'wordpress-seo' );
84
- self::$meta_fields['advanced']['meta-robots-adv']['options']['noimageindex'] = __( 'No Image Index', 'wordpress-seo' );
85
- self::$meta_fields['advanced']['meta-robots-adv']['options']['noarchive'] = __( 'No Archive', 'wordpress-seo' );
86
- self::$meta_fields['advanced']['meta-robots-adv']['options']['nosnippet'] = __( 'No Snippet', 'wordpress-seo' );
87
-
88
- self::$meta_fields['advanced']['bctitle']['title'] = __( 'Breadcrumbs Title', 'wordpress-seo' );
89
- self::$meta_fields['advanced']['bctitle']['description'] = __( 'Title to use for this page in breadcrumb paths', 'wordpress-seo' );
90
-
91
- self::$meta_fields['advanced']['canonical']['title'] = __( 'Canonical URL', 'wordpress-seo' );
92
- /* translators: 1: link open tag; 2: link close tag. */
93
- self::$meta_fields['advanced']['canonical']['description'] = sprintf( __( 'The canonical URL that this page should point to, leave empty to default to permalink. %1$sCross domain canonical%2$s supported too.', 'wordpress-seo' ), '<a target="_blank" href="http://googlewebmastercentral.blogspot.com/2009/12/handling-legitimate-cross-domain.html">', '</a>' );
 
 
 
 
 
94
 
95
- self::$meta_fields['advanced']['redirect']['title'] = __( '301 Redirect', 'wordpress-seo' );
96
- self::$meta_fields['advanced']['redirect']['description'] = __( 'The URL that this page should redirect to.', 'wordpress-seo' );
97
 
98
  do_action( 'wpseo_tab_translate' );
99
  }
@@ -112,48 +122,6 @@ class WPSEO_Metabox extends WPSEO_Meta {
112
  return WPSEO_Utils::is_metabox_active( $identifier, $type );
113
  }
114
 
115
- /**
116
- * Sets up all the functionality related to the prominence of the page analysis functionality.
117
- */
118
- public function setup_page_analysis() {
119
- if ( apply_filters( 'wpseo_use_page_analysis', true ) === true ) {
120
- add_action( 'post_submitbox_start', array( $this, 'publish_box' ) );
121
- }
122
- }
123
-
124
- /**
125
- * Outputs the page analysis score in the Publish Box.
126
- */
127
- public function publish_box() {
128
- if ( $this->display_metabox() === false ) {
129
- return;
130
- }
131
-
132
- $post = $this->get_metabox_post();
133
-
134
- if ( self::get_value( 'meta-robots-noindex', $post->ID ) === '1' ) {
135
- $score_label = 'noindex';
136
- $title = __( 'Post is set to noindex.', 'wordpress-seo' );
137
- $score_title = $title;
138
- }
139
- else {
140
- $score = self::get_value( 'linkdex', $post->ID );
141
- if ( $score === '' ) {
142
- $score_label = 'na';
143
- $title = __( 'No focus keyphrase set.', 'wordpress-seo' );
144
- }
145
- else {
146
- $score_label = WPSEO_Utils::translate_score( $score );
147
- }
148
-
149
- $score_title = WPSEO_Utils::translate_score( $score, false );
150
-
151
- if ( ! isset( $title ) ) {
152
- $title = $score_title;
153
- }
154
- }
155
- }
156
-
157
  /**
158
  * Adds the Yoast SEO meta box to the edit boxes in the edit post, page,
159
  * attachment, and custom post types pages.
@@ -162,36 +130,18 @@ class WPSEO_Metabox extends WPSEO_Meta {
162
  */
163
  public function add_meta_box() {
164
  $post_types = WPSEO_Post_Type::get_accessible_post_types();
 
165
 
166
  if ( ! is_array( $post_types ) || $post_types === array() ) {
167
  return;
168
  }
169
 
170
- $tab_registered = false;
171
 
172
- foreach ( $post_types as $post_type ) {
173
- if ( $this->display_metabox( $post_type ) === false ) {
174
- continue;
175
- }
176
-
177
- $product_title = 'Yoast SEO';
178
-
179
- if ( file_exists( WPSEO_PATH . 'premium/' ) ) {
180
- $product_title .= ' Premium';
181
- }
182
-
183
- if ( get_current_screen() !== null ) {
184
- $screen_id = get_current_screen()->id;
185
- add_filter( "postbox_classes_{$screen_id}_wpseo_meta", array( $this, 'wpseo_metabox_class' ) );
186
- }
187
 
188
- if ( ! $tab_registered ) {
189
- // Add template variables tab to the Help Center.
190
- $tab = new WPSEO_Help_Center_Template_Variables_Tab();
191
- $tab->register_hooks();
192
-
193
- $tab_registered = true;
194
- }
195
 
196
  add_meta_box(
197
  'wpseo_meta',
@@ -463,7 +413,7 @@ class WPSEO_Metabox extends WPSEO_Meta {
463
  */
464
  private function get_tab_content( $tab_name ) {
465
  $content = '';
466
- foreach ( $this->get_meta_field_defs( $tab_name ) as $key => $meta_field ) {
467
  $content .= $this->do_meta_box( $meta_field, $key );
468
  }
469
 
@@ -482,8 +432,8 @@ class WPSEO_Metabox extends WPSEO_Meta {
482
  */
483
  public function do_meta_box( $meta_field_def, $key = '' ) {
484
  $content = '';
485
- $esc_form_key = esc_attr( self::$form_prefix . $key );
486
- $meta_value = self::get_value( $key, $this->get_metabox_post()->ID );
487
 
488
  $class = '';
489
  if ( isset( $meta_field_def['class'] ) && $meta_field_def['class'] !== '' ) {
@@ -558,7 +508,7 @@ class WPSEO_Metabox extends WPSEO_Meta {
558
  $content .= '<select multiple="multiple" size="' . esc_attr( $options_count ) . '" name="' . $esc_form_key . '[]" id="' . $esc_form_key . '" class="yoast' . $class . '"' . $aria_describedby . '>';
559
  foreach ( $meta_field_def['options'] as $val => $option ) {
560
  $selected = '';
561
- if ( in_array( $val, $selected_arr ) ) {
562
  $selected = ' selected="selected"';
563
  }
564
  $content .= '<option ' . $selected . ' value="' . esc_attr( $val ) . '">' . esc_html( $option ) . '</option>';
@@ -700,18 +650,18 @@ class WPSEO_Metabox extends WPSEO_Meta {
700
  do_action( 'wpseo_save_compare_data', $post );
701
 
702
  $meta_boxes = apply_filters( 'wpseo_save_metaboxes', array() );
703
- $meta_boxes = array_merge( $meta_boxes, $this->get_meta_field_defs( 'general', $post->post_type ), $this->get_meta_field_defs( 'advanced' ) );
704
 
705
  foreach ( $meta_boxes as $key => $meta_box ) {
706
 
707
  // If analysis is disabled remove that analysis score value from the DB.
708
  if ( $this->is_meta_value_disabled( $key ) ) {
709
- self::delete( $key, $post_id );
710
  continue;
711
  }
712
 
713
  $data = null;
714
- $field_name = self::$form_prefix . $key;
715
 
716
  if ( 'checkbox' === $meta_box['type'] ) {
717
  $data = isset( $_POST[ $field_name ] ) ? 'on' : 'off';
@@ -737,7 +687,7 @@ class WPSEO_Metabox extends WPSEO_Meta {
737
  }
738
 
739
  if ( $data !== null ) {
740
- self::set_value( $key, $data, $post_id );
741
  }
742
  }
743
 
@@ -775,11 +725,6 @@ class WPSEO_Metabox extends WPSEO_Meta {
775
 
776
  $is_editor = self::is_post_overview( $pagenow ) || self::is_post_edit( $pagenow );
777
 
778
- /* Filter 'wpseo_always_register_metaboxes_on_admin' documented in wpseo-main.php */
779
- if ( ( $is_editor === false && apply_filters( 'wpseo_always_register_metaboxes_on_admin', false ) === false ) || $this->display_metabox() === false ) {
780
- return;
781
- }
782
-
783
  if ( self::is_post_overview( $pagenow ) ) {
784
  $asset_manager->enqueue_style( 'edit-page' );
785
  $asset_manager->enqueue_script( 'edit-page-script' );
@@ -787,6 +732,11 @@ class WPSEO_Metabox extends WPSEO_Meta {
787
  return;
788
  }
789
 
 
 
 
 
 
790
  if ( get_queried_object_id() !== 0 ) {
791
  // Enqueue files needed for upload functionality.
792
  wp_enqueue_media( array( 'post' => get_queried_object_id() ) );
@@ -1026,4 +976,64 @@ class WPSEO_Metabox extends WPSEO_Meta {
1026
  return 'post.php' === $page
1027
  || 'post-new.php' === $page;
1028
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1029
  }
25
  */
26
  protected $analysis_readability;
27
 
28
+ /**
29
+ * The metabox editor object.
30
+ *
31
+ * @var WPSEO_Metabox_Editor
32
+ */
33
+ protected $editor;
34
+
35
  /**
36
  * Class constructor.
37
  */
41
  add_action( 'wp_insert_post', array( $this, 'save_postdata' ) );
42
  add_action( 'edit_attachment', array( $this, 'save_postdata' ) );
43
  add_action( 'add_attachment', array( $this, 'save_postdata' ) );
 
 
44
  add_action( 'admin_init', array( $this, 'translate_meta_boxes' ) );
45
 
46
  // Check if one of the social settings is checked in the options, if so, initialize the social_admin object.
62
  * the main meta box definition array in the class WPSEO_Meta() as well!!!!
63
  */
64
  public static function translate_meta_boxes() {
65
+ WPSEO_Meta::$meta_fields['general']['title']['title'] = __( 'SEO title', 'wordpress-seo' );
66
 
67
+ WPSEO_Meta::$meta_fields['general']['metadesc']['title'] = __( 'Meta description', 'wordpress-seo' );
68
 
69
  /* translators: %s expands to the post type name. */
70
+ WPSEO_Meta::$meta_fields['advanced']['meta-robots-noindex']['title'] = __( 'Allow search engines to show this %s in search results?', 'wordpress-seo' );
71
  if ( '0' === (string) get_option( 'blog_public' ) ) {
72
+ WPSEO_Meta::$meta_fields['advanced']['meta-robots-noindex']['description'] = '<p class="error-message">' . __( 'Warning: even though you can set the meta robots setting here, the entire site is set to noindex in the sitewide privacy settings, so these settings won\'t have an effect.', 'wordpress-seo' ) . '</p>';
73
  }
74
  /* translators: %1$s expands to Yes or No, %2$s expands to the post type name.*/
75
+ WPSEO_Meta::$meta_fields['advanced']['meta-robots-noindex']['options']['0'] = __( 'Default for %2$s, currently: %1$s', 'wordpress-seo' );
76
+ WPSEO_Meta::$meta_fields['advanced']['meta-robots-noindex']['options']['2'] = __( 'Yes', 'wordpress-seo' );
77
+ WPSEO_Meta::$meta_fields['advanced']['meta-robots-noindex']['options']['1'] = __( 'No', 'wordpress-seo' );
78
 
79
  /* translators: %1$s expands to the post type name.*/
80
+ WPSEO_Meta::$meta_fields['advanced']['meta-robots-nofollow']['title'] = __( 'Should search engines follow links on this %1$s?', 'wordpress-seo' );
81
+ WPSEO_Meta::$meta_fields['advanced']['meta-robots-nofollow']['options']['0'] = __( 'Yes', 'wordpress-seo' );
82
+ WPSEO_Meta::$meta_fields['advanced']['meta-robots-nofollow']['options']['1'] = __( 'No', 'wordpress-seo' );
83
 
84
+ WPSEO_Meta::$meta_fields['advanced']['meta-robots-adv']['title'] = __( 'Meta robots advanced', 'wordpress-seo' );
85
+ WPSEO_Meta::$meta_fields['advanced']['meta-robots-adv']['description'] = __( 'Advanced <code>meta</code> robots settings for this page.', 'wordpress-seo' );
86
  /* translators: %s expands to the advanced robots settings default as set in the site-wide settings.*/
87
+ WPSEO_Meta::$meta_fields['advanced']['meta-robots-adv']['options']['-'] = __( 'Site-wide default: %s', 'wordpress-seo' );
88
+ WPSEO_Meta::$meta_fields['advanced']['meta-robots-adv']['options']['none'] = __( 'None', 'wordpress-seo' );
89
+ WPSEO_Meta::$meta_fields['advanced']['meta-robots-adv']['options']['noimageindex'] = __( 'No Image Index', 'wordpress-seo' );
90
+ WPSEO_Meta::$meta_fields['advanced']['meta-robots-adv']['options']['noarchive'] = __( 'No Archive', 'wordpress-seo' );
91
+ WPSEO_Meta::$meta_fields['advanced']['meta-robots-adv']['options']['nosnippet'] = __( 'No Snippet', 'wordpress-seo' );
92
+
93
+ WPSEO_Meta::$meta_fields['advanced']['bctitle']['title'] = __( 'Breadcrumbs Title', 'wordpress-seo' );
94
+ WPSEO_Meta::$meta_fields['advanced']['bctitle']['description'] = __( 'Title to use for this page in breadcrumb paths', 'wordpress-seo' );
95
+
96
+ WPSEO_Meta::$meta_fields['advanced']['canonical']['title'] = __( 'Canonical URL', 'wordpress-seo' );
97
+
98
+ WPSEO_Meta::$meta_fields['advanced']['canonical']['description'] = sprintf(
99
+ /* translators: 1: link open tag; 2: link close tag. */
100
+ __( 'The canonical URL that this page should point to. Leave empty to default to permalink. %1$sCross domain canonical%2$s supported too.', 'wordpress-seo' ),
101
+ '<a href="https://googlewebmastercentral.blogspot.com/2009/12/handling-legitimate-cross-domain.html" target="_blank" rel="noopener">',
102
+ WPSEO_Admin_Utils::get_new_tab_message() . '</a>'
103
+ );
104
 
105
+ WPSEO_Meta::$meta_fields['advanced']['redirect']['title'] = __( '301 Redirect', 'wordpress-seo' );
106
+ WPSEO_Meta::$meta_fields['advanced']['redirect']['description'] = __( 'The URL that this page should redirect to.', 'wordpress-seo' );
107
 
108
  do_action( 'wpseo_tab_translate' );
109
  }
122
  return WPSEO_Utils::is_metabox_active( $identifier, $type );
123
  }
124
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
  /**
126
  * Adds the Yoast SEO meta box to the edit boxes in the edit post, page,
127
  * attachment, and custom post types pages.
130
  */
131
  public function add_meta_box() {
132
  $post_types = WPSEO_Post_Type::get_accessible_post_types();
133
+ $post_types = array_filter( $post_types, array( $this, 'display_metabox' ) );
134
 
135
  if ( ! is_array( $post_types ) || $post_types === array() ) {
136
  return;
137
  }
138
 
139
+ $product_title = $this->get_product_title();
140
 
141
+ $this->register_helpcenter_tab();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
142
 
143
+ foreach ( $post_types as $post_type ) {
144
+ add_filter( "postbox_classes_{$post_type}_wpseo_meta", array( $this, 'wpseo_metabox_class' ) );
 
 
 
 
 
145
 
146
  add_meta_box(
147
  'wpseo_meta',
413
  */
414
  private function get_tab_content( $tab_name ) {
415
  $content = '';
416
+ foreach ( WPSEO_Meta::get_meta_field_defs( $tab_name ) as $key => $meta_field ) {
417
  $content .= $this->do_meta_box( $meta_field, $key );
418
  }
419
 
432
  */
433
  public function do_meta_box( $meta_field_def, $key = '' ) {
434
  $content = '';
435
+ $esc_form_key = esc_attr( WPSEO_Meta::$form_prefix . $key );
436
+ $meta_value = WPSEO_Meta::get_value( $key, $this->get_metabox_post()->ID );
437
 
438
  $class = '';
439
  if ( isset( $meta_field_def['class'] ) && $meta_field_def['class'] !== '' ) {
508
  $content .= '<select multiple="multiple" size="' . esc_attr( $options_count ) . '" name="' . $esc_form_key . '[]" id="' . $esc_form_key . '" class="yoast' . $class . '"' . $aria_describedby . '>';
509
  foreach ( $meta_field_def['options'] as $val => $option ) {
510
  $selected = '';
511
+ if ( in_array( $val, $selected_arr, true ) ) {
512
  $selected = ' selected="selected"';
513
  }
514
  $content .= '<option ' . $selected . ' value="' . esc_attr( $val ) . '">' . esc_html( $option ) . '</option>';
650
  do_action( 'wpseo_save_compare_data', $post );
651
 
652
  $meta_boxes = apply_filters( 'wpseo_save_metaboxes', array() );
653
+ $meta_boxes = array_merge( $meta_boxes, WPSEO_Meta::get_meta_field_defs( 'general', $post->post_type ), WPSEO_Meta::get_meta_field_defs( 'advanced' ) );
654
 
655
  foreach ( $meta_boxes as $key => $meta_box ) {
656
 
657
  // If analysis is disabled remove that analysis score value from the DB.
658
  if ( $this->is_meta_value_disabled( $key ) ) {
659
+ WPSEO_Meta::delete( $key, $post_id );
660
  continue;
661
  }
662
 
663
  $data = null;
664
+ $field_name = WPSEO_Meta::$form_prefix . $key;
665
 
666
  if ( 'checkbox' === $meta_box['type'] ) {
667
  $data = isset( $_POST[ $field_name ] ) ? 'on' : 'off';
687
  }
688
 
689
  if ( $data !== null ) {
690
+ WPSEO_Meta::set_value( $key, $data, $post_id );
691
  }
692
  }
693
 
725
 
726
  $is_editor = self::is_post_overview( $pagenow ) || self::is_post_edit( $pagenow );
727
 
 
 
 
 
 
728
  if ( self::is_post_overview( $pagenow ) ) {
729
  $asset_manager->enqueue_style( 'edit-page' );
730
  $asset_manager->enqueue_script( 'edit-page-script' );
732
  return;
733
  }
734
 
735
+ /* Filter 'wpseo_always_register_metaboxes_on_admin' documented in wpseo-main.php */
736
+ if ( ( $is_editor === false && apply_filters( 'wpseo_always_register_metaboxes_on_admin', false ) === false ) || $this->display_metabox() === false ) {
737
+ return;
738
+ }
739
+
740
  if ( get_queried_object_id() !== 0 ) {
741
  // Enqueue files needed for upload functionality.
742
  wp_enqueue_media( array( 'post' => get_queried_object_id() ) );
976
  return 'post.php' === $page
977
  || 'post-new.php' === $page;
978
  }
979
+
980
+ /**
981
+ * Retrieves the product title.
982
+ *
983
+ * @return string The product title.
984
+ */
985
+ protected function get_product_title() {
986
+ $product_title = 'Yoast SEO';
987
+
988
+ if ( WPSEO_Utils::is_yoast_seo_premium() ) {
989
+ $product_title .= ' Premium';
990
+ }
991
+
992
+ return $product_title;
993
+ }
994
+
995
+ /**
996
+ * Adds the template variables tab to the helpcenter.
997
+ *
998
+ * @return void
999
+ */
1000
+ protected function register_helpcenter_tab() {
1001
+ static $tab_registered;
1002
+
1003
+ if ( $tab_registered ) {
1004
+ return;
1005
+ }
1006
+
1007
+ // Add template variables tab to the Help Center.
1008
+ $tab = new WPSEO_Help_Center_Template_Variables_Tab();
1009
+ $tab->register_hooks();
1010
+
1011
+ $tab_registered = true;
1012
+ }
1013
+
1014
+ /* ********************* DEPRECATED METHODS ********************* */
1015
+
1016
+ /**
1017
+ * Outputs the page analysis score in the Publish Box.
1018
+ *
1019
+ * @deprecated 9.6
1020
+ * @codeCoverageIgnore
1021
+ *
1022
+ * @return void
1023
+ */
1024
+ public function publish_box() {
1025
+ _deprecated_function( __METHOD__, 'WPSEO 9.6' );
1026
+ }
1027
+
1028
+ /**
1029
+ * Sets up all the functionality related to the prominence of the page analysis functionality.
1030
+ *
1031
+ * @deprecated 9.6
1032
+ * @codeCoverageIgnore
1033
+ *
1034
+ * @return void
1035
+ */
1036
+ public function setup_page_analysis() {
1037
+ _deprecated_function( __METHOD__, 'WPSEO 9.6' );
1038
+ }
1039
  }
admin/my-yoast-proxy.php DELETED
@@ -1,26 +0,0 @@
1
- <?php
2
- /**
3
- * WPSEO plugin file.
4
- *
5
- * This file acts as a proxy. It will read external files and serves the like they are located locally.
6
- *
7
- * @package WPSEO\Admin
8
- */
9
-
10
- switch ( filter_input( INPUT_GET, 'file', FILTER_SANITIZE_STRING ) ) {
11
- case 'research-webworker':
12
- $my_yoast_url = 'https://my.yoast.com/api/downloads/file/analysis-worker';
13
- $my_yoast_url_content_type = 'text/javascript; charset=UTF-8';
14
- break;
15
- }
16
-
17
- if ( empty( $my_yoast_url ) ) {
18
- exit;
19
- }
20
-
21
- header( 'Content-Type: ' . $my_yoast_url_content_type );
22
- header( 'Cache-Control: max-age=86400' );
23
-
24
- readfile( $my_yoast_url );
25
-
26
- exit;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/onpage/class-onpage-option.php CHANGED
@@ -10,28 +10,51 @@
10
  */
11
  class WPSEO_OnPage_Option {
12
 
13
- const NOT_FETCHED = 99;
14
- const IS_INDEXABLE = 1;
 
 
 
 
 
 
 
 
 
 
 
15
  const IS_NOT_INDEXABLE = 0;
16
- const CANNOT_FETCH = -1;
17
 
18
  /**
19
- * The name of the option where data will be stored
 
 
 
 
 
 
 
20
  */
21
  const OPTION_NAME = 'wpseo_onpage';
22
 
23
  /**
24
- * The key of the status in the option
 
 
25
  */
26
  const STATUS = 'status';
27
 
28
  /**
29
  * The key of the last fetch date in the option.
 
 
30
  */
31
  const LAST_FETCH = 'last_fetch';
32
 
33
  /**
34
  * The limit for fetching the status manually.
 
 
35
  */
36
  const FETCH_LIMIT = 15;
37
 
10
  */
11
  class WPSEO_OnPage_Option {
12
 
13
+ /**
14
+ * @var int
15
+ */
16
+ const NOT_FETCHED = 99;
17
+
18
+ /**
19
+ * @var int
20
+ */
21
+ const IS_INDEXABLE = 1;
22
+
23
+ /**
24
+ * @var int
25
+ */
26
  const IS_NOT_INDEXABLE = 0;
 
27
 
28
  /**
29
+ * @var int
30
+ */
31
+ const CANNOT_FETCH = -1;
32
+
33
+ /**
34
+ * The name of the option where data will be stored.
35
+ *
36
+ * @var string
37
  */
38
  const OPTION_NAME = 'wpseo_onpage';
39
 
40
  /**
41
+ * The key of the status in the option.
42
+ *
43
+ * @var string
44
  */
45
  const STATUS = 'status';
46
 
47
  /**
48
  * The key of the last fetch date in the option.
49
+ *
50
+ * @var string
51
  */
52
  const LAST_FETCH = 'last_fetch';
53
 
54
  /**
55
  * The limit for fetching the status manually.
56
+ *
57
+ * @var int
58
  */
59
  const FETCH_LIMIT = 15;
60
 
admin/onpage/class-onpage.php CHANGED
@@ -12,6 +12,8 @@ class WPSEO_OnPage implements WPSEO_WordPress_Integration {
12
 
13
  /**
14
  * The name of the user meta key for storing the dismissed status.