-
Notifications
You must be signed in to change notification settings - Fork 30
/
adminimize_page.php
executable file
·227 lines (191 loc) · 6.65 KB
/
adminimize_page.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
<?php
/**
* @package Adminimize
* @subpackage Settings page
* @author Frank Bültge
*/
// A rather more popular way to check if the file is being accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
die( "Hi there! I'm just a part of plugin, not much I can do when called directly." );
}
/*
// Export the options to local client.
if ( array_key_exists( '_mw_adminimize_export', $_GET ) ) {
add_action( 'admin_init', '_mw_adminimize_export_json' );
//_mw_adminimize_export_json();
die();
}*/
function _mw_adminimize_options() {
// The removed data is never used.
// update options
// Some indenting cleanups
if (
( array_key_exists( '_mw_adminimize_action', $_POST )
&& $_POST[ '_mw_adminimize_action' ] === '_mw_adminimize_insert' )
&& $_POST[ '_mw_adminimize_save' ]
) {
if ( function_exists( 'current_user_can' ) && current_user_can( 'manage_options' ) ) {
check_admin_referer( 'mw_adminimize_nonce' );
_mw_adminimize_update();
} else {
$myErrors = new _mw_adminimize_message_class();
$myErrors = '<div id="message" class="error"><p>' .
$myErrors->get_error(
'_mw_adminimize_access_denied'
) .
'</p></div>';
wp_die( $myErrors );
// Some indenting cleanups
}
}
// import options
// Some indenting cleanups
if (
( array_key_exists( '_mw_adminimize_action', $_POST )
&& $_POST[ '_mw_adminimize_action' ] === '_mw_adminimize_import' )
&& $_POST[ '_mw_adminimize_save' ]
) {
_mw_adminimize_import_json();
}
// Uninstall options
// Some indenting cleanups
if (
( array_key_exists( '_mw_adminimize_action', $_POST )
&& $_POST[ '_mw_adminimize_action' ] === '_mw_adminimize_uninstall' )
&& ! array_key_exists( '_mw_adminimize_uninstall_yes', $_POST )
) {
$myErrors = new _mw_adminimize_message_class();
$myErrors = '<div id="message" class="error"><p>' . $myErrors->get_error(
'_mw_adminimize_uninstall_yes'
) . '</p></div>';
wp_die( $myErrors );
}
// Some indenting cleanups
if (
( array_key_exists( '_mw_adminimize_action', $_POST )
&& array_key_exists( '_mw_adminimize_uninstall_yes', $_POST )
&& $_POST[ '_mw_adminimize_action' ] === '_mw_adminimize_uninstall' )
&& $_POST[ '_mw_adminimize_uninstall' ]
&& $_POST[ '_mw_adminimize_uninstall_yes' ] === '_mw_adminimize_uninstall'
) {
if ( function_exists( 'current_user_can' ) && current_user_can( 'manage_options' ) ) {
check_admin_referer( 'mw_adminimize_nonce' );
_mw_adminimize_uninstall();
$myErrors = new _mw_adminimize_message_class();
$myErrors = '<div id="message" class="updated fade"><p>' . $myErrors->get_error(
'_mw_adminimize_uninstall'
) . '</p></div>';
echo $myErrors;
} else {
$myErrors = new _mw_adminimize_message_class();
$myErrors = '<div id="message" class="error"><p>' . $myErrors->get_error(
'_mw_adminimize_access_denied'
) . '</p></div>';
wp_die( $myErrors );
}
}
// load theme user data
// Some indenting cleanups
if (
( array_key_exists( '_mw_adminimize_action', $_POST )
&& $_POST[ '_mw_adminimize_action' ] === '_mw_adminimize_load_theme' )
&& $_POST[ '_mw_adminimize_load' ]
) {
if ( function_exists( 'current_user_can' ) && current_user_can( 'edit_users' ) ) {
check_admin_referer( 'mw_adminimize_nonce' );
$myErrors = new _mw_adminimize_message_class();
$myErrors = '<div id="message" class="updated fade"><p>' .
$myErrors->get_error(
'_mw_adminimize_load_theme'
) .
'</p></div>';
echo $myErrors;
} else {
$myErrors = new _mw_adminimize_message_class();
$myErrors = '<div id="message" class="error"><p>' .
$myErrors->get_error(
'_mw_adminimize_access_denied'
) .
'</p></div>';
wp_die( $myErrors );
}
}
// Some indenting cleanups
if (
( array_key_exists( '_mw_adminimize_action', $_POST )
&& $_POST[ '_mw_adminimize_action' ] === '_mw_adminimize_set_theme' )
&& $_POST[ '_mw_adminimize_save' ]
) {
if ( function_exists( 'current_user_can' ) && current_user_can( 'edit_users' ) ) {
check_admin_referer( 'mw_adminimize_nonce' );
// _mw_adminimize_set_theme();
// This function isn't defined anywhere.
$myErrors = new _mw_adminimize_message_class();
$myErrors = '<div id="message" class="updated fade"><p>' .
$myErrors->get_error(
'_mw_adminimize_set_theme'
) .
'</p></div>';
echo $myErrors;
} else {
$myErrors = new _mw_adminimize_message_class();
$myErrors = '<div id="message" class="error"><p>' .
$myErrors->get_error(
'_mw_adminimize_access_denied'
) .
'</p></div>';
wp_die( $myErrors );
}
}
?>
<div class="wrap">
<?php
do_action( 'mw_adminimize_before_settings_form' );
// Backend Options for all roles
require_once 'inc-options/minimenu.php';
?>
<form name="backend_option" method="post" id="_mw_adminimize_options" action="?page=<?php echo esc_attr( $_GET[ 'page' ] ); ?>">
<?php
// Adminimize Settings for the plugin.
require_once 'inc-options/self_settings.php';
// Admin Bar options
require_once 'inc-options/admin_bar.php';
// Admin Bar items frontend
require_once 'inc-options/admin_bar_frontend.php';
// Backend Options for all roles
require_once 'inc-options/backend_options.php';
// global options on all pages in backend for different roles
require_once 'inc-options/global_options.php';
// dashboard options for different roles
require_once 'inc-options/dashboard_options.php';
// Menu Sub-menu Options
require_once 'inc-options/menu_options.php';
// Write Page Options
require_once 'inc-options/write_post_options.php';
// Write Page Options
require_once 'inc-options/write_page_options.php';
// Custom Post Type
if ( function_exists( 'get_post_types' ) ) {
require_once 'inc-options/write_cp_options.php';
}
// Links Options
if ( 0 !== get_option( 'link_manager_enabled' ) ) {
require_once 'inc-options/links_options.php';
}
// Widget options
require_once 'inc-options/widget_options.php';
// WP Nav Menu Options
require_once 'inc-options/wp_nav_menu_options.php';
do_action( 'mw_adminimize_settings_form' );
?>
</form>
<?php
do_action( 'mw_adminimize_after_settings_form' );
// Im/Export Options
require_once 'inc-options/im_export_options.php';
// Uninstall options
require_once 'inc-options/deinstall_options.php';
?>
</div>
<?php
}