Yoast SEO - Version 12.7

Version Description

Download this release

Release Info

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

Code changes from version 12.6.2 to 12.7

Files changed (332) hide show
  1. admin/admin-settings-changed-listener.php +1 -1
  2. admin/ajax.php +8 -8
  3. admin/ajax/class-recalculate-scores-ajax.php +9 -9
  4. admin/ajax/class-shortcode-filter.php +4 -4
  5. admin/ajax/class-yoast-dismissable-notice.php +1 -1
  6. admin/ajax/class-yoast-onpage-ajax.php +1 -1
  7. admin/ajax/class-yoast-plugin-conflict-ajax.php +3 -3
  8. admin/capabilities/class-abstract-capability-manager.php +2 -2
  9. admin/capabilities/class-capability-manager-integration.php +11 -11
  10. admin/capabilities/class-capability-manager-vip.php +3 -3
  11. admin/capabilities/class-capability-utils.php +1 -1
  12. admin/capabilities/class-register-capabilities.php +5 -5
  13. admin/class-add-keyword-modal.php +4 -4
  14. admin/class-admin-asset-analysis-worker-location.php +3 -3
  15. admin/class-admin-asset-manager.php +186 -186
  16. admin/class-admin-asset-yoast-components-l10n.php +2 -2
  17. admin/class-admin-editor-specific-replace-vars.php +14 -14
  18. admin/class-admin-gutenberg-compatibility-notification.php +3 -3
  19. admin/class-admin-init.php +41 -41
  20. admin/class-admin-media-purge-notification.php +4 -4
  21. admin/class-admin-recommended-replace-vars.php +16 -16
  22. admin/class-admin-user-profile.php +6 -6
  23. admin/class-admin.php +36 -36
  24. admin/class-asset.php +3 -3
  25. admin/class-bulk-description-editor-list-table.php +4 -4
  26. admin/class-bulk-editor-list-table.php +53 -53
  27. admin/class-bulk-title-editor-list-table.php +5 -5
  28. admin/class-collector.php +2 -2
  29. admin/class-config.php +10 -10
  30. admin/class-customizer.php +24 -24
  31. admin/class-database-proxy.php +3 -3
  32. admin/class-expose-shortlinks.php +3 -3
  33. admin/class-extension-manager.php +2 -2
  34. admin/class-extension.php +1 -1
  35. admin/class-extensions.php +12 -12
  36. admin/class-helpscout.php +6 -6
  37. admin/class-keyword-synonyms-modal.php +4 -4
  38. admin/class-license-page-manager.php +7 -7
  39. admin/class-meta-columns.php +50 -50
  40. admin/class-meta-storage.php +8 -8
  41. admin/class-multiple-keywords-modal.php +4 -4
  42. admin/class-my-yoast-proxy.php +7 -7
  43. admin/class-my-yoast-route.php +10 -10
  44. admin/class-option-tab.php +1 -1
  45. admin/class-option-tabs.php +2 -2
  46. admin/class-paper-presenter.php +12 -12
  47. admin/class-plugin-availability.php +29 -29
  48. admin/class-plugin-conflict.php +11 -11
  49. admin/class-premium-upsell-admin-block.php +4 -4
  50. admin/class-primary-term-admin.php +13 -13
  51. admin/class-product-upsell-notice.php +2 -2
  52. admin/class-recalculate-scores.php +2 -2
  53. admin/class-remote-request.php +3 -3
  54. admin/class-schema-person-upgrade-notification.php +3 -3
  55. admin/class-social-admin.php +11 -11
  56. admin/class-suggested-plugins.php +5 -5
  57. admin/class-yoast-alerts.php +24 -24
  58. admin/class-yoast-columns.php +3 -3
  59. admin/class-yoast-dashboard-widget.php +8 -9
  60. admin/class-yoast-form.php +42 -42
  61. admin/class-yoast-input-validation.php +4 -4
  62. admin/class-yoast-network-admin.php +15 -15
  63. admin/class-yoast-network-settings-api.php +9 -9
  64. admin/class-yoast-notification-center.php +26 -26
  65. admin/class-yoast-notification.php +16 -16
  66. admin/class-yoast-plugin-conflict.php +10 -10
  67. admin/config-ui/class-configuration-components.php +5 -5
  68. admin/config-ui/class-configuration-endpoint.php +8 -8
  69. admin/config-ui/class-configuration-options-adapter.php +4 -4
  70. admin/config-ui/class-configuration-page.php +7 -7
  71. admin/config-ui/class-configuration-service.php +2 -2
  72. admin/config-ui/class-configuration-storage.php +9 -9
  73. admin/config-ui/class-configuration-structure.php +16 -16
  74. admin/config-ui/class-configuration-translations.php +2 -2
  75. admin/config-ui/components/class-component-mailchimp-signup.php +4 -4
  76. admin/config-ui/components/class-component-suggestions.php +13 -13
  77. admin/config-ui/factories/class-factory-post-type.php +3 -3
  78. admin/config-ui/fields/class-field-choice-post-type.php +2 -2
  79. admin/config-ui/fields/class-field-choice.php +3 -3
  80. admin/config-ui/fields/class-field-environment.php +2 -2
  81. admin/config-ui/fields/class-field-mailchimp-signup.php +2 -2
  82. admin/config-ui/fields/class-field-multiple-authors.php +4 -4
  83. admin/config-ui/fields/class-field-site-name.php +2 -2
  84. admin/config-ui/fields/class-field-success-message.php +2 -2
  85. admin/config-ui/fields/class-field-suggestions.php +4 -4
  86. admin/config-ui/fields/class-field-upsell-configuration-service.php +6 -6
  87. admin/config-ui/fields/class-field-upsell-site-review.php +6 -6
  88. admin/config-ui/fields/class-field.php +7 -7
  89. admin/endpoints/class-endpoint-file-size.php +10 -10
  90. admin/endpoints/class-endpoint-indexable.php +5 -5
  91. admin/endpoints/class-endpoint-ryte.php +4 -4
  92. admin/endpoints/class-endpoint-statistics.php +4 -4
  93. admin/filters/class-abstract-post-filter.php +11 -11
  94. admin/filters/class-cornerstone-filter.php +4 -4
  95. admin/formatter/class-metabox-formatter.php +16 -16
  96. admin/formatter/class-post-metabox-formatter.php +5 -5
  97. admin/formatter/class-term-metabox-formatter.php +3 -3
  98. admin/import/class-import-detector.php +1 -1
  99. admin/import/class-import-settings.php +2 -8
  100. admin/import/plugins/class-abstract-plugin-importer.php +3 -3
  101. admin/import/plugins/class-import-aioseo.php +14 -14
  102. admin/import/plugins/class-import-greg-high-performance-seo.php +6 -6
  103. admin/import/plugins/class-import-headspace.php +12 -12
  104. admin/import/plugins/class-import-jetpack.php +4 -4
  105. admin/import/plugins/class-import-platinum-seo-pack.php +11 -11
  106. admin/import/plugins/class-import-rankmath.php +31 -31
  107. admin/import/plugins/class-import-seo-framework.php +22 -22
  108. admin/import/plugins/class-import-seopressor.php +11 -11
  109. admin/import/plugins/class-import-smartcrawl.php +19 -19
  110. admin/import/plugins/class-import-squirrly.php +2 -2
  111. admin/import/plugins/class-import-ultimate-seo.php +18 -18
  112. admin/import/plugins/class-import-woothemes-seo.php +14 -14
  113. admin/import/plugins/class-import-wp-meta-seo.php +26 -26
  114. admin/import/plugins/class-import-wpseo.php +37 -37
  115. admin/import/plugins/class-importers.php +2 -2
  116. admin/links/class-link-cleanup-transient.php +1 -1
  117. admin/links/class-link-column-count.php +6 -6
  118. admin/links/class-link-columns.php +13 -13
  119. admin/links/class-link-compatibility-notifier.php +2 -2
  120. admin/links/class-link-content-processor.php +5 -5
  121. admin/links/class-link-extractor.php +1 -1
  122. admin/links/class-link-factory.php +2 -2
  123. admin/links/class-link-installer.php +3 -3
  124. admin/links/class-link-notifier.php +4 -4
  125. admin/links/class-link-query.php +1 -1
  126. admin/links/class-link-reindex-dashboard.php +16 -16
  127. admin/links/class-link-reindex-post-endpoint.php +4 -4
  128. admin/links/class-link-reindex-post-service.php +2 -2
  129. admin/links/class-link-storage.php +11 -11
  130. admin/links/class-link-table-accessible-notifier.php +2 -2
  131. admin/links/class-link-type-classifier.php +2 -2
  132. admin/links/class-link-watcher.php +3 -3
  133. admin/menu/class-admin-menu.php +4 -4
  134. admin/menu/class-base-menu.php +5 -5
  135. admin/menu/class-network-admin-menu.php +5 -5
  136. admin/menu/class-replacevar-editor.php +6 -6
  137. admin/menu/class-submenu-capability-normalize.php +1 -1
  138. admin/metabox/class-abstract-sectioned-metabox-tab.php +3 -3
  139. admin/metabox/class-metabox-collapsible.php +2 -2
  140. admin/metabox/class-metabox-collapsibles-section.php +6 -6
  141. admin/metabox/class-metabox-editor.php +2 -2
  142. admin/metabox/class-metabox-form-tab.php +3 -3
  143. admin/metabox/class-metabox-section-additional.php +3 -3
  144. admin/metabox/class-metabox-section-react.php +7 -7
  145. admin/metabox/class-metabox.php +53 -53
  146. admin/notifiers/class-post-type-archive-notification-handler.php +7 -7
  147. admin/onpage/class-onpage-option.php +2 -2
  148. admin/onpage/class-onpage-request.php +4 -4
  149. admin/onpage/class-onpage.php +10 -10
  150. admin/onpage/class-ryte-service.php +10 -10
  151. admin/pages/dashboard.php +2 -2
  152. admin/pages/network.php +1 -1
  153. admin/pages/tools.php +9 -9
  154. admin/recalculate/class-recalculate-posts.php +6 -6
  155. admin/recalculate/class-recalculate-terms.php +8 -8
  156. admin/recalculate/class-recalculate.php +2 -2
  157. admin/roles/class-abstract-role-manager.php +8 -8
  158. admin/roles/class-register-roles.php +1 -1
  159. admin/roles/class-role-manager-vip.php +4 -4
  160. admin/roles/class-role-manager-wp.php +1 -1
  161. admin/services/class-file-size.php +6 -6
  162. admin/services/class-indexable-post-provider.php +5 -5
  163. admin/services/class-indexable-provider.php +1 -1
  164. admin/services/class-indexable-term-provider.php +5 -5
  165. admin/statistics/class-statistics-integration.php +2 -2
  166. admin/statistics/class-statistics-service.php +12 -12
  167. admin/taxonomy/class-taxonomy-columns.php +3 -3
  168. admin/taxonomy/class-taxonomy-content-fields.php +3 -3
  169. admin/taxonomy/class-taxonomy-fields-presenter.php +1 -1
  170. admin/taxonomy/class-taxonomy-fields.php +2 -2
  171. admin/taxonomy/class-taxonomy-metabox.php +6 -6
  172. admin/taxonomy/class-taxonomy-settings-fields.php +3 -3
  173. admin/taxonomy/class-taxonomy-social-fields.php +8 -8
  174. admin/taxonomy/class-taxonomy.php +19 -19
  175. admin/tracking/class-tracking-default-data.php +2 -2
  176. admin/tracking/class-tracking-plugin-data.php +6 -6
  177. admin/tracking/class-tracking-server-data.php +7 -7
  178. admin/tracking/class-tracking-settings-data.php +6 -6
  179. admin/tracking/class-tracking-theme-data.php +6 -6
  180. admin/tracking/class-tracking.php +66 -13
  181. admin/views/class-view-utils.php +2 -2
  182. admin/views/class-yoast-feature-toggle.php +1 -1
  183. admin/views/class-yoast-feature-toggles.php +20 -20
  184. admin/views/class-yoast-input-select.php +4 -4
  185. admin/views/licenses.php +22 -22
  186. admin/views/partial-alerts-template.php +2 -2
  187. admin/views/tabs/dashboard/dashboard.php +1 -1
  188. admin/views/tabs/dashboard/features.php +2 -2
  189. admin/views/tabs/dashboard/webmaster-tools.php +2 -2
  190. admin/views/tabs/metas/archives.php +10 -10
  191. admin/views/tabs/metas/archives/help.php +2 -2
  192. admin/views/tabs/metas/breadcrumbs.php +2 -2
  193. admin/views/tabs/metas/general.php +2 -2
  194. admin/views/tabs/metas/media.php +2 -2
  195. admin/views/tabs/metas/paper-content/author-archive-settings.php +4 -4
  196. admin/views/tabs/metas/paper-content/breadcrumbs-content.php +11 -11
  197. admin/views/tabs/metas/paper-content/date-archives-settings.php +4 -4
  198. admin/views/tabs/metas/paper-content/general/homepage.php +2 -2
  199. admin/views/tabs/metas/paper-content/general/knowledge-graph.php +3 -3
  200. admin/views/tabs/metas/paper-content/general/title-separator.php +1 -1
  201. admin/views/tabs/metas/paper-content/media-content.php +2 -2
  202. admin/views/tabs/metas/paper-content/post-type-content.php +2 -2
  203. admin/views/tabs/metas/paper-content/post_type/post-type.php +2 -2
  204. admin/views/tabs/metas/paper-content/rss-content.php +2 -2
  205. admin/views/tabs/metas/paper-content/taxonomy-content.php +3 -3
  206. admin/views/tabs/metas/post-types.php +6 -6
  207. admin/views/tabs/metas/rss.php +2 -2
  208. admin/views/tabs/metas/taxonomies.php +7 -7
  209. admin/views/tabs/metas/taxonomies/category-url.php +1 -1
  210. admin/views/tabs/network/features.php +2 -2
  211. admin/views/tabs/network/general.php +2 -2
  212. admin/views/tabs/social/accounts.php +18 -18
  213. admin/views/tabs/social/twitterbox.php +1 -1
  214. admin/views/tool-bulk-editor.php +8 -8
  215. admin/views/tool-import-export.php +8 -8
  216. admin/watchers/class-slug-change-watcher.php +9 -9
  217. css/dist/{admin-global-1262-rtl.min.css → admin-global-1270-rtl.min.css} +0 -0
  218. css/dist/{admin-global-1262.min.css → admin-global-1270.min.css} +0 -0
  219. css/dist/{adminbar-1262-rtl.min.css → adminbar-1270-rtl.min.css} +0 -0
  220. css/dist/{adminbar-1262.min.css → adminbar-1270.min.css} +0 -0
  221. css/dist/alerts-1262-rtl.min.css +0 -1
  222. css/dist/alerts-1262.min.css +0 -1
  223. css/dist/alerts-1270-rtl.min.css +1 -0
  224. css/dist/alerts-1270.min.css +1 -0
  225. css/dist/{dashboard-1262-rtl.min.css → dashboard-1270-rtl.min.css} +0 -0
  226. css/dist/{dashboard-1262.min.css → dashboard-1270.min.css} +0 -0
  227. css/dist/{edit-page-1262-rtl.min.css → edit-page-1270-rtl.min.css} +0 -0
  228. css/dist/{edit-page-1262.min.css → edit-page-1270.min.css} +0 -0
  229. css/dist/{featured-image-1262-rtl.min.css → featured-image-1270-rtl.min.css} +0 -0
  230. css/dist/{featured-image-1262.min.css → featured-image-1270.min.css} +0 -0
  231. css/dist/{filter-explanation-1262-rtl.min.css → filter-explanation-1270-rtl.min.css} +0 -0
  232. css/dist/{filter-explanation-1262.min.css → filter-explanation-1270.min.css} +0 -0
  233. css/dist/{inside-editor-1262-rtl.min.css → inside-editor-1270-rtl.min.css} +0 -0
  234. css/dist/{inside-editor-1262.min.css → inside-editor-1270.min.css} +0 -0
  235. css/dist/{metabox-1262-rtl.min.css → metabox-1270-rtl.min.css} +0 -0
  236. css/dist/{metabox-1262.min.css → metabox-1270.min.css} +0 -0
  237. css/dist/{metabox-primary-category-1262-rtl.min.css → metabox-primary-category-1270-rtl.min.css} +0 -0
  238. css/dist/{metabox-primary-category-1262.min.css → metabox-primary-category-1270.min.css} +0 -0
  239. css/dist/{search-appearance-1262-rtl.min.css → search-appearance-1270-rtl.min.css} +0 -0
  240. css/dist/{search-appearance-1262.min.css → search-appearance-1270.min.css} +0 -0
  241. css/dist/{structured-data-blocks-1262-rtl.min.css → structured-data-blocks-1270-rtl.min.css} +0 -0
  242. css/dist/{structured-data-blocks-1262.min.css → structured-data-blocks-1270.min.css} +0 -0
  243. css/dist/{toggle-switch-1262-rtl.min.css → toggle-switch-1270-rtl.min.css} +0 -0
  244. css/dist/{toggle-switch-1262.min.css → toggle-switch-1270.min.css} +0 -0
  245. css/dist/{wpseo-dismissible-1262-rtl.min.css → wpseo-dismissible-1270-rtl.min.css} +0 -0
  246. css/dist/{wpseo-dismissible-1262.min.css → wpseo-dismissible-1270.min.css} +0 -0
  247. css/dist/{yoast-components-1262-rtl.min.css → yoast-components-1270-rtl.min.css} +0 -0
  248. css/dist/{yoast-components-1262.min.css → yoast-components-1270.min.css} +0 -0
  249. css/dist/{yoast-extensions-1262-rtl.min.css → yoast-extensions-1270-rtl.min.css} +0 -0
  250. css/dist/{yoast-extensions-1262.min.css → yoast-extensions-1270.min.css} +0 -0
  251. css/dist/{yst_plugin_tools-1262-rtl.min.css → yst_plugin_tools-1270-rtl.min.css} +0 -0
  252. css/dist/{yst_plugin_tools-1262.min.css → yst_plugin_tools-1270.min.css} +0 -0
  253. css/dist/{yst_seo_score-1262-rtl.min.css → yst_seo_score-1270-rtl.min.css} +0 -0
  254. css/dist/{yst_seo_score-1262.min.css → yst_seo_score-1270.min.css} +0 -0
  255. frontend/class-breadcrumbs.php +24 -24
  256. frontend/class-frontend.php +38 -38
  257. frontend/class-handle-404.php +1 -1
  258. frontend/class-opengraph-image.php +14 -14
  259. frontend/class-opengraph-oembed.php +1 -1
  260. frontend/class-opengraph.php +20 -20
  261. frontend/class-primary-category.php +1 -1
  262. frontend/class-remove-reply-to-com.php +2 -2
  263. frontend/class-twitter.php +6 -6
  264. frontend/class-woocommerce-shop-page.php +1 -1
  265. frontend/schema/class-schema-article.php +9 -9
  266. frontend/schema/class-schema-author.php +3 -3
  267. frontend/schema/class-schema-breadcrumb.php +9 -9
  268. frontend/schema/class-schema-context.php +2 -2
  269. frontend/schema/class-schema-faq-question-list.php +5 -5
  270. frontend/schema/class-schema-faq-questions.php +8 -6
  271. frontend/schema/class-schema-faq.php +4 -4
  272. frontend/schema/class-schema-howto.php +13 -13
  273. frontend/schema/class-schema-image.php +2 -2
  274. frontend/schema/class-schema-organization.php +6 -6
  275. frontend/schema/class-schema-person.php +8 -8
  276. frontend/schema/class-schema-webpage.php +8 -8
  277. frontend/schema/class-schema-website.php +5 -5
  278. frontend/schema/class-schema.php +11 -11
  279. inc/class-addon-manager.php +20 -20
  280. inc/class-my-yoast-api-request.php +12 -12
  281. inc/class-post-type.php +2 -2
  282. inc/class-rewrite.php +12 -12
  283. inc/class-structured-data-blocks.php +4 -4
  284. inc/class-upgrade-history.php +7 -7
  285. inc/class-upgrade.php +71 -142
  286. inc/class-wpseo-admin-bar-menu.php +65 -65
  287. inc/class-wpseo-content-images.php +4 -4
  288. inc/class-wpseo-custom-fields.php +2 -2
  289. inc/class-wpseo-custom-taxonomies.php +3 -3
  290. inc/class-wpseo-endpoint-factory.php +7 -7
  291. inc/class-wpseo-image-utils.php +8 -8
  292. inc/class-wpseo-installation.php +1 -1
  293. inc/class-wpseo-meta.php +84 -84
  294. inc/class-wpseo-primary-term.php +1 -1
  295. inc/class-wpseo-rank.php +22 -22
  296. inc/class-wpseo-replace-vars.php +32 -32
  297. inc/class-wpseo-shortlinker.php +2 -2
  298. inc/class-wpseo-statistics.php +11 -11
  299. inc/class-wpseo-utils.php +44 -47
  300. inc/endpoints/class-myyoast-connect.php +6 -6
  301. inc/health-check.php +13 -13
  302. inc/indexables/class-indexable.php +3 -3
  303. inc/indexables/class-post-indexable.php +5 -5
  304. inc/indexables/class-term-indexable.php +4 -4
  305. inc/indexables/validators/class-object-type-validator.php +1 -1
  306. inc/indexables/validators/class-robots-validator.php +2 -2
  307. inc/language-utils.php +2 -2
  308. inc/options/class-wpseo-option-ms.php +12 -12
  309. inc/options/class-wpseo-option-social.php +11 -11
  310. inc/options/class-wpseo-option-titles.php +73 -73
  311. inc/options/class-wpseo-option-wpseo.php +27 -27
  312. inc/options/class-wpseo-option.php +10 -10
  313. inc/options/class-wpseo-options-backfill.php +29 -29
  314. inc/options/class-wpseo-options.php +14 -14
  315. inc/options/class-wpseo-taxonomy-meta.php +27 -27
  316. inc/sitemaps/class-author-sitemap-provider.php +32 -32
  317. inc/sitemaps/class-post-type-sitemap-provider.php +21 -22
  318. inc/sitemaps/class-sitemap-cache-data.php +2 -2
  319. inc/sitemaps/class-sitemap-image-parser.php +26 -38
  320. inc/sitemaps/class-sitemaps-admin.php +3 -3
  321. inc/sitemaps/class-sitemaps-cache-validator.php +1 -1
  322. inc/sitemaps/class-sitemaps-cache.php +15 -15
  323. inc/sitemaps/class-sitemaps-renderer.php +1 -1
  324. inc/sitemaps/class-sitemaps-router.php +4 -4
  325. inc/sitemaps/class-sitemaps.php +19 -21
  326. inc/sitemaps/class-taxonomy-sitemap-provider.php +21 -21
  327. inc/wpseo-functions.php +5 -5
  328. inc/wpseo-non-ajax-functions.php +2 -2
  329. js/dist/{analysis-1262.min.js → analysis-1270.min.js} +0 -0
  330. js/dist/{babel-polyfill-1262.min.js → babel-polyfill-1270.min.js} +0 -0
  331. js/dist/{commons-1262.min.js → commons-1270.min.js} +0 -0
  332. js/dist/components-1262.min.js +0 -29
admin/admin-settings-changed-listener.php CHANGED
@@ -23,7 +23,7 @@ class WPSEO_Admin_Settings_Changed_Listener implements WPSEO_WordPress_Integrati
23
  * @return void
24
  */
25
  public function register_hooks() {
26
- add_action( 'admin_init', array( $this, 'intercept_save_update_notification' ) );
27
  }
28
 
29
  /**
23
  * @return void
24
  */
25
  public function register_hooks() {
26
+ add_action( 'admin_init', [ $this, 'intercept_save_update_notification' ] );
27
  }
28
 
29
  /**
admin/ajax.php CHANGED
@@ -46,7 +46,7 @@ add_action( 'wp_ajax_wpseo_set_option', 'wpseo_set_option' );
46
  /**
47
  * Since 3.2 Notifications are dismissed in the Notification Center.
48
  */
49
- add_action( 'wp_ajax_yoast_dismiss_notification', array( 'Yoast_Notification_Center', 'ajax_dismiss_notification' ) );
50
 
51
  /**
52
  * Function used to remove the admin notices for several purposes, dies on exit.
@@ -136,12 +136,12 @@ function wpseo_upsert_meta( $post_id, $new_meta_value, $orig_meta_value, $meta_k
136
  $sanitized_new_meta_value = wp_strip_all_tags( $new_meta_value );
137
  $orig_meta_value = wp_strip_all_tags( $orig_meta_value );
138
 
139
- $upsert_results = array(
140
  'status' => 'success',
141
  'post_id' => $post_id,
142
  "new_{$return_key}" => $sanitized_new_meta_value,
143
  "original_{$return_key}" => $orig_meta_value,
144
- );
145
 
146
  $the_post = get_post( $post_id );
147
  if ( empty( $the_post ) ) {
@@ -231,13 +231,13 @@ add_action( 'wp_ajax_wpseo_save_all_descriptions', 'wpseo_save_all_descriptions'
231
  function wpseo_save_all( $what ) {
232
  check_ajax_referer( 'wpseo-bulk-editor' );
233
 
234
- $results = array();
235
  if ( ! isset( $_POST['items'], $_POST['existingItems'] ) ) {
236
  wpseo_ajax_json_echo_die( $results );
237
  }
238
 
239
- $new_values = array_map( array( 'WPSEO_Utils', 'sanitize_text_field' ), wp_unslash( (array) $_POST['items'] ) );
240
- $original_values = array_map( array( 'WPSEO_Utils', 'sanitize_text_field' ), wp_unslash( (array) $_POST['existingItems'] ) );
241
 
242
  foreach ( $new_values as $post_id => $new_value ) {
243
  $original_value = $original_values[ $post_id ];
@@ -319,7 +319,7 @@ add_action( 'wp_ajax_get_term_keyword_usage', 'ajax_get_term_keyword_usage' );
319
  * @return void
320
  */
321
  function wpseo_register_ajax_integrations() {
322
- $integrations = array( new Yoast_Network_Admin() );
323
 
324
  foreach ( $integrations as $integration ) {
325
  $integration->register_ajax_hooks();
@@ -397,7 +397,7 @@ function wpseo_ajax_replace_vars() {
397
  $wp_query->queried_object = $post;
398
  $wp_query->queried_object_id = $post->ID;
399
 
400
- $omit = array( 'excerpt', 'excerpt_only', 'title' );
401
  echo wpseo_replace_vars( stripslashes( filter_input( INPUT_POST, 'string' ) ), $post, $omit );
402
  die;
403
  }
46
  /**
47
  * Since 3.2 Notifications are dismissed in the Notification Center.
48
  */
49
+ add_action( 'wp_ajax_yoast_dismiss_notification', [ 'Yoast_Notification_Center', 'ajax_dismiss_notification' ] );
50
 
51
  /**
52
  * Function used to remove the admin notices for several purposes, dies on exit.
136
  $sanitized_new_meta_value = wp_strip_all_tags( $new_meta_value );
137
  $orig_meta_value = wp_strip_all_tags( $orig_meta_value );
138
 
139
+ $upsert_results = [
140
  'status' => 'success',
141
  'post_id' => $post_id,
142
  "new_{$return_key}" => $sanitized_new_meta_value,
143
  "original_{$return_key}" => $orig_meta_value,
144
+ ];
145
 
146
  $the_post = get_post( $post_id );
147
  if ( empty( $the_post ) ) {
231
  function wpseo_save_all( $what ) {
232
  check_ajax_referer( 'wpseo-bulk-editor' );
233
 
234
+ $results = [];
235
  if ( ! isset( $_POST['items'], $_POST['existingItems'] ) ) {
236
  wpseo_ajax_json_echo_die( $results );
237
  }
238
 
239
+ $new_values = array_map( [ 'WPSEO_Utils', 'sanitize_text_field' ], wp_unslash( (array) $_POST['items'] ) );
240
+ $original_values = array_map( [ 'WPSEO_Utils', 'sanitize_text_field' ], wp_unslash( (array) $_POST['existingItems'] ) );
241
 
242
  foreach ( $new_values as $post_id => $new_value ) {
243
  $original_value = $original_values[ $post_id ];
319
  * @return void
320
  */
321
  function wpseo_register_ajax_integrations() {
322
+ $integrations = [ new Yoast_Network_Admin() ];
323
 
324
  foreach ( $integrations as $integration ) {
325
  $integration->register_ajax_hooks();
397
  $wp_query->queried_object = $post;
398
  $wp_query->queried_object_id = $post->ID;
399
 
400
+ $omit = [ 'excerpt', 'excerpt_only', 'title' ];
401
  echo wpseo_replace_vars( stripslashes( filter_input( INPUT_POST, 'string' ) ), $post, $omit );
402
  die;
403
  }
admin/ajax/class-recalculate-scores-ajax.php CHANGED
@@ -16,9 +16,9 @@ class WPSEO_Recalculate_Scores_Ajax {
16
  * Initialize the AJAX hooks.
17
  */
18
  public function __construct() {
19
- add_action( 'wp_ajax_wpseo_recalculate_scores', array( $this, 'recalculate_scores' ) );
20
- add_action( 'wp_ajax_wpseo_update_score', array( $this, 'save_score' ) );
21
- add_action( 'wp_ajax_wpseo_recalculate_total', array( $this, 'get_total' ) );
22
  }
23
 
24
  /**
@@ -30,10 +30,10 @@ class WPSEO_Recalculate_Scores_Ajax {
30
  wp_die(
31
  // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: WPSEO_Utils::format_json_encode is considered safe.
32
  WPSEO_Utils::format_json_encode(
33
- array(
34
  'posts' => $this->calculate_posts(),
35
  'terms' => $this->calculate_terms(),
36
- )
37
  )
38
  );
39
  }
@@ -96,12 +96,12 @@ class WPSEO_Recalculate_Scores_Ajax {
96
  */
97
  private function calculate_posts() {
98
  $count_posts_query = new WP_Query(
99
- array(
100
  'post_type' => 'any',
101
  'meta_key' => '_yoast_wpseo_focuskw',
102
  'posts_per_page' => 1,
103
  'fields' => 'ids',
104
- )
105
  );
106
 
107
  return $count_posts_query->found_posts;
@@ -114,8 +114,8 @@ class WPSEO_Recalculate_Scores_Ajax {
114
  */
115
  private function calculate_terms() {
116
  $total = 0;
117
- foreach ( get_taxonomies( array(), 'objects' ) as $taxonomy ) {
118
- $total += wp_count_terms( $taxonomy->name, array( 'hide_empty' => false ) );
119
  }
120
 
121
  return $total;
16
  * Initialize the AJAX hooks.
17
  */
18
  public function __construct() {
19
+ add_action( 'wp_ajax_wpseo_recalculate_scores', [ $this, 'recalculate_scores' ] );
20
+ add_action( 'wp_ajax_wpseo_update_score', [ $this, 'save_score' ] );
21
+ add_action( 'wp_ajax_wpseo_recalculate_total', [ $this, 'get_total' ] );
22
  }
23
 
24
  /**
30
  wp_die(
31
  // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: WPSEO_Utils::format_json_encode is considered safe.
32
  WPSEO_Utils::format_json_encode(
33
+ [
34
  'posts' => $this->calculate_posts(),
35
  'terms' => $this->calculate_terms(),
36
+ ]
37
  )
38
  );
39
  }
96
  */
97
  private function calculate_posts() {
98
  $count_posts_query = new WP_Query(
99
+ [
100
  'post_type' => 'any',
101
  'meta_key' => '_yoast_wpseo_focuskw',
102
  'posts_per_page' => 1,
103
  'fields' => 'ids',
104
+ ]
105
  );
106
 
107
  return $count_posts_query->found_posts;
114
  */
115
  private function calculate_terms() {
116
  $total = 0;
117
+ foreach ( get_taxonomies( [], 'objects' ) as $taxonomy ) {
118
+ $total += wp_count_terms( $taxonomy->name, [ 'hide_empty' => false ] );
119
  }
120
 
121
  return $total;
admin/ajax/class-shortcode-filter.php CHANGED
@@ -16,7 +16,7 @@ class WPSEO_Shortcode_Filter {
16
  * Initialize the AJAX hooks.
17
  */
18
  public function __construct() {
19
- add_action( 'wp_ajax_wpseo_filter_shortcodes', array( $this, 'do_filter' ) );
20
  }
21
 
22
  /**
@@ -27,13 +27,13 @@ class WPSEO_Shortcode_Filter {
27
 
28
  $shortcodes = filter_input( INPUT_POST, 'data', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY );
29
 
30
- $parsed_shortcodes = array();
31
 
32
  foreach ( $shortcodes as $shortcode ) {
33
- $parsed_shortcodes[] = array(
34
  'shortcode' => $shortcode,
35
  'output' => do_shortcode( $shortcode ),
36
- );
37
  }
38
 
39
  // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: WPSEO_Utils::format_json_encode is considered safe.
16
  * Initialize the AJAX hooks.
17
  */
18
  public function __construct() {
19
+ add_action( 'wp_ajax_wpseo_filter_shortcodes', [ $this, 'do_filter' ] );
20
  }
21
 
22
  /**
27
 
28
  $shortcodes = filter_input( INPUT_POST, 'data', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY );
29
 
30
+ $parsed_shortcodes = [];
31
 
32
  foreach ( $shortcodes as $shortcode ) {
33
+ $parsed_shortcodes[] = [
34
  'shortcode' => $shortcode,
35
  'output' => do_shortcode( $shortcode ),
36
+ ];
37
  }
38
 
39
  // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: WPSEO_Utils::format_json_encode is considered safe.
admin/ajax/class-yoast-dismissable-notice.php CHANGED
@@ -56,7 +56,7 @@ class Yoast_Dismissable_Notice_Ajax {
56
  $this->notice_name = $notice_name;
57
  $this->notice_type = $notice_type;
58
 
59
- add_action( 'wp_ajax_wpseo_dismiss_' . $notice_name, array( $this, 'dismiss_notice' ) );
60
  }
61
 
62
  /**
56
  $this->notice_name = $notice_name;
57
  $this->notice_type = $notice_type;
58
 
59
+ add_action( 'wp_ajax_wpseo_dismiss_' . $notice_name, [ $this, 'dismiss_notice' ] );
60
  }
61
 
62
  /**
admin/ajax/class-yoast-onpage-ajax.php CHANGED
@@ -17,7 +17,7 @@ class Yoast_OnPage_Ajax {
17
  * Initialize the hooks for the AJAX request.
18
  */
19
  public function __construct() {
20
- add_action( 'wp_ajax_wpseo_dismiss_onpageorg', array( $this, 'dismiss_notice' ) );
21
  }
22
 
23
  /**
17
  * Initialize the hooks for the AJAX request.
18
  */
19
  public function __construct() {
20
+ add_action( 'wp_ajax_wpseo_dismiss_onpageorg', [ $this, 'dismiss_notice' ] );
21
  }
22
 
23
  /**
admin/ajax/class-yoast-plugin-conflict-ajax.php CHANGED
@@ -22,13 +22,13 @@ class Yoast_Plugin_Conflict_Ajax {
22
  *
23
  * @var array
24
  */
25
- private $dismissed_conflicts = array();
26
 
27
  /**
28
  * Initialize the hooks for the AJAX request.
29
  */
30
  public function __construct() {
31
- add_action( 'wp_ajax_wpseo_dismiss_plugin_conflict', array( $this, 'dismiss_notice' ) );
32
  }
33
 
34
  /**
@@ -71,7 +71,7 @@ class Yoast_Plugin_Conflict_Ajax {
71
  return $dismissed_conflicts[ $plugin_section ];
72
  }
73
 
74
- return array();
75
  }
76
 
77
  /**
22
  *
23
  * @var array
24
  */
25
+ private $dismissed_conflicts = [];
26
 
27
  /**
28
  * Initialize the hooks for the AJAX request.
29
  */
30
  public function __construct() {
31
+ add_action( 'wp_ajax_wpseo_dismiss_plugin_conflict', [ $this, 'dismiss_notice' ] );
32
  }
33
 
34
  /**
71
  return $dismissed_conflicts[ $plugin_section ];
72
  }
73
 
74
+ return [];
75
  }
76
 
77
  /**
admin/capabilities/class-abstract-capability-manager.php CHANGED
@@ -15,7 +15,7 @@ abstract class WPSEO_Abstract_Capability_Manager implements WPSEO_Capability_Man
15
  *
16
  * @var array
17
  */
18
- protected $capabilities = array();
19
 
20
  /**
21
  * Registers a capability.
@@ -81,7 +81,7 @@ abstract class WPSEO_Abstract_Capability_Manager implements WPSEO_Capability_Man
81
 
82
  // Make sure we have the expected type.
83
  if ( ! is_array( $filtered ) ) {
84
- return array();
85
  }
86
 
87
  return $filtered;
15
  *
16
  * @var array
17
  */
18
+ protected $capabilities = [];
19
 
20
  /**
21
  * Registers a capability.
81
 
82
  // Make sure we have the expected type.
83
  if ( ! is_array( $filtered ) ) {
84
+ return [];
85
  }
86
 
87
  return $filtered;
admin/capabilities/class-capability-manager-integration.php CHANGED
@@ -35,11 +35,11 @@ class WPSEO_Capability_Manager_Integration implements WPSEO_WordPress_Integratio
35
  * @return void
36
  */
37
  public function register_hooks() {
38
- add_filter( 'members_get_capabilities', array( $this, 'get_capabilities' ) );
39
- add_action( 'members_register_cap_groups', array( $this, 'action_members_register_cap_group' ) );
40
 
41
- add_filter( 'ure_capabilities_groups_tree', array( $this, 'filter_ure_capabilities_groups_tree' ) );
42
- add_filter( 'ure_custom_capability_groups', array( $this, 'filter_ure_custom_capability_groups' ), 10, 2 );
43
  }
44
 
45
  /**
@@ -49,7 +49,7 @@ class WPSEO_Capability_Manager_Integration implements WPSEO_WordPress_Integratio
49
  * @param array $caps Optional existing capability list.
50
  * @return array
51
  */
52
- public function get_capabilities( array $caps = array() ) {
53
  if ( ! did_action( 'wpseo_register_capabilities' ) ) {
54
  do_action( 'wpseo_register_capabilities' );
55
  }
@@ -68,12 +68,12 @@ class WPSEO_Capability_Manager_Integration implements WPSEO_WordPress_Integratio
68
  }
69
 
70
  // Register the yoast group.
71
- $args = array(
72
  'label' => esc_html__( 'Yoast SEO', 'wordpress-seo' ),
73
  'caps' => $this->get_capabilities(),
74
  'icon' => 'dashicons-admin-plugins',
75
  'diff_added' => true,
76
- );
77
  members_register_cap_group( 'wordpress-seo', $args );
78
  }
79
 
@@ -86,14 +86,14 @@ class WPSEO_Capability_Manager_Integration implements WPSEO_WordPress_Integratio
86
  *
87
  * @return array Filtered list of capabilty groups.
88
  */
89
- public function filter_ure_capabilities_groups_tree( $groups = array() ) {
90
  $groups = (array) $groups;
91
 
92
- $groups['wordpress-seo'] = array(
93
  'caption' => 'Yoast SEO',
94
  'parent' => 'custom',
95
  'level' => 3,
96
- );
97
 
98
  return $groups;
99
  }
@@ -108,7 +108,7 @@ class WPSEO_Capability_Manager_Integration implements WPSEO_WordPress_Integratio
108
  *
109
  * @return array List of filtered groups.
110
  */
111
- public function filter_ure_custom_capability_groups( $groups = array(), $cap_id = '' ) {
112
  if ( in_array( $cap_id, $this->get_capabilities(), true ) ) {
113
  $groups = (array) $groups;
114
  $groups[] = 'wordpress-seo';
35
  * @return void
36
  */
37
  public function register_hooks() {
38
+ add_filter( 'members_get_capabilities', [ $this, 'get_capabilities' ] );
39
+ add_action( 'members_register_cap_groups', [ $this, 'action_members_register_cap_group' ] );
40
 
41
+ add_filter( 'ure_capabilities_groups_tree', [ $this, 'filter_ure_capabilities_groups_tree' ] );
42
+ add_filter( 'ure_custom_capability_groups', [ $this, 'filter_ure_custom_capability_groups' ], 10, 2 );
43
  }
44
 
45
  /**
49
  * @param array $caps Optional existing capability list.
50
  * @return array
51
  */
52
+ public function get_capabilities( array $caps = [] ) {
53
  if ( ! did_action( 'wpseo_register_capabilities' ) ) {
54
  do_action( 'wpseo_register_capabilities' );
55
  }
68
  }
69
 
70
  // Register the yoast group.
71
+ $args = [
72
  'label' => esc_html__( 'Yoast SEO', 'wordpress-seo' ),
73
  'caps' => $this->get_capabilities(),
74
  'icon' => 'dashicons-admin-plugins',
75
  'diff_added' => true,
76
+ ];
77
  members_register_cap_group( 'wordpress-seo', $args );
78
  }
79
 
86
  *
87
  * @return array Filtered list of capabilty groups.
88
  */
89
+ public function filter_ure_capabilities_groups_tree( $groups = [] ) {
90
  $groups = (array) $groups;
91
 
92
+ $groups['wordpress-seo'] = [
93
  'caption' => 'Yoast SEO',
94
  'parent' => 'custom',
95
  'level' => 3,
96
+ ];
97
 
98
  return $groups;
99
  }
108
  *
109
  * @return array List of filtered groups.
110
  */
111
+ public function filter_ure_custom_capability_groups( $groups = [], $cap_id = '' ) {
112
  if ( in_array( $cap_id, $this->get_capabilities(), true ) ) {
113
  $groups = (array) $groups;
114
  $groups[] = 'wordpress-seo';
admin/capabilities/class-capability-manager-vip.php CHANGED
@@ -16,7 +16,7 @@ final class WPSEO_Capability_Manager_VIP extends WPSEO_Abstract_Capability_Manag
16
  * @return void
17
  */
18
  public function add() {
19
- $role_capabilities = array();
20
  foreach ( $this->capabilities as $capability => $roles ) {
21
  $role_capabilities = $this->get_role_capabilities( $role_capabilities, $capability, $roles );
22
  }
@@ -36,7 +36,7 @@ final class WPSEO_Capability_Manager_VIP extends WPSEO_Abstract_Capability_Manag
36
  $roles = wp_roles()->get_names();
37
  $roles = array_keys( $roles );
38
 
39
- $role_capabilities = array();
40
  foreach ( array_keys( $this->capabilities ) as $capability ) {
41
  // Allow filtering of roles.
42
  $role_capabilities = $this->get_role_capabilities( $role_capabilities, $capability, $roles );
@@ -62,7 +62,7 @@ final class WPSEO_Capability_Manager_VIP extends WPSEO_Abstract_Capability_Manag
62
 
63
  foreach ( $filtered_roles as $role ) {
64
  if ( ! isset( $add_role_caps[ $role ] ) ) {
65
- $role_capabilities[ $role ] = array();
66
  }
67
 
68
  $role_capabilities[ $role ][] = $capability;
16
  * @return void
17
  */
18
  public function add() {
19
+ $role_capabilities = [];
20
  foreach ( $this->capabilities as $capability => $roles ) {
21
  $role_capabilities = $this->get_role_capabilities( $role_capabilities, $capability, $roles );
22
  }
36
  $roles = wp_roles()->get_names();
37
  $roles = array_keys( $roles );
38
 
39
+ $role_capabilities = [];
40
  foreach ( array_keys( $this->capabilities ) as $capability ) {
41
  // Allow filtering of roles.
42
  $role_capabilities = $this->get_role_capabilities( $role_capabilities, $capability, $roles );
62
 
63
  foreach ( $filtered_roles as $role ) {
64
  if ( ! isset( $add_role_caps[ $role ] ) ) {
65
+ $role_capabilities[ $role ] = [];
66
  }
67
 
68
  $role_capabilities[ $role ][] = $capability;
admin/capabilities/class-capability-utils.php CHANGED
@@ -22,7 +22,7 @@ class WPSEO_Capability_Utils {
22
  return self::has( $capability );
23
  }
24
 
25
- return self::has_any( array( 'wpseo_manage_options', $capability ) );
26
  }
27
 
28
  /**
22
  return self::has( $capability );
23
  }
24
 
25
+ return self::has_any( [ 'wpseo_manage_options', $capability ] );
26
  }
27
 
28
  /**
admin/capabilities/class-register-capabilities.php CHANGED
@@ -16,10 +16,10 @@ class WPSEO_Register_Capabilities implements WPSEO_WordPress_Integration {
16
  * @return void
17
  */
18
  public function register_hooks() {
19
- add_action( 'wpseo_register_capabilities', array( $this, 'register' ) );
20
 
21
  if ( is_multisite() ) {
22
- add_action( 'user_has_cap', array( $this, 'filter_user_has_wpseo_manage_options_cap' ), 10, 4 );
23
  }
24
  }
25
 
@@ -31,10 +31,10 @@ class WPSEO_Register_Capabilities implements WPSEO_WordPress_Integration {
31
  public function register() {
32
  $manager = WPSEO_Capability_Manager_Factory::get();
33
 
34
- $manager->register( 'wpseo_bulk_edit', array( 'editor', 'wpseo_editor', 'wpseo_manager' ) );
35
- $manager->register( 'wpseo_edit_advanced_metadata', array( 'wpseo_editor', 'wpseo_manager' ) );
36
 
37
- $manager->register( 'wpseo_manage_options', array( 'administrator', 'wpseo_manager' ) );
38
  }
39
 
40
  /**
16
  * @return void
17
  */
18
  public function register_hooks() {
19
+ add_action( 'wpseo_register_capabilities', [ $this, 'register' ] );
20
 
21
  if ( is_multisite() ) {
22
+ add_action( 'user_has_cap', [ $this, 'filter_user_has_wpseo_manage_options_cap' ], 10, 4 );
23
  }
24
  }
25
 
31
  public function register() {
32
  $manager = WPSEO_Capability_Manager_Factory::get();
33
 
34
+ $manager->register( 'wpseo_bulk_edit', [ 'editor', 'wpseo_editor', 'wpseo_manager' ] );
35
+ $manager->register( 'wpseo_edit_advanced_metadata', [ 'wpseo_editor', 'wpseo_manager' ] );
36
 
37
+ $manager->register( 'wpseo_manage_options', [ 'administrator', 'wpseo_manager' ] );
38
  }
39
 
40
  /**
admin/class-add-keyword-modal.php CHANGED
@@ -19,7 +19,7 @@ class WPSEO_Add_Keyword_Modal {
19
  * @return array Translated text strings for the Add Keyword modal.
20
  */
21
  public function get_translations() {
22
- return array(
23
  'title' => __( 'Would you like to add more than one keyphrase?', 'wordpress-seo' ),
24
  'intro' => sprintf(
25
  /* translators: %s expands to a 'Yoast SEO Premium' text linked to the yoast.com website. */
@@ -40,7 +40,7 @@ class WPSEO_Add_Keyword_Modal {
40
  ),
41
  'small' => __( '1 year free support and updates included!', 'wordpress-seo' ),
42
  'a11yNotice.opensInNewTab' => __( '(Opens in a new browser tab)', 'wordpress-seo' ),
43
- );
44
  }
45
 
46
  /**
@@ -50,10 +50,10 @@ class WPSEO_Add_Keyword_Modal {
50
  */
51
  public function get_translations_for_js() {
52
  $translations = $this->get_translations();
53
- return array(
54
  'locale' => WPSEO_Language_Utils::get_user_locale(),
55
  'intl' => $translations,
56
- );
57
  }
58
 
59
  /**
19
  * @return array Translated text strings for the Add Keyword modal.
20
  */
21
  public function get_translations() {
22
+ return [
23
  'title' => __( 'Would you like to add more than one keyphrase?', 'wordpress-seo' ),
24
  'intro' => sprintf(
25
  /* translators: %s expands to a 'Yoast SEO Premium' text linked to the yoast.com website. */
40
  ),
41
  'small' => __( '1 year free support and updates included!', 'wordpress-seo' ),
42
  'a11yNotice.opensInNewTab' => __( '(Opens in a new browser tab)', 'wordpress-seo' ),
43
+ ];
44
  }
45
 
46
  /**
50
  */
51
  public function get_translations_for_js() {
52
  $translations = $this->get_translations();
53
+ return [
54
  'locale' => WPSEO_Language_Utils::get_user_locale(),
55
  'intl' => $translations,
56
+ ];
57
  }
58
 
59
  /**
admin/class-admin-asset-analysis-worker-location.php CHANGED
@@ -40,10 +40,10 @@ final class WPSEO_Admin_Asset_Analysis_Worker_Location implements WPSEO_Admin_As
40
 
41
  $this->asset_location = WPSEO_Admin_Asset_Manager::create_default_location();
42
  $this->asset = new WPSEO_Admin_Asset(
43
- array(
44
  'name' => $name,
45
  'src' => $analysis_worker,
46
- )
47
  );
48
  }
49
 
@@ -66,7 +66,7 @@ final class WPSEO_Admin_Asset_Analysis_Worker_Location implements WPSEO_Admin_As
66
  */
67
  public function get_url( WPSEO_Admin_Asset $asset, $type ) {
68
  $scheme = wp_parse_url( $asset->get_src(), PHP_URL_SCHEME );
69
- if ( in_array( $scheme, array( 'http', 'https' ), true ) ) {
70
  return $asset->get_src();
71
  }
72
 
40
 
41
  $this->asset_location = WPSEO_Admin_Asset_Manager::create_default_location();
42
  $this->asset = new WPSEO_Admin_Asset(
43
+ [
44
  'name' => $name,
45
  'src' => $analysis_worker,
46
+ ]
47
  );
48
  }
49
 
66
  */
67
  public function get_url( WPSEO_Admin_Asset $asset, $type ) {
68
  $scheme = wp_parse_url( $asset->get_src(), PHP_URL_SCHEME );
69
+ if ( in_array( $scheme, [ 'http', 'https' ], true ) ) {
70
  return $asset->get_src();
71
  }
72
 
admin/class-admin-asset-manager.php CHANGED
@@ -136,12 +136,12 @@ class WPSEO_Admin_Asset_Manager {
136
  */
137
  public function special_styles() {
138
  $flat_version = $this->flatten_version( WPSEO_VERSION );
139
- $asset_args = array(
140
  'name' => 'inside-editor',
141
  'src' => 'inside-editor-' . $flat_version,
142
- );
143
 
144
- return array( 'inside-editor' => new WPSEO_Admin_Asset( $asset_args ) );
145
  }
146
 
147
  /**
@@ -200,7 +200,7 @@ class WPSEO_Admin_Asset_Manager {
200
  wp_register_script(
201
  'react',
202
  plugins_url( 'js/vendor/react.min.js', WPSEO_FILE ),
203
- array(),
204
  'v16.6.1',
205
  true
206
  );
@@ -208,7 +208,7 @@ class WPSEO_Admin_Asset_Manager {
208
  wp_register_script(
209
  'react-dom',
210
  plugins_url( 'js/vendor/react-dom.min.js', WPSEO_FILE ),
211
- array( 'react' ),
212
  'v16.6.1',
213
  true
214
  );
@@ -216,7 +216,7 @@ class WPSEO_Admin_Asset_Manager {
216
  wp_register_script(
217
  'lodash-base',
218
  plugins_url( 'js/vendor/lodash.min.js', WPSEO_FILE ),
219
- array(),
220
  '4.17.5',
221
  true
222
  );
@@ -224,7 +224,7 @@ class WPSEO_Admin_Asset_Manager {
224
  wp_register_script(
225
  'lodash',
226
  plugins_url( 'js/vendor/lodash-noconflict.js', WPSEO_FILE ),
227
- array( 'lodash-base' ),
228
  WPSEO_VERSION,
229
  true
230
  );
@@ -232,7 +232,7 @@ class WPSEO_Admin_Asset_Manager {
232
  wp_register_script(
233
  'wp-polyfill',
234
  plugins_url( 'js/dist/babel-polyfill-' . $flat_version . '.min.js', WPSEO_FILE ),
235
- array(),
236
  WPSEO_VERSION,
237
  true
238
  );
@@ -240,7 +240,7 @@ class WPSEO_Admin_Asset_Manager {
240
  wp_register_script(
241
  'wp-element',
242
  plugins_url( 'js/dist/wp-element-' . $flat_version . '.min.js', WPSEO_FILE ),
243
- array( 'lodash', 'wp-polyfill', 'react', 'react-dom' ),
244
  WPSEO_VERSION,
245
  true
246
  );
@@ -248,7 +248,7 @@ class WPSEO_Admin_Asset_Manager {
248
  wp_register_script(
249
  'wp-api-fetch',
250
  plugins_url( 'js/dist/wp-apiFetch-' . $flat_version . '.min.js', WPSEO_FILE ),
251
- array( 'wp-i18n', 'wp-polyfill' ),
252
  WPSEO_VERSION,
253
  true
254
  );
@@ -256,7 +256,7 @@ class WPSEO_Admin_Asset_Manager {
256
  wp_register_script(
257
  'wp-components',
258
  plugins_url( 'js/dist/wp-components-' . $flat_version . '.min.js', WPSEO_FILE ),
259
- array( 'lodash', 'wp-api-fetch', 'wp-i18n', 'wp-polyfill', 'wp-compose' ),
260
  WPSEO_VERSION,
261
  true
262
  );
@@ -264,7 +264,7 @@ class WPSEO_Admin_Asset_Manager {
264
  wp_register_script(
265
  'wp-data',
266
  plugins_url( 'js/dist/wp-data-' . $flat_version . '.min.js', WPSEO_FILE ),
267
- array( 'lodash', 'wp-element', 'wp-polyfill', 'wp-compose' ),
268
  WPSEO_VERSION,
269
  true
270
  );
@@ -272,7 +272,7 @@ class WPSEO_Admin_Asset_Manager {
272
  wp_register_script(
273
  'wp-i18n',
274
  plugins_url( 'js/dist/wp-i18n-' . $flat_version . '.min.js', WPSEO_FILE ),
275
- array( 'wp-polyfill' ),
276
  WPSEO_VERSION,
277
  true
278
  );
@@ -280,7 +280,7 @@ class WPSEO_Admin_Asset_Manager {
280
  wp_register_script(
281
  'wp-rich-text',
282
  plugins_url( 'js/dist/wp-rich-text-' . $flat_version . '.min.js', WPSEO_FILE ),
283
- array( 'lodash', 'wp-polyfill', 'wp-data' ),
284
  WPSEO_VERSION,
285
  true
286
  );
@@ -288,7 +288,7 @@ class WPSEO_Admin_Asset_Manager {
288
  wp_register_script(
289
  'wp-compose',
290
  plugins_url( 'js/dist/wp-compose-' . $flat_version . '.min.js', WPSEO_FILE ),
291
- array( 'lodash', 'wp-polyfill' ),
292
  WPSEO_VERSION,
293
  true
294
  );
@@ -328,40 +328,40 @@ class WPSEO_Admin_Asset_Manager {
328
 
329
  $flat_version = $this->flatten_version( WPSEO_VERSION );
330
 
331
- return array(
332
- array(
333
  'name' => 'commons',
334
  // Load webpack-commons for bundle support.
335
  'src' => 'commons-' . $flat_version,
336
  'in_footer' => false,
337
- 'deps' => array(
338
  'wp-polyfill',
339
- ),
340
- ),
341
- array(
342
  'name' => 'search-appearance',
343
  'src' => 'search-appearance-' . $flat_version,
344
- 'deps' => array(
345
  'wp-api',
346
  self::PREFIX . 'components',
347
  self::PREFIX . 'commons',
348
- ),
349
- ),
350
- array(
351
  'name' => 'yoast-modal',
352
  'src' => 'wp-seo-modal-' . $flat_version,
353
- 'deps' => array(
354
  'jquery',
355
  'wp-element',
356
  'wp-i18n',
357
  self::PREFIX . 'components',
358
  self::PREFIX . 'commons',
359
- ),
360
- ),
361
- array(
362
  'name' => 'admin-script',
363
  'src' => 'wp-seo-admin-' . $flat_version,
364
- 'deps' => array(
365
  'lodash',
366
  'jquery',
367
  'jquery-ui-core',
@@ -369,45 +369,45 @@ class WPSEO_Admin_Asset_Manager {
369
  self::PREFIX . 'select2',
370
  self::PREFIX . 'select2-translations',
371
  self::PREFIX . 'commons',
372
- ),
373
- ),
374
- array(
375
  'name' => 'admin-media',
376
  'src' => 'wp-seo-admin-media-' . $flat_version,
377
- 'deps' => array(
378
  'jquery',
379
  'jquery-ui-core',
380
  self::PREFIX . 'commons',
381
- ),
382
- ),
383
- array(
384
  'name' => 'network-admin-script',
385
  'src' => 'wp-seo-network-admin-' . $flat_version,
386
- 'deps' => array(
387
  'jquery',
388
  self::PREFIX . 'commons',
389
- ),
390
- ),
391
- array(
392
  'name' => 'bulk-editor',
393
  'src' => 'wp-seo-bulk-editor-' . $flat_version,
394
- 'deps' => array(
395
  'jquery',
396
  self::PREFIX . 'commons',
397
- ),
398
- ),
399
- array(
400
  'name' => 'admin-global-script',
401
  'src' => 'wp-seo-admin-global-' . $flat_version,
402
- 'deps' => array(
403
  'jquery',
404
  self::PREFIX . 'commons',
405
- ),
406
- ),
407
- array(
408
  'name' => 'metabox',
409
  'src' => 'wp-seo-metabox-' . $flat_version,
410
- 'deps' => array(
411
  'jquery',
412
  'wp-element',
413
  'wp-i18n',
@@ -416,33 +416,33 @@ class WPSEO_Admin_Asset_Manager {
416
  self::PREFIX . 'select2',
417
  self::PREFIX . 'select2-translations',
418
  self::PREFIX . 'commons',
419
- ),
420
  'in_footer' => false,
421
- ),
422
- array(
423
  'name' => 'featured-image',
424
  'src' => 'wp-seo-featured-image-' . $flat_version,
425
- 'deps' => array(
426
  'jquery',
427
  self::PREFIX . 'commons',
428
- ),
429
- ),
430
- array(
431
  'name' => 'admin-gsc',
432
  'src' => 'wp-seo-admin-gsc-' . $flat_version,
433
- 'deps' => array(
434
  'wp-element',
435
  'wp-i18n',
436
  self::PREFIX . 'styled-components',
437
  self::PREFIX . 'components',
438
  self::PREFIX . 'commons',
439
- ),
440
  'in_footer' => false,
441
- ),
442
- array(
443
  'name' => 'post-scraper',
444
  'src' => 'wp-seo-post-scraper-' . $flat_version,
445
- 'deps' => array(
446
  'wp-util',
447
  'wp-api',
448
  'wp-sanitize',
@@ -457,12 +457,12 @@ class WPSEO_Admin_Asset_Manager {
457
  self::PREFIX . 'analysis',
458
  self::PREFIX . 'components',
459
  self::PREFIX . 'commons',
460
- ),
461
- ),
462
- array(
463
  'name' => 'term-scraper',
464
  'src' => 'wp-seo-term-scraper-' . $flat_version,
465
- 'deps' => array(
466
  'wp-sanitize',
467
  'wp-element',
468
  'wp-i18n',
@@ -473,40 +473,40 @@ class WPSEO_Admin_Asset_Manager {
473
  self::PREFIX . 'analysis',
474
  self::PREFIX . 'components',
475
  self::PREFIX . 'commons',
476
- ),
477
- ),
478
- array(
479
  'name' => 'replacevar-plugin',
480
  'src' => 'wp-seo-replacevar-plugin-' . $flat_version,
481
- 'deps' => array(
482
  self::PREFIX . 'analysis',
483
  self::PREFIX . 'components',
484
  self::PREFIX . 'commons',
485
- ),
486
- ),
487
- array(
488
  'name' => 'shortcode-plugin',
489
  'src' => 'wp-seo-shortcode-plugin-' . $flat_version,
490
- 'deps' => array(
491
  self::PREFIX . 'analysis',
492
  self::PREFIX . 'commons',
493
- ),
494
- ),
495
- array(
496
  'name' => 'recalculate',
497
  'src' => 'wp-seo-recalculate-' . $flat_version,
498
- 'deps' => array(
499
  'jquery',
500
  'jquery-ui-core',
501
  'jquery-ui-progressbar',
502
  self::PREFIX . 'analysis',
503
  self::PREFIX . 'commons',
504
- ),
505
- ),
506
- array(
507
  'name' => 'primary-category',
508
  'src' => 'wp-seo-metabox-category-' . $flat_version,
509
- 'deps' => array(
510
  'jquery',
511
  'wp-util',
512
  'wp-element',
@@ -516,141 +516,141 @@ class WPSEO_Admin_Asset_Manager {
516
  self::PREFIX . 'analysis',
517
  self::PREFIX . 'components',
518
  self::PREFIX . 'commons',
519
- ),
520
- ),
521
- array(
522
  'name' => 'select2',
523
  'src' => 'select2/select2.full',
524
  'suffix' => '.min',
525
- 'deps' => array(
526
  'jquery',
527
- ),
528
  'version' => '4.0.3',
529
- ),
530
- array(
531
  'name' => 'select2-translations',
532
  'src' => 'select2/i18n/' . $select2_language,
533
- 'deps' => array(
534
  'jquery',
535
  self::PREFIX . 'select2',
536
- ),
537
  'version' => '4.0.3',
538
  'suffix' => '',
539
- ),
540
- array(
541
  'name' => 'configuration-wizard',
542
  'src' => 'configuration-wizard-' . $flat_version,
543
- 'deps' => array(
544
  'jquery',
545
  'wp-element',
546
  'wp-i18n',
547
  'wp-api',
548
  self::PREFIX . 'components',
549
  self::PREFIX . 'commons',
550
- ),
551
- ),
552
- array(
553
  'name' => 'reindex-links',
554
  'src' => 'wp-seo-reindex-links-' . $flat_version,
555
- 'deps' => array(
556
  'jquery',
557
  'jquery-ui-core',
558
  'jquery-ui-progressbar',
559
  self::PREFIX . 'commons',
560
- ),
561
- ),
562
- array(
563
  'name' => 'edit-page-script',
564
  'src' => 'wp-seo-edit-page-' . $flat_version,
565
- 'deps' => array(
566
  'jquery',
567
  self::PREFIX . 'commons',
568
- ),
569
- ),
570
- array(
571
  'name' => 'quick-edit-handler',
572
  'src' => 'wp-seo-quick-edit-handler-' . $flat_version,
573
- 'deps' => array(
574
  'jquery',
575
  self::PREFIX . 'commons',
576
- ),
577
  'in_footer' => true,
578
- ),
579
- array(
580
  'name' => 'api',
581
  'src' => 'wp-seo-api-' . $flat_version,
582
- 'deps' => array(
583
  'wp-api',
584
  'jquery',
585
  self::PREFIX . 'commons',
586
- ),
587
- ),
588
- array(
589
  'name' => 'dashboard-widget',
590
  'src' => 'wp-seo-dashboard-widget-' . $flat_version,
591
- 'deps' => array(
592
  self::PREFIX . 'api',
593
  'jquery',
594
  'wp-element',
595
  'wp-i18n',
596
  self::PREFIX . 'components',
597
  self::PREFIX . 'commons',
598
- ),
599
- ),
600
- array(
601
  'name' => 'filter-explanation',
602
  'src' => 'wp-seo-filter-explanation-' . $flat_version,
603
- 'deps' => array(
604
  'jquery',
605
  self::PREFIX . 'commons',
606
- ),
607
- ),
608
- array(
609
  'name' => 'analysis',
610
  'src' => 'analysis-' . $flat_version,
611
- 'deps' => array(
612
  'lodash',
613
  self::PREFIX . 'commons',
614
- ),
615
- ),
616
- array(
617
  'name' => 'components',
618
  'src' => 'components-' . $flat_version,
619
- 'deps' => array(
620
  self::PREFIX . 'analysis',
621
  self::PREFIX . 'styled-components',
622
  self::PREFIX . 'commons',
623
- ),
624
- ),
625
- array(
626
  'name' => 'structured-data-blocks',
627
  'src' => 'wp-seo-structured-data-blocks-' . $flat_version,
628
- 'deps' => array(
629
  'wp-blocks',
630
  'wp-i18n',
631
  'wp-element',
632
  self::PREFIX . 'styled-components',
633
  self::PREFIX . 'commons',
634
- ),
635
- ),
636
- array(
637
  'name' => 'styled-components',
638
  'src' => 'styled-components-' . $flat_version,
639
- 'deps' => array(
640
  'wp-element',
641
- ),
642
- ),
643
- array(
644
  'name' => 'help-scout-beacon',
645
  'src' => 'help-scout-beacon-' . $flat_version,
646
  'in_footer' => false,
647
- 'deps' => array(
648
  self::PREFIX . 'styled-components',
649
  'wp-element',
650
  'wp-i18n',
651
- ),
652
- ),
653
- );
654
  }
655
 
656
  /**
@@ -663,92 +663,92 @@ class WPSEO_Admin_Asset_Manager {
663
  protected function styles_to_be_registered() {
664
  $flat_version = $this->flatten_version( WPSEO_VERSION );
665
 
666
- return array(
667
- array(
668
  'name' => 'admin-css',
669
  'src' => 'yst_plugin_tools-' . $flat_version,
670
- 'deps' => array( self::PREFIX . 'toggle-switch' ),
671
- ),
672
- array(
673
  'name' => 'toggle-switch',
674
  'src' => 'toggle-switch-' . $flat_version,
675
- ),
676
- array(
677
  'name' => 'dismissible',
678
  'src' => 'wpseo-dismissible-' . $flat_version,
679
- ),
680
- array(
681
  'name' => 'alerts',
682
  'src' => 'alerts-' . $flat_version,
683
- ),
684
- array(
685
  'name' => 'edit-page',
686
  'src' => 'edit-page-' . $flat_version,
687
- ),
688
- array(
689
  'name' => 'featured-image',
690
  'src' => 'featured-image-' . $flat_version,
691
- ),
692
- array(
693
  'name' => 'metabox-css',
694
  'src' => 'metabox-' . $flat_version,
695
- 'deps' => array(
696
  self::PREFIX . 'select2',
697
  self::PREFIX . 'admin-css',
698
- ),
699
- ),
700
- array(
701
  'name' => 'wp-dashboard',
702
  'src' => 'dashboard-' . $flat_version,
703
- ),
704
- array(
705
  'name' => 'scoring',
706
  'src' => 'yst_seo_score-' . $flat_version,
707
- ),
708
- array(
709
  'name' => 'adminbar',
710
  'src' => 'adminbar-' . $flat_version,
711
- 'deps' => array(
712
  'admin-bar',
713
- ),
714
- ),
715
- array(
716
  'name' => 'primary-category',
717
  'src' => 'metabox-primary-category-' . $flat_version,
718
- ),
719
- array(
720
  'name' => 'select2',
721
  'src' => 'select2/select2',
722
  'suffix' => '.min',
723
  'version' => '4.0.1',
724
  'rtl' => false,
725
- ),
726
- array(
727
  'name' => 'admin-global',
728
  'src' => 'admin-global-' . $flat_version,
729
- ),
730
- array(
731
  'name' => 'yoast-components',
732
  'src' => 'yoast-components-' . $flat_version,
733
- ),
734
- array(
735
  'name' => 'extensions',
736
  'src' => 'yoast-extensions-' . $flat_version,
737
- ),
738
- array(
739
  'name' => 'filter-explanation',
740
  'src' => 'filter-explanation-' . $flat_version,
741
- ),
742
- array(
743
  'name' => 'search-appearance',
744
  'src' => 'search-appearance-' . $flat_version,
745
- ),
746
- array(
747
  'name' => 'structured-data-blocks',
748
  'src' => 'structured-data-blocks-' . $flat_version,
749
- 'deps' => array( 'wp-edit-blocks' ),
750
- ),
751
- );
752
  }
753
 
754
  /**
@@ -761,7 +761,7 @@ class WPSEO_Admin_Asset_Manager {
761
  */
762
  protected function get_url( WPSEO_Admin_Asset $asset, $type ) {
763
  $scheme = wp_parse_url( $asset->get_src(), PHP_URL_SCHEME );
764
- if ( in_array( $scheme, array( 'http', 'https' ), true ) ) {
765
  return $asset->get_src();
766
  }
767
 
136
  */
137
  public function special_styles() {
138
  $flat_version = $this->flatten_version( WPSEO_VERSION );
139
+ $asset_args = [
140
  'name' => 'inside-editor',
141
  'src' => 'inside-editor-' . $flat_version,
142
+ ];
143
 
144
+ return [ 'inside-editor' => new WPSEO_Admin_Asset( $asset_args ) ];
145
  }
146
 
147
  /**
200
  wp_register_script(
201
  'react',
202
  plugins_url( 'js/vendor/react.min.js', WPSEO_FILE ),
203
+ [],
204
  'v16.6.1',
205
  true
206
  );
208
  wp_register_script(
209
  'react-dom',
210
  plugins_url( 'js/vendor/react-dom.min.js', WPSEO_FILE ),
211
+ [ 'react' ],
212
  'v16.6.1',
213
  true
214
  );
216
  wp_register_script(
217
  'lodash-base',
218
  plugins_url( 'js/vendor/lodash.min.js', WPSEO_FILE ),
219
+ [],
220
  '4.17.5',
221
  true
222
  );
224
  wp_register_script(
225
  'lodash',
226
  plugins_url( 'js/vendor/lodash-noconflict.js', WPSEO_FILE ),
227
+ [ 'lodash-base' ],
228
  WPSEO_VERSION,
229
  true
230
  );
232
  wp_register_script(
233
  'wp-polyfill',
234
  plugins_url( 'js/dist/babel-polyfill-' . $flat_version . '.min.js', WPSEO_FILE ),
235
+ [],
236
  WPSEO_VERSION,
237
  true
238
  );
240
  wp_register_script(
241
  'wp-element',
242
  plugins_url( 'js/dist/wp-element-' . $flat_version . '.min.js', WPSEO_FILE ),
243
+ [ 'lodash', 'wp-polyfill', 'react', 'react-dom' ],
244
  WPSEO_VERSION,
245
  true
246
  );
248
  wp_register_script(
249
  'wp-api-fetch',
250
  plugins_url( 'js/dist/wp-apiFetch-' . $flat_version . '.min.js', WPSEO_FILE ),
251
+ [ 'wp-i18n', 'wp-polyfill' ],
252
  WPSEO_VERSION,
253
  true
254
  );
256
  wp_register_script(
257
  'wp-components',
258
  plugins_url( 'js/dist/wp-components-' . $flat_version . '.min.js', WPSEO_FILE ),
259
+ [ 'lodash', 'wp-api-fetch', 'wp-i18n', 'wp-polyfill', 'wp-compose' ],
260
  WPSEO_VERSION,
261
  true
262
  );
264
  wp_register_script(
265
  'wp-data',
266
  plugins_url( 'js/dist/wp-data-' . $flat_version . '.min.js', WPSEO_FILE ),
267
+ [ 'lodash', 'wp-element', 'wp-polyfill', 'wp-compose' ],
268
  WPSEO_VERSION,
269
  true
270
  );
272
  wp_register_script(
273
  'wp-i18n',
274
  plugins_url( 'js/dist/wp-i18n-' . $flat_version . '.min.js', WPSEO_FILE ),
275
+ [ 'wp-polyfill' ],
276
  WPSEO_VERSION,
277
  true
278
  );
280
  wp_register_script(
281
  'wp-rich-text',
282
  plugins_url( 'js/dist/wp-rich-text-' . $flat_version . '.min.js', WPSEO_FILE ),
283
+ [ 'lodash', 'wp-polyfill', 'wp-data' ],
284
  WPSEO_VERSION,
285
  true
286
  );
288
  wp_register_script(
289
  'wp-compose',
290
  plugins_url( 'js/dist/wp-compose-' . $flat_version . '.min.js', WPSEO_FILE ),
291
+ [ 'lodash', 'wp-polyfill' ],
292
  WPSEO_VERSION,
293
  true
294
  );
328
 
329
  $flat_version = $this->flatten_version( WPSEO_VERSION );
330
 
331
+ return [
332
+ [
333
  'name' => 'commons',
334
  // Load webpack-commons for bundle support.
335
  'src' => 'commons-' . $flat_version,
336
  'in_footer' => false,
337
+ 'deps' => [
338
  'wp-polyfill',
339
+ ],
340
+ ],
341
+ [
342
  'name' => 'search-appearance',
343
  'src' => 'search-appearance-' . $flat_version,
344
+ 'deps' => [
345
  'wp-api',
346
  self::PREFIX . 'components',
347
  self::PREFIX . 'commons',
348
+ ],
349
+ ],
350
+ [
351
  'name' => 'yoast-modal',
352
  'src' => 'wp-seo-modal-' . $flat_version,
353
+ 'deps' => [
354
  'jquery',
355
  'wp-element',
356
  'wp-i18n',
357
  self::PREFIX . 'components',
358
  self::PREFIX . 'commons',
359
+ ],
360
+ ],
361
+ [
362
  'name' => 'admin-script',
363
  'src' => 'wp-seo-admin-' . $flat_version,
364
+ 'deps' => [
365
  'lodash',
366
  'jquery',
367
  'jquery-ui-core',
369
  self::PREFIX . 'select2',
370
  self::PREFIX . 'select2-translations',
371
  self::PREFIX . 'commons',
372
+ ],
373
+ ],
374
+ [
375
  'name' => 'admin-media',
376
  'src' => 'wp-seo-admin-media-' . $flat_version,
377
+ 'deps' => [
378
  'jquery',
379
  'jquery-ui-core',
380
  self::PREFIX . 'commons',
381
+ ],
382
+ ],
383
+ [
384
  'name' => 'network-admin-script',
385
  'src' => 'wp-seo-network-admin-' . $flat_version,
386
+ 'deps' => [
387
  'jquery',
388
  self::PREFIX . 'commons',
389
+ ],
390
+ ],
391
+ [
392
  'name' => 'bulk-editor',
393
  'src' => 'wp-seo-bulk-editor-' . $flat_version,
394
+ 'deps' => [
395
  'jquery',
396
  self::PREFIX . 'commons',
397
+ ],
398
+ ],
399
+ [
400
  'name' => 'admin-global-script',
401
  'src' => 'wp-seo-admin-global-' . $flat_version,
402
+ 'deps' => [
403
  'jquery',
404
  self::PREFIX . 'commons',
405
+ ],
406
+ ],
407
+ [
408
  'name' => 'metabox',
409
  'src' => 'wp-seo-metabox-' . $flat_version,
410
+ 'deps' => [
411
  'jquery',
412
  'wp-element',
413
  'wp-i18n',
416
  self::PREFIX . 'select2',
417
  self::PREFIX . 'select2-translations',
418
  self::PREFIX . 'commons',
419
+ ],
420
  'in_footer' => false,
421
+ ],
422
+ [
423
  'name' => 'featured-image',
424
  'src' => 'wp-seo-featured-image-' . $flat_version,
425
+ 'deps' => [
426
  'jquery',
427
  self::PREFIX . 'commons',
428
+ ],
429
+ ],
430
+ [
431
  'name' => 'admin-gsc',
432
  'src' => 'wp-seo-admin-gsc-' . $flat_version,
433
+ 'deps' => [
434
  'wp-element',
435
  'wp-i18n',
436
  self::PREFIX . 'styled-components',
437
  self::PREFIX . 'components',
438
  self::PREFIX . 'commons',
439
+ ],
440
  'in_footer' => false,
441
+ ],
442
+ [
443
  'name' => 'post-scraper',
444
  'src' => 'wp-seo-post-scraper-' . $flat_version,
445
+ 'deps' => [
446
  'wp-util',
447
  'wp-api',
448
  'wp-sanitize',
457
  self::PREFIX . 'analysis',
458
  self::PREFIX . 'components',
459
  self::PREFIX . 'commons',
460
+ ],
461
+ ],
462
+ [
463
  'name' => 'term-scraper',
464
  'src' => 'wp-seo-term-scraper-' . $flat_version,
465
+ 'deps' => [
466
  'wp-sanitize',
467
  'wp-element',
468
  'wp-i18n',
473
  self::PREFIX . 'analysis',
474
  self::PREFIX . 'components',
475
  self::PREFIX . 'commons',
476
+ ],
477
+ ],
478
+ [
479
  'name' => 'replacevar-plugin',
480
  'src' => 'wp-seo-replacevar-plugin-' . $flat_version,
481
+ 'deps' => [
482
  self::PREFIX . 'analysis',
483
  self::PREFIX . 'components',
484
  self::PREFIX . 'commons',
485
+ ],
486
+ ],
487
+ [
488
  'name' => 'shortcode-plugin',
489
  'src' => 'wp-seo-shortcode-plugin-' . $flat_version,
490
+ 'deps' => [
491
  self::PREFIX . 'analysis',
492
  self::PREFIX . 'commons',
493
+ ],
494
+ ],
495
+ [
496
  'name' => 'recalculate',
497
  'src' => 'wp-seo-recalculate-' . $flat_version,
498
+ 'deps' => [
499
  'jquery',
500
  'jquery-ui-core',
501
  'jquery-ui-progressbar',
502
  self::PREFIX . 'analysis',
503
  self::PREFIX . 'commons',
504
+ ],
505
+ ],
506
+ [
507
  'name' => 'primary-category',
508
  'src' => 'wp-seo-metabox-category-' . $flat_version,
509
+ 'deps' => [
510
  'jquery',
511
  'wp-util',
512
  'wp-element',
516
  self::PREFIX . 'analysis',
517
  self::PREFIX . 'components',
518
  self::PREFIX . 'commons',
519
+ ],
520
+ ],
521
+ [
522
  'name' => 'select2',
523
  'src' => 'select2/select2.full',
524
  'suffix' => '.min',
525
+ 'deps' => [
526
  'jquery',
527
+ ],
528
  'version' => '4.0.3',
529
+ ],
530
+ [
531
  'name' => 'select2-translations',
532
  'src' => 'select2/i18n/' . $select2_language,
533
+ 'deps' => [
534
  'jquery',
535
  self::PREFIX . 'select2',
536
+ ],
537
  'version' => '4.0.3',
538
  'suffix' => '',
539
+ ],
540
+ [
541
  'name' => 'configuration-wizard',
542
  'src' => 'configuration-wizard-' . $flat_version,
543
+ 'deps' => [
544
  'jquery',
545
  'wp-element',
546
  'wp-i18n',
547
  'wp-api',
548
  self::PREFIX . 'components',
549
  self::PREFIX . 'commons',
550
+ ],
551
+ ],
552
+ [
553
  'name' => 'reindex-links',
554
  'src' => 'wp-seo-reindex-links-' . $flat_version,
555
+ 'deps' => [
556
  'jquery',
557
  'jquery-ui-core',
558
  'jquery-ui-progressbar',
559
  self::PREFIX . 'commons',
560
+ ],
561
+ ],
562
+ [
563
  'name' => 'edit-page-script',
564
  'src' => 'wp-seo-edit-page-' . $flat_version,
565
+ 'deps' => [
566
  'jquery',
567
  self::PREFIX . 'commons',
568
+ ],
569
+ ],
570
+ [
571
  'name' => 'quick-edit-handler',
572
  'src' => 'wp-seo-quick-edit-handler-' . $flat_version,
573
+ 'deps' => [
574
  'jquery',
575
  self::PREFIX . 'commons',
576
+ ],
577
  'in_footer' => true,
578
+ ],
579
+ [
580
  'name' => 'api',
581
  'src' => 'wp-seo-api-' . $flat_version,
582
+ 'deps' => [
583
  'wp-api',
584
  'jquery',
585
  self::PREFIX . 'commons',
586
+ ],
587
+ ],
588
+ [
589
  'name' => 'dashboard-widget',
590
  'src' => 'wp-seo-dashboard-widget-' . $flat_version,
591
+ 'deps' => [
592
  self::PREFIX . 'api',
593
  'jquery',
594
  'wp-element',
595
  'wp-i18n',
596
  self::PREFIX . 'components',
597
  self::PREFIX . 'commons',
598
+ ],
599
+ ],
600
+ [
601
  'name' => 'filter-explanation',
602
  'src' => 'wp-seo-filter-explanation-' . $flat_version,
603
+ 'deps' => [
604
  'jquery',
605
  self::PREFIX . 'commons',
606
+ ],
607
+ ],
608
+ [
609
  'name' => 'analysis',
610
  'src' => 'analysis-' . $flat_version,
611
+ 'deps' => [
612
  'lodash',
613
  self::PREFIX . 'commons',
614
+ ],
615
+ ],
616
+ [
617
  'name' => 'components',
618
  'src' => 'components-' . $flat_version,
619
+ 'deps' => [
620
  self::PREFIX . 'analysis',
621
  self::PREFIX . 'styled-components',
622
  self::PREFIX . 'commons',
623
+ ],
624
+ ],
625
+ [
626
  'name' => 'structured-data-blocks',
627
  'src' => 'wp-seo-structured-data-blocks-' . $flat_version,
628
+ 'deps' => [
629
  'wp-blocks',
630
  'wp-i18n',
631
  'wp-element',
632
  self::PREFIX . 'styled-components',
633
  self::PREFIX . 'commons',
634
+ ],
635
+ ],
636
+ [
637
  'name' => 'styled-components',
638
  'src' => 'styled-components-' . $flat_version,
639
+ 'deps' => [
640
  'wp-element',
641
+ ],
642
+ ],
643
+ [
644
  'name' => 'help-scout-beacon',
645
  'src' => 'help-scout-beacon-' . $flat_version,
646
  'in_footer' => false,
647
+ 'deps' => [
648
  self::PREFIX . 'styled-components',
649
  'wp-element',
650
  'wp-i18n',
651
+ ],
652
+ ],
653
+ ];
654
  }
655
 
656
  /**
663
  protected function styles_to_be_registered() {
664
  $flat_version = $this->flatten_version( WPSEO_VERSION );
665
 
666
+ return [
667
+ [
668
  'name' => 'admin-css',
669
  'src' => 'yst_plugin_tools-' . $flat_version,
670
+ 'deps' => [ self::PREFIX . 'toggle-switch' ],
671
+ ],
672
+ [
673
  'name' => 'toggle-switch',
674
  'src' => 'toggle-switch-' . $flat_version,
675
+ ],
676
+ [
677
  'name' => 'dismissible',
678
  'src' => 'wpseo-dismissible-' . $flat_version,
679
+ ],
680
+ [
681
  'name' => 'alerts',
682
  'src' => 'alerts-' . $flat_version,
683
+ ],
684
+ [
685
  'name' => 'edit-page',
686
  'src' => 'edit-page-' . $flat_version,
687
+ ],
688
+ [
689
  'name' => 'featured-image',
690
  'src' => 'featured-image-' . $flat_version,
691
+ ],
692
+ [
693
  'name' => 'metabox-css',
694
  'src' => 'metabox-' . $flat_version,
695
+ 'deps' => [
696
  self::PREFIX . 'select2',
697
  self::PREFIX . 'admin-css',
698
+ ],
699
+ ],
700
+ [
701
  'name' => 'wp-dashboard',
702
  'src' => 'dashboard-' . $flat_version,
703
+ ],
704
+ [
705
  'name' => 'scoring',
706
  'src' => 'yst_seo_score-' . $flat_version,
707
+ ],
708
+ [
709
  'name' => 'adminbar',
710
  'src' => 'adminbar-' . $flat_version,
711
+ 'deps' => [
712
  'admin-bar',
713
+ ],
714
+ ],
715
+ [
716
  'name' => 'primary-category',
717
  'src' => 'metabox-primary-category-' . $flat_version,
718
+ ],
719
+ [
720
  'name' => 'select2',
721
  'src' => 'select2/select2',
722
  'suffix' => '.min',
723
  'version' => '4.0.1',
724
  'rtl' => false,
725
+ ],
726
+ [
727
  'name' => 'admin-global',
728
  'src' => 'admin-global-' . $flat_version,
729
+ ],
730
+ [
731
  'name' => 'yoast-components',
732
  'src' => 'yoast-components-' . $flat_version,
733
+ ],
734
+ [
735
  'name' => 'extensions',
736
  'src' => 'yoast-extensions-' . $flat_version,
737
+ ],
738
+ [
739
  'name' => 'filter-explanation',
740
  'src' => 'filter-explanation-' . $flat_version,
741
+ ],
742
+ [
743
  'name' => 'search-appearance',
744
  'src' => 'search-appearance-' . $flat_version,
745
+ ],
746
+ [
747
  'name' => 'structured-data-blocks',
748
  'src' => 'structured-data-blocks-' . $flat_version,
749
+ 'deps' => [ 'wp-edit-blocks' ],
750
+ ],
751
+ ];
752
  }
753
 
754
  /**
761
  */
762
  protected function get_url( WPSEO_Admin_Asset $asset, $type ) {
763
  $scheme = wp_parse_url( $asset->get_src(), PHP_URL_SCHEME );
764
+ if ( in_array( $scheme, [ 'http', 'https' ], true ) ) {
765
  return $asset->get_src();
766
  }
767
 
admin/class-admin-asset-yoast-components-l10n.php CHANGED
@@ -18,10 +18,10 @@ final class WPSEO_Admin_Asset_Yoast_Components_L10n {
18
  * @return void
19
  */
20
  public function localize_script( $script_handle ) {
21
- $translations = array(
22
  'yoast-components' => $this->get_translations( 'yoast-components' ),
23
  'wordpress-seo' => $this->get_translations( 'wordpress-seojs' ),
24
- );
25
  wp_localize_script( $script_handle, 'wpseoYoastJSL10n', $translations );
26
  }
27
 
18
  * @return void
19
  */
20
  public function localize_script( $script_handle ) {
21
+ $translations = [
22
  'yoast-components' => $this->get_translations( 'yoast-components' ),
23
  'wordpress-seo' => $this->get_translations( 'wordpress-seojs' ),
24
+ ];
25
  wp_localize_script( $script_handle, 'wpseoYoastJSL10n', $translations );
26
  }
27
 
admin/class-admin-editor-specific-replace-vars.php CHANGED
@@ -15,37 +15,37 @@ class WPSEO_Admin_Editor_Specific_Replace_Vars {
15
  *
16
  * @var array The editor specific replacement variables.
17
  */
18
- protected $replacement_variables = array(
19
  // Posts types.
20
- 'page' => array( 'id', 'pt_single', 'pt_plural', 'parent_title' ),
21
- 'post' => array( 'id', 'term404', 'pt_single', 'pt_plural' ),
22
  // Custom post type.
23
- 'custom_post_type' => array( 'id', 'term404', 'pt_single', 'pt_plural', 'parent_title' ),
24
  // Settings - archive pages.
25
- 'custom-post-type_archive' => array( 'pt_single', 'pt_plural' ),
26
 
27
  // Taxonomies.
28
- 'category' => array( 'term_title', 'term_description', 'category_description', 'parent_title' ),
29
- 'post_tag' => array( 'term_title', 'term_description', 'tag_description' ),
30
- 'post_format' => array(),
31
  // Custom taxonomy.
32
- 'term-in-custom-taxonomy' => array( 'term_title', 'term_description', 'category_description', 'parent_title' ),
33
 
34
  // Settings - special pages.
35
- 'search' => array( 'searchphrase' ),
36
- );
37
 
38
  /**
39
  * WPSEO_Admin_Editor_Specific_Replace_Vars constructor.
40
  */
41
  public function __construct() {
42
  $this->add_for_page_types(
43
- array( 'page', 'post', 'custom_post_type' ),
44
  WPSEO_Custom_Fields::get_custom_fields()
45
  );
46
 
47
  $this->add_for_page_types(
48
- array( 'post', 'term-in-custom-taxonomies' ),
49
  WPSEO_Custom_Taxonomies::get_custom_taxonomies()
50
  );
51
  }
@@ -188,7 +188,7 @@ class WPSEO_Admin_Editor_Specific_Replace_Vars {
188
  * @return array Extracted names.
189
  */
190
  protected function extract_names( $replacement_variables ) {
191
- $extracted_names = array();
192
 
193
  foreach ( $replacement_variables as $replacement_variable ) {
194
  if ( empty( $replacement_variable['name'] ) ) {
15
  *
16
  * @var array The editor specific replacement variables.
17
  */
18
+ protected $replacement_variables = [
19
  // Posts types.
20
+ 'page' => [ 'id', 'pt_single', 'pt_plural', 'parent_title' ],
21
+ 'post' => [ 'id', 'term404', 'pt_single', 'pt_plural' ],
22
  // Custom post type.
23
+ 'custom_post_type' => [ 'id', 'term404', 'pt_single', 'pt_plural', 'parent_title' ],
24
  // Settings - archive pages.
25
+ 'custom-post-type_archive' => [ 'pt_single', 'pt_plural' ],
26
 
27
  // Taxonomies.
28
+ 'category' => [ 'term_title', 'term_description', 'category_description', 'parent_title' ],
29
+ 'post_tag' => [ 'term_title', 'term_description', 'tag_description' ],
30
+ 'post_format' => [],
31
  // Custom taxonomy.
32
+ 'term-in-custom-taxonomy' => [ 'term_title', 'term_description', 'category_description', 'parent_title' ],
33
 
34
  // Settings - special pages.
35
+ 'search' => [ 'searchphrase' ],
36
+ ];
37
 
38
  /**
39
  * WPSEO_Admin_Editor_Specific_Replace_Vars constructor.
40
  */
41
  public function __construct() {
42
  $this->add_for_page_types(
43
+ [ 'page', 'post', 'custom_post_type' ],
44
  WPSEO_Custom_Fields::get_custom_fields()
45
  );
46
 
47
  $this->add_for_page_types(
48
+ [ 'post', 'term-in-custom-taxonomies' ],
49
  WPSEO_Custom_Taxonomies::get_custom_taxonomies()
50
  );
51
  }
188
  * @return array Extracted names.
189
  */
190
  protected function extract_names( $replacement_variables ) {
191
+ $extracted_names = [];
192
 
193
  foreach ( $replacement_variables as $replacement_variable ) {
194
  if ( empty( $replacement_variable['name'] ) ) {
admin/class-admin-gutenberg-compatibility-notification.php CHANGED
@@ -45,7 +45,7 @@ class WPSEO_Admin_Gutenberg_Compatibility_Notification implements WPSEO_WordPres
45
  * @return void
46
  */
47
  public function register_hooks() {
48
- add_action( 'admin_init', array( $this, 'manage_notification' ) );
49
  }
50
 
51
  /**
@@ -81,11 +81,11 @@ class WPSEO_Admin_Gutenberg_Compatibility_Notification implements WPSEO_WordPres
81
 
82
  $notification = new Yoast_Notification(
83
  $message,
84
- array(
85
  'id' => $this->notification_id,
86
  'type' => $level,
87
  'priority' => 1,
88
- )
89
  );
90
 
91
  $this->notification_center->add_notification( $notification );
45
  * @return void
46
  */
47
  public function register_hooks() {
48
+ add_action( 'admin_init', [ $this, 'manage_notification' ] );
49
  }
50
 
51
  /**
81
 
82
  $notification = new Yoast_Notification(
83
  $message,
84
+ [
85
  'id' => $this->notification_id,
86
  'type' => $level,
87
  'priority' => 1,
88
+ ]
89
  );
90
 
91
  $this->notification_center->add_notification( $notification );
admin/class-admin-init.php CHANGED
@@ -34,22 +34,22 @@ class WPSEO_Admin_Init {
34
 
35
  $this->asset_manager = new WPSEO_Admin_Asset_Manager();
36
 
37
- add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_dismissible' ) );
38
- add_action( 'admin_init', array( $this, 'tagline_notice' ), 15 );
39
- add_action( 'admin_init', array( $this, 'blog_public_notice' ), 15 );
40
- add_action( 'admin_init', array( $this, 'permalink_notice' ), 15 );
41
- add_action( 'admin_init', array( $this, 'page_comments_notice' ), 15 );
42
- add_action( 'admin_init', array( $this, 'yoast_plugin_suggestions_notification' ), 15 );
43
- add_action( 'admin_init', array( $this, 'recalculate_notice' ), 15 );
44
- add_action( 'admin_init', array( $this, 'unsupported_php_notice' ), 15 );
45
- add_action( 'admin_init', array( $this->asset_manager, 'register_assets' ) );
46
- add_action( 'admin_init', array( $this, 'show_hook_deprecation_warnings' ) );
47
- add_action( 'admin_init', array( 'WPSEO_Plugin_Conflict', 'hook_check_for_plugin_conflicts' ) );
48
- add_action( 'admin_init', array( $this, 'handle_notifications' ), 15 );
49
- add_action( 'admin_notices', array( $this, 'permalink_settings_notice' ) );
50
- add_action( 'admin_enqueue_scripts', array( $this->asset_manager, 'register_wp_assets' ), PHP_INT_MAX );
51
-
52
- $listeners = array();
53
  $listeners[] = new WPSEO_Post_Type_Archive_Notification_Handler();
54
 
55
  /**
@@ -80,7 +80,7 @@ class WPSEO_Admin_Init {
80
  *
81
  * @var WPSEO_Notification_Handler[] $handlers
82
  */
83
- $handlers = array();
84
  $handlers[] = new WPSEO_Post_Type_Archive_Notification_Handler();
85
 
86
  $notification_center = Yoast_Notification_Center::get();
@@ -100,9 +100,9 @@ class WPSEO_Admin_Init {
100
  * Notify about the default tagline if the user hasn't changed it.
101
  */
102
  public function tagline_notice() {
103
- $query_args = array(
104
  'autofocus[control]' => 'blogdescription',
105
- );
106
  $customize_url = add_query_arg( $query_args, wp_customize_url() );
107
 
108
  $info_message = sprintf(
@@ -112,11 +112,11 @@ class WPSEO_Admin_Init {
112
  '</a>'
113
  );
114
 
115
- $notification_options = array(
116
  'type' => Yoast_Notification::ERROR,
117
  'id' => 'wpseo-dismiss-tagline-notice',
118
  'capabilities' => 'wpseo_manage_options',
119
- );
120
 
121
  $tagline_notification = new Yoast_Notification( $info_message, $notification_options );
122
 
@@ -137,12 +137,12 @@ class WPSEO_Admin_Init {
137
  '</a>'
138
  );
139
 
140
- $notification_options = array(
141
  'type' => Yoast_Notification::ERROR,
142
  'id' => 'wpseo-dismiss-blog-public-notice',
143
  'priority' => 1.0,
144
  'capabilities' => 'wpseo_manage_options',
145
- );
146
 
147
  $notification = new Yoast_Notification( $info_message, $notification_options );
148
 
@@ -170,11 +170,11 @@ class WPSEO_Admin_Init {
170
  '</a>'
171
  );
172
 
173
- $notification_options = array(
174
  'type' => Yoast_Notification::WARNING,
175
  'id' => 'wpseo-dismiss-page_comments-notice',
176
  'capabilities' => 'wpseo_manage_options',
177
- );
178
 
179
  $tagline_notification = new Yoast_Notification( $info_message, $notification_options );
180
 
@@ -217,12 +217,12 @@ class WPSEO_Admin_Init {
217
  '</a>'
218
  );
219
 
220
- $notification_options = array(
221
  'type' => Yoast_Notification::WARNING,
222
  'id' => 'wpseo-dismiss-permalink-notice',
223
  'capabilities' => 'wpseo_manage_options',
224
  'priority' => 0.8,
225
- );
226
 
227
  $notification = new Yoast_Notification( $info_message, $notification_options );
228
 
@@ -302,10 +302,10 @@ class WPSEO_Admin_Init {
302
 
303
  return new Yoast_Notification(
304
  $info_message,
305
- array(
306
  'id' => 'wpseo-suggested-plugin-' . $name,
307
  'type' => Yoast_Notification::WARNING,
308
- )
309
  );
310
  }
311
 
@@ -338,11 +338,11 @@ class WPSEO_Admin_Init {
338
  '<a href="' . admin_url( 'admin.php?page=wpseo_tools&recalculate=1' ) . '">',
339
  '</a>'
340
  ),
341
- array(
342
  'type' => 'updated yoast-dismissible',
343
  'id' => 'wpseo-dismiss-recalculate',
344
  'nonce' => wp_create_nonce( 'wpseo-dismiss-recalculate' ),
345
- )
346
  )
347
  );
348
  }
@@ -363,7 +363,7 @@ class WPSEO_Admin_Init {
363
  * @return float The latest released major WordPress version. 0 The stable-check api doesn't respond.
364
  */
365
  private function get_latest_major_wordpress_version() {
366
- $core_updates = get_core_updates( array( 'dismissed' => true ) );
367
 
368
  if ( $core_updates === false ) {
369
  return 0;
@@ -440,7 +440,7 @@ class WPSEO_Admin_Init {
440
  * Loads admin page class for all admin pages starting with `wpseo_`.
441
  */
442
  private function load_admin_user_class() {
443
- if ( in_array( $this->pagenow, array( 'user-edit.php', 'profile.php' ), true )
444
  && current_user_can( 'edit_users' )
445
  ) {
446
  new WPSEO_Admin_User_Profile();
@@ -494,11 +494,11 @@ class WPSEO_Admin_Init {
494
  private function register_i18n_promo_class() {
495
  // BC, because an older version of the i18n-module didn't have this class.
496
  $i18n_module = new Yoast_I18n_WordPressOrg_v3(
497
- array(
498
  'textdomain' => 'wordpress-seo',
499
  'plugin_name' => 'Yoast SEO',
500
  'hook' => 'wpseo_admin_promo_footer',
501
- ),
502
  false
503
  );
504
 
@@ -512,10 +512,10 @@ class WPSEO_Admin_Init {
512
 
513
  $notification = new Yoast_Notification(
514
  $message,
515
- array(
516
  'type' => Yoast_Notification::WARNING,
517
  'id' => 'i18nModuleTranslationAssistance',
518
- )
519
  );
520
 
521
  if ( $message ) {
@@ -556,12 +556,12 @@ class WPSEO_Admin_Init {
556
  }
557
 
558
  // WordPress hooks that have been deprecated since a Yoast SEO version.
559
- $deprecated_filters = array(
560
- 'wpseo_genesis_force_adjacent_rel_home' => array(
561
  'version' => '9.4',
562
  'alternative' => null,
563
- ),
564
- );
565
 
566
  // Determine which filters have been registered.
567
  $deprecated_notices = array_intersect(
34
 
35
  $this->asset_manager = new WPSEO_Admin_Asset_Manager();
36
 
37
+ add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_dismissible' ] );
38
+ add_action( 'admin_init', [ $this, 'tagline_notice' ], 15 );
39
+ add_action( 'admin_init', [ $this, 'blog_public_notice' ], 15 );
40
+ add_action( 'admin_init', [ $this, 'permalink_notice' ], 15 );
41
+ add_action( 'admin_init', [ $this, 'page_comments_notice' ], 15 );
42
+ add_action( 'admin_init', [ $this, 'yoast_plugin_suggestions_notification' ], 15 );
43
+ add_action( 'admin_init', [ $this, 'recalculate_notice' ], 15 );
44
+ add_action( 'admin_init', [ $this, 'unsupported_php_notice' ], 15 );
45
+ add_action( 'admin_init', [ $this->asset_manager, 'register_assets' ] );
46
+ add_action( 'admin_init', [ $this, 'show_hook_deprecation_warnings' ] );
47
+ add_action( 'admin_init', [ 'WPSEO_Plugin_Conflict', 'hook_check_for_plugin_conflicts' ] );
48
+ add_action( 'admin_init', [ $this, 'handle_notifications' ], 15 );
49
+ add_action( 'admin_notices', [ $this, 'permalink_settings_notice' ] );
50
+ add_action( 'admin_enqueue_scripts', [ $this->asset_manager, 'register_wp_assets' ], PHP_INT_MAX );
51
+
52
+ $listeners = [];
53
  $listeners[] = new WPSEO_Post_Type_Archive_Notification_Handler();
54
 
55
  /**
80
  *
81
  * @var WPSEO_Notification_Handler[] $handlers
82
  */
83
+ $handlers = [];
84
  $handlers[] = new WPSEO_Post_Type_Archive_Notification_Handler();
85
 
86
  $notification_center = Yoast_Notification_Center::get();
100
  * Notify about the default tagline if the user hasn't changed it.
101
  */
102
  public function tagline_notice() {
103
+ $query_args = [
104
  'autofocus[control]' => 'blogdescription',
105
+ ];
106
  $customize_url = add_query_arg( $query_args, wp_customize_url() );
107
 
108
  $info_message = sprintf(
112
  '</a>'
113
  );
114
 
115
+ $notification_options = [
116
  'type' => Yoast_Notification::ERROR,
117
  'id' => 'wpseo-dismiss-tagline-notice',
118
  'capabilities' => 'wpseo_manage_options',
119
+ ];
120
 
121
  $tagline_notification = new Yoast_Notification( $info_message, $notification_options );
122
 
137
  '</a>'
138
  );
139
 
140
+ $notification_options = [
141
  'type' => Yoast_Notification::ERROR,
142
  'id' => 'wpseo-dismiss-blog-public-notice',
143
  'priority' => 1.0,
144
  'capabilities' => 'wpseo_manage_options',
145
+ ];
146
 
147
  $notification = new Yoast_Notification( $info_message, $notification_options );
148
 
170
  '</a>'
171
  );
172
 
173
+ $notification_options = [
174
  'type' => Yoast_Notification::WARNING,
175
  'id' => 'wpseo-dismiss-page_comments-notice',
176
  'capabilities' => 'wpseo_manage_options',
177
+ ];
178
 
179
  $tagline_notification = new Yoast_Notification( $info_message, $notification_options );
180
 
217
  '</a>'
218
  );
219
 
220
+ $notification_options = [
221
  'type' => Yoast_Notification::WARNING,
222
  'id' => 'wpseo-dismiss-permalink-notice',
223
  'capabilities' => 'wpseo_manage_options',
224
  'priority' => 0.8,
225
+ ];
226
 
227
  $notification = new Yoast_Notification( $info_message, $notification_options );
228
 
302
 
303
  return new Yoast_Notification(
304
  $info_message,
305
+ [
306
  'id' => 'wpseo-suggested-plugin-' . $name,
307
  'type' => Yoast_Notification::WARNING,
308
+ ]
309
  );
310
  }
311
 
338
  '<a href="' . admin_url( 'admin.php?page=wpseo_tools&recalculate=1' ) . '">',
339
  '</a>'
340
  ),
341
+ [
342
  'type' => 'updated yoast-dismissible',
343
  'id' => 'wpseo-dismiss-recalculate',
344
  'nonce' => wp_create_nonce( 'wpseo-dismiss-recalculate' ),
345
+ ]
346
  )
347
  );
348
  }
363
  * @return float The latest released major WordPress version. 0 The stable-check api doesn't respond.
364
  */
365
  private function get_latest_major_wordpress_version() {
366
+ $core_updates = get_core_updates( [ 'dismissed' => true ] );
367
 
368
  if ( $core_updates === false ) {
369
  return 0;
440
  * Loads admin page class for all admin pages starting with `wpseo_`.
441
  */
442
  private function load_admin_user_class() {
443
+ if ( in_array( $this->pagenow, [ 'user-edit.php', 'profile.php' ], true )
444
  && current_user_can( 'edit_users' )
445
  ) {
446
  new WPSEO_Admin_User_Profile();
494
  private function register_i18n_promo_class() {
495
  // BC, because an older version of the i18n-module didn't have this class.
496
  $i18n_module = new Yoast_I18n_WordPressOrg_v3(
497
+ [
498
  'textdomain' => 'wordpress-seo',
499
  'plugin_name' => 'Yoast SEO',
500
  'hook' => 'wpseo_admin_promo_footer',
501
+ ],
502
  false
503
  );
504
 
512
 
513
  $notification = new Yoast_Notification(
514
  $message,
515
+ [
516
  'type' => Yoast_Notification::WARNING,
517
  'id' => 'i18nModuleTranslationAssistance',
518
+ ]
519
  );
520
 
521
  if ( $message ) {
556
  }
557
 
558
  // WordPress hooks that have been deprecated since a Yoast SEO version.
559
+ $deprecated_filters = [
560
+ 'wpseo_genesis_force_adjacent_rel_home' => [
561
  'version' => '9.4',
562
  'alternative' => null,
563
+ ],
564
+ ];
565
 
566
  // Determine which filters have been registered.
567
  $deprecated_notices = array_intersect(
admin/class-admin-media-purge-notification.php CHANGED
@@ -23,8 +23,8 @@ class WPSEO_Admin_Media_Purge_Notification implements WPSEO_WordPress_Integratio
23
  * @return void
24
  */
25
  public function register_hooks() {
26
- add_action( 'admin_init', array( $this, 'manage_notification' ) );
27
- add_filter( 'wpseo_option_tab-metas_media', array( $this, 'output_hidden_setting' ) );
28
 
29
  // Dismissing is just setting the relevancy to false, which cancels out any functionality.
30
  if ( WPSEO_Utils::is_yoast_seo_page() && filter_input( INPUT_GET, 'dismiss' ) === $this->notification_id ) {
@@ -81,12 +81,12 @@ class WPSEO_Admin_Media_Purge_Notification implements WPSEO_WordPress_Integratio
81
 
82
  return new Yoast_Notification(
83
  $content,
84
- array(
85
  'type' => Yoast_Notification::ERROR,
86
  'id' => $this->notification_id,
87
  'capabilities' => 'wpseo_manage_options',
88
  'priority' => 1,
89
- )
90
  );
91
  }
92
 
23
  * @return void
24
  */
25
  public function register_hooks() {
26
+ add_action( 'admin_init', [ $this, 'manage_notification' ] );
27
+ add_filter( 'wpseo_option_tab-metas_media', [ $this, 'output_hidden_setting' ] );
28
 
29
  // Dismissing is just setting the relevancy to false, which cancels out any functionality.
30
  if ( WPSEO_Utils::is_yoast_seo_page() && filter_input( INPUT_GET, 'dismiss' ) === $this->notification_id ) {
81
 
82
  return new Yoast_Notification(
83
  $content,
84
+ [
85
  'type' => Yoast_Notification::ERROR,
86
  'id' => $this->notification_id,
87
  'capabilities' => 'wpseo_manage_options',
88
  'priority' => 1,
89
+ ]
90
  );
91
  }
92
 
admin/class-admin-recommended-replace-vars.php CHANGED
@@ -15,32 +15,32 @@ class WPSEO_Admin_Recommended_Replace_Vars {
15
  *
16
  * @var array
17
  */
18
- protected $recommended_replace_vars = array(
19
  // Posts types.
20
- 'page' => array( 'sitename', 'title', 'sep', 'primary_category' ),
21
- 'post' => array( 'sitename', 'title', 'sep', 'primary_category' ),
22
  // Homepage.
23
- 'homepage' => array( 'sitename', 'sitedesc', 'sep' ),
24
  // Custom post type.
25
- 'custom_post_type' => array( 'sitename', 'title', 'sep' ),
26
 
27
  // Taxonomies.
28
- 'category' => array( 'sitename', 'term_title', 'sep' ),
29
- 'post_tag' => array( 'sitename', 'term_title', 'sep' ),
30
- 'post_format' => array( 'sitename', 'term_title', 'sep', 'page' ),
31
 
32
  // Custom taxonomy.
33
- 'term-in-custom-taxomomy' => array( 'sitename', 'term_title', 'sep' ),
34
 
35
  // Settings - archive pages.
36
- 'author_archive' => array( 'sitename', 'title', 'sep', 'page' ),
37
- 'date_archive' => array( 'sitename', 'sep', 'date', 'page' ),
38
- 'custom-post-type_archive' => array( 'sitename', 'title', 'sep', 'page' ),
39
 
40
  // Settings - special pages.
41
- 'search' => array( 'sitename', 'searchphrase', 'sep', 'page' ),
42
- '404' => array( 'sitename', 'sep' ),
43
- );
44
 
45
  /**
46
  * Determines the page type of the current term.
@@ -134,7 +134,7 @@ class WPSEO_Admin_Recommended_Replace_Vars {
134
  $has_recommended_replace_vars = $this->has_recommended_replace_vars( $recommended_replace_vars, $page_type );
135
 
136
  if ( ! $has_recommended_replace_vars ) {
137
- return array();
138
  }
139
 
140
  return $recommended_replace_vars[ $page_type ];
15
  *
16
  * @var array
17
  */
18
+ protected $recommended_replace_vars = [
19
  // Posts types.
20
+ 'page' => [ 'sitename', 'title', 'sep', 'primary_category' ],
21
+ 'post' => [ 'sitename', 'title', 'sep', 'primary_category' ],
22
  // Homepage.
23
+ 'homepage' => [ 'sitename', 'sitedesc', 'sep' ],
24
  // Custom post type.
25
+ 'custom_post_type' => [ 'sitename', 'title', 'sep' ],
26
 
27
  // Taxonomies.
28
+ 'category' => [ 'sitename', 'term_title', 'sep' ],
29
+ 'post_tag' => [ 'sitename', 'term_title', 'sep' ],
30
+ 'post_format' => [ 'sitename', 'term_title', 'sep', 'page' ],
31
 
32
  // Custom taxonomy.
33
+ 'term-in-custom-taxomomy' => [ 'sitename', 'term_title', 'sep' ],
34
 
35
  // Settings - archive pages.
36
+ 'author_archive' => [ 'sitename', 'title', 'sep', 'page' ],
37
+ 'date_archive' => [ 'sitename', 'sep', 'date', 'page' ],
38
+ 'custom-post-type_archive' => [ 'sitename', 'title', 'sep', 'page' ],
39
 
40
  // Settings - special pages.
41
+ 'search' => [ 'sitename', 'searchphrase', 'sep', 'page' ],
42
+ '404' => [ 'sitename', 'sep' ],
43
+ ];
44
 
45
  /**
46
  * Determines the page type of the current term.
134
  $has_recommended_replace_vars = $this->has_recommended_replace_vars( $recommended_replace_vars, $page_type );
135
 
136
  if ( ! $has_recommended_replace_vars ) {
137
+ return [];
138
  }
139
 
140
  return $recommended_replace_vars[ $page_type ];
admin/class-admin-user-profile.php CHANGED
@@ -15,12 +15,12 @@ class WPSEO_Admin_User_Profile {
15
  * Class constructor.
16