PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 3.2.4.5
Adminify – White Label, Admin Menu Editor, Login Customizer v3.2.4.5
4.3.1 4.3.0 4.2.26 4.2.25 4.2.24 4.2.23 4.2.22 4.2.21 4.2.20 4.2.19 4.2.18 4.2.17 4.2.16 4.2.15 4.2.14 4.2.13 4.2.12 4.2.11 4.2.10 4.2.9 4.2.8 4.2.7 4.2.6 4.2.5 4.1.17 All 164 releases
← All changes | Inc/Modules/MenuEditor/MenuEditor.php +303 -643 4.2.213.2.4.5 View file →
@@ -1,12 +1,11 @@
1 1 <?php
2 2
3 -namespace PXLBSAdminify\Inc\Modules\MenuEditor;
3 +namespace WPAdminify\Inc\Modules\MenuEditor;
4 4
5 -use PXLBSAdminify\Inc\Utils;
6 -use PXLBSAdminify\Inc\Admin\AdminSettings;
7 -use PXLBSAdminify\Inc\Modules\MenuEditor\MenuEditorAssets;
8 -use enshrined\svgSanitize\Sanitizer;
5 +use WPAdminify\Inc\Utils;
6 +use WPAdminify\Inc\Admin\AdminSettings;
7 +use WPAdminify\Inc\Modules\MenuEditor\MenuEditorAssets;
9 8 // no direct access allowed
10 9 if ( !defined( 'ABSPATH' ) ) {
11 10 exit;
12 11 }
@@ -32,86 +31,37 @@
32 31 public $options = [];
33 32
34 33 public $menu_settings = [];
35 34
36 - public static $instance;
37 -
38 - public static function get_instance() {
39 - if ( self::$instance === null ) {
40 - self::$instance = new self();
41 - }
42 - return self::$instance;
43 - }
44 -
45 35 public function __construct() {
36 + $this->url = WP_ADMINIFY_URL . 'Inc/Modules/MenuEditor';
46 37 $this->menu_settings = ( new MenuEditorOptions() )->get();
47 38 $this->options = (array) AdminSettings::get_instance()->get();
48 39 add_filter( 'upload_mimes', [$this, 'custom_icon_mime_types'] );
49 - add_filter( 'wp_handle_upload_prefilter', [$this, 'sanitize_svg_file'] );
50 - add_filter( 'admin_body_class', [$this, 'menu_editor_body_class'] );
51 - // add_filter('parent_file', [$this, 'set_menu'], 800);
52 - // add_filter('parent_file', [$this, 'apply_menu'], 900);
53 - // add_action('modules_menu_editor_render', [$this, 'modules_menu_editor_render']);
54 - if ( apply_filters( 'pxlbsadminify_enable_menu_editor_render', true ) ) {
55 - add_filter( 'parent_file', [$this, 'set_menu'], 800 );
56 - add_filter( 'parent_file', [$this, 'apply_menu'], 900 );
57 - }
58 - add_action( 'wp_ajax_pxlbsadminify_save_menu_settings', [$this, 'save_menu_settings'] );
59 - add_action( 'wp_ajax_pxlbsadminify_reset_menu_settings', [$this, 'reset_menu_settings'] );
60 - add_action( 'wp_ajax_pxlbsadminify_export_menu_settings', [$this, 'export_menu_settings'] );
61 - add_action( 'wp_ajax_pxlbsadminify_import_menu_settings', [$this, 'import_menu_settings'] );
62 - add_action( 'wp_ajax_pxlbsadminify_file_upload', [$this, 'file_upload_callback'] );
63 - add_action( 'wp_ajax_pxlbsadminify_load_custom_icons', [$this, 'load_custom_icons_callback'] );
64 - add_action( 'wp_ajax_pxlbsadminify_search_users', [$this, 'search_users_callback'] );
40 + add_action( 'admin_menu', [$this, 'jltwp_adminify_menu_editor_submenu'], 51 );
41 + add_filter( 'admin_body_class', [$this, 'jltwp_adminify_menu_editor_body_class'] );
42 + add_filter( 'parent_file', [$this, 'set_menu'], 800 );
43 + add_filter( 'parent_file', [$this, 'apply_menu'], 900 );
44 + add_action( 'wp_ajax_adminify_save_menu_settings', [$this, 'adminify_save_menu_settings'] );
45 + add_action( 'wp_ajax_adminify_reset_menu_settings', [$this, 'adminify_reset_menu_settings'] );
46 + add_action( 'wp_ajax_adminify_export_menu_settings', [$this, 'adminify_export_menu_settings'] );
47 + add_action( 'wp_ajax_adminify_import_menu_settings', [$this, 'adminify_import_menu_settings'] );
48 + add_action( 'wp_ajax_adminify_file_upload', [$this, 'adminify_file_upload_callback'] );
49 + add_action( 'wp_ajax_adminify_load_custom_icons', [$this, 'adminify_load_custom_icons_callback'] );
65 50 new MenuEditorAssets();
66 51 }
67 52
68 53 public function custom_icon_mime_types( $mimes ) {
69 - if ( current_user_can( 'administrator' ) ) {
70 - $mimes['svg'] = 'image/svg+xml';
71 - }
54 + $mimes['svg'] = 'image/svg+xml';
72 55 return $mimes;
73 56 }
74 57
75 - public function sanitize_svg_file( $file ) {
76 - // Step 1: Validate File Type
77 - $file_type = wp_check_filetype( $file['name'] );
78 - // Ensure the file is an SVG
79 - if ( $file_type['ext'] === 'svg' ) {
80 - // Read the contents of the SVG file
81 - $file_contents = file_get_contents( $file['tmp_name'] );
82 - // Validate if it's an actual SVG by checking if it contains the <svg> tag
83 - if ( strpos( $file_contents, '<svg' ) === false ) {
84 - $file['error'] = 'Invalid SVG file';
85 - return $file;
86 - // Stop further processing if it's not a valid SVG
87 - }
88 - // Step 2: Sanitize the SVG File
89 - $sanitizer = new Sanitizer();
90 - $clean_svg = $sanitizer->sanitize( $file_contents );
91 - if ( $clean_svg ) {
92 - // Save the sanitized SVG back to the file
93 - file_put_contents( $file['tmp_name'], $clean_svg );
94 - } else {
95 - $file['error'] = 'Failed to sanitize the SVG file';
96 - }
97 - }
98 - return $file;
99 - }
100 -
101 58 public function filter_attachment( $value ) {
102 59 // return $value->post_title == 'adminify-custom-icon';
103 60 return strpos( $value->guid, 'adminify-custom-icon' ) !== false;
104 61 }
105 62
106 - public function load_custom_icons_callback() {
107 - // Security check - verify nonce and capability
108 - check_ajax_referer( 'pxlbsadminify-menu-editor-security-nonce', 'security' );
109 - if ( !current_user_can( 'manage_options' ) ) {
110 - wp_send_json_error( array(
111 - 'message' => __( 'You do not have permission to perform this action.', 'adminify' ),
112 - ) );
113 - }
63 + public function adminify_load_custom_icons_callback() {
114 64 $result['images'] = null;
115 65 $query = get_posts( [
116 66 'post_type' => 'attachment',
117 67 'numberposts' => -1,
@@ -123,28 +73,17 @@
123 73 echo wp_json_encode( $result );
124 74 die;
125 75 }
126 76
127 - public function file_upload_callback() {
77 + public function adminify_file_upload_callback() {
128 78 $result['status'] = false;
129 - check_ajax_referer( 'pxlbsadminify-menu-editor-security-nonce', 'security' );
130 - if ( !current_user_can( 'manage_options' ) ) {
131 - wp_send_json_error( array(
132 - 'message' => __( 'You do not have permission to perform this action.', 'adminify' ),
133 - ) );
134 - }
79 + check_ajax_referer( 'adminify-menu-editor-security-nonce', 'security' );
135 80 $upload_dir = wp_upload_dir();
136 81 $targeted_dir = $upload_dir['basedir'] . '/adminify-custom-icons';
137 82 if ( !is_dir( $targeted_dir ) ) {
138 83 wp_mkdir_p( $targeted_dir );
139 84 }
140 - add_filter( 'upload_dir', [$this, 'icon_custom_upload_dir'] );
141 - if ( !isset( $_FILES['my_file_upload'] ) ) {
142 - wp_send_json_error( array(
143 - 'message' => __( 'No file was uploaded.', 'adminify' ),
144 - ) );
145 - }
146 - // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- $_FILES is sanitized by the WP upload handler.
85 + add_filter( 'upload_dir', [$this, 'adminify_icon_custom_upload_dir'] );
147 86 $files = wp_kses_post_deep( wp_unslash( $_FILES['my_file_upload'] ) );
148 87 foreach ( $files['name'] as $key => $value ) {
149 88 if ( $files['name'][$key] ) {
150 89 $file = [
@@ -169,14 +108,14 @@
169 108 $result['images'][$attachment_id] = wp_get_attachment_url( $attachment_id );
170 109 }
171 110 }
172 111 }
173 - remove_filter( 'upload_dir', [$this, 'icon_custom_upload_dir'] );
112 + remove_filter( 'upload_dir', [$this, 'adminify_icon_custom_upload_dir'] );
174 113 echo wp_json_encode( $result );
175 114 wp_die();
176 115 }
177 116
178 - public function icon_custom_upload_dir( $dir_data ) {
117 + public function adminify_icon_custom_upload_dir( $dir_data ) {
179 118 // $dir_data already you might want to use
180 119 $custom_dir = 'adminify-custom-icons';
181 120 return [
182 121 'path' => $dir_data['basedir'] . '/' . $custom_dir,
@@ -187,75 +126,10 @@
187 126 'error' => $dir_data['error'],
188 127 ];
189 128 }
190 129
191 - /**
192 - * AJAX callback to search users for Select2
193 - * Uses 'fields' parameter for optimized database query performance
194 - */
195 - public function search_users_callback() {
196 - check_ajax_referer( 'pxlbsadminify-menu-editor-security-nonce', 'security' );
197 - if ( !current_user_can( 'manage_options' ) ) {
198 - wp_send_json_error( array(
199 - 'message' => __( 'You do not have permission to perform this action.', 'adminify' ),
200 - ) );
201 - }
202 - $search = ( isset( $_GET['search'] ) ? sanitize_text_field( wp_unslash( $_GET['search'] ) ) : '' );
203 - // If no search term or less than 3 chars, return first 3 users
204 - if ( strlen( $search ) < 3 ) {
205 - $args = array(
206 - 'number' => 3,
207 - 'orderby' => 'ID',
208 - 'order' => 'DESC',
209 - 'fields' => array('ID', 'user_login', 'display_name'),
210 - );
211 - $users = get_users( $args );
212 - $results = array();
213 - foreach ( $users as $user ) {
214 - $results[] = array(
215 - 'id' => $user->user_login,
216 - 'text' => $user->user_login . ' (' . $user->display_name . ')',
217 - );
218 - }
219 - // Get total user count efficiently
220 - $user_count = count_users();
221 - $total_users = $user_count['total_users'];
222 - wp_send_json( array(
223 - 'results' => $results,
224 - 'pagination' => array(
225 - 'more' => $total_users > 3,
226 - ),
227 - 'total_users' => $total_users,
228 - ) );
229 - return;
230 - }
231 - // Search users when 3+ characters typed
232 - $args = array(
233 - 'search' => '*' . $search . '*',
234 - 'search_columns' => array('user_login', 'user_email', 'display_name'),
235 - 'number' => 20,
236 - 'orderby' => 'display_name',
237 - 'order' => 'ASC',
238 - 'fields' => array('ID', 'user_login', 'display_name'),
239 - );
240 - $users = get_users( $args );
241 - $results = array();
242 - foreach ( $users as $user ) {
243 - $results[] = array(
244 - 'id' => $user->user_login,
245 - 'text' => $user->user_login . ' (' . $user->display_name . ')',
246 - );
247 - }
248 - wp_send_json( array(
249 - 'results' => $results,
250 - 'pagination' => array(
251 - 'more' => false,
252 - ),
253 - ) );
254 - }
255 -
256 130 // Menu Editor Body Class
257 - public function menu_editor_body_class( $classes ) {
131 + public function jltwp_adminify_menu_editor_body_class( $classes ) {
258 132 $classes .= ' adminify_menu_editor ';
259 133 return $classes;
260 134 }
261 135
@@ -270,13 +144,13 @@
270 144 foreach ( $values as $index => $in ) {
271 145 if ( is_array( $in ) ) {
272 146 $values[$index] = $this->clean_ajax_input( $in );
273 147 } else {
274 - $values[$index] = wp_strip_all_tags( $in );
148 + $values[$index] = strip_tags( $in );
275 149 }
276 150 }
277 151 } else {
278 - $values = wp_strip_all_tags( $values );
152 + $values = strip_tags( $values );
279 153 }
280 154 return $values;
281 155 }
282 156
@@ -289,25 +163,18 @@
289 163 public function ajax_error_message( $message ) {
290 164 $returndata = [];
291 165 $returndata['error'] = true;
292 166 $returndata['error_message'] = $message;
293 - return wp_json_encode( $returndata );
167 + return json_encode( $returndata );
294 168 }
295 169
296 - public function save_menu_settings() {
297 - if ( defined( 'DOING_AJAX' ) && DOING_AJAX && check_ajax_referer( 'pxlbsadminify-menu-editor-security-nonce', 'security' ) > 0 ) {
298 - if ( !current_user_can( 'manage_options' ) ) {
299 - wp_send_json_error( array(
300 - 'message' => __( 'You do not have permission to perform this action.', 'adminify' ),
301 - ) );
302 - }
303 - $options = ( isset( $_POST['options'] ) ? wp_kses_post_deep( wp_unslash( $_POST['options'] ) ) : '' );
304 - // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- sanitized via wp_kses_post_deep() and clean_ajax_input() below.
170 + public function adminify_save_menu_settings() {
171 + if ( defined( 'DOING_AJAX' ) && DOING_AJAX && check_ajax_referer( 'adminify-menu-editor-security-nonce', 'security' ) > 0 ) {
172 + $options = wp_kses_post_deep( wp_unslash( $_POST['options'] ) );
305 173 $options = $this->clean_ajax_input( $options );
306 174 if ( $options == '' || !is_array( $options ) ) {
307 175 $message = __( 'No options supplied to save', 'adminify' );
308 - // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- kses_custom() is a wp_kses() wrapper; output already escaped.
309 - echo Utils::kses_custom( $this->ajax_error_message( $message ) );
176 + echo Utils::wp_kses_custom( $this->ajax_error_message( $message ) );
310 177 die;
311 178 }
312 179 if ( is_array( $options ) ) {
313 180 update_option( $this->prefix, $options );
@@ -313,14 +180,13 @@
313 180 update_option( $this->prefix, $options );
314 181 $returndata = [];
315 182 $returndata['success'] = true;
316 183 $returndata['message'] = __( 'Settings saved', 'adminify' );
317 - echo wp_json_encode( $returndata );
184 + echo json_encode( $returndata );
318 185 die;
319 186 } else {
320 187 $message = __( 'Something went wrong', 'adminify' );
321 - // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- kses_custom() is a wp_kses() wrapper; output already escaped.
322 - echo Utils::kses_custom( $this->ajax_error_message( $message ) );
188 + echo Utils::wp_kses_custom( $this->ajax_error_message( $message ) );
323 189 die;
324 190 }
325 191 }
326 192 die;
@@ -330,15 +196,10 @@
330 196 * Menu Editor Settings Reset
331 197 *
332 198 * @return void
333 199 */
334 - public function reset_menu_settings() {
335 - if ( defined( 'DOING_AJAX' ) && DOING_AJAX && check_ajax_referer( 'pxlbsadminify-menu-editor-security-nonce', 'security' ) > 0 ) {
336 - if ( !current_user_can( 'manage_options' ) ) {
337 - wp_send_json_error( array(
338 - 'message' => __( 'You do not have permission to perform this action.', 'adminify' ),
339 - ) );
340 - }
200 + public function adminify_reset_menu_settings() {
201 + if ( defined( 'DOING_AJAX' ) && DOING_AJAX && check_ajax_referer( 'adminify-menu-editor-security-nonce', 'security' ) > 0 ) {
341 202 update_option( $this->prefix, [] );
342 203 $menu_editor_options = get_option( $this->prefix );
343 204 if ( !$menu_editor_options ) {
344 205 $returndata = [];
@@ -343,14 +204,13 @@
343 204 if ( !$menu_editor_options ) {
344 205 $returndata = [];
345 206 $returndata['success'] = true;
346 207 $returndata['message'] = __( 'Settings reset', 'adminify' );
347 - echo wp_json_encode( $returndata );
208 + echo json_encode( $returndata );
348 209 die;
349 210 } else {
350 211 $message = __( 'Something went wrong', 'adminify' );
351 - // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- kses_custom() is a wp_kses() wrapper; output already escaped.
352 - echo Utils::kses_custom( $this->ajax_error_message( $message ) );
212 + echo Utils::wp_kses_custom( $this->ajax_error_message( $message ) );
353 213 die;
354 214 }
355 215 }
356 216 die;
@@ -360,17 +220,12 @@
360 220 * Export Menu Editor Settings
361 221 *
362 222 * @return void
363 223 */
364 - public function export_menu_settings() {
365 - if ( defined( 'DOING_AJAX' ) && DOING_AJAX && check_ajax_referer( 'pxlbsadminify-menu-editor-security-nonce', 'security' ) > 0 ) {
366 - if ( !current_user_can( 'manage_options' ) ) {
367 - wp_send_json_error( array(
368 - 'message' => __( 'You do not have permission to perform this action.', 'adminify' ),
369 - ) );
370 - }
224 + public function adminify_export_menu_settings() {
225 + if ( defined( 'DOING_AJAX' ) && DOING_AJAX && check_ajax_referer( 'adminify-menu-editor-security-nonce', 'security' ) > 0 ) {
371 226 $menu_editor_options = get_option( $this->prefix );
372 - echo wp_json_encode( $menu_editor_options );
227 + echo json_encode( $menu_editor_options );
373 228 }
374 229 die;
375 230 }
376 231
@@ -378,21 +233,14 @@
378 233 * Import Menu Editor Settings
379 234 *
380 235 * @since 1.0.0
381 236 */
382 - public function import_menu_settings() {
383 - if ( defined( 'DOING_AJAX' ) && DOING_AJAX && check_ajax_referer( 'pxlbsadminify-menu-editor-security-nonce', 'security' ) > 0 ) {
384 - if ( !current_user_can( 'manage_options' ) ) {
385 - wp_send_json_error( array(
386 - 'message' => __( 'You do not have permission to perform this action.', 'adminify' ),
387 - ) );
388 - }
389 - $new_options = ( isset( $_POST['settings'] ) ? wp_kses_post_deep( wp_unslash( $_POST['settings'] ) ) : '' );
390 - // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- sanitized via wp_kses_post_deep().
237 + public function adminify_import_menu_settings() {
238 + if ( defined( 'DOING_AJAX' ) && DOING_AJAX && check_ajax_referer( 'adminify-menu-editor-security-nonce', 'security' ) > 0 ) {
239 + $new_options = wp_kses_post_deep( $_POST['settings'] );
391 240 if ( $new_options == '' || !is_array( $new_options ) ) {
392 241 $message = __( 'No options supplied to save', 'adminify' );
393 - // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- kses_custom() is a wp_kses() wrapper; output already escaped.
394 - echo Utils::kses_custom( $this->ajax_error_message( $message ) );
242 + echo Utils::wp_kses_custom( $this->ajax_error_message( $message ) );
395 243 die;
396 244 }
397 245 if ( is_array( $new_options ) ) {
398 246 update_option( $this->prefix, $new_options );
@@ -398,14 +246,13 @@
398 246 update_option( $this->prefix, $new_options );
399 247 $returndata = [];
400 248 $returndata['success'] = true;
401 249 $returndata['message'] = __( 'Menu Imported', 'adminify' );
402 - echo wp_json_encode( $returndata );
250 + echo json_encode( $returndata );
403 251 die;
404 252 } else {
405 253 $message = __( 'Something went wrong', 'adminify' );
406 - // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- kses_custom() is a wp_kses() wrapper; output already escaped.
407 - echo Utils::kses_custom( $this->ajax_error_message( $message ) );
254 + echo Utils::wp_kses_custom( $this->ajax_error_message( $message ) );
408 255 die;
409 256 }
410 257 }
411 258 die;
@@ -411,37 +258,8 @@
411 258 die;
412 259 }
413 260
414 261 /**
415 - * Find menu settings for a given slug.
416 - * Some plugins (e.g. Yoast SEO) register different top-level menu slugs
417 - * depending on user capabilities. The admin sees slug 'wpseo_dashboard'
418 - * but the editor sees 'wpseo_tools'. This method handles that mismatch
419 - * by falling back to checking if the slug appears as a submenu key.
420 - *
421 - * @param string $slug The menu slug to look up.
422 - * @return array|null The matching settings array, or null if not found.
423 - */
424 - public function find_menu_settings_by_slug( $slug ) {
425 - // Direct match
426 - if ( isset( $this->menu_settings[$slug] ) ) {
427 - return $this->menu_settings[$slug];
428 - }
429 - // Fallback: check if this slug is a submenu of any saved parent menu
430 - if ( is_array( $this->menu_settings ) ) {
431 - foreach ( $this->menu_settings as $parent_slug => $parent_settings ) {
432 - if ( !is_array( $parent_settings ) || !isset( $parent_settings['submenu'] ) || !is_array( $parent_settings['submenu'] ) ) {
433 - continue;
434 - }
435 - if ( isset( $parent_settings['submenu'][$slug] ) ) {
436 - return $parent_settings;
437 - }
438 - }
439 - }
440 - return null;
441 - }
442 -
443 - /**
444 262 * Get menu items
445 263 *
446 264 * @param [type] $parent_file
447 265 *
@@ -460,21 +278,12 @@
460 278 public function sort_menu_settings( $thismenu ) {
461 279 $menu_settings = $this->menu_settings;
462 280 $tempmenu = [];
463 281 foreach ( $thismenu as $key => $current_menu_item ) {
464 - if ( $current_menu_item[4] === "wp-menu-separator" ) {
465 - unset($thismenu[$key]);
466 - continue;
467 - }
468 - if ( !current_user_can( 'administrator' ) && $current_menu_item[2] === 'vc-welcome' ) {
469 - unset($thismenu[$key]);
470 - continue;
471 - }
472 282 $next_menu_item = next( $thismenu );
473 283 $optiongroup = [];
474 284 $order = $key;
475 285 $separator = 0;
476 - $external_link = 0;
477 286 $icon = null;
478 287 $hidden_for = [];
479 288 if ( !empty( $next_menu_item ) && strpos( $next_menu_item[2], 'separator' ) !== false ) {
480 289 $separator = 1;
@@ -479,18 +288,10 @@
479 288 if ( !empty( $next_menu_item ) && strpos( $next_menu_item[2], 'separator' ) !== false ) {
480 289 $separator = 1;
481 290 }
482 291 if ( is_array( $menu_settings ) ) {
483 - // Direct slug match first, then fallback for dynamic-slug plugins (e.g. Yoast SEO)
484 292 if ( isset( $menu_settings[$current_menu_item[2]] ) ) {
485 293 $optiongroup = $menu_settings[$current_menu_item[2]];
486 - } else {
487 - $fallback = $this->find_menu_settings_by_slug( $current_menu_item[2] );
488 - if ( $fallback !== null ) {
489 - $optiongroup = $fallback;
490 - }
491 - }
492 - if ( !empty( $optiongroup ) ) {
493 294 if ( isset( $optiongroup['order'] ) ) {
494 295 $order = $optiongroup['order'];
495 296 }
496 297 if ( isset( $optiongroup['separator'] ) ) {
@@ -495,11 +296,8 @@
495 296 }
496 297 if ( isset( $optiongroup['separator'] ) ) {
497 298 $separator = $optiongroup['separator'];
498 299 }
499 - if ( isset( $optiongroup['external_link'] ) ) {
500 - $external_link = $optiongroup['external_link'];
501 - }
502 300 if ( !empty( $optiongroup['icon'] ) ) {
503 301 $icon = $optiongroup['icon'];
504 302 }
505 303 if ( !empty( $optiongroup['hidden_for'] ) ) {
@@ -507,29 +305,27 @@
507 305 }
508 306 }
509 307 }
510 308 $current_menu_item['order'] = $order;
511 - $current_menu_item['hidden_for'] = $hidden_for;
512 309 $current_menu_item['separator'] = $separator;
513 - $current_menu_item['external_link'] = $external_link;
514 - // if (empty($this->options['admin_ui'])) {
515 - if ( $icon !== null ) {
516 - if ( strpos( $icon, 'dashicons ' ) !== false ) {
517 - $menu_icon = str_replace( 'dashicons ', '', $icon );
518 - $current_menu_item[6] = $menu_icon;
519 - } else {
520 - if ( strpos( $icon, ',' ) !== false ) {
521 - $menu_icon = explode( ',', $icon )[1];
310 + if ( empty( $this->options['admin_ui'] ) ) {
311 + if ( $icon !== null ) {
312 + if ( strpos( $icon, 'dashicons ' ) !== false ) {
313 + $menu_icon = str_replace( 'dashicons ', '', $icon );
314 + $current_menu_item[6] = $menu_icon;
522 315 } else {
523 - $menu_icon = 'dashicons-adminify- ' . $icon;
316 + if ( strpos( $icon, ',' ) !== false ) {
317 + $menu_icon = explode( ',', $icon )[1];
318 + } else {
319 + $menu_icon = 'dashicons-adminify- ' . $icon;
320 + }
321 + $current_menu_item[6] = $menu_icon;
524 322 }
525 - $current_menu_item[6] = $menu_icon;
526 323 }
324 + if ( $separator == 1 ) {
325 + $current_menu_item[4] = $current_menu_item[4] . ' adminify-menu-separator';
326 + }
527 327 }
528 - if ( $separator == 1 ) {
529 - $current_menu_item[4] = $current_menu_item[4] . ' adminify-menu-separator';
530 - }
531 - // }
532 328 array_push( $tempmenu, $current_menu_item );
533 329 if ( isset( $menu_settings[$current_menu_item[2]] ) ) {
534 330 unset($menu_settings[$current_menu_item[2]]);
535 331 }
@@ -535,22 +331,8 @@
535 331 }
536 332 }
537 333 if ( is_array( $menu_settings ) && !array_key_exists( 0, $menu_settings ) ) {
538 334 foreach ( $menu_settings as $key => $menu_s ) {
539 - // Skip if $menu_s is not an array
540 - if ( !is_array( $menu_s ) ) {
541 - continue;
542 - }
543 - // Ensure required keys exist with defaults
544 - $menu_s = wp_parse_args( $menu_s, [
545 - 'name' => '',
546 - 'link' => '',
547 - 'icon' => '',
548 - 'order' => 0,
549 - 'separator' => 0,
550 - 'external_link' => 0,
551 - 'hidden_for' => [],
552 - ] );
553 335 $new_array = [
554 336 $menu_s['name'],
555 337 'read',
556 338 ( !empty( $menu_s['link'] ) ? $menu_s['link'] : '' ),
@@ -559,33 +341,29 @@
559 341 $key,
560 342 ( !empty( $menu_s['icon'] ) ? $menu_s['icon'] : '' ),
561 343 'order' => $menu_s['order'],
562 344 'separator' => ( !empty( $menu_s['separator'] ) ? $menu_s['separator'] : 0 ),
563 - 'external_link' => ( !empty( $menu_s['external_link'] ) ? $menu_s['external_link'] : 0 ),
564 345 'hidden_for' => ( !empty( $menu_s['hidden_for'] ) ? $menu_s['hidden_for'] : [] )
565 346 ];
566 - // if (empty($this->options['admin_ui'])) {
567 - if ( strpos( $menu_s['icon'], 'dashicons ' ) !== false ) {
568 - $menu_icon = str_replace( 'dashicons ', '', $menu_s['icon'] );
569 - } else {
570 - if ( empty( $menu_s['icon'] ) || strpos( $menu_s['icon'], ',' ) !== false ) {
571 - if ( empty( $menu_s['icon'] ) ) {
572 - $menu_icon = PXLBSADMINIFY_ASSETS_IMAGE . 'logos/menu-icon.svg';
347 + if ( empty( $this->options['admin_ui'] ) ) {
348 + if ( strpos( $menu_s['icon'], 'dashicons ' ) !== false ) {
349 + $menu_icon = str_replace( 'dashicons ', '', $menu_s['icon'] );
350 + } else {
351 + if ( empty( $menu_s['icon'] ) || strpos( $menu_s['icon'], ',' ) !== false ) {
352 + if ( empty( $menu_s['icon'] ) ) {
353 + $menu_icon = WP_ADMINIFY_ASSETS_IMAGE . 'logos/menu-icon.svg';
354 + } else {
355 + $menu_icon = explode( ',', $menu_s['icon'] )[1];
356 + }
573 357 } else {
574 - $menu_icon = explode( ',', $menu_s['icon'] )[1];
358 + $menu_icon = 'dashicons-adminify- ' . $menu_s['icon'];
575 359 }
576 - } else {
577 - $menu_icon = 'dashicons-adminify- ' . $menu_s['icon'];
578 360 }
361 + if ( $menu_s['separator'] == 1 ) {
362 + $new_array[4] = $new_array[4] . ' adminify-menu-separator';
363 + }
364 + $new_array[6] = $menu_icon;
579 365 }
580 - if ( !empty( $menu_s['separator'] ) && $menu_s['separator'] == 1 ) {
581 - $new_array[4] = $new_array[4] . ' adminify-menu-separator';
582 - }
583 - // if (!empty($menu_s['external_link']) && $menu_s['external_link'] == 1) {
584 - // $new_array[4] = $new_array[4] . ' adminify-menu-external_link';
585 - // }
586 - $new_array[6] = $menu_icon;
587 - // }
588 366 array_push( $tempmenu, $new_array );
589 367 }
590 368 }
591 369 return $this->sort_array( $tempmenu );
@@ -697,9 +475,9 @@
697 475 $tempsub = [];
698 476 $submenu = $this->sort_sub_menu_settings( $menu, $submenu );
699 477 if ( $this->menu && is_array( $this->menu ) ) {
700 478 foreach ( $this->menu as $key => $menu_item ) {
701 - if ( empty( $menu_item[2] ) ) {
479 + if ( empty( $menu_item[0] ) ) {
702 480 continue;
703 481 }
704 482 if ( strpos( $menu_item[2], 'separator' ) !== false && !$menu_item[0] ) {
705 483 // Build Separator
@@ -711,21 +489,8 @@
711 489 // Build Top Level
712 490 $newitem = $this->apply_top_level_settings( $menu_item, $key );
713 491 if ( $newitem ) {
714 492 array_push( $tempmenu, $newitem );
715 - // Menu Editor Custom Separator
716 - if ( !empty( $newitem['separator'] ) ) {
717 - $separator_order = $this->menu[$key]['order'];
718 - $empty_separator = array(
719 - 0 => '',
720 - 1 => 'read',
721 - 2 => 'separator_' . wp_rand( 200, 1000 ) * 1000,
722 - 3 => '',
723 - 4 => 'wp-menu-separator',
724 - 'order' => $separator_order + 0.5,
725 - );
726 - array_push( $tempmenu, $empty_separator );
727 - }
728 493 $parent_key = $newitem[2];
729 494 if ( strpos( $newitem[5], 'adminify-custom-menu-' ) !== false ) {
730 495 $parent_key = $newitem[5];
731 496 }
@@ -760,15 +525,10 @@
760 525 }
761 526 $submenu_settings = $this->menu_settings[$parentname]['submenu'];
762 527 $tempsub = [];
763 528 foreach ( $subitems as $current_menu_item ) {
764 - $sub_level = apply_filters( 'pxlbsadminify/menu_editor', [
765 - 'sub_level' => false,
766 - ] );
767 - if ( !empty( $sub_level['sub_level'] ) ) {
768 - if ( empty( $current_menu_item[0] ) || $current_menu_item[2] === 'wp-adminify-settings-pricing' ) {
769 - continue;
770 - }
529 + if ( empty( $current_menu_item[0] ) || $current_menu_item[2] === 'wp-adminify-settings-pricing' && jltwp_adminify()->can_use_premium_code__premium_only() ) {
530 + continue;
771 531 }
772 532 $name = '';
773 533 $link = '';
774 534 $disabled_for = [];
@@ -788,15 +548,12 @@
788 548 $current_menu_item[2] = $link;
789 549 $current_menu_item['link'] = $link;
790 550 }
791 551 }
792 - if ( isset( $optiongroup['external_link'] ) ) {
793 - $external_link = $optiongroup['external_link'];
794 - }
795 552 if ( isset( $optiongroup['hidden_for'] ) ) {
796 553 $disabled_for = $optiongroup['hidden_for'];
797 554 if ( $this->is_hidden( $disabled_for ) ) {
798 - $current_menu_item['hidden_for'] = true;
555 + $current_menu_item['hidden'] = true;
799 556 continue;
800 557 }
801 558 }
802 559 }
@@ -804,13 +561,10 @@
804 561 if ( strpos( $custom_menu, 'adminify-custom-submenu-' ) !== false ) {
805 562 if ( isset( $submenu_settings[$current_menu_item['key']]['hidden_for'] ) ) {
806 563 $disabled_for = $submenu_settings[$current_menu_item['key']]['hidden_for'];
807 564 }
808 - if ( isset( $submenu_settings[$current_menu_item['key']]['external_link'] ) ) {
809 - $external_link = $submenu_settings[$current_menu_item['key']]['external_link'];
810 - }
811 565 if ( $this->is_hidden( $disabled_for ) ) {
812 - $current_menu_item['hidden_for'] = true;
566 + $current_menu_item['hidden'] = true;
813 567 continue;
814 568 }
815 569 }
816 570 array_push( $tempsub, $current_menu_item );
@@ -834,18 +588,10 @@
834 588 $disabled_for = [];
835 589 $optiongroup = [];
836 590 $order = $key;
837 591 if ( is_array( $this->menu_settings ) ) {
838 - // Direct slug match first, then fallback for dynamic-slug plugins (e.g. Yoast SEO)
839 592 if ( isset( $this->menu_settings[$current_menu_item[2]] ) ) {
840 593 $optiongroup = $this->menu_settings[$current_menu_item[2]];
841 - } else {
842 - $fallback = $this->find_menu_settings_by_slug( $current_menu_item[2] );
843 - if ( $fallback !== null ) {
844 - $optiongroup = $fallback;
845 - }
846 - }
847 - if ( !empty( $optiongroup ) ) {
848 594 if ( isset( $optiongroup['name'] ) ) {
849 595 $name = $optiongroup['name'];
850 596 if ( $name != '' ) {
851 597 $current_menu_item[0] = $name;
@@ -857,11 +603,8 @@
857 603 $current_menu_item[2] = $link;
858 604 $current_menu_item['link'] = $link;
859 605 }
860 606 }
861 - if ( isset( $optiongroup['external_link'] ) ) {
862 - $external_link = ( $optiongroup['external_link'] ? $optiongroup['external_link'] : '' );
863 - }
864 607 if ( isset( $optiongroup['icon'] ) ) {
865 608 $icon = $optiongroup['icon'];
866 609 if ( $icon != '' ) {
867 610 $current_menu_item['icon'] = $icon;
@@ -872,39 +615,29 @@
872 615 }
873 616 if ( isset( $optiongroup['hidden_for'] ) ) {
874 617 $disabled_for = $optiongroup['hidden_for'];
875 618 if ( $this->is_hidden( $disabled_for ) ) {
876 - $current_menu_item['hidden_for'] = true;
877 - } else {
878 - $current_menu_item['hidden_for'] = false;
619 + $current_menu_item['hidden'] = true;
879 620 }
880 621 }
881 622 }
882 623 $custom_menu = ( isset( $current_menu_item[5] ) ? $current_menu_item[5] : '' );
883 624 if ( strpos( $custom_menu, 'adminify-custom-menu-' ) !== false ) {
884 - if ( isset( $this->menu_settings[$current_menu_item[5]]['hidden_for'] ) && !empty( $this->menu_settings[$current_menu_item[5]]['hidden_for'] ) ) {
625 + if ( isset( $this->menu_settings[$current_menu_item[5]]['hidden_for'] ) ) {
885 626 $disabled_for = $this->menu_settings[$current_menu_item[5]]['hidden_for'];
886 - if ( $this->is_hidden( $disabled_for ) ) {
887 - $current_menu_item['hidden_for'] = true;
888 - }
889 627 }
890 - if ( isset( $this->menu_settings[$current_menu_item[5]]['external_link'] ) ) {
891 - $external_link = $this->menu_settings[$current_menu_item[5]]['external_link'];
628 + if ( $this->is_hidden( $disabled_for ) ) {
629 + $current_menu_item['hidden'] = true;
892 630 }
893 631 }
894 632 }
895 633 $current_menu_item['order'] = $order;
896 - // Check hidden_for: boolean true means hide, array means check via is_hidden
897 - if ( isset( $current_menu_item['hidden_for'] ) ) {
898 - if ( $current_menu_item['hidden_for'] === true ) {
634 + if ( isset( $current_menu_item['hidden'] ) ) {
635 + if ( $current_menu_item['hidden'] == true ) {
899 636 return false;
900 - } elseif ( is_array( $current_menu_item['hidden_for'] ) && !empty( $current_menu_item['hidden_for'] ) ) {
901 - // Fallback: hidden_for is still an array (settings lookup may have missed it)
902 - if ( $this->is_hidden( $current_menu_item['hidden_for'] ) ) {
903 - return false;
904 - }
637 + } else {
638 + return $current_menu_item;
905 639 }
906 - return $current_menu_item;
907 640 } else {
908 641 return $current_menu_item;
909 642 }
910 643 }
@@ -920,64 +653,36 @@
920 653 if ( !is_array( $disabled_for ) ) {
921 654 return false;
922 655 }
923 656 $current_user = wp_get_current_user();
657 + $current_name = $current_user->display_name;
924 658 $current_roles = $current_user->roles;
925 659 $all_roles = wp_roles()->get_names();
926 - foreach ( $current_roles as $current_role ) {
927 - if ( isset( $all_roles[$current_role] ) && in_array( $all_roles[$current_role], $disabled_for ) ) {
928 - return true;
929 - }
930 - }
931 - // Normalize disabled_for array
932 - $disabled_for_arr = [];
933 - foreach ( $disabled_for as $v ) {
934 - $disabled_for_arr[] = Utils::sluggify_with_underscores( $v );
935 - }
936 - $slugify_user_login = Utils::sluggify_with_underscores( $current_user->user_login );
937 - // Check Username
938 - if ( in_array( $current_user->user_login, $disabled_for_arr ) || in_array( $slugify_user_login, $disabled_for_arr ) ) {
660 + if ( in_array( $current_name, $disabled_for ) ) {
939 661 return true;
940 662 }
941 - // Check User Roles and Capabilities
942 - foreach ( $current_roles as $role ) {
943 - $role_obj = get_role( $role );
944 - if ( !$role_obj ) {
945 - continue;
946 - }
947 - // Check if role slug is in disabled array
948 - if ( in_array( $role, $disabled_for_arr ) ) {
663 + // MULTISITE SUPER ADMIN
664 + if ( is_super_admin() && is_multisite() ) {
665 + if ( in_array( 'Super Admin', $disabled_for ) ) {
949 666 return true;
667 + } else {
668 + return false;
950 669 }
951 - // Check if role display name is in disabled array
952 - if ( isset( $disabled_for_arr[$role] ) && (in_array( $all_roles[$role], $disabled_for ) || in_array( strtolower( $all_roles[$role] ), array_map( 'strtolower', $disabled_for ) )) ) {
953 - return true;
954 - }
955 - // Check for custom roles
956 - foreach ( $disabled_for as $disabled_item ) {
957 - // Convert role names to match WordPress format
958 - $disabled_role = str_replace( ' ', '_', strtolower( $disabled_item ) );
959 - if ( $role === $disabled_role ) {
960 - return true;
961 - }
962 - }
963 670 }
964 - // Handle Super Admin specially
965 - if ( is_super_admin( $current_user->ID ) ) {
966 - if ( in_array( 'Super Admin', $disabled_for_arr ) || in_array( 'super_admin', $disabled_for_arr ) || in_array( 'administrator', $disabled_for_arr ) ) {
671 + // NORMAL SUPER ADMIN
672 + if ( $current_user->ID === 1 ) {
673 + if ( in_array( 'Super Admin', $disabled_for ) ) {
967 674 return true;
675 + } else {
676 + return false;
968 677 }
969 - // Super admin sees everything by default unless explicitly disabled
970 - return false;
971 678 }
972 - // Special check for user ID 1 (default admin)
973 - if ( $current_user->ID === 1 ) {
974 - if ( in_array( 'Super Admin', $disabled_for_arr ) || in_array( 'super_admin', $disabled_for_arr ) || in_array( 'administrator', $disabled_for_arr ) ) {
679 + foreach ( $current_roles as $role ) {
680 + $role_name = $all_roles[$role];
681 + if ( in_array( $role_name, $disabled_for ) ) {
975 682 return true;
976 683 }
977 - return false;
978 684 }
979 - return false;
980 685 }
981 686
982 687 /**
983 688 * Applies separator menu item settings
@@ -1003,16 +708,16 @@
1003 708 }
1004 709 if ( isset( $optiongroup['hidden_for'] ) ) {
1005 710 $disabled_for = $optiongroup['hidden_for'];
1006 711 if ( $this->is_hidden( $disabled_for ) ) {
1007 - $current_menu_item['hidden_for'] = true;
712 + $current_menu_item['hidden'] = true;
1008 713 }
1009 714 }
1010 715 }
1011 716 }
1012 717 $current_menu_item['order'] = $order;
1013 - if ( isset( $current_menu_item['hidden_for'] ) ) {
1014 - if ( $current_menu_item['hidden_for'] == true ) {
718 + if ( isset( $current_menu_item['hidden'] ) ) {
719 + if ( $current_menu_item['hidden'] == true ) {
1015 720 return false;
1016 721 } else {
1017 722 return $current_menu_item;
1018 723 }
@@ -1020,8 +725,23 @@
1020 725 return $current_menu_item;
1021 726 }
1022 727 }
1023 728
729 + /**
730 + * Menu Editor Menu
731 + */
732 + public function jltwp_adminify_menu_editor_submenu() {
733 + add_submenu_page(
734 + 'wp-adminify-settings',
735 + esc_html__( 'Menu Editor by WP Adminify', 'adminify' ),
736 + esc_html__( 'Menu Editor', 'adminify' ),
737 + apply_filters( 'jltwp_adminify_capability', 'manage_options' ),
738 + 'adminify-menu-editor',
739 + // Page slug, will be displayed in URL
740 + [$this, 'jltwp_adminify_menu_editor_contents']
741 + );
742 + }
743 +
1024 744 public function get_saved_sub_menu() {
1025 745 $menu_settings = $this->menu_settings;
1026 746 $menu = $this->menu;
1027 747 $submenu = $this->submenu;
@@ -1062,8 +782,10 @@
1062 782 * Render Menu Editor
1063 783 */
1064 784 public function render_menu_editor() {
1065 785 global $wp_roles;
786 + $users = get_users();
787 + $this->users = $users;
1066 788 $this->roles = $wp_roles->roles;
1067 789 if ( $this->menu && is_array( $this->menu ) ) {
1068 790 foreach ( $this->menu as $menu_item ) {
1069 791 $next_menu_item = next( $this->menu );
@@ -1080,8 +802,25 @@
1080 802 );
1081 803 }
1082 804 }
1083 805 $this->render_add_new_menu_item();
806 + ?>
807 + <script>
808 + jQuery(function($) {
809 +
810 + $('.adminify-menu-settings').tokenize2({
811 + placeholder: '<?php
812 + esc_html_e( 'Select roles or users', 'adminify' );
813 + ?>'
814 + });
815 +
816 + $('.adminify-menu-settings').on('tokenize:select', function() {
817 + $(this).tokenize2().trigger('tokenize:search', [$(this).tokenize2().input.val()]);
818 + });
819 +
820 + });
821 + </script>
822 + <?php
1084 823 }
1085 824 }
1086 825
1087 826 public function get_icon( $value, $default ) {
@@ -1096,17 +835,27 @@
1096 835 */
1097 836 public function generate_user_rules_select_field( $menu_id, $disabled_for, $menu_type = 'menu' ) {
1098 837 ob_start();
1099 838 ?>
1100 - <select class="adminify-menu-settings adminify-user-role-select <?php
1101 - echo esc_attr( $menu_type );
839 + <select class="adminify-menu-settings <?php
840 + echo $menu_type;
1102 841 ?>_setting" name="hidden_for" id="<?php
1103 842 echo esc_attr( $menu_id );
1104 843 ?>-user-role-types" multiple>
1105 - <optgroup label="<?php
1106 - esc_attr_e( 'Roles', 'adminify' );
1107 - ?>">
1108 844 <?php
845 + $sel = '';
846 + // if (in_array('Super Admin', $disabled_for)) {
847 + // $sel = 'selected';
848 + // }
849 + ?>
850 +
851 + <!-- <option value="Super Admin" <?php
852 + // echo esc_attr($sel);
853 + ?>><?php
854 + // esc_html_e('Super Admin', 'adminify');
855 + ?></option> -->
856 +
857 + <?php
1109 858 foreach ( $this->roles as $role ) {
1110 859 $rolename = $role['name'];
1111 860 if ( 'administrator' == strtolower( $rolename ) ) {
1112 861 continue;
@@ -1124,40 +873,25 @@
1124 873 echo esc_html( $rolename );
1125 874 ?></option>
1126 875 <?php
1127 876 }
1128 - ?>
1129 - </optgroup>
1130 -
1131 - <optgroup label="<?php
1132 - esc_attr_e( 'Users', 'adminify' );
1133 - ?>" class="adminify-users-optgroup">
877 + foreach ( $this->users as $user ) {
878 + $username = $user->display_name;
879 + $sel = '';
880 + if ( in_array( $username, $disabled_for ) ) {
881 + $sel = 'selected';
882 + }
883 + ?>
884 + <option value="<?php
885 + echo esc_attr( $username );
886 + ?>" <?php
887 + echo esc_attr( $sel );
888 + ?>><?php
889 + echo esc_html( $username );
890 + ?></option>
1134 891 <?php
1135 - // Only include pre-selected users in HTML (AJAX will populate dropdown)
1136 - foreach ( $disabled_for as $item ) {
1137 - // Check if this is a user (not a role)
1138 - $is_role = false;
1139 - foreach ( $this->roles as $role ) {
1140 - if ( $role['name'] === $item ) {
1141 - $is_role = true;
1142 - break;
1143 - }
1144 - }
1145 - if ( !$is_role ) {
1146 - $user = get_user_by( 'login', $item );
1147 - if ( $user ) {
1148 - ?>
1149 - <option value="<?php
1150 - echo esc_attr( $user->user_login );
1151 - ?>" selected><?php
1152 - echo esc_html( $user->user_login . ' (' . $user->display_name . ')' );
1153 - ?></option>
1154 - <?php
1155 - }
1156 - }
1157 892 }
1158 893 ?>
1159 - </optgroup>
1160 894 </select>
1161 895 <?php
1162 896 return ob_get_clean();
1163 897 }
@@ -1172,16 +906,12 @@
1172 906 $current_menu_item,
1173 907 $master_sub_menu,
1174 908 $next_menu_item
1175 909 ) {
1176 - if ( empty( $current_menu_item[2] ) ) {
1177 - return;
1178 - }
1179 - // $disabled_for = '';
910 + $disabled_for = '';
1180 911 $menu_id = preg_replace( '/[^A-Za-z0-9 ]/', '', $current_menu_item[5] );
1181 912 $name = '';
1182 913 $link = '';
1183 - $external_link = '';
1184 914 $icon = '';
1185 915 $separator = '';
1186 916 $disabled_for = [];
1187 917 $optiongroup = [];
@@ -1206,11 +936,8 @@
1206 936 }
1207 937 if ( isset( $optiongroup['separator'] ) ) {
1208 938 $separator = $optiongroup['separator'];
1209 939 }
1210 - if ( isset( $optiongroup['external_link'] ) ) {
1211 - $external_link = $optiongroup['external_link'];
1212 - }
1213 940 }
1214 941 }
1215 942 $name_attr = $current_menu_item[2];
1216 943 if ( strpos( $current_menu_item[5], 'adminify-custom-menu-' ) !== false ) {
@@ -1228,11 +955,8 @@
1228 955 }
1229 956 if ( isset( $current_menu_item['separator'] ) ) {
1230 957 $separator = $current_menu_item['separator'];
1231 958 }
1232 - if ( isset( $current_menu_item['external_link'] ) ) {
1233 - $external_link = $current_menu_item['external_link'];
1234 - }
1235 959 }
1236 960 if ( !is_array( $disabled_for ) ) {
1237 961 $disabled_for = [];
1238 962 }
@@ -1259,9 +983,9 @@
1259 983 ?>" id="wp-adminify-top-menu-<?php
1260 984 echo esc_attr( $menu_id );
1261 985 ?>">
1262 986 <input type="number" class="top_level_order" value="" style="display:none;">
1263 - <a class="menu-editor-title accordion-button adminify-flex adminify-flex-center adminify-gap-2" href="#">
987 + <a class="menu-editor-title accordion-button p-4" href="#">
1264 988 <svg class="drag-icon is-pulled-left mr-2" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
1265 989 <path d="M12 14C13.1046 14 14 13.1046 14 12C14 10.8954 13.1046 10 12 10C10.8954 10 10 10.8954 10 12C10 13.1046 10.8954 14 12 14Z" fill="#4E4B66" fill-opacity="0.72" />
1266 990 <path d="M12 7C13.1046 7 14 6.10457 14 5C14 3.89543 13.1046 3 12 3C10.8954 3 10 3.89543 10 5C10 6.10457 10.8954 7 12 7Z" fill="#4E4B66" fill-opacity="0.72" />
1267 991 <path d="M12 21C13.1046 21 14 20.1046 14 19C14 17.8954 13.1046 17 12 17C10.8954 17 10 17.8954 10 19C10 20.1046 10.8954 21 12 21Z" fill="#4E4B66" fill-opacity="0.72" />
@@ -1277,10 +1001,10 @@
1277 1001 ?>
1278 1002 </a>
1279 1003
1280 1004 <div class="accordion-body adminify_top_level_settings">
1281 - <div class="tabs tabbable">
1282 - <ul class="adminify-flex adminify-flex-center adminify-m-0 nav nav-tabs">
1005 + <div class="tabs tabbable m-0">
1006 + <ul class="m-0 b-0 nav nav-tabs">
1283 1007 <li class="nav-item active">
1284 1008 <a class="nav-link is-clickable active" href="#tab-<?php
1285 1009 echo esc_attr( $menu_id );
1286 1010 ?>-1">
@@ -1300,9 +1024,9 @@
1300 1024 </li>
1301 1025 </ul>
1302 1026 </div>
1303 1027
1304 - <div class="tab-content tab-panel panel adminify-p-4">
1028 + <div class="tab-content tab-panel panel p-4">
1305 1029 <div id="tab-<?php
1306 1030 echo esc_attr( $menu_id );
1307 1031 ?>-1" class="tab-pane">
1308 1032 <div class="menu-editor-form">
@@ -1327,9 +1051,9 @@
1327 1051 <label for="<?php
1328 1052 echo esc_attr( $current_menu_item[2] );
1329 1053 ?>">
1330 1054 <?php
1331 - esc_html_e( 'Hidden For Roles or Users', 'adminify' );
1055 + esc_html_e( 'Hidden For Rules', 'adminify' );
1332 1056 ?>
1333 1057 </label>
1334 1058
1335 1059 <div class="select is-small">
@@ -1334,9 +1058,8 @@
1334 1058
1335 1059 <div class="select is-small">
1336 1060
1337 1061 <?php
1338 - // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- generate_user_rules_select_field() returns a trusted <select> template with form inputs that wp_kses_post() would strip; values inside are escaped.
1339 1062 echo $this->generate_user_rules_select_field( $menu_id, $disabled_for );
1340 1063 ?>
1341 1064
1342 1065 </div>
@@ -1341,11 +1064,10 @@
1341 1064
1342 1065 </div>
1343 1066 </div>
1344 1067 </div>
1345 -
1346 1068 <div class="columns">
1347 - <!-- <div class="column">
1069 + <div class="column">
1348 1070 <label for="">
1349 1071 <?php
1350 1072 esc_html_e( 'Change Link', 'adminify' );
1351 1073 ?>
@@ -1353,103 +1075,12 @@
1353 1075 <input class="menu_setting" name="link" type="url" placeholder="<?php
1354 1076 esc_html_e( 'New link', 'adminify' );
1355 1077 ?>" value="<?php
1356 1078 echo esc_attr( ( $name_attr != ltrim( $link, '#' ) ? $link : '' ) );
1357 - ?>" onchange="checkForLinkTarget(this)" >
1358 -
1359 - <label for="external_link-<?php
1360 - echo esc_attr( $name_attr );
1361 1079 ?>">
1362 - <?php
1363 - esc_html_e( 'New Window?', 'adminify' );
1364 - ?>
1365 - <input class="menu_setting" id="external_link-<?php
1366 - echo esc_attr( $name_attr );
1367 - ?>" name="external_link" type="checkbox" value="0" <?php
1368 - checked( (int) $external_link, 1 );
1369 - ?> disabled>
1370 -
1371 - </label>
1372 - <script>
1373 - function checkForLinkTarget(inputField) {
1374 - var checkbox = inputField.closest('.column').querySelector('input[type="checkbox"]');
1375 -
1376 - if (inputField.value.trim() !== "") {
1377 - checkbox.disabled = false; // Enable checkbox if input is not empty
1378 - } else {
1379 - checkbox.disabled = true; // Disable checkbox if input is empty
1380 - }
1381 - }
1382 - </script>
1383 - </div> -->
1384 -
1080 + </div>
1385 1081 <div class="column">
1386 1082 <label for="">
1387 - <?php
1388 - esc_html_e( 'Change Link', 'adminify' );
1389 - ?>
1390 - </label>
1391 - <input class="menu_setting" name="link" type="url"
1392 - placeholder="<?php
1393 - esc_html_e( 'New link', 'adminify' );
1394 - ?>"
1395 - value="<?php
1396 - echo esc_attr( ( $name_attr != ltrim( $link, '#' ) ? $link : '' ) );
1397 - ?>"
1398 - oninput="checkForLinkTarget(this)">
1399 - <div class="new-tab-settings" style="padding-top: 10px;">
1400 - <label for="external_link-<?php
1401 - echo esc_attr( $name_attr );
1402 - ?>" style="display: flex; align-items: center; gap: 8px;">
1403 -
1404 - <input class="menu_setting" id="external_link-<?php
1405 - echo esc_attr( $name_attr );
1406 - ?>"
1407 - name="external_link" type="checkbox" value="1"
1408 - <?php
1409 - checked( (int) $external_link, 1 );
1410 - ?> disabled style="margin-top: 0;" >
1411 - <span><?php
1412 - esc_html_e( 'New Window?', 'adminify' );
1413 - ?></span>
1414 - </label>
1415 - </div>
1416 -
1417 - <script>
1418 - // Function to validate URL
1419 - function isValidURL(url) {
1420 - // Allow absolute URLs (with http:// or https://)
1421 - var absolutePattern = /^(https?:\/\/)[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}.*$/;
1422 -
1423 - // Allow relative URLs (starting with "/")
1424 - var relativePattern = /^\/[a-zA-Z0-9-_\/]+$/;
1425 -
1426 - return absolutePattern.test(url) || relativePattern.test(url);
1427 - }
1428 -
1429 -
1430 - function checkForLinkTarget(inputField) {
1431 - var checkbox = inputField.closest('.column').querySelector('input[type="checkbox"]');
1432 -
1433 - if (isValidURL(inputField.value.trim())) {
1434 - checkbox.disabled = false; // Enable if URL is valid
1435 - } else {
1436 - checkbox.disabled = true; // Disable if invalid
1437 - checkbox.checked = false; // Also uncheck if disabled
1438 - }
1439 - }
1440 -
1441 - // Run on page load
1442 - document.addEventListener("DOMContentLoaded", function() {
1443 - document.querySelectorAll('.column input[name="link"]').forEach(function(inputField) {
1444 - checkForLinkTarget(inputField);
1445 - });
1446 - });
1447 - </script>
1448 - </div>
1449 -
1450 - <div class="column">
1451 - <label for="">
1452 1083 <?php
1453 1084 esc_html_e( 'Set Custom Icon', 'adminify' );
1454 1085 ?>
1455 1086 </label>
@@ -1462,9 +1093,9 @@
1462 1093 <?php
1463 1094 if ( !empty( $icon ) ) {
1464 1095 if ( preg_match( '/http(s?)\\:\\/\\//i', $icon ) ) {
1465 1096 $image = explode( ',', $icon );
1466 - echo '<i class=""><img width="24" height="24" src=' . esc_url( $image[1] ) . ' ></i>';
1097 + echo '<i class=""><img src=' . esc_url( $image[1] ) . ' ></i>';
1467 1098 } else {
1468 1099 ?>
1469 1100 <i class="<?php
1470 1101 echo esc_attr( $this->get_icon( esc_attr( $icon ), '' ) );
@@ -1471,11 +1102,11 @@
1471 1102 ?>"></i>
1472 1103 <?php
1473 1104 }
1474 1105 } else {
1475 - $adminify_icon = PXLBSADMINIFY_ASSETS_IMAGE . 'logos/menu-icon.svg';
1106 + $adminify_icon = WP_ADMINIFY_ASSETS_IMAGE . 'logos/menu-icon.svg';
1476 1107 if ( empty( $icons[$default_icons] ) ) {
1477 - echo '<i class=""><img width="24" height="24" src=' . esc_url( $adminify_icon ) . ' ></i>';
1108 + echo '<i class=""><img src=' . esc_url( $adminify_icon ) . ' ></i>';
1478 1109 } else {
1479 1110 ?>
1480 1111 <i class="<?php
1481 1112 echo wp_kses_post( $this->get_icon( esc_attr( $icon ), $icons[$default_icons] ) );
@@ -1493,27 +1124,16 @@
1493 1124 </div>
1494 1125 </div>
1495 1126 </div>
1496 1127 <div class='columns'>
1497 - <?php
1498 - $upgrade_pro = '';
1499 - $separator_name_attr = '';
1500 - $upgrade_pro = 'upgrade-pro';
1501 - $separator_name_attr = Utils::upgrade_pro_notice( 'Add Separator' );
1502 - ?>
1503 -
1504 1128 <div class='column <?php
1505 - echo esc_attr( $upgrade_pro );
1129 + echo ( !jltwp_adminify()->can_use_premium_code__premium_only() ? 'upgrade-pro' : '' );
1506 1130 ?>'>
1507 - <label for="seperator-<?php
1508 - echo esc_attr( $name_attr );
1509 - ?>">
1510 - <?php
1511 - $separator_content = apply_filters( 'pxlbsadminify/menu_editor/add_separator', $separator_name_attr, $separator );
1512 - // Apply the filter
1513 - echo wp_kses_post( $separator_content || "" );
1131 + <?php
1514 1132 ?>
1515 - </label>
1133 + <?php
1134 + echo Utils::adminify_upgrade_pro( 'Add Separator' );
1135 + ?>
1516 1136 </div>
1517 1137 </div>
1518 1138 </div>
1519 1139 <?php
@@ -1614,16 +1234,36 @@
1614 1234 ?>">
1615 1235 </div>
1616 1236 <div class="column">
1617 1237 <label for=""><?php
1618 - esc_html_e( 'Hidden For Roles or Users', 'adminify' );
1238 + esc_html_e( 'Hidden For Rules', 'adminify' );
1619 1239 ?></label>
1620 1240
1621 1241 <div class="select is-small">
1622 1242 <?php
1623 - // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- generate_user_rules_select_field() returns a trusted <select> template with form inputs that wp_kses_post() would strip; values inside are escaped.
1624 1243 echo $this->generate_user_rules_select_field( $menu_id, $disabled_for );
1625 1244 ?>
1245 +
1246 + <script>
1247 + jQuery('#<?php
1248 + echo esc_attr( $menu_id );
1249 + ?> #<?php
1250 + echo esc_attr( $menu_id );
1251 + ?>-user-role-types').tokenize2({
1252 + placeholder: '<?php
1253 + esc_html_e( 'Select roles or users', 'adminify' );
1254 + ?>'
1255 + });
1256 + jQuery(document).ready(function($) {
1257 + $('#<?php
1258 + echo esc_attr( $menu_id );
1259 + ?> #<?php
1260 + echo esc_attr( $menu_id );
1261 + ?>-user-role-types').on('tokenize:select', function(container) {
1262 + $(this).tokenize2().trigger('tokenize:search', [$(this).tokenize2().input.val()]);
1263 + });
1264 + })
1265 + </script>
1626 1266 </div>
1627 1267 </div>
1628 1268 </div>
1629 1269 </div>
@@ -1638,9 +1278,8 @@
1638 1278 public function build_sub_menu_item( $current_menu_item, $optiongroup, $name_attr ) {
1639 1279 $name = '';
1640 1280 $link = '';
1641 1281 $icon = '';
1642 - $external_link = '';
1643 1282 $disabled_for = [];
1644 1283 $suboptiongroup = [];
1645 1284 $menu_options = $this->menu_settings;
1646 1285 if ( isset( $optiongroup['submenu'] ) ) {
@@ -1651,11 +1290,8 @@
1651 1290 }
1652 1291 if ( isset( $suboptiongroup['link'] ) ) {
1653 1292 $link = $suboptiongroup['link'];
1654 1293 }
1655 - if ( isset( $suboptiongroup['external_link'] ) ) {
1656 - $external_link = $suboptiongroup['external_link'];
1657 - }
1658 1294 if ( isset( $suboptiongroup['icon'] ) ) {
1659 1295 $icon = $suboptiongroup['icon'];
1660 1296 }
1661 1297 if ( isset( $suboptiongroup['hidden_for'] ) ) {
@@ -1675,11 +1311,8 @@
1675 1311 }
1676 1312 if ( isset( $optiongroup['submenu'][$sub_menu_name_attr]['icon'] ) ) {
1677 1313 $icon = $optiongroup['submenu'][$sub_menu_name_attr]['icon'];
1678 1314 }
1679 - if ( isset( $optiongroup['submenu'][$sub_menu_name_attr]['external_link'] ) ) {
1680 - $external_link = $optiongroup['submenu'][$sub_menu_name_attr]['external_link'];
1681 - }
1682 1315 }
1683 1316 if ( !is_array( $disabled_for ) ) {
1684 1317 $disabled_for = [];
1685 1318 }
@@ -1690,9 +1323,9 @@
1690 1323 ?>" id="wp-adminify-sub-menu-<?php
1691 1324 echo esc_attr( $menu_id );
1692 1325 ?>">
1693 1326 <input type="number" class="top_level_order" value="" style="display:none;">
1694 - <a class="menu-editor-title accordion-button adminify-flex adminify-flex-center adminify-gap-2" href="#">
1327 + <a class="menu-editor-title accordion-button p-4" href="#">
1695 1328 <svg class="drag-icon is-pulled-left mr-2" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
1696 1329 <path d="M12 14C13.1046 14 14 13.1046 14 12C14 10.8954 13.1046 10 12 10C10.8954 10 10 10.8954 10 12C10 13.1046 10.8954 14 12 14Z" fill="#4E4B66" fill-opacity="0.72" />
1697 1330 <path d="M12 7C13.1046 7 14 6.10457 14 5C14 3.89543 13.1046 3 12 3C10.8954 3 10 3.89543 10 5C10 6.10457 10.8954 7 12 7Z" fill="#4E4B66" fill-opacity="0.72" />
1698 1331 <path d="M12 21C13.1046 21 14 20.1046 14 19C14 17.8954 13.1046 17 12 17C10.8954 17 10 17.8954 10 19C10 20.1046 10.8954 21 12 21Z" fill="#4E4B66" fill-opacity="0.72" />
@@ -1728,16 +1361,38 @@
1728 1361 ?>">
1729 1362 </div>
1730 1363 <div class="column">
1731 1364 <label for=""><?php
1732 - esc_html_e( 'Hidden For Roles or Users', 'adminify' );
1365 + esc_html_e( 'Hidden For Rules', 'adminify' );
1733 1366 ?></label>
1734 1367
1735 1368 <div class="select is-small">
1369 +
1736 1370 <?php
1737 - // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- generate_user_rules_select_field() returns a trusted <select> template with form inputs that wp_kses_post() would strip; values inside are escaped.
1738 1371 echo $this->generate_user_rules_select_field( $menu_id, $disabled_for, 'sub_menu' );
1739 1372 ?>
1373 +
1374 + <script>
1375 + jQuery('#wp-adminify-sub-menu-<?php
1376 + echo esc_attr( $menu_id );
1377 + ?> #<?php
1378 + echo esc_attr( $menu_id );
1379 + ?>-user-role-types').tokenize2({
1380 + placeholder: '<?php
1381 + esc_html_e( 'Select roles or users', 'adminify' );
1382 + ?>'
1383 + });
1384 + jQuery(document).ready(function($) {
1385 + $('#wp-adminify-sub-menu-<?php
1386 + echo esc_attr( $menu_id );
1387 + ?> #<?php
1388 + echo esc_attr( $menu_id );
1389 + ?>-user-role-types').on('tokenize:select', function(container) {
1390 + $(this).tokenize2().trigger('tokenize:search', [$(this).tokenize2().input.val()]);
1391 + });
1392 + })
1393 + </script>
1394 +
1740 1395 </div>
1741 1396 </div>
1742 1397 </div>
1743 1398 <div class="columns">
@@ -1746,30 +1401,41 @@
1746 1401 esc_html_e( 'Change Link', 'adminify' );
1747 1402 ?></label>
1748 1403 <input class="sub_menu_setting" name="link" type="url" placeholder="New link" value="<?php
1749 1404 echo esc_attr( ( $sub_menu_name_attr != ltrim( $link, '#' ) ? $link : '' ) );
1750 - ?>" onchange="checkForLinkTarget(this)" >
1751 -
1752 - <label for="external_link-<?php
1753 - echo esc_attr( $sub_menu_name_attr );
1754 1405 ?>">
1755 - <?php
1756 - esc_html_e( 'New Window?', 'adminify' );
1757 - ?>
1758 - <input class="sub_menu_setting" id="external_link-<?php
1759 - echo esc_attr( $sub_menu_name_attr );
1760 - ?>" name="external_link" type="checkbox" value="0" <?php
1761 - checked( (int) $external_link, 1 );
1762 - ?>disabled />
1763 -
1764 - </label>
1765 1406 </div>
1766 1407 <div class="column">
1767 - <label for="" style="margin-top:25px">
1768 - <?php
1769 - esc_html_e( 'Custom Icon is not allowed for Submenu', 'adminify' );
1408 + <label for=""><?php
1409 + esc_html_e( 'Set Custom Icon', 'adminify' );
1410 + ?> <i>(<?php
1411 + esc_html_e( 'Not available for Submenu.', 'adminify' );
1412 + ?>)</i></label>
1413 +
1414 + <div class="icon-picker-wrap wp-adminify-menu-icon-picker adminify-icon-picker-input icon-select-button is-clickable-no is-pulled-left">
1415 + <ul class="icon-picker">
1416 + <li class="icon-none" title="None"><i class="dashicons dashicons-dismiss"></i></li>
1417 + <?php
1418 + $custom_class = '';
1419 + $icon = '<i class="' . $this->get_icon( esc_attr( $icon ), 'dashicons dashicons-external' ) . '"></i>';
1420 + if ( strpos( $sub_menu_name_attr, 'adminify-custom-submenu-' ) !== false ) {
1421 + $custom_class = 'custom-icon';
1422 + $icon = '<img src="' . esc_url( WP_ADMINIFY_ASSETS_IMAGE ) . 'logos/menu-icon.svg" />';
1423 + }
1770 1424 ?>
1771 - </label>
1425 + <li class="select-icon <?php
1426 + echo esc_attr( $custom_class );
1427 + ?>" title="Icon Library">
1428 + <?php
1429 + echo wp_kses_post( $icon );
1430 + ?>
1431 + </li>
1432 + <input type="hidden" class="sub_menu_setting" name="icon" value="<?php
1433 + echo esc_attr( $icon );
1434 + ?>">
1435 + </ul>
1436 + </div>
1437 +
1772 1438 </div>
1773 1439 </div>
1774 1440 </div>
1775 1441 <?php
@@ -1792,17 +1458,13 @@
1792 1458 /**
1793 1459 * Add New Menu Item.
1794 1460 */
1795 1461 public function render_add_new_menu_item( $submenu = false ) {
1796 - $add_item = apply_filters( 'pxlbsadminify/menu_editor', [
1797 - 'upgrade_pro' => Utils::upgrade_pro_notice( ' ' ),
1798 - 'upgrade_class' => 'upgrade-pro',
1799 - ] );
1800 1462 ?>
1801 - <div class="adminify-accordion adminify-add-new-menu-editor-item upgrade-pro adminify-field adminify-field-switcher adminify-depend-visible adminify-depend-on adminify-pro-notice <?php
1463 + <div class="accordion add-new-menu-editor-item <?php
1802 1464 echo esc_attr( ( $submenu ? 'submenu' : '' ) );
1803 1465 ?> <?php
1804 - echo esc_attr( $add_item['upgrade_class'] );
1466 + echo ( !jltwp_adminify()->can_use_premium_code__premium_only() ? 'upgrade-pro' : '' );
1805 1467 ?>">
1806 1468 <div class="inner-text">
1807 1469 <i class="dashicons dashicons-plus-alt"></i>
1808 1470 <span class="title"><?php
@@ -1809,9 +1471,9 @@
1809 1471 esc_html_e( 'Add Item', 'adminify' );
1810 1472 ?></span>
1811 1473 </div>
1812 1474 <?php
1813 - echo wp_kses( $add_item['upgrade_pro'], Utils::kses_allowed_html() );
1475 + echo Utils::adminify_upgrade_pro( ' ' );
1814 1476 ?>
1815 1477 </div>
1816 1478 <?php
1817 1479 }
@@ -1820,72 +1482,69 @@
1820 1482 * Menu Editor Header
1821 1483 *
1822 1484 * @return void
1823 1485 */
1824 - public static function render_menu_editor_header() {
1486 + public function render_menu_editor_header() {
1825 1487 ?>
1826 1488
1827 - <div class="adminify-flex adminify-flex-center adminify-justify-between">
1828 - <div class="adminify-menu-editor-help-urls adminify-flex adminify-flex-center adminify-gap-2">
1829 - <?php
1830 - // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- help_urls() returns a trusted template containing inline SVG icons that wp_kses_post() would strip; URLs inside are passed through esc_url().
1831 - echo Utils::help_urls(
1489 + <div class="adminify-menu-editor-help-urls wp-heading-inline is-pulled-left is-flex is-align-items-center">
1490 + <?php
1491 + echo Utils::adminfiy_help_urls(
1832 1492 __( 'Menu Editor', 'adminify' ),
1833 1493 'https://wpadminify.com/kb/wordpress-dashboard-menu-editor/',
1834 1494 'https://www.youtube.com/playlist?list=PLqpMw0NsHXV-EKj9Xm1DMGa6FGniHHly8',
1835 1495 'https://www.facebook.com/groups/jeweltheme',
1836 - esc_url( \PXLBSAdminify\Inc\Admin\AdminSettings::support_url() )
1496 + 'https://wpadminify.com/support/'
1837 1497 );
1838 1498 ?>
1839 - </div>
1499 + </div>
1840 1500
1841 1501
1842 - <div class="wp-adminify--page--title--actions adminify-flex adminify-flex-center adminify-gap-2">
1502 + <div class="wp-adminify--page--title--actions mt-1 is-pulled-right">
1843 1503
1844 - <button class="adminify-btn adminify-btn-outline-primary adminify_menu_save_settings">
1845 - <?php
1504 + <button class="page-title-action mr-3 adminify_menu_save_settings">
1505 + <?php
1846 1506 esc_html_e( 'Save', 'adminify' );
1847 1507 ?>
1848 - </button>
1508 + </button>
1849 1509
1850 - <div class="adminify-dropdown">
1851 - <div class="adminify-dropdown-trigger">
1852 - <button class="adminify-btn adminify-btn-outline-primary" aria-haspopup="true" aria-controls="dropdown-menu">
1853 - <svg class="icon" width="16" height="12" viewBox="0 0 16 12" fill="none" xmlns="http://www.w3.org/2000/svg">
1854 - <path d="M5 12C3.63144 12.0007 2.43589 11.0751 2.09375 9.75H0.5V8.25H2.0945C2.48423 6.74059 3.96509 5.78119 5.50196 6.04243C7.03883 6.30366 8.11953 7.69847 7.98865 9.25188C7.85776 10.8053 6.55892 11.9996 5 12ZM5 7.5C4.18055 7.50083 3.51342 8.15914 3.50167 8.97851C3.48993 9.79788 4.13792 10.475 4.95702 10.4993C5.77611 10.5237 6.46312 9.88613 6.5 9.0675V9.3675V9C6.5 8.17158 5.82843 7.5 5 7.5ZM15.5 9.75H8.75V8.25H15.5V9.75ZM8.75 6C7.38172 6.00035 6.18657 5.07483 5.8445 3.75H0.5V2.25H5.8445C6.23423 0.740588 7.71509 -0.218809 9.25196 0.0424253C10.7888 0.30366 11.8695 1.69847 11.7386 3.25188C11.6078 4.80529 10.3089 5.99961 8.75 6ZM8.75 1.5C7.93055 1.50083 7.26342 2.15914 7.25167 2.97851C7.23993 3.79788 7.88792 4.47503 8.70702 4.49934C9.52611 4.52365 10.2131 3.88613 10.25 3.0675V3.3675V3C10.25 2.17158 9.57843 1.5 8.75 1.5ZM15.5 3.75H12.5V2.25H15.5V3.75Z" fill="#0347FF" />
1855 - </svg>
1856 - </button>
1857 - </div>
1858 - <div class="adminify-dropdown-menu" id="dropdown-menu" role="menu">
1859 - <div class="adminify-dropdown-content adminify-flex adminify-flex-col adminify-gap-2">
1860 - <a href="#" class="adminify-dropdown-item adminify_export_menu_settings">
1861 - <?php
1510 + <div class="dropdown is-right is-hoverable is-pulled-right">
1511 + <div class="dropdown-trigger">
1512 + <button class="button" aria-haspopup="true" aria-controls="dropdown-menu">
1513 + <svg class="icon" width="16" height="12" viewBox="0 0 16 12" fill="none" xmlns="http://www.w3.org/2000/svg">
1514 + <path d="M5 12C3.63144 12.0007 2.43589 11.0751 2.09375 9.75H0.5V8.25H2.0945C2.48423 6.74059 3.96509 5.78119 5.50196 6.04243C7.03883 6.30366 8.11953 7.69847 7.98865 9.25188C7.85776 10.8053 6.55892 11.9996 5 12ZM5 7.5C4.18055 7.50083 3.51342 8.15914 3.50167 8.97851C3.48993 9.79788 4.13792 10.475 4.95702 10.4993C5.77611 10.5237 6.46312 9.88613 6.5 9.0675V9.3675V9C6.5 8.17158 5.82843 7.5 5 7.5ZM15.5 9.75H8.75V8.25H15.5V9.75ZM8.75 6C7.38172 6.00035 6.18657 5.07483 5.8445 3.75H0.5V2.25H5.8445C6.23423 0.740588 7.71509 -0.218809 9.25196 0.0424253C10.7888 0.30366 11.8695 1.69847 11.7386 3.25188C11.6078 4.80529 10.3089 5.99961 8.75 6ZM8.75 1.5C7.93055 1.50083 7.26342 2.15914 7.25167 2.97851C7.23993 3.79788 7.88792 4.47503 8.70702 4.49934C9.52611 4.52365 10.2131 3.88613 10.25 3.0675V3.3675V3C10.25 2.17158 9.57843 1.5 8.75 1.5ZM15.5 3.75H12.5V2.25H15.5V3.75Z" fill="#0347FF" />
1515 + </svg>
1516 + </button>
1517 + </div>
1518 + <div class="dropdown-menu" id="dropdown-menu" role="menu">
1519 + <div class="dropdown-content">
1520 + <a href="#" class="dropdown-item adminify_export_menu_settings">
1521 + <?php
1862 1522 esc_html_e( 'Export menu', 'adminify' );
1863 1523 ?>
1864 - </a>
1865 - <input accept=".json" type="file" single="" id="adminify_import_menu" class="hidden">
1866 - <a href="#" class="adminify-dropdown-item adminify_import_menu_settings">
1867 - <?php
1524 + </a>
1525 + <input accept=".json" type="file" single="" id="adminify_import_menu" class="hidden">
1526 + <a href="#" class="dropdown-item adminify_import_menu_settings">
1527 + <?php
1868 1528 esc_html_e( 'Import menu', 'adminify' );
1869 1529 ?>
1870 - </a>
1871 - <a href="#" class="adminify-dropdown-item adminify_reset_menu_settings">
1872 - <?php
1530 + </a>
1531 + <a href="#" class="dropdown-item adminify_reset_menu_settings">
1532 + <?php
1873 1533 esc_html_e( 'Reset menu', 'adminify' );
1874 1534 ?>
1875 - </a>
1876 - </div>
1535 + </a>
1877 1536 </div>
1878 1537 </div>
1879 1538 </div>
1880 1539 </div>
1881 1540
1882 - <div class="adminify-text-wrap">
1541 + <div class="is-inline-block">
1883 1542 <p><?php
1884 1543 esc_html_e( 'Edit each menu item\'s name, link, icon and visibility. Drag and drop to rearange the menu. Changes will take effect after page refresh.', 'adminify' );
1885 1544 ?></p>
1886 - <p class="adminify-flex adminify-flex-center adminify-gap-1">
1887 - <svg class="" width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
1545 + <p>
1546 + <svg class="is-pulled-left mr-1 mt-1" width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
1888 1547 <path d="M7.33398 7.32002C7.33398 7.14321 7.40422 6.97364 7.52925 6.84861C7.65427 6.72359 7.82384 6.65335 8.00065 6.65335C8.17746 6.65335 8.34703 6.72359 8.47206 6.84861C8.59708 6.97364 8.66732 7.14321 8.66732 7.32002V11.32C8.66732 11.4968 8.59708 11.6664 8.47206 11.7914C8.34703 11.9164 8.17746 11.9867 8.00065 11.9867C7.82384 11.9867 7.65427 11.9164 7.52925 11.7914C7.40422 11.6664 7.33398 11.4968 7.33398 11.32V7.32002Z" fill="#4E4B66" />
1889 1548 <path d="M8.00065 4.034C7.82384 4.034 7.65427 4.10423 7.52925 4.22926C7.40422 4.35428 7.33398 4.52385 7.33398 4.70066C7.33398 4.87747 7.40422 5.04704 7.52925 5.17207C7.65427 5.29709 7.82384 5.36733 8.00065 5.36733C8.17746 5.36733 8.34703 5.29709 8.47206 5.17207C8.59708 5.04704 8.66732 4.87747 8.66732 4.70066C8.66732 4.52385 8.59708 4.35428 8.47206 4.22926C8.34703 4.10423 8.17746 4.034 8.00065 4.034Z" fill="#4E4B66" />
1890 1549 <path fill-rule="evenodd" clip-rule="evenodd" d="M8.00065 1.33334C4.31865 1.33334 1.33398 4.31801 1.33398 8.00001C1.33398 11.682 4.31865 14.6667 8.00065 14.6667C11.6827 14.6667 14.6673 11.682 14.6673 8.00001C14.6673 4.31801 11.6827 1.33334 8.00065 1.33334ZM2.66732 8.00001C2.66732 9.4145 3.22922 10.7711 4.22942 11.7712C5.22961 12.7714 6.58616 13.3333 8.00065 13.3333C9.41514 13.3333 10.7717 12.7714 11.7719 11.7712C12.7721 10.7711 13.334 9.4145 13.334 8.00001C13.334 6.58552 12.7721 5.22897 11.7719 4.22877C10.7717 3.22858 9.41514 2.66668 8.00065 2.66668C6.58616 2.66668 5.22961 3.22858 4.22942 4.22877C3.22922 5.22897 2.66732 6.58552 2.66732 8.00001V8.00001Z" fill="#4E4B66" />
1891 1550 </svg>
@@ -1890,9 +1549,9 @@
1890 1549 <path fill-rule="evenodd" clip-rule="evenodd" d="M8.00065 1.33334C4.31865 1.33334 1.33398 4.31801 1.33398 8.00001C1.33398 11.682 4.31865 14.6667 8.00065 14.6667C11.6827 14.6667 14.6673 11.682 14.6673 8.00001C14.6673 4.31801 11.6827 1.33334 8.00065 1.33334ZM2.66732 8.00001C2.66732 9.4145 3.22922 10.7711 4.22942 11.7712C5.22961 12.7714 6.58616 13.3333 8.00065 13.3333C9.41514 13.3333 10.7717 12.7714 11.7719 11.7712C12.7721 10.7711 13.334 9.4145 13.334 8.00001C13.334 6.58552 12.7721 5.22897 11.7719 4.22877C10.7717 3.22858 9.41514 2.66668 8.00065 2.66668C6.58616 2.66668 5.22961 3.22858 4.22942 4.22877C3.22922 5.22897 2.66732 6.58552 2.66732 8.00001V8.00001Z" fill="#4E4B66" />
1891 1550 </svg>
1892 1551
1893 1552 <?php
1894 - esc_html_e( 'If you have Adminify Menu Module disabled, icons and label dividers won\'t change.', 'adminify' );
1553 + esc_html_e( 'If you have WP Adminify Menu Module disabled, icons and label dividers won\'t change.', 'adminify' );
1895 1554 ?>
1896 1555
1897 1556 </p>
1898 1557 </div>
@@ -1900,21 +1559,22 @@
1900 1559
1901 1560 <?php
1902 1561 }
1903 1562
1904 - public function menu_editor_contents() {
1563 + public function jltwp_adminify_menu_editor_contents() {
1905 1564 ?>
1906 1565
1907 1566 <div class="wrap">
1908 - <div class="wp-adminify--menu--editor--container">
1567 + <div class="wp-adminify--menu--editor--container mt-4">
1909 1568
1910 - <!-- <div id="adminify-data-saved-message"></div> -->
1569 + <div id="adminify-data-saved-message"></div>
1911 1570
1912 1571 <?php
1913 - //self::render_menu_editor_header();
1572 + $this->render_menu_editor_header();
1914 1573 ?>
1915 1574
1916 - <div class="wp-adminify--menu--editor--settings adminify-flex adminify-flex-col adminify-gap-4">
1575 +
1576 + <div class="wp-adminify--menu--editor--settings mt-5 pt-3">
1917 1577 <div class="wp-adminify-menu-editor-loader"></div>
1918 1578 <?php
1919 1579 $this->render_menu_editor();
1920 1580 ?>