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

equalizedigital / accessibility-checker / 16151684817

08 Jul 2025 06:43PM UTC coverage: 29.153% (+0.3%) from 28.87%
16151684817

push

github

web-flow
Merge pull request #1067 from equalizedigital/steve/pro-199-filter-admin-footer-message-only-on-our-settings-pages

added: Admin_Footer_Text class and corresponding PHPUnit tests

22 of 24 new or added lines in 2 files covered. (91.67%)

1553 of 5327 relevant lines covered (29.15%)

1.68 hits per line

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

90.91
/admin/class-admin-footer-text.php
1
<?php
2
/**
3
 * Filters the admin_footer_text on Accessibility Checker settings pages only.
4
 *
5
 * @package Accessibility_Checker\Admin
6
 */
7

8
namespace EqualizeDigital\AccessibilityChecker\Admin;
9

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

14
/**
15
 * Class Admin_Footer_Text
16
 *
17
 * Handles filtering of admin footer text on Accessibility Checker settings pages.
18
 *
19
 * @since 1.27.0
20
 */
21
class Admin_Footer_Text {
22
        /**
23
         * Initialize the admin footer text filter.
24
         *
25
         * @since 1.27.0
26
         */
27
        public function init() {
28
                add_filter( 'admin_footer_text', [ $this, 'filter_footer_text' ] );
6✔
29
        }
30

31
        /**
32
         * Filter the admin footer text on our settings pages only.
33
         *
34
         * @since 1.27.0
35
         * @param string $footer_text The current footer text.
36
         * @return string
37
         */
38
        public function filter_footer_text( $footer_text ) {
39
                if ( ! $this->is_settings_page() ) {
14✔
40
                        return $footer_text;
2✔
41
                }
42

43
                if ( $this->is_pro_active() ) {
12✔
44
                        return sprintf(
2✔
45
                                /* translators: %1$s: opening link tag, %2$s: closing link tag */
46
                                esc_html__( 'Enjoying Accessibility Checker? %1$sPlease leave us a ★★★★★ rating.%2$s We really appreciate your support!', 'accessibility-checker' ),
2✔
47
                                '<a href="' . esc_url( 'https://wordpress.org/support/plugin/accessibility-checker/reviews/#new-post' ) . '" target="_blank" aria-label="' . esc_attr__( 'Please leave us a five star rating (opens in new window)', 'accessibility-checker' ) . '">',
2✔
48
                                '</a>'
2✔
49
                        );
2✔
50
                }
51

52
                $pro_link = edac_link_wrapper( 'https://equalizedigital.com/accessibility-checker/pricing/', 'admin-footer', 'admin-footer-text', false );
10✔
53
                return sprintf(
10✔
54
                        /* translators: %1$s: opening link tag, %2$s: closing link tag */
55
                        esc_html__( 'Want to do more with Accessibility Checker? %1$sUnlock Pro Features%2$s', 'accessibility-checker' ),
10✔
56
                        '<a href="' . esc_url( $pro_link ) . '" target="_blank" aria-label="' . esc_attr__( 'Unlock Pro Features (opens in new window)', 'accessibility-checker' ) . '">',
10✔
57
                        '</a>'
10✔
58
                );
10✔
59
        }
60

61
        /**
62
         * Check if we are on the Accessibility Checker settings page.
63
         *
64
         * @since 1.27.0
65
         * @return bool
66
         */
67
        protected function is_settings_page() {
68
                // Check if we're on an admin page and have a page parameter.
69
                if ( ! is_admin() || ! isset( $_GET['page'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
22✔
70
                        return false;
6✔
71
                }
72

73
                // Sanitize and check if it's an accessibility checker page.
74
                $page = sanitize_text_field( wp_unslash( $_GET['page'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
16✔
75
                return strpos( $page, 'accessibility_checker' ) === 0;
16✔
76
        }
77

78
        /**
79
         * Check if Pro is active with a valid license.
80
         *
81
         * @since 1.27.0
82
         * @return bool
83
         */
84
        protected function is_pro_active() {
85
                // Pro is active if EDACP_VERSION is defined and license is valid.
86
                return defined( 'EDACP_VERSION' ) && defined( 'EDAC_KEY_VALID' ) && EDAC_KEY_VALID;
12✔
87
        }
88
}
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