PluginProbe
My WP Customize Admin/Frontend / 1.3.2
My WP Customize Admin/Frontend v1.3.2
1.27.4 1.27.3 trunk 1.0 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.10 1.10.1 1.10.2 1.11 1.12 1.12.1 1.12.2 1.13 1.13.1 1.13.2 1.14 1.15.0 1.16 1.17.0 All 76 releases
my-wp / controller / modules / mywp.controller.module.admin.sidebar.php

mywp.controller.module.admin.sidebar.php in My WP Customize Admin/Frontend 1.3.2, at controller/modules/mywp.controller.module.admin.sidebar.php

973 lines 20.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit;
5 }
6
7 if( ! class_exists( 'MywpControllerAbstractModule' ) ) {
8 return false;
9 }
10
11 if ( ! class_exists( 'MywpControllerModuleAdminSidebar' ) ) :
12
13 final class MywpControllerModuleAdminSidebar extends MywpControllerAbstractModule {
14
15 static protected $id = 'admin_sidebar';
16
17 static private $sidebar = false;
18
19 static private $sidebar_items = false;
20
21 static private $sidebar_items_added_classes = false;
22
23 static private $child_items = array();
24
25 static private $parent_items = array();
26
27 static private $found_parent_item_ids = array();
28
29 static private $current_url = false;
30
31 static private $find_parent_id = array();
32
33 public static function mywp_controller_initial_data( $initial_data ) {
34
35 $initial_data['custom_menu_ui'] = '';
36
37 return $initial_data;
38
39 }
40
41 public static function mywp_controller_default_data( $default_data ) {
42
43 $default_data['custom_menu_ui'] = false;
44
45 return $default_data;
46
47 }
48
49 public static function mywp_wp_loaded() {
50
51 if( ! is_admin() ) {
52
53 return false;
54
55 }
56
57 if( is_network_admin() ) {
58
59 return false;
60
61 }
62
63 if( ! self::is_do_controller() ) {
64
65 return false;
66
67 }
68
69 add_action( 'admin_enqueue_scripts' , array( __CLASS__ , 'admin_enqueue_scripts' ) );
70 add_action( 'admin_head' , array( __CLASS__ , 'hidden_default_menus' ) , 1000 );
71 add_action( 'adminmenu' , array( __CLASS__ , 'render_menus' ) );
72 add_filter( 'mywp_controller_admin_sidebar_get_sidebar_item_added_classes_found_current_item_ids' , array( __CLASS__ , 'mywp_controller_admin_sidebar_get_sidebar_item_added_classes_found_current_item_ids' ) , 9 , 5 );
73
74 }
75
76 private static function get_sidebar() {
77
78 if( !empty( self::$sidebar ) ) {
79
80 return self::$sidebar;
81
82 }
83
84 $args = array( 'post_status' => array( 'publish' ) , 'post_type' => 'mywp_admin_sidebar' , 'order' => 'ASC' , 'orderby' => 'menu_order' , 'posts_per_page' => -1 );
85
86 $args = apply_filters( 'mywp_controller_admin_sidebar_get_sidebar_args' , $args );
87
88 $posts = MywpPostType::get_posts( $args );
89
90 if( empty( $posts ) ) {
91
92 return false;
93
94 }
95
96 $sidebar = apply_filters( 'mywp_controller_admin_sidebar_get_sidebar' , $posts );
97
98 self::$sidebar = $sidebar;
99
100 return $sidebar;
101
102 }
103
104 private static function get_sidebar_items() {
105
106 if( !empty( self::$sidebar_items ) ) {
107
108 return self::$sidebar_items;
109
110 }
111
112 $sidebar = self::get_sidebar();
113
114 if( empty( $sidebar ) ) {
115
116 return false;
117
118 }
119
120 $sidebar_items = array();
121
122 foreach( $sidebar as $key => $sidebar_item ) {
123
124 if( $sidebar_item->item_type == 'default') {
125
126 $sidebar_item = MywpAdminSidebar::default_item_convert( $sidebar_item );
127
128 if( !empty( $sidebar_item ) ) {
129
130 $sidebar_items[] = $sidebar_item;
131
132 }
133
134 } else {
135
136 $sidebar_items[] = $sidebar_item;
137
138 }
139
140 }
141
142 $sidebar_items = apply_filters( 'mywp_controller_admin_sidebar_get_sidebar_item' , $sidebar_items );
143
144 if( empty( $sidebar_items ) ) {
145
146 return false;
147
148 }
149
150 ksort( $sidebar_items );
151
152 self::$sidebar_items = $sidebar_items;
153
154 return $sidebar_items;
155
156 }
157
158 private static function get_sidebar_items_added_classes(){
159
160 if( !empty( self::$sidebar_items_added_classes ) ) {
161
162 return self::$sidebar_items_added_classes;
163
164 }
165
166 $sidebar_items = self::get_sidebar_items();
167
168 if( empty( $sidebar_items ) ) {
169
170 return false;
171
172 }
173
174 foreach( $sidebar_items as $key => $sidebar_item ) {
175
176 if( ! is_object( $sidebar_item ) ) {
177
178 unset( $sidebar_items[ $key ] );
179
180 continue;
181
182 }
183
184 if( empty( $sidebar_item->item_li_class ) ) {
185
186 $sidebar_items[ $key ]->item_li_class = '';
187
188 }
189
190 if( empty( $sidebar_item->item_link_class ) ) {
191
192 $sidebar_items[ $key ]->item_link_class = '';
193
194 }
195
196 if( empty( $sidebar_item->item_link_url ) ) {
197
198 $sidebar_items[ $key ]->item_link_url = '';
199
200 }
201
202 if( empty( $sidebar_item->item_link_url_parse ) ) {
203
204 $sidebar_items[ $key ]->item_link_url_parse = array();
205
206 }
207
208 if( empty( $sidebar_item->item_link_url_parse_query ) ) {
209
210 $sidebar_items[ $key ]->item_link_url_parse_query = array();
211
212 }
213
214 $sidebar_item->item_link_url = do_shortcode( $sidebar_item->item_link_url );
215
216 $sidebar_items[ $key ]->item_link_url = $sidebar_item->item_link_url;
217
218 if( !empty( $sidebar_item->item_link_url ) ) {
219
220 $item_link_url_parse = parse_url( $sidebar_item->item_link_url );
221
222 if( isset( $item_link_url_parse['fragment'] ) ) {
223
224 unset( $item_link_url_parse['fragment'] );
225
226 }
227
228 if( empty( $item_link_url_parse['query'] ) ) {
229
230 $item_link_url_parse['query'] = '';
231
232 }
233
234 $sidebar_items[ $key ]->item_link_url_parse = $item_link_url_parse;
235
236 if( !empty( $item_link_url_parse['query'] ) ) {
237
238 wp_parse_str( $item_link_url_parse['query'] , $item_link_url_parse_query );
239
240 ksort( $item_link_url_parse_query );
241
242 $sidebar_items[ $key ]->item_link_url_parse_query = $item_link_url_parse_query;
243
244 }
245
246 }
247
248 }
249
250 foreach( $sidebar_items as $key => $sidebar_item ) {
251
252 self::$child_items[ $sidebar_item->item_parent ][] = $sidebar_item;
253
254 }
255
256 $tmp = $sidebar_items;
257
258 foreach( $sidebar_items as $key => $sidebar_item ) {
259
260 if( empty( $sidebar_item->item_parent ) ) {
261
262 continue;
263
264 }
265
266 foreach( $tmp as $tmp_key => $tmp_sidebar_item ) {
267
268 if( $tmp_sidebar_item->ID == $sidebar_item->item_parent ) {
269
270 self::$parent_items[ $sidebar_item->ID ][] = $tmp_sidebar_item;
271
272 break;
273
274 }
275
276 }
277
278 }
279
280 unset( $tmp );
281
282 $first = true;
283
284 foreach( $sidebar_items as $key => $sidebar_item ) {
285
286 if( $first ) {
287
288 $sidebar_items[ $key ]->item_li_class .= ' wp-first-item';
289 $sidebar_items[ $key ]->item_link_class .= ' wp-first-item';
290 $first = false;
291
292 }
293
294 if( !empty( $sidebar_item->item_default_id ) && strpos( $sidebar_item->item_default_id , 'separator' ) !== false ) {
295
296 continue;
297
298 }
299
300 if( empty( $sidebar_item->item_parent ) ) {
301
302 $sidebar_items[ $key ]->item_li_class .= ' menu-top';
303 $sidebar_items[ $key ]->item_link_class .= ' menu-top';
304
305 }
306
307 if( !empty( self::$child_items[ $sidebar_item->ID ] ) ) {
308
309 $sidebar_items[ $key ]->item_li_class .= ' wp-has-submenu';
310 $sidebar_items[ $key ]->item_link_class .= ' wp-has-submenu';
311
312 }
313
314 }
315
316 $current_url = self::get_current_url();
317
318 $current_url_parse = parse_url( $current_url );
319 $current_url_query = array();
320
321 if( isset( $current_url_parse['fragment'] ) ) {
322
323 unset( $current_url_parse['fragment'] );
324
325 }
326
327 if( !empty( $current_url_parse['query'] ) ) {
328
329 wp_parse_str( $current_url_parse['query'] , $current_url_query );
330
331 ksort( $current_url_query );
332
333 } else {
334
335 $current_url_parse['query'] = '';
336
337 }
338
339 $found_current_item_ids = array();
340
341 foreach( $sidebar_items as $key => $sidebar_item ) {
342
343 if( empty( $sidebar_item->item_link_url_parse['host'] ) or empty( $sidebar_item->item_link_url_parse['path'] ) ) {
344
345 continue;
346
347 }
348
349 if(
350 $current_url_parse['scheme'] === $sidebar_item->item_link_url_parse['scheme'] &&
351 $current_url_parse['host'] === $sidebar_item->item_link_url_parse['host'] &&
352 $current_url_parse['path'] === $sidebar_item->item_link_url_parse['path'] &&
353 $current_url_query === $sidebar_item->item_link_url_parse_query
354 ) {
355
356 $found_current_item_ids[] = $sidebar_item->ID;
357
358 }
359
360 }
361
362 if( empty( $found_current_item_ids ) ) {
363
364 $identification_query = array();
365
366 if( !empty( $current_url_query['page'] ) ) {
367
368 $identification_query['page'] = $current_url_query['page'];
369
370 }
371
372 if( !empty( $current_url_query['post_type'] ) ) {
373
374 if( $current_url_query['post_type'] != 'post' ) {
375
376 $identification_query['post_type'] = $current_url_query['post_type'];
377
378 }
379
380 }
381
382 if( !empty( $current_url_query['taxonomy'] ) ) {
383
384 $identification_query['taxonomy'] = $current_url_query['taxonomy'];
385
386 }
387
388 foreach( $sidebar_items as $key => $sidebar_item ) {
389
390 if( empty( $sidebar_item->item_link_url_parse['host'] ) or empty( $sidebar_item->item_link_url_parse['path'] ) ) {
391
392 continue;
393
394 }
395
396 if(
397 $current_url_parse['scheme'] === $sidebar_item->item_link_url_parse['scheme'] &&
398 $current_url_parse['host'] === $sidebar_item->item_link_url_parse['host'] &&
399 $current_url_parse['path'] === $sidebar_item->item_link_url_parse['path'] &&
400 http_build_query( $identification_query ) === $sidebar_item->item_link_url_parse['query']
401 ) {
402
403 $found_current_item_ids[] = $sidebar_item->ID;
404
405 }
406
407 }
408
409 }
410
411 $found_current_item_ids = apply_filters( 'mywp_controller_admin_sidebar_get_sidebar_item_added_classes_found_current_item_ids' , $found_current_item_ids , $sidebar_items , $current_url , $current_url_parse , $current_url_query );
412
413 if( !empty( $found_current_item_ids ) ) {
414
415 $found_current_item_ids = array_map( 'strip_tags' , $found_current_item_ids );
416
417 }
418
419 if( !empty( $found_current_item_ids ) ) {
420
421 foreach( $sidebar_items as $key => $sidebar_item ) {
422
423 if( in_array( $sidebar_item->ID , $found_current_item_ids ) ) {
424
425 $sidebar_items[ $key ]->item_li_class .= ' current';
426 $sidebar_items[ $key ]->item_link_class .= ' current';
427
428 }
429
430 }
431
432 foreach( $found_current_item_ids as $found_current_item_id ) {
433
434 $find_item_parents_ids = self::get_find_item_to_parent_ids( $found_current_item_id );
435
436 if( !empty( $find_item_parents_ids ) ) {
437
438 foreach( $sidebar_items as $key => $sidebar_item ) {
439
440 if( ! in_array( $sidebar_item->ID , $find_item_parents_ids ) ) {
441
442 continue;
443
444 }
445
446 $sidebar_items[ $key ]->item_li_class .= ' wp-has-current-submenu wp-menu-open';
447 $sidebar_items[ $key ]->item_link_class .= ' wp-has-current-submenu wp-menu-open';
448
449 }
450
451 }
452
453 }
454
455 }
456
457 $sidebar_items = apply_filters( 'mywp_controller_admin_sidebar_get_sidebar_item_added_classes' , $sidebar_items );
458
459 self::$sidebar_items_added_classes = $sidebar_items;
460
461 return self::$sidebar_items_added_classes;
462
463 }
464
465 public static function mywp_controller_admin_sidebar_get_sidebar_item_added_classes_found_current_item_ids( $found_current_item_ids , $sidebar_items , $current_url , $current_url_parse , $current_url_query ) {
466
467 if( empty( $sidebar_items ) ) {
468
469 return $sidebar_items;
470
471 }
472
473 if( !empty( $found_current_item_ids ) ) {
474
475 return $found_current_item_ids;
476
477 }
478
479 foreach( $sidebar_items as $key => $sidebar_item ) {
480
481 if( empty( $sidebar_item->item_link_url_parse['host'] ) or empty( $sidebar_item->item_link_url_parse['path'] ) ) {
482
483 continue;
484
485 }
486
487 if(
488 $current_url_parse['scheme'] !== $sidebar_item->item_link_url_parse['scheme'] or
489 $current_url_parse['host'] !== $sidebar_item->item_link_url_parse['host']
490 ) {
491
492 continue;
493
494 }
495
496 if( strpos( $current_url_parse['path'] , 'post.php' ) !== false && !empty( $current_url_query['post'] ) ) {
497
498 if( strpos( $sidebar_item->item_link_url_parse['path'] , 'edit.php' ) === false ) {
499
500 continue;
501
502 }
503
504 $post_type = get_post_type( intval( $current_url_query['post'] ) );
505
506 if( empty( $post_type ) ) {
507
508 continue;
509
510 }
511
512 if( $post_type == 'post' && empty( $sidebar_item->item_link_url_parse_query['post_type'] ) ) {
513
514 $found_current_item_ids[] = $sidebar_item->ID;
515
516 } elseif( !empty( $sidebar_item->item_link_url_parse_query['post_type'] ) && $sidebar_item->item_link_url_parse_query === array( 'post_type' => $post_type ) ) {
517
518 $found_current_item_ids[] = $sidebar_item->ID;
519
520 }
521
522 } elseif( strpos( $current_url_parse['path'] , 'term.php' ) !== false && $current_url_query['taxonomy'] ) {
523
524 if( strpos( $sidebar_item->item_link_url_parse['path'] , 'edit-tags.php' ) === false ) {
525
526 continue;
527
528 }
529
530 if( $current_url_query['taxonomy'] == $sidebar_item->item_link_url_parse_query['taxonomy'] ) {
531
532 $found_current_item_ids[] = $sidebar_item->ID;
533
534 }
535
536 } elseif( strpos( $current_url_parse['path'] , 'comment.php' ) !== false ) {
537
538 if( strpos( $sidebar_item->item_link_url_parse['path'] , 'edit-comments.php' ) === false ) {
539
540 continue;
541
542 }
543
544 if( $sidebar_item->item_link_url_parse_query === array() ) {
545
546 $found_current_item_ids[] = $sidebar_item->ID;
547
548 }
549
550 } elseif( strpos( $current_url_parse['path'] , 'theme-install.php' ) !== false ) {
551
552 if( strpos( $sidebar_item->item_link_url_parse['path'] , 'themes.php' ) === false ) {
553
554 continue;
555
556 }
557
558 if( $sidebar_item->item_link_url_parse_query === array() ) {
559
560 $found_current_item_ids[] = $sidebar_item->ID;
561
562 }
563
564 } elseif( strpos( $current_url_parse['path'] , 'user-edit.php' ) !== false ) {
565
566 if( strpos( $sidebar_item->item_link_url_parse['path'] , 'users.php' ) === false ) {
567
568 continue;
569
570 }
571
572 if( $sidebar_item->item_link_url_parse_query === array() ) {
573
574 $found_current_item_ids[] = $sidebar_item->ID;
575
576 }
577
578 }
579
580 }
581
582 return $found_current_item_ids;
583
584 }
585
586 private static function get_find_item_to_parent_ids( $find_id = false ) {
587
588 if( empty( $find_id ) ) {
589
590 return false;
591
592 }
593
594 $find_id = strip_tags( $find_id );
595
596 self::set_find_item_parent_ids( $find_id );
597
598 return self::$found_parent_item_ids;
599
600 }
601
602 private static function set_find_item_parent_ids( $find_id ) {
603
604 if( empty( $find_id ) ) {
605
606 return false;
607
608 }
609
610 if( empty( self::$parent_items[ $find_id ] ) ) {
611
612 return false;
613
614 }
615
616 $parent_items = self::$parent_items[ $find_id ];
617
618 foreach( $parent_items as $parent_item ) {
619
620 self::$found_parent_item_ids[] = $parent_item->ID;
621
622 if( !empty( $parent_item->item_parent ) ) {
623
624 self::set_find_item_parent_ids( $parent_item->ID );
625
626 }
627
628 }
629
630 }
631
632 private static function get_find_menu_items_to_parent_id( $parent_id = 0 ) {
633
634 $sidebar_items_added_classes = self::get_sidebar_items_added_classes();
635
636 if( empty( $sidebar_items_added_classes ) ) {
637
638 return false;
639
640 }
641
642 if( !empty( $parent_id ) ) {
643
644 if( is_numeric( $parent_id ) ) {
645
646 $parent_id = intval( $parent_id );
647
648 } else {
649
650 $parent_id = strip_tags( $parent_id );
651
652 }
653
654 }
655
656 if( !empty( self::$find_parent_id[ $parent_id ] ) ) {
657
658 return self::$find_parent_id[ $parent_id ];
659
660 }
661
662 $find_items = array();
663
664 foreach( $sidebar_items_added_classes as $item ) {
665
666 $item_parent = $item->item_parent;
667
668 if( !empty( $item_parent ) ) {
669
670 if( is_numeric( $item_parent ) ) {
671
672 $item_parent = intval( $item_parent );
673
674 } else {
675
676 $item_parent = strip_tags( $item_parent );
677
678 }
679
680 }
681
682 if( $item_parent !== $parent_id ) {
683
684 continue;
685
686 }
687
688 $find_items[] = $item;
689
690 }
691
692 if( empty( $find_items ) ) {
693
694 return false;
695
696 }
697
698 self::$find_parent_id[ $parent_id ] = $find_items;
699
700 return $find_items;
701
702 }
703
704 private static function get_current_url() {
705
706 if( !empty( self::$current_url ) ) {
707
708 return self::$current_url;
709
710 }
711
712 $current_url = urldecode( do_shortcode( '[mywp_url current="1"]' ) );
713
714 self::$current_url = $current_url;
715
716 return $current_url;
717
718 }
719
720 public static function admin_enqueue_scripts() {
721
722 $sidebar = self::get_sidebar();
723
724 if( empty( $sidebar ) ) {
725
726 return false;
727
728 }
729
730 wp_register_style( 'mywp_admin_sidebar' , MywpApi::get_plugin_url( 'css' ) . 'admin-sidebar.css' , array() , MYWP_VERSION );
731
732 wp_enqueue_style( 'mywp_admin_sidebar' );
733
734 $setting_data = self::get_setting_data();
735
736 if( !empty( $setting_data['custom_menu_ui'] ) ) {
737
738 wp_register_style( 'mywp_admin_sidebar_custom_ui' , MywpApi::get_plugin_url( 'css' ) . 'admin-sidebar-custom-ui.css' , array() , MYWP_VERSION );
739
740 wp_enqueue_style( 'mywp_admin_sidebar_custom_ui' );
741
742 }
743
744 }
745
746 public static function hidden_default_menus() {
747
748 global $menu;
749 global $submenu;
750
751 if( ! self::is_do_function( __FUNCTION__ ) ) {
752
753 return false;
754
755 }
756
757 $sidebar = self::get_sidebar();
758
759 if( empty( $sidebar ) ) {
760
761 return false;
762
763 }
764
765 $menu = array();
766 $submenu = array();
767
768 self::after_do_function( __FUNCTION__ );
769
770 }
771
772 public static function render_menus() {
773
774 if( ! self::is_do_function( __FUNCTION__ ) ) {
775
776 return false;
777
778 }
779
780 $parent_items = self::get_find_menu_items_to_parent_id();
781
782 if( empty( $parent_items ) ) {
783
784 return false;
785
786 }
787
788 foreach( $parent_items as $item ) {
789
790 self::print_sidebar_item( $item );
791
792 }
793
794 self::after_do_function( __FUNCTION__ );
795
796 }
797
798 private static function print_sidebar_item( $item ) {
799
800 if( empty( $item ) or empty( $item->item_type ) or empty( $item->ID ) ) {
801
802 return false;
803
804 }
805
806 $item = apply_filters( 'mywp_controller_admin_sidebar_print_sidebar_item' , $item );
807
808 if( !empty( $item->item_capability ) ) {
809
810 if( ! current_user_can( $item->item_capability ) ) {
811
812 return false;
813
814 }
815
816 }
817
818 $item_id = $item->ID;
819
820 if( is_numeric( $item_id ) ) {
821
822 $item_id = intval( $item_id );
823
824 } else {
825
826 $item_id = strip_tags( $item_id );
827
828 }
829
830
831 $item_type = $item->item_type;
832 $item_parent = $item->item_parent;
833
834 $item->item_link_title = do_shortcode( $item->item_link_title );
835
836 $li_class = '';
837
838 if( !empty( $item->item_li_class ) ) {
839
840 $li_class = $item->item_li_class;
841
842 }
843
844 $li_id = '';
845
846 if( !empty( $item->item_li_id ) ) {
847
848 $li_id = $item->item_li_id;
849
850 }
851
852 printf( '<li class="mywp-sidebar-item item-%d item-type-%s %s" id="%s">' , esc_attr( $item_id ) , esc_attr( $item_type ) , esc_attr( $li_class ) , esc_attr( $li_id ) );
853
854 if( $item_type == 'custom' ) {
855
856 echo do_shortcode( $item->item_custom_html );
857
858 } elseif( in_array( $item_type , array( 'default' , 'link' ) ) ) {
859
860 $link_class = '';
861
862 if( !empty( $item->item_link_class ) ) {
863
864 $link_class = $item->item_link_class;
865
866 }
867
868 $link_id = '';
869
870 if( !empty( $item->item_link_id ) ) {
871
872 $link_id = $item->item_link_id;
873
874 }
875
876 $link_attr = '';
877
878 if( !empty( $item->item_link_attr ) ) {
879
880 $link_attr = $item->item_link_attr;
881
882 }
883
884 printf( '<a href="%s" class="mywp-sidebar-item-link %s" id="%s" %s>' , esc_url( $item->item_link_url ) , esc_attr( $link_class ) , esc_attr( $link_id ) , esc_attr( $link_attr ) );
885
886 $icon_class = '';
887
888 if( !empty( $item->item_icon_class ) ) {
889
890 $icon_class = $item->item_icon_class;
891
892 }
893
894 $icon_id = '';
895
896 if( !empty( $item->item_icon_id ) ) {
897
898 $icon_id = $item->item_icon_id;
899
900 }
901
902 $icon_title = '';
903
904 if( !empty( $item->item_icon_title ) ) {
905
906 $icon_title = $item->item_icon_title;
907
908 }
909
910 $icon_style = '';
911
912 if( !empty( $item->item_icon_style ) ) {
913
914 $icon_style = $item->item_icon_style;
915
916 }
917
918 $icon_img = '';
919
920 if( !empty( $item->item_icon_img ) ) {
921
922 $icon_img = $item->item_icon_img;
923
924 }
925
926 if( !empty( $item->item_icon_img ) ) {
927
928 printf( '<img src="%s" alt="%s"></div>' , esc_attr( $icon_img ) , esc_attr( $icon_title ) );
929
930 } elseif( !empty( $icon_class ) or !empty( $icon_style ) or !empty( $icon_id ) ) {
931
932 printf( '<div class="wp-menu-image mywp-sidebar-item-icon %s" id="%s" style="%s">%s</div>' , esc_attr( $icon_class ) , esc_attr( $icon_id ) , $icon_style , $icon_title );
933
934 } else {
935
936 echo do_action( 'mywp_controller_admin_sidebar_print_sidebar_item_icon' , $item );
937
938 }
939
940 printf( '<div class="wp-menu-name mywp-sidebar-name">%s</div>' , $item->item_link_title );
941
942 echo '</a>';
943
944 $child_items = self::get_find_menu_items_to_parent_id( $item_id );
945
946 if( !empty( $child_items ) ) {
947
948 echo '<ul class="wp-submenu wp-submenu-wrap mywp-sidebar-item-childs">';
949
950 printf( '<li class="wp-submenu-head" aria-hidden="true">%s</li>' , $item->item_link_title );
951
952 foreach( $child_items as $child_item ) {
953
954 self::print_sidebar_item( $child_item );
955
956 }
957
958 echo '</ul>';
959
960 }
961
962 }
963
964 echo '</li>';
965
966 }
967
968 }
969
970 MywpControllerModuleAdminSidebar::init();
971
972 endif;
973