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 / migration-error-integration.php

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

59 lines 1.3 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\Config\Migration_Status;
7 use Yoast\WP\SEO\Integrations\Integration_Interface;
8 use Yoast\WP\SEO\Presenters\Admin\Migration_Error_Presenter;
9
10 /**
11 * Migration_Error_Integration class.
12 */
13 class Migration_Error_Integration implements Integration_Interface {
14
15 /**
16 * The migration status object.
17 *
18 * @var Migration_Status
19 */
20 protected $migration_status;
21
22 /**
23 * {@inheritDoc}
24 */
25 public static function get_conditionals() {
26 return [ Admin_Conditional::class ];
27 }
28
29 /**
30 * Migration_Error_Integration constructor.
31 *
32 * @param Migration_Status $migration_status The migration status object.
33 */
34 public function __construct( Migration_Status $migration_status ) {
35 $this->migration_status = $migration_status;
36 }
37
38 /**
39 * {@inheritDoc}
40 */
41 public function register_hooks() {
42 if ( $this->migration_status->get_error( 'free' ) === false ) {
43 return;
44 }
45
46 \add_action( 'admin_notices', [ $this, 'render_migration_error' ] );
47 }
48
49 /**
50 * Renders the migration error.
51 *
52 * @return void
53 */
54 public function render_migration_error() {
55 // phpcs:ignore WordPress.Security.EscapeOutput -- The Migration_Error_Presenter already escapes it's output.
56 echo new Migration_Error_Presenter( $this->migration_status->get_error( 'free' ) );
57 }
58 }
59