3
3
namespace WpssUserManager \Admin ;
4
4
5
5
/** Prevent direct access */
6
- if ( ! function_exists ( 'add_action ' ) ):
6
+ if ( !defined ( 'ABSPATH ' ) ) {
7
7
header ( 'HTTP/1.0 403 Forbidden ' );
8
8
exit ;
9
- endif ;
9
+ }
10
10
11
11
/**
12
12
* Class WPSSAdminFrontend
@@ -34,11 +34,13 @@ public static function admin_main_content(): void {
34
34
*/
35
35
public static function nav_menu_tabs (): array {
36
36
return [
37
- 'roles-tab ' => __ ( 'Roles List ' , 'wpss-ultimate-user-management ' ),
38
- 'menus-tab ' => __ ( 'Menu Items ' , 'wpss-ultimate-user-management ' ),
39
- 'caps-tab ' => __ ( 'Capabilities List ' , 'wpss-ultimate-user-management ' ),
40
- 'users-tab ' => __ ( 'User Management ' , 'wpss-ultimate-user-management ' ),
41
- 'settings-tab ' => __ ( 'Settings ' , 'wpss-ultimate-user-management ' ),
37
+ 'roles-tab ' => __ ( 'Roles List ' , 'wpss-ultimate-user-management ' ),
38
+ 'menus-tab ' => __ ( 'Menu Items ' , 'wpss-ultimate-user-management ' ),
39
+ 'caps-tab ' => __ ( 'Capabilities List ' , 'wpss-ultimate-user-management ' ),
40
+ 'users-tab ' => __ ( 'User Management ' , 'wpss-ultimate-user-management ' ),
41
+ 'widgets-tab ' => __ ( 'Admin/Front Widgets ' , 'wpss-ultimate-user-management ' ),
42
+ 'individual-widgets-tab ' => __ ( 'Sidebar Widgets ' , 'wpss-ultimate-user-management ' ),
43
+ 'settings-tab ' => __ ( 'Settings ' , 'wpss-ultimate-user-management ' ),
42
44
];
43
45
}
44
46
@@ -54,12 +56,13 @@ public static function nav_menu_tabs(): array {
54
56
public static function render_template ( array $ template ): void {
55
57
if ( in_array ( $ template ['template ' ], self ::template_whitelist () ) ) {
56
58
$ file_path = WPSS_URCM_PLUGIN_PATH . "admin/templates/ {$ template ['template ' ]}.php " ;
57
- $ output = __ ( 'Template not found... ' , 'wpss-ultimate-user-management ' );
58
- if ( file_exists ( $ file_path ) ):
59
+ $ output = __ ( 'Template not found... ' , 'wpss-ultimate-user-management ' );
60
+ if ( file_exists ( $ file_path ) ) {
59
61
ob_start ();
60
62
require $ file_path ;
61
63
$ output = ob_get_clean ();
62
- endif ;
64
+ }
65
+
63
66
echo wp_kses ( $ output , self ::sanitize_output () );
64
67
}
65
68
}
@@ -71,49 +74,61 @@ public static function render_template( array $template ): void {
71
74
*/
72
75
public static function sanitize_output (): array {
73
76
return [
74
- 'div ' => [ 'class ' => [], 'id ' => [] ],
75
- 'table ' => [ 'class ' => [], 'id ' => [] ],
76
- 'thead ' => [ 'class ' => [], 'id ' => [] ],
77
- 'tr ' => [ 'class ' => [], 'id ' => [] ],
78
- 'td ' => [ 'class ' => [], 'id ' => [], 'colspan ' => [] ],
79
- 'th ' => [ 'scope ' => [] ],
80
- 'caption ' => [ 'class ' => [] ],
81
- 'tbody ' => [ 'class ' => [], 'id ' => [] ],
82
- 'tfoot ' => [ 'class ' => [], 'id ' => [] ],
83
- 'a ' => [ 'href ' => [], 'title ' => [], 'class ' => [], 'id ' => [], 'target ' => [] ],
84
- 'p ' => [ 'class ' => [], 'id ' => [] ],
85
- 'hr ' => [],
86
- 'ul ' => [ 'class ' => [], 'id ' => [] ],
87
- 'li ' => [ 'label ' => [], 'class ' => [] ],
88
- 'h3 ' => [ 'class ' => [], 'id ' => [] ],
89
- 'u ' => [],
90
- 'br ' => [],
91
- 'img ' => [ 'alt ' => [], 'src ' => [], 'class ' => [], 'id ' => [] ],
92
- 'strong ' => [ 'class ' => [], 'id ' => [] ],
93
- 'span ' => [
77
+ 'div ' => [ 'class ' => [], 'id ' => [], 'role ' => [], 'aria-label ' => [], 'aria-pressed ' => [] ],
78
+ 'table ' => [ 'class ' => [], 'id ' => [] ],
79
+ 'thead ' => [ 'class ' => [], 'id ' => [] ],
80
+ 'tr ' => [ 'class ' => [], 'id ' => [] ],
81
+ 'td ' => [ 'class ' => [], 'id ' => [], 'colspan ' => [] ],
82
+ 'th ' => [ 'scope ' => [] ],
83
+ 'caption ' => [ 'class ' => [] ],
84
+ 'tbody ' => [ 'class ' => [], 'id ' => [] ],
85
+ 'tfoot ' => [ 'class ' => [], 'id ' => [] ],
86
+ 'a ' => [ 'href ' => [], 'title ' => [], 'class ' => [], 'id ' => [], 'target ' => [] ],
87
+ 'p ' => [ 'class ' => [], 'id ' => [] ],
88
+ 'hr ' => [],
89
+ 'ul ' => [ 'class ' => [], 'id ' => [] ],
90
+ 'li ' => [ 'label ' => [], 'class ' => [] ],
91
+ 'h1 ' => [ 'class ' => [], 'id ' => [] ],
92
+ 'h2 ' => [ 'class ' => [], 'id ' => [] ],
93
+ 'h3 ' => [ 'class ' => [], 'id ' => [] ],
94
+ 'h4 ' => [ 'class ' => [], 'id ' => [] ],
95
+ 'u ' => [],
96
+ 'i ' => [ 'class ' => [], 'id ' => [] ],
97
+ 'link ' => [ 'rel ' => [], 'href ' => [], 'id ' => [] ],
98
+ 'small ' => [],
99
+ 'pre ' => [],
100
+ 'br ' => [],
101
+ 'img ' => [ 'alt ' => [], 'src ' => [], 'class ' => [], 'id ' => [] ],
102
+ 'strong ' => [ 'class ' => [], 'id ' => [] ],
103
+ 'span ' => [
94
104
'class ' => [],
95
105
'id ' => [],
96
106
'data-role-id ' => [],
97
107
'data-role-name ' => [],
98
108
'data-user-id ' => [],
99
109
'title ' => [],
100
110
],
101
- 'form ' => [ 'method ' => [], 'action ' => [], 'class ' => [] ],
102
- 'label ' => [ 'for ' => [], 'class ' => [], 'id ' => [] ],
103
- 'input ' => [
104
- 'type ' => [],
105
- 'name ' => [],
106
- 'value ' => [],
107
- 'id ' => [],
108
- 'class ' => [],
109
- 'required ' => [],
110
- 'checked ' => [],
111
- 'placeholder ' => [],
112
- 'title ' => [],
111
+ 'form ' => [ 'method ' => [], 'action ' => [], 'class ' => [], 'id ' => [] ],
112
+ 'label ' => [ 'for ' => [], 'class ' => [], 'id ' => [] ],
113
+ 'input ' => [
114
+ 'type ' => [],
115
+ 'name ' => [],
116
+ 'value ' => [],
117
+ 'id ' => [],
118
+ 'class ' => [],
119
+ 'required ' => [],
120
+ 'checked ' => [],
121
+ 'placeholder ' => [],
122
+ 'title ' => [],
123
+ 'autocomplete ' => [],
124
+ 'aria-expanded ' => [],
125
+ 'aria-owns ' => [],
126
+ 'style ' => [],
113
127
],
114
- 'select ' => [ 'name ' => [], 'class ' => [], 'id ' => [], 'required ' => [], 'onchange ' => [], ],
115
- 'option ' => [ 'value ' => [], 'selected ' => [] ],
116
- 'button ' => [ 'type ' => [], 'class ' => [], 'id ' => [] ],
128
+ 'select ' => [ 'name ' => [], 'class ' => [], 'id ' => [], 'required ' => [], 'onchange ' => [], ],
129
+ 'textarea ' => [ 'name ' => [], 'class ' => [], 'id ' => [], 'rows ' => [], 'cols ' => [] ],
130
+ 'option ' => [ 'value ' => [], 'selected ' => [] ],
131
+ 'button ' => [ 'type ' => [], 'class ' => [], 'id ' => [], 'role ' => [], 'hidefocus ' => [] ],
117
132
];
118
133
}
119
134
@@ -129,10 +144,13 @@ public static function template_whitelist(): array {
129
144
'menus-tab ' ,
130
145
'roles-tab ' ,
131
146
'users-tab ' ,
147
+ 'widgets-tab ' ,
148
+ 'individual-widgets-tab ' ,
132
149
'settings-tab ' ,
133
150
'content/caps-actions ' ,
134
151
'content/user-details ' ,
135
152
'content/users-table ' ,
153
+ 'content/post-type-access-metabox ' ,
136
154
'messages/user-role-add ' ,
137
155
'messages/user-role-remove ' ,
138
156
'messages/add-role-cap ' ,
0 commit comments