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

Yoast / wordpress-seo / defe33a3b9bceedef266c312754d9acf5c811177

14 Jul 2025 11:24AM UTC coverage: 53.858% (+0.4%) from 53.412%
defe33a3b9bceedef266c312754d9acf5c811177

push

github

thijsoo
Merge branch 'trunk' of github.com:Yoast/wordpress-seo into feature/redirection20

# Conflicts:
#	admin/class-config.php

8246 of 14361 branches covered (57.42%)

Branch coverage included in aggregate %.

162 of 253 new or added lines in 36 files covered. (64.03%)

81 existing lines in 18 files now uncovered.

30489 of 57559 relevant lines covered (52.97%)

41481.99 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 WPSEO_Admin_Asset_Manager;
6
use Yoast\WP\SEO\Conditionals\Admin_Conditional;
7
use Yoast\WP\SEO\Conditionals\Premium_Inactive_Conditional;
8
use Yoast\WP\SEO\Integrations\Integration_Interface;
9

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

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

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

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

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

61
                return $submenu_pages;
2✔
62
        }
63

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

UNCOV
75
                $asset_manager = new WPSEO_Admin_Asset_Manager();
×
UNCOV
76
                $asset_manager->enqueue_script( 'redirects' );
×
UNCOV
77
                $asset_manager->enqueue_style( 'redirects' );
×
78

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

92
        /**
93
         * Displays the redirects page.
94
         *
95
         * @return void
96
         */
UNCOV
97
        public function display() {
×
UNCOV
98
                require \WPSEO_PATH . 'admin/pages/redirects.php';
×
99
        }
100
}
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