1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
<?php /** * WPSEO plugin file. * * @package WPSEO\Admin\Menu */
/** * Network Admin Menu handler. */ class WPSEO_Network_Admin_Menu extends WPSEO_Base_Menu {
/** * Registers all hooks to WordPress. * * @return void */ public function register_hooks() { // Needs the lower than default priority so other plugins can hook underneath it without issue. add_action( 'network_admin_menu', array( $this, 'register_settings_page' ), 5 ); }
/** * Register the settings page for the Network settings. * * @return void */ public function register_settings_page() { if ( ! $this->check_manage_capability() ) { return; }
add_menu_page( __( 'Network Settings', 'wordpress-seo' ) . ' - Yoast SEO', __( 'SEO', 'wordpress-seo' ), $this->get_manage_capability(), $this->get_page_identifier(), array( $this, 'network_config_page' ), WPSEO_Utils::get_icon_svg() );
$submenu_pages = $this->get_submenu_pages(); $this->register_submenu_pages( $submenu_pages ); }
/** * Returns the list of registered submenu pages. * * @return array List of registered submenu pages. */ public function get_submenu_pages() {
// Submenu pages. $submenu_pages = array( $this->get_submenu_page( __( 'General', 'wordpress-seo' ), $this->get_page_identifier(), array( $this, 'network_config_page' ) ), );
if ( WPSEO_Utils::allow_system_file_edit() === true ) { $submenu_pages[] = $this->get_submenu_page( __( 'Edit Files', 'wordpress-seo' ), 'wpseo_files' ); }
$submenu_pages[] = $this->get_submenu_page( __( 'Extensions', 'wordpress-seo' ), 'wpseo_licenses' );
return $submenu_pages; }
/** * Loads the form for the network configuration page. * * @return void */ public function network_config_page() { require_once WPSEO_PATH . 'admin/pages/network.php'; }
/** * Checks whether the current user has capabilities to manage all options. * * @return bool True if capabilities are sufficient, false otherwise. */ protected function check_manage_capability() { return current_user_can( $this->get_manage_capability() ); }
/** * Returns the capability that is required to manage all options. * * @return string Capability to check against. */ protected function get_manage_capability() { return 'wpseo_manage_network_options'; } }
|