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

equalizedigital / accessibility-checker / 20440201089

22 Dec 2025 06:11PM UTC coverage: 57.5%. First build
20440201089

Pull #1316

github

web-flow
Merge b590f5c7c into b669336f5
Pull Request #1316: Release v1.36.0

21 of 30 new or added lines in 5 files covered. (70.0%)

4190 of 7287 relevant lines covered (57.5%)

3.43 hits per line

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

66.67
/admin/class-activation-redirect.php
1
<?php
2
/**
3
 * Handles plugin activation redirect to welcome page.
4
 *
5
 * @package Accessibility_Checker\Admin
6
 */
7

8
namespace EDAC\Admin;
9

NEW
10
if ( ! defined( 'ABSPATH' ) ) {
×
NEW
11
        exit; // Exit if accessed directly.
×
12
}
13

14
/**
15
 * Class Activation_Redirect
16
 *
17
 * Handles redirecting to the welcome page after plugin activation.
18
 *
19
 * @since 1.36.0
20
 */
21
class Activation_Redirect {
22

23
        /**
24
         * The page slug for the welcome page.
25
         *
26
         * @since 1.36.0
27
         * @var string
28
         */
29
        const WELCOME_PAGE_SLUG = 'accessibility_checker';
30

31
        /**
32
         * Initialize the activation redirect.
33
         *
34
         * @since 1.36.0
35
         */
36
        public function init(): void {
37
                add_action( 'admin_init', [ $this, 'maybe_redirect_to_welcome' ] );
4✔
38
        }
39

40
        /**
41
         * Get the welcome page URL.
42
         *
43
         * @since 1.36.0
44
         * @return string The URL to the welcome page.
45
         */
46
        public function get_welcome_page_url(): string {
47
                return admin_url( 'admin.php?page=' . self::WELCOME_PAGE_SLUG );
2✔
48
        }
49

50
        /**
51
         * Redirect to welcome page after activation if conditions are met.
52
         *
53
         * This will only redirect if:
54
         * - The activation redirect transient is set
55
         * - We're not doing an AJAX request
56
         * - We're not in the network admin (multisite)
57
         * - We're not activating multiple plugins at once
58
         * - User has permission to access the welcome page
59
         *
60
         * @since 1.36.0
61
         * @return void
62
         */
63
        public function maybe_redirect_to_welcome(): void {
64
                // Check if the activation redirect transient exists.
65
                if ( ! get_transient( 'edac_activation_redirect' ) ) {
12✔
66
                        return;
2✔
67
                }
68

69
                // Don't redirect during AJAX requests.
70
                if ( wp_doing_ajax() ) {
10✔
71
                        return;
2✔
72
                }
73

74
                // Don't redirect during REST API requests.
75
                if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) {
8✔
NEW
76
                        return;
×
77
                }
78

79
                // Don't redirect in network admin (multisite).
80
                if ( is_network_admin() ) {
8✔
NEW
81
                        return;
×
82
                }
83

84
                // Don't redirect if multiple plugins are being activated at once.
85
                // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- We're checking $_GET, not processing form data.
86
                if ( isset( $_GET['activate-multi'] ) ) {
8✔
87
                        return;
2✔
88
                }
89

90
                // Don't redirect if user doesn't have permission to see the welcome page.
91
                // Uses 'edit_posts' to match the welcome page's capability check (see includes/options-page.php).
92
                // This allows Authors and above to access the welcome page, as intended by the plugin design.
93
                if ( ! current_user_can( 'edit_posts' ) ) {
6✔
94
                        return;
2✔
95
                }
96

97
                // Don't redirect if we're in a test environment.
98
                if ( defined( 'WP_TESTS_DOMAIN' ) ) {
4✔
99
                        return;
4✔
100
                }
101

102
                // Delete the transient to prevent redirect loops.
NEW
103
                delete_transient( 'edac_activation_redirect' );
×
104

105
                // Perform the redirect to the welcome page.
NEW
106
                wp_safe_redirect( $this->get_welcome_page_url() );
×
NEW
107
                exit;
×
108
        }
109
}
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