• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Yoast / wordpress-seo / 4972286220c65f7b3dc0502d9bdb6900c46d29d7

10 Jul 2025 12:05PM UTC coverage: 53.511% (+0.1%) from 53.412%
4972286220c65f7b3dc0502d9bdb6900c46d29d7

Pull #22356

github

kyrylo-polozenko-newfold
fix: remove unnecessary components from editor modules
Pull Request #22356: Feature/get redirects

8217 of 14373 branches covered (57.17%)

Branch coverage included in aggregate %.

3 of 42 new or added lines in 10 files covered. (7.14%)

3 existing lines in 3 files now uncovered.

30355 of 57710 relevant lines covered (52.6%)

41373.44 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

48.65
/src/integrations/admin/redirects-page-integration.php
1
<?php
2

3
namespace Yoast\WP\SEO\Integrations\Admin;
4

5
use Yoast\WP\SEO\Conditionals\Admin_Conditional;
6
use Yoast\WP\SEO\Conditionals\Premium_Inactive_Conditional;
7
use Yoast\WP\SEO\Integrations\Integration_Interface;
8

9
/**
10
 * Redirects_Page_Integration class.
11
 */
12
class Redirects_Page_Integration implements Integration_Interface {
13

14
        /**
15
         * The page identifier.
16
         */
17
        public const PAGE = 'wpseo_redirects';
18

19
        /**
20
         * Sets up the hooks.
21
         *
22
         * @return void
23
         */
24
        public function register_hooks() {
2✔
25
                \add_filter( 'wpseo_submenu_pages', [ $this, 'add_submenu_page' ], 9 );
2✔
26
                \add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_assets' ] );
2✔
27
        }
28

29
        /**
30
         * Returns the conditionals based on which this loadable should be active.
31
         *
32
         * In this case: only when on an admin page and Premium is not active.
33
         *
34
         * @return array The conditionals.
35
         */
36
        public static function get_conditionals() {
2✔
37
                return [
2✔
38
                        Admin_Conditional::class,
2✔
39
                        Premium_Inactive_Conditional::class,
2✔
40
                ];
2✔
41
        }
42

43
        /**
44
         * Adds the redirects submenu page.
45
         *
46
         * @param array $submenu_pages The Yoast SEO submenu pages.
47
         *
48
         * @return array The filtered submenu pages.
49
         */
50
        public function add_submenu_page( $submenu_pages ) {
2✔
51
                $submenu_pages[] = [
2✔
52
                        'wpseo_dashboard',
2✔
53
                        '',
2✔
54
                        \__( 'Redirects', 'wordpress-seo' ) . ' <span class="yoast-badge yoast-premium-badge"></span>',
2✔
55
                        'edit_others_posts',
2✔
56
                        self::PAGE,
2✔
57
                        [ $this, 'display' ],
2✔
58
                ];
2✔
59

60
                return $submenu_pages;
2✔
61
        }
62

63
        /**
64
         * Enqueue assets on the redirects page.
65
         *
66
         * @return void
67
         */
NEW
68
        public function enqueue_assets() {
×
69
                // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Data is not processed or saved.
NEW
70
                if ( ! isset( $_GET['page'] ) || $_GET['page'] !== self::PAGE ) {
×
NEW
71
                        return;
×
72
                }
73

NEW
74
                $asset_manager = new \WPSEO_Admin_Asset_Manager();
×
NEW
75
                $asset_manager->enqueue_script( 'redirects' );
×
NEW
76
                $asset_manager->enqueue_style( 'redirects' );
×
77

NEW
78
                $asset_manager->localize_script(
×
NEW
79
                        'redirects',
×
NEW
80
                        'wpseoScriptData',
×
NEW
81
                        [
×
NEW
82
                                'preferences' => [
×
NEW
83
                                        'isPremium' => \YoastSEO()->helpers->product->is_premium(),
×
NEW
84
                                        'isRtl'     => \is_rtl(),
×
NEW
85
                                ],
×
NEW
86
                                'linkParams' => \YoastSEO()->helpers->short_link->get_query_params(),
×
NEW
87
                        ]
×
NEW
88
                );
×
89
        }
90

91
        /**
92
         * Displays the redirects page.
93
         *
94
         * @return void
95
         */
96
        public function display() {
×
97
                require \WPSEO_PATH . 'admin/pages/redirects.php';
×
98
        }
99
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc