PluginProbe
Booking Calendar / 10.11.2
Booking Calendar v10.11.2
11.8.3 11.8.2 11.8.1 11.8 11.7 11.6.1 11.6 11.5 11.4.3 11.4.2 11.4.1 11.4 11.3 11.2.1 11.2 11.1 11.0 10.15.7 10.15.6 10.1.3 10.10 10.10.1 10.10.2 10.11 10.11.2 All 203 releases
booking / includes / ui_settings / elements / ui_el__dropdown_menu.php

ui_el__dropdown_menu.php in Booking Calendar 10.11.2, at includes/ui_settings/elements/ui_el__dropdown_menu.php

201 lines 7.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Admin Panel UI - Parts
4 *
5 * @version 1.2
6 * @package Any
7 * @category Page Structure in Admin Panel
8 * @author wpdevelop
9 *
10 * @web-site https://wpbookingcalendar.com/
11 * @email info@wpbookingcalendar.com
12 *
13 * @modified 2025-02-15
14 */
15
16 if ( ! defined( 'ABSPATH' ) ) {
17 exit; // Exit, if accessed directly.
18 }
19
20 /**
21 * Show Drop Down menu.
22 *
23 * @param array $args - parameters.
24 *
25 * @return void
26 */
27 function wpbc_ui_el__dropdown_menu( $args ) {
28
29 $defaults = array(
30 'title' => '',
31 'hint' => '', // Example : array -> 'title' => 'Manage bookings' , 'position' => 'top' .
32 'font_icon' => '',
33
34 'title_html' => '', // Alternative to 'title'.
35 'svg_icon' => '', // Alternative to 'font_icon'.
36 'svg_icon_class' => 'wpbc_svg_icon_class',
37 'svg_icon_style' => '',
38
39 'position' => '',
40 'has_down_arrow' => true, // Show or Hide down arrow at right side.
41 'has_border' => false, // Show border, like in selectbox.
42 'style' => '',
43 'class' => '',
44 'container_class' => '',
45 'container_style' => '',
46 'attr' => array(),
47 'items' => array(),
48 );
49 $params = wp_parse_args( $args, $defaults );
50
51
52 ?><div class="wpbc_ui_el wpbc_ui_el_container wpbc_ui_el__dropdown <?php echo esc_attr( $params['container_class'] ); ?>" style="<?php echo esc_attr( $params['container_style'] ); ?>">
53 <a href="javascript:void(0)"
54 data-toggle="wpbc_dropdown"
55 aria-expanded="true"
56 class="ul_dropdown_menu_toggle
57 <?php
58 echo esc_attr( ( ! empty( $params['has_down_arrow'] ) ) ? ' has_down_arrow ' : '' );
59 echo esc_attr( ( ! empty( $params['has_border'] ) ) ? ' has_border ' : '' );
60 echo esc_attr( ( ! empty( $params['hint'] ) ) ? ' tooltip_' . $params['hint']['position'] . ' ' : '' );
61 echo esc_attr( ' ' . $params['class'] . ' ' );
62 ?>
63 "
64 style="<?php echo esc_attr( $params['style'] ); ?>"
65 <?php
66 if ( ! empty( $params['hint'] ) ) {
67 echo ' title="' . esc_attr( $params['hint']['title'] ) . '" ';
68 }
69 echo wpbc_get_custom_attr( $params ); /* phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped */
70 ?>
71 >
72 <?php
73
74 if ( ! empty( $params['font_icon'] ) ) {
75 // Font Icon.
76 ?><i class="menu_icon icon-1x <?php echo wp_kses_post( $params['font_icon'] ); ?>"></i><?php
77 }
78 if ( ! empty( $params['svg_icon'] ) ) {
79 // SVG Icon.
80 ?><i class="menu_icon <?php echo esc_attr($params['svg_icon_class']); ?>" style="<?php echo esc_attr($params['svg_icon_style']); ?>;background-image: url('<?php echo esc_attr($params['svg_icon']); ?>');"></i><?php
81 }
82 if ( ! empty( $params['title'] ) ){
83 ?><span class="nav-tab-text"><?php echo wp_kses_post( $params['title'] ); ?></span><?php
84 }
85 if ( ! empty( $params['title_html'] ) ) {
86 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
87 echo $params['title_html'];
88 }
89 ?></a><?php
90
91
92
93 ?><ul class="ul_dropdown_menu" role="menu" style="<?php echo( ( $params['position'] == 'right' ) ? 'right:0px; left:auto;' : '' ); ?>">
94 <?php
95
96 foreach ( $params['items'] as $items ) {
97
98 if ( ( empty( $items['type'] ) ) && ( ! empty( $items['html'] ) ) ) {
99 $items['type'] = 'html';
100 }
101 if ( empty( $items['type'] ) ) {
102 continue;
103 }
104 switch ( $items['type'] ) {
105
106 case 'divider':
107 echo '<li class="divider' . esc_attr( ( ! empty( $items['class'] ) ) ? ' ' . $items['class'] : '' ) . '"></li>';
108 break;
109
110 case 'html':
111 echo '<li ' . wpbc_get_custom_attr( $items ) . '>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
112 echo $items['html']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
113 echo '</li>';
114 break;
115
116 case 'header':
117 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
118 echo '<li ' . wpbc_get_custom_attr( $items ) . ' class="dropdown-header' . esc_attr( ( ! empty( $items['class'] ) ) ? ' ' . $items['class'] : '' ) . '">';
119 echo wp_kses_post( $items['title'] );
120 echo '</li>';
121 break;
122
123 default:
124 echo '<li>';
125 echo '<a href="' . esc_attr( $items['url'] ) . '" ' . wpbc_get_custom_attr( $items ) . '>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
126 echo wp_kses_post( $items['title'] );
127 echo '</a>';
128 echo '</li>';
129 break;
130 }
131 }
132
133 ?></ul></div><?php
134 }
135
136 /**
137 * Usage Example:
138 *
139 $el_arr = array(
140 'title' => __( 'Booking Calendar', 'booking' ),
141 'font_icon' => 'wpbc-bi-calendar2-range',
142 'position' => 'left',
143 'items' => array(
144 array(
145 'type' => 'link',
146 'title' => __( 'FAQ', 'booking' ),
147 'url' => 'https://wpbookingcalendar.com/faq/',
148 ),
149 array( 'type' => 'divider' ),
150 array(
151 'type' => 'link',
152 'title' => __( 'Support Forum', 'booking' ),
153 'url' => 'https://wpbookingcalendar.com/support/',
154 ),
155 array(
156 'type' => 'html',
157 'html' => '<span class="wpbc_flex_settings_containers" style="flex-flow:row nowrap;display:flex;">
158 <div id="wpbc_general_settings_calendar_tab" class="wpbc_settings_navigation_item wpbc_settings_navigation_item_active" style="min-width:350px;">
159 <a class="" original-title="" onclick="javascript:wpbc_navigation_click_show_section(this,\'#wpbc_general_settings_calendar_metabox\' );" href="javascript:void(0);">
160 <i class="menu_icon icon-1x wpbc-bi-calendar3-week"></i>
161 <div class="wpbc_text_inside">
162 <div class="wpbc_flex_settings_title"><div>Calendar Look</div><div>01</div></div>
163 <div class="wpbc_flex_settings_description">Set Calendar Skin, Max Months to Scroll, Calendar Legend</div>
164 </div>
165 </a>
166 </div>
167 <div id="wpbc_general_settings_calendar_tab" class="wpbc_settings_navigation_item wpbc_settings_navigation_item_active" style="min-width:350px;">
168 <a class="" original-title="" onclick="javascript:wpbc_navigation_click_show_section(this,\'#wpbc_general_settings_calendar_metabox\' );" href="javascript:void(0);">
169 <i class="menu_icon icon-1x wpbc-bi-calendar3-week"></i>
170 <div class="wpbc_text_inside">
171 <div class="wpbc_flex_settings_title"><div>Days Selection</div><div>02</div></div>
172 <div class="wpbc_flex_settings_description">Single Day, Multi Days or Range Days Selection (Min/Max days )</div>
173 </div>
174 </a>
175 </div>
176 </span>',
177 ),
178 array(
179 'type' => 'header',
180 'title' => __( 'Contact Support', 'booking' ),
181 ),
182 array(
183 'type' => 'link',
184 'title' => __( 'Contact Support', 'booking' ),
185 'url' => 'mailto:support@wpbookingcalendar.com',
186 'attr' => array( 'style' => 'font-weight: 600;' ),
187 ),
188 array(
189 'type' => 'link',
190 'title' => "What's New",
191 'url' => esc_url( admin_url( add_query_arg( array( 'page' => 'wpbc-about' ), 'index.php' ) ) ),
192 ),
193 array(
194 'type' => 'link',
195 'title' => __( 'About', 'booking' ),
196 'url' => 'https://wpbookingcalendar.com/',
197 ),
198 ),
199 );
200 wpbc_ui_el__dropdown_menu( $el_arr );
201 */