PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 19.0
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v19.0
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
wordpress-seo / src / integrations / admin / old-configuration-integration.php

old-configuration-integration.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 19.0, at src/integrations/admin/old-configuration-integration.php

68 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Yoast\WP\SEO\Integrations\Admin;
4
5 use WPSEO_Admin_Asset_Manager;
6 use Yoast\WP\SEO\Conditionals\Admin_Conditional;
7 use Yoast\WP\SEO\Integrations\Integration_Interface;
8
9 /**
10 * Old_Configuration_Integration class
11 */
12 class Old_Configuration_Integration implements Integration_Interface {
13
14 /**
15 * {@inheritDoc}
16 */
17 public static function get_conditionals() {
18 return [ Admin_Conditional::class ];
19 }
20
21 /**
22 * {@inheritDoc}
23 */
24 public function register_hooks() {
25 \add_filter( 'admin_menu', [ $this, 'add_submenu_page' ], 11 );
26 \add_action( 'admin_init', [ $this, 'redirect_to_new_configuration' ] );
27 }
28
29 /**
30 * Adds the old configuration submenu page.
31 *
32 * @param array $submenu_pages The Yoast SEO submenu pages.
33 *
34 * @return array the filtered submenu pages.
35 */
36 public function add_submenu_page( $submenu_pages ) {
37 \add_submenu_page(
38 null,
39 \__( 'Old Configuration Wizard', 'wordpress-seo' ),
40 null,
41 'manage_options',
42 'wpseo_configurator',
43 [ $this, 'render_page' ]
44 );
45
46 return $submenu_pages;
47 }
48
49 /**
50 * Renders the old configuration page.
51 */
52 public function render_page() {
53 // This page is never to be displayed.
54 }
55
56 /**
57 * Redirects from the old configuration page to the new configuration page.
58 */
59 public function redirect_to_new_configuration() {
60 // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Data is not processed or saved.
61 if ( ! isset( $_GET['page'] ) || $_GET['page'] !== 'wpseo_configurator' ) {
62 return;
63 }
64 \wp_safe_redirect( \admin_url( 'admin.php?page=wpseo_dashboard#top#first-time-configuration' ), 302, 'Yoast SEO' );
65 exit;
66 }
67 }
68