-
Notifications
You must be signed in to change notification settings - Fork 81
/
network-settings.php
executable file
·158 lines (69 loc) · 2.06 KB
/
network-settings.php
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
<?php defined( 'ABSPATH' ) or die();
class Brizy_Admin_NetworkSettings {
/**
* @return Brizy_Admin_NetworkSettings
*/
public static function _init() {
static $instance;
return $instance ? $instance : $instance = new self();
}
/**
* Brizy_Admin_NetworkSettings constructor.
*/
private function __construct() {
add_action( 'network_admin_menu', array( $this, 'actionRegisterSettingsPage' ) );
add_action( 'brizy_network_settings_render_tabs', array( $this, 'render_tabs' ) );
add_action( 'brizy_network_settings_render_content', array( $this, 'render_tab_content' ) );
}
public static function menu_slug() {
return Brizy_Editor::prefix( '-network-settings' );
}
/**
* @internal
*/
function actionRegisterSettingsPage() {
add_menu_page( Brizy_Editor::get()->get_name(),
Brizy_Editor::get()->get_name(),
'read',
self::menu_slug(),
array( $this, 'render' ),
__bt( 'brizy-logo', plugins_url( 'static/img/brizy-logo.svg', __FILE__ ) ),
//plugins_url( '/static/img/brizy-logo.svg', __FILE__ ),
'58'
);
}
private function get_selected_tab() {
return ( ! empty( $_REQUEST['tab'] ) ) ? esc_attr( $_REQUEST['tab'] ) : 'license';
}
private function get_tabs() {
$selected_tab = $this->get_selected_tab();
$tabs = [];
return apply_filters( 'brizy_network_settings_tabs', $tabs, $selected_tab );
}
/**
* @internal
*/
public function render() {
try {
echo Brizy_Admin_View::render(
'settings/network-view',
array()
);
} catch ( Exception $e ) {
}
}
public function render_tabs() {
$tabs = $this->get_tabs();
foreach ( $tabs as $tab ) {
$is_active_class = $tab['is_selected'] ? 'nav-tab-active' : '';
?>
<a href="<?php echo $tab['href'] ?>"
class="nav-tab <?php echo $is_active_class ?>"><?php echo __( $tab['label'] ) ?></a>
<?php
}
}
public function render_tab_content() {
$tab = $this->get_selected_tab();
echo apply_filters( 'brizy_network_settings_render_tab', '', $tab );
}
}