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

Yoast / wordpress-seo / 7004843404

27 Nov 2023 11:48AM UTC coverage: 49.206% (-0.03%) from 49.232%
7004843404

push

github

web-flow
Merge pull request #20858 from Yoast/improve-copy-in-the-ftc-57

15305 of 31104 relevant lines covered (49.21%)

4.03 hits per line

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

0.0
/admin/menu/class-menu.php
1
<?php
2
/**
3
 * WPSEO plugin file.
4
 *
5
 * @package WPSEO\Admin\Menu
6
 */
7

8
/**
9
 * Registers the regular admin menu and network admin menu implementations.
10
 */
11
class WPSEO_Menu implements WPSEO_WordPress_Integration {
12

13
        /**
14
         * The page identifier used in WordPress to register the admin page.
15
         *
16
         * !DO NOT CHANGE THIS!
17
         *
18
         * @var string
19
         */
20
        const PAGE_IDENTIFIER = 'wpseo_dashboard';
21

22
        /**
23
         * List of classes that add admin functionality.
24
         *
25
         * @var array
26
         */
27
        protected $admin_features;
28

29
        /**
30
         * Registers all hooks to WordPress.
31
         *
32
         * @return void
33
         */
34
        public function register_hooks() {
×
35
                $admin_menu = new WPSEO_Admin_Menu( $this );
×
36
                $admin_menu->register_hooks();
×
37

38
                if ( WPSEO_Utils::is_plugin_network_active() ) {
×
39
                        $network_admin_menu = new WPSEO_Network_Admin_Menu( $this );
×
40
                        $network_admin_menu->register_hooks();
×
41
                }
42

43
                $capability_normalizer = new WPSEO_Submenu_Capability_Normalize();
×
44
                $capability_normalizer->register_hooks();
×
45
        }
46

47
        /**
48
         * Returns the main menu page identifier.
49
         *
50
         * @return string Page identifier to use.
51
         */
52
        public function get_page_identifier() {
×
53
                return self::PAGE_IDENTIFIER;
×
54
        }
55

56
        /**
57
         * Loads the requested admin settings page.
58
         *
59
         * @return void
60
         */
61
        public function load_page() {
×
62
                // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.
63
                if ( isset( $_GET['page'] ) && is_string( $_GET['page'] ) ) {
×
64
                        // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.
65
                        $page = sanitize_text_field( wp_unslash( $_GET['page'] ) );
×
66
                        $this->show_page( $page );
×
67
                }
68
        }
69

70
        /**
71
         * Shows an admin settings page.
72
         *
73
         * @param string $page Page to display.
74
         *
75
         * @return void
76
         */
77
        protected function show_page( $page ) {
×
78
                switch ( $page ) {
79
                        case 'wpseo_tools':
×
80
                                require_once WPSEO_PATH . 'admin/pages/tools.php';
×
81
                                break;
×
82

83
                        case 'wpseo_licenses':
×
84
                                require_once WPSEO_PATH . 'admin/pages/licenses.php';
×
85
                                break;
×
86

87
                        case 'wpseo_files':
×
88
                                require_once WPSEO_PATH . 'admin/views/tool-file-editor.php';
×
89
                                break;
×
90

91
                        default:
92
                                require_once WPSEO_PATH . 'admin/pages/dashboard.php';
×
93
                                break;
×
94
                }
95
        }
96
}
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

© 2025 Coveralls, Inc