PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 28.3
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v28.3
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 28.3, at src/integrations/admin/old-configuration-integration.php

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