| 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 |
function wpbc_ui__get_root_menu_arr() { |
| 21 |
|
| 22 |
$icn = '<i style="margin: 0;margin-left: auto;" class="wpbc_ui_el__vert_nav_icon menu_icon icon-1x wpbc-bi-chevron-right arrow-right-short"></i>'; |
| 23 |
|
| 24 |
$pages_arr = array( |
| 25 |
'wpbc' => array( |
| 26 |
'type' => 'menu', |
| 27 |
'title' => __( 'Bookings', 'booking' ), |
| 28 |
'font_icon' => 'wpbc-bi-collection', |
| 29 |
), |
| 30 |
'wpbc-new' => array( |
| 31 |
'type' => 'menu', |
| 32 |
'title' => __( 'Add Booking', 'booking' ), |
| 33 |
'font_icon' => 'wpbc-bi-plus', |
| 34 |
'url' => wpbc_get_new_booking_url(), |
| 35 |
), |
| 36 |
'wpbc-divider-1' => array( |
| 37 |
'type' => 'divider', |
| 38 |
), |
| 39 |
'wpbc-availability' => array( |
| 40 |
'type' => 'menu', |
| 41 |
'title' => __( 'Availability', 'booking' ), |
| 42 |
'font_icon' => 'wpbc-bi-calendar-week', |
| 43 |
), |
| 44 |
); |
| 45 |
|
| 46 |
if ( class_exists('wpdev_bk_biz_m') ) { |
| 47 |
$pages_arr['wpbc-prices'] = array( |
| 48 |
'type' => 'menu', |
| 49 |
'title' => __( 'Prices', 'booking' ), |
| 50 |
'font_icon' => 'wpbc-bi-cash-stack', |
| 51 |
); |
| 52 |
} |
| 53 |
|
| 54 |
if ( class_exists('wpdev_bk_personal') ) { |
| 55 |
$pages_arr['wpbc-resources'] = array( |
| 56 |
'type' => 'menu', |
| 57 |
'title' => __( 'Resources', 'booking' ), |
| 58 |
'font_icon' => 'wpbc-bi-list', |
| 59 |
); |
| 60 |
} else { |
| 61 |
$pages_arr['wpbc-resources'] = array( |
| 62 |
'type' => 'menu', |
| 63 |
'title' => __( 'Resource', 'booking' ) . ' / ' . __( 'Publish', 'booking' ), |
| 64 |
'font_icon' => 'wpbc-bi-list', |
| 65 |
); |
| 66 |
} |
| 67 |
$pages_arr['wpbc-divider-2'] = array( |
| 68 |
'type' => 'divider', |
| 69 |
); |
| 70 |
$pages_arr['wpbc-settings'] = array( |
| 71 |
'type' => 'menu', |
| 72 |
'title' => __( 'Settings', 'booking' ), |
| 73 |
'font_icon' => 'wpbc_icn_settings', |
| 74 |
); |
| 75 |
|
| 76 |
return $pages_arr; |
| 77 |
} |
| 78 |
|
| 79 |
/** |
| 80 |
* Show Left Vaertical Navigation Bar |
| 81 |
* |
| 82 |
* @param array $args - parameters. |
| 83 |
* |
| 84 |
* @return void |
| 85 |
*/ |
| 86 |
function wpbc_ui__left_vertical_nav( $args =array() ) { |
| 87 |
|
| 88 |
$defaults = array( |
| 89 |
'attr' => array(), |
| 90 |
); |
| 91 |
$params = wp_parse_args( $args, $defaults ); |
| 92 |
|
| 93 |
// Ability to click on panel, only if there 'min' class - panel minimized! |
| 94 |
echo '<div class="wpbc_ui_el__vert_left_bar__wrapper" onclick="javascript:if ( jQuery( this ).parent(\'.wpbc_settings_page_wrapper\').hasClass(\'min\') ) { wpbc_admin_ui__sidebar_left__do_max(); }" >'; |
| 95 |
|
| 96 |
$active_page_arr = array( |
| 97 |
'active_page' => $args['active_page'], // wpbc-settings. |
| 98 |
'active_tab' => $args ['active_tab'], // calendar_appearance. |
| 99 |
'active_subtab' => $args['active_subtab'], // calendar_appearance_skin. |
| 100 |
); |
| 101 |
|
| 102 |
// Available Main Menu - slug => titles. |
| 103 |
$root_menu_arr = wpbc_ui__get_root_menu_arr(); |
| 104 |
|
| 105 |
echo ' <div class="wpbc_ui_el__vert_left_bar__content">'; |
| 106 |
|
| 107 |
wpbc_ui__vert_left_bar__section__root_menu( $root_menu_arr ); |
| 108 |
|
| 109 |
// Loop to show all main sections in vertical menu. |
| 110 |
foreach ( $root_menu_arr as $main_page_slug => $root_menu_options_arr ) { |
| 111 |
|
| 112 |
if ( 'menu' !== $root_menu_options_arr['type'] ) { |
| 113 |
continue; |
| 114 |
} |
| 115 |
|
| 116 |
$page_title = $root_menu_options_arr['title']; |
| 117 |
|
| 118 |
echo ' <div class="wpbc_ui_el__vert_left_bar__section wpbc_ui_el__vert_left_bar__section_' . |
| 119 |
esc_attr( $main_page_slug ) . |
| 120 |
(( $main_page_slug !== $active_page_arr['active_page'] ) ? ' wpbc_ui__hide ' : '') . |
| 121 |
'">'; |
| 122 |
|
| 123 |
// Show only active page settings list. |
| 124 |
if ( $main_page_slug !== $active_page_arr['active_page'] ) { |
| 125 |
//continue; |
| 126 |
} |
| 127 |
$page_item_arr = $args['page_nav_tabs'][ $main_page_slug ]; |
| 128 |
|
| 129 |
// Section Header. |
| 130 |
echo '<div class="wpbc_ui_el__row100 wpbc_ui_el__expand_colapse_btns">'; |
| 131 |
|
| 132 |
|
| 133 |
wpbc_ui__vert_menu__show_section_header_go_back( $page_title ); |
| 134 |
|
| 135 |
wpbc_ui__vert_left_bar__do_compact(); |
| 136 |
wpbc_ui__vert_left_bar__do_max(); |
| 137 |
|
| 138 |
echo '</div>'; |
| 139 |
|
| 140 |
wpbc_ui_el__divider_horizontal(); |
| 141 |
|
| 142 |
foreach ( $page_item_arr as $main_menu_slug => $menu_item_arr ) { |
| 143 |
|
| 144 |
$folder_style = ( ! empty( $menu_item_arr['folder_style'] ) ) ? esc_attr( $menu_item_arr['folder_style'] ) : ''; |
| 145 |
|
| 146 |
$folder_css = ''; |
| 147 |
if ( ( ! empty( $menu_item_arr['subtabs'] ) ) && ( ! empty( $menu_item_arr['is_active'] ) ) ) { |
| 148 |
$folder_css .= ' expanded'; |
| 149 |
} |
| 150 |
|
| 151 |
echo '<div class="wpbc_ui_el__level__folder ' . esc_attr( $folder_css ) . '" style="' . esc_attr( $folder_style ) . '">'; |
| 152 |
|
| 153 |
|
| 154 |
if ( empty( $menu_item_arr['type'] ) ) { |
| 155 |
$menu_item_arr['type'] = 'main'; |
| 156 |
} |
| 157 |
|
| 158 |
switch ( $menu_item_arr['type'] ) { |
| 159 |
|
| 160 |
case 'separator': |
| 161 |
wpbc_ui_el__divider_horizontal(); |
| 162 |
break; |
| 163 |
|
| 164 |
case 'html': |
| 165 |
wpbc_ui__vert_menu__item_html( $main_menu_slug, $menu_item_arr ); |
| 166 |
break; |
| 167 |
|
| 168 |
default: |
| 169 |
wpbc_ui__vert_menu__item_main( $main_menu_slug, $menu_item_arr ); |
| 170 |
} |
| 171 |
|
| 172 |
|
| 173 |
foreach ( $menu_item_arr['subtabs'] as $main_submenu_slug => $submenu_item_arr ) { |
| 174 |
|
| 175 |
if ( empty( $submenu_item_arr['type'] ) ) { |
| 176 |
$submenu_item_arr['type'] = 'subtab'; |
| 177 |
} |
| 178 |
|
| 179 |
switch ( $submenu_item_arr['type'] ) { |
| 180 |
|
| 181 |
case 'subtab': |
| 182 |
wpbc_ui__vert_menu__item_sub( $main_submenu_slug, $submenu_item_arr ); |
| 183 |
break; |
| 184 |
|
| 185 |
case 'separator': |
| 186 |
wpbc_ui__vert_menu__item_separtor( $main_submenu_slug, $submenu_item_arr ); |
| 187 |
break; |
| 188 |
|
| 189 |
case 'html': |
| 190 |
wpbc_ui__vert_menu__item_html( $main_submenu_slug, $submenu_item_arr ); |
| 191 |
break; |
| 192 |
|
| 193 |
default: |
| 194 |
} |
| 195 |
} |
| 196 |
echo '</div><!-- wpbc_ui_el__level__folder -->'; |
| 197 |
} |
| 198 |
echo ' </div><!-- wpbc_ui_el__vert_left_bar__section -->'; |
| 199 |
} // Loop to show all main sections in vertical menu. |
| 200 |
echo ' </div><!-- wpbc_ui_el__vert_left_bar__content -->'; |
| 201 |
|
| 202 |
echo '</div><!-- wpbc_ui_el__vert_left_bar__wrapper -->'; |
| 203 |
} |
| 204 |
|
| 205 |
|
| 206 |
/* == Elements in Left menu ========================================================================================= */ |
| 207 |
|
| 208 |
/** |
| 209 |
* Show element - "Open / Hide Left Vertical Navigation" panel |
| 210 |
* |
| 211 |
* @return void |
| 212 |
*/ |
| 213 |
function wpbc_ui__vert_left_bar__do_toggle() { |
| 214 |
|
| 215 |
$el_arr = array(); |
| 216 |
$el_arr['font_icon'] = 'wpbc_icn_menu'; |
| 217 |
$el_arr['container_style'] = 'padding:0 8px;'; |
| 218 |
$el_arr['container_class'] = 'wpbc_ui__top_nav__btn_show_left_vertical_nav'; |
| 219 |
$el_arr['onclick'] = "if ( jQuery( '.wpbc_ui_el__vert_left_bar__content' ).is( ':visible' ) ) {"; |
| 220 |
$el_arr['onclick'] .= ' wpbc_admin_ui__sidebar_left__do_min(); '; |
| 221 |
$el_arr['onclick'] .= '} else {'; |
| 222 |
$el_arr['onclick'] .= ' wpbc_admin_ui__sidebar_left__do_max(); '; |
| 223 |
$el_arr['onclick'] .= '}'; |
| 224 |
$el_arr['hint'] = array( |
| 225 |
'title' => __( 'Toggle side menu', 'booking' ), |
| 226 |
'position' => 'bottom', |
| 227 |
); |
| 228 |
wpbc_ui_el__a( $el_arr ); |
| 229 |
} |
| 230 |
|
| 231 |
/** |
| 232 |
* Show element - "Max - Vertical Navigation" panel |
| 233 |
* |
| 234 |
* @return void |
| 235 |
*/ |
| 236 |
function wpbc_ui__vert_left_bar__do_max() { |
| 237 |
|
| 238 |
$el_arr = array(); |
| 239 |
$el_arr['container_style'] = ''; |
| 240 |
$el_arr['container_class'] = 'wpbc_ui__top_nav__btn_open_left_vertical_nav wpbc_ui__hide'; |
| 241 |
$el_arr['onclick'] = ' wpbc_admin_ui__sidebar_left__do_max(); '; |
| 242 |
$el_arr['font_icon'] = 'wpbc-bi-box-arrow-right'; |
| 243 |
$el_arr['hint'] = array( |
| 244 |
'title' => __( 'Open side menu', 'booking' ), |
| 245 |
'position' => 'bottom', |
| 246 |
); |
| 247 |
wpbc_ui_el__a( $el_arr ); |
| 248 |
} |
| 249 |
|
| 250 |
/** |
| 251 |
* Show element - "Compact - Vertical Navigation" panel |
| 252 |
* |
| 253 |
* @return void |
| 254 |
*/ |
| 255 |
function wpbc_ui__vert_left_bar__do_compact() { |
| 256 |
|
| 257 |
$el_arr = array(); |
| 258 |
$el_arr['container_style'] = ''; |
| 259 |
$el_arr['container_class'] = 'wpbc_ui__top_nav__btn_hide_left_vertical_nav'; |
| 260 |
$el_arr['onclick'] = ' wpbc_admin_ui__sidebar_left__do_compact(); '; |
| 261 |
$el_arr['font_icon'] = 'wpbc-bi-box-arrow-left'; |
| 262 |
$el_arr['hint'] = array( |
| 263 |
'title' => __( 'Set side menu compact', 'booking' ), |
| 264 |
'position' => 'bottom', |
| 265 |
); |
| 266 |
wpbc_ui_el__a( $el_arr ); |
| 267 |
} |
| 268 |
|
| 269 |
/** |
| 270 |
* Show element - "X - Close (none)" panel |
| 271 |
* |
| 272 |
* @return void |
| 273 |
*/ |
| 274 |
function wpbc_ui__vert_left_bar__do_none() { |
| 275 |
|
| 276 |
$el_arr = array(); |
| 277 |
$el_arr['container_style'] = ''; |
| 278 |
$el_arr['container_class'] = 'wpbc_ui__top_nav__btn_hide_left_vertical_nav'; |
| 279 |
$el_arr['onclick'] = ' wpbc_admin_ui__sidebar_left__do_hide(); '; |
| 280 |
$el_arr['font_icon'] = 'wpbc_icn_close'; |
| 281 |
$el_arr['hint'] = array( |
| 282 |
'title' => __( 'Close side menu', 'booking' ), |
| 283 |
'position' => 'bottom', |
| 284 |
); |
| 285 |
wpbc_ui_el__a( $el_arr ); |
| 286 |
} |
| 287 |
|
| 288 |
/** |
| 289 |
* Show element - "_ - Min" panel |
| 290 |
* |
| 291 |
* @return void |
| 292 |
*/ |
| 293 |
function wpbc_ui__vert_left_bar__do_min() { |
| 294 |
|
| 295 |
$el_arr = array(); |
| 296 |
$el_arr['container_style'] = ''; |
| 297 |
$el_arr['container_class'] = 'wpbc_ui__top_nav__btn_hide_left_vertical_nav'; |
| 298 |
$el_arr['onclick'] = ' wpbc_admin_ui__sidebar_left__do_min(); '; |
| 299 |
$el_arr['font_icon'] = 'wpbc_icn_minimize'; |
| 300 |
$el_arr['hint'] = array( |
| 301 |
'title' => __( 'Minimize side menu', 'booking' ), |
| 302 |
'position' => 'bottom', |
| 303 |
); |
| 304 |
wpbc_ui_el__a( $el_arr ); |
| 305 |
} |
| 306 |
|
| 307 |
/** |
| 308 |
* Show Section Header - e.g. ' SETTINGS ' |
| 309 |
* |
| 310 |
* @param string $page_title - title to show. |
| 311 |
* |
| 312 |
* @return void |
| 313 |
*/ |
| 314 |
function wpbc_ui__vert_menu__show_section_header_go_back( $page_title ) { |
| 315 |
|
| 316 |
?> |
| 317 |
<a onclick="javascript:wpbc_admin_ui__sidebar_left__show_section('main_menus');" href="javascript:void(0)" |
| 318 |
class="wpbc_ui_el__go_back wpbc_ui_el hide_in_compact_mode" > |
| 319 |
<i class="menu_icon icon-1x wpbc_icn_navigate_before"></i> |
| 320 |
<?php |
| 321 |
wpbc_ui__vert_menu__show_section_header( __( 'Go back', 'booking' ) ); |
| 322 |
?> |
| 323 |
</a> |
| 324 |
<?php |
| 325 |
} |
| 326 |
|
| 327 |
/** |
| 328 |
* Left Sidebar. |
| 329 |
* |
| 330 |
* @param array $pages_arr |
| 331 |
* |
| 332 |
* @return void |
| 333 |
*/ |
| 334 |
function wpbc_ui__vert_left_bar__section__root_menu( $pages_arr ) { |
| 335 |
|
| 336 |
?> |
| 337 |
<div class="wpbc_ui_el__vert_left_bar__section wpbc_ui_el__vert_left_bar__section_main_menus wpbc_ui__hide"> |
| 338 |
<?php |
| 339 |
|
| 340 |
// Section Header. |
| 341 |
echo '<div class="wpbc_ui_el__row100 wpbc_ui_el__expand_colapse_btns">'; |
| 342 |
// wpbc_ui__vert_menu__show_section_header( __( 'Main menu', 'booking' ) ); |
| 343 |
wpbc_ui__vert_left_bar__do_compact(); |
| 344 |
wpbc_ui__vert_left_bar__do_max(); |
| 345 |
echo '</div>'; |
| 346 |
wpbc_ui_el__divider_horizontal(); |
| 347 |
|
| 348 |
foreach ( $pages_arr as $page_slug => $main_page_options_arr ) { |
| 349 |
|
| 350 |
switch ( $main_page_options_arr['type'] ) { |
| 351 |
|
| 352 |
case 'divider': |
| 353 |
wpbc_ui_el__divider_horizontal(); |
| 354 |
break; |
| 355 |
|
| 356 |
case 'menu': |
| 357 |
default: |
| 358 |
$page_title = $main_page_options_arr['title']; |
| 359 |
|
| 360 |
echo '<div class="wpbc_ui_el__vert_nav_item wpbc_ui_el__vert_nav_item_root wpbc_ui_el__vert_nav_item__' . esc_attr( $page_slug ) . '">'; |
| 361 |
if ( ! empty( $main_page_options_arr['url'] ) ) { |
| 362 |
echo ' <a href="' . esc_url( $main_page_options_arr['url'] ) . '" class="wpbc_ui_el__vert_nav_item__a wpbc_ui_el__vert_nav_item__single">'; |
| 363 |
} else { |
| 364 |
echo ' <a onclick="wpbc_admin_ui__sidebar_left__show_section(\'' . esc_attr( $page_slug ) . '\');" href="javascript:void(0)" class="wpbc_ui_el__vert_nav_item__a wpbc_ui_el__vert_nav_item__single">'; |
| 365 |
} |
| 366 |
|
| 367 |
echo ' <i class="wpbc_ui_el__vert_nav_icon menu_icon icon-1x ' . esc_attr( $main_page_options_arr['font_icon'] ) . '"></i>'; |
| 368 |
echo ' <span class="wpbc_ui_el__vert_nav_title hide_in_compact_mode">' . esc_html( $page_title ) . '</span>'; |
| 369 |
if ( empty( $main_page_options_arr['url'] ) ) { |
| 370 |
echo ' <i class="wpbc_ui_el__vert_nav_icon wpbc_ui_el__vert_nav_icon_arrow menu_icon icon-1x wpbc-bi-chevron-right"></i>'; |
| 371 |
} |
| 372 |
echo ' </a>'; |
| 373 |
echo '</div>'; |
| 374 |
} |
| 375 |
} |
| 376 |
?> |
| 377 |
</div> |
| 378 |
<?php |
| 379 |
} |
| 380 |
|
| 381 |
/** |
| 382 |
* Show Section Header - e.g. ' SETTINGS ' |
| 383 |
* |
| 384 |
* @param string $page_title - title to show. |
| 385 |
* |
| 386 |
* @return void |
| 387 |
*/ |
| 388 |
function wpbc_ui__vert_menu__show_section_header( $page_title ) { |
| 389 |
|
| 390 |
echo '<h2 class="wpbc_ui_el__section_header hide_in_compact_mode">' . wp_kses_post( $page_title ) . '</h2>'; |
| 391 |
} |
| 392 |
|
| 393 |
/** |
| 394 |
* Show main menu item. |
| 395 |
* |
| 396 |
* @param string $menu_slug - 'calendar_appearance'. |
| 397 |
* @param array $menu_item_arr - [ [title] => Skin |
| 398 |
* [page_title] => Calendar General Settings 3 |
| 399 |
* [hint] => Calendar General Settings 2 |
| 400 |
* [link] => |
| 401 |
* [position] => |
| 402 |
* [css_classes] => |
| 403 |
* [icon] => |
| 404 |
* [font_icon] => wpbc-bi-calendar2-range |
| 405 |
* [default] => |
| 406 |
* [disabled] => |
| 407 |
* [hided] => |
| 408 |
* [is_active] => 1 |
| 409 |
* [url] => http://beta/wp-admin/admin.php?page=wpbc-settings&tab=calendar_appearance |
| 410 |
* [subtabs] => [....] |
| 411 |
* ] |
| 412 |
* |
| 413 |
* @return void |
| 414 |
*/ |
| 415 |
function wpbc_ui__vert_menu__item_main( $menu_slug, $menu_item_arr ) { |
| 416 |
|
| 417 |
$defaults = array( |
| 418 |
'title' => '', |
| 419 |
'page_title' => '', |
| 420 |
'hint' => '', |
| 421 |
'link' => '', |
| 422 |
'position' => '', |
| 423 |
'css_classes' => '', |
| 424 |
'icon' => '', |
| 425 |
'font_icon' => '', |
| 426 |
'default' => false, |
| 427 |
'disabled' => false, |
| 428 |
'hided' => false, |
| 429 |
'is_active' => 0, |
| 430 |
'url' => '', |
| 431 |
'subtabs' => array(), |
| 432 |
); |
| 433 |
$menu_item_arr = wp_parse_args( $menu_item_arr, $defaults ); |
| 434 |
|
| 435 |
// CSS Classes. |
| 436 |
$menu_css_arr = array(); |
| 437 |
$menu_css_arr[] = 'wpbc_ui_el__vert_nav_item'; |
| 438 |
$menu_css_arr[] = 'wpbc_ui_el__vert_nav_item__' . esc_attr( $menu_slug ); |
| 439 |
|
| 440 |
if ( ( empty( $menu_item_arr['subtabs'] ) ) && ( ! empty( $menu_item_arr['is_active'] ) ) ) { |
| 441 |
$menu_css_arr[] = 'active'; |
| 442 |
} |
| 443 |
if ( isset( $menu_item_arr['css_classes'] ) ) { |
| 444 |
$menu_css_arr[] = $menu_item_arr['css_classes']; |
| 445 |
} |
| 446 |
$menu_css_str = implode( ' ', $menu_css_arr ); |
| 447 |
|
| 448 |
// Styles. |
| 449 |
$menu_style_str = ( isset( $menu_item_arr['style'] ) ) ? $menu_item_arr['style'] : ''; |
| 450 |
|
| 451 |
|
| 452 |
?><div class="<?php echo esc_attr( $menu_css_str ); ?>" style="<?php echo esc_attr( $menu_style_str ); ?>"> |
| 453 |
<?php |
| 454 |
if ( ! empty( $menu_item_arr['subtabs'] ) ) { |
| 455 |
// Folder Item - expand / colapse. |
| 456 |
?> |
| 457 |
<a href="javascript:void(0)" |
| 458 |
onclick="javascript: wpbc_admin_ui__sidebar_left__do_max(); if( ! jQuery( this ).parents('.wpbc_ui_el__level__folder').hasClass('expanded') ) { jQuery( '.wpbc_ui_el__level__folder' ).removeClass('expanded');jQuery( this ).parents('.wpbc_ui_el__level__folder').addClass('expanded'); } else {jQuery( '.wpbc_ui_el__level__folder' ).removeClass('expanded');} " |
| 459 |
class="wpbc_ui_el__vert_nav_item__a wpbc_ui_el__vert_nav_item__folder"> |
| 460 |
<?php if ( ! empty( $menu_item_arr['font_icon'] ) ) { ?> |
| 461 |
<i class="wpbc_ui_el__vert_nav_icon menu_icon icon-1x <?php echo esc_attr( $menu_item_arr['font_icon'] ); ?>" |
| 462 |
title="<?php echo ( ! empty( $menu_item_arr['hint'] ) ) ? esc_attr( wp_strip_all_tags( $menu_item_arr['hint'] ) ) : esc_attr( wp_strip_all_tags( $menu_item_arr['title'] ) ); ?>" |
| 463 |
></i> |
| 464 |
<?php } ?> |
| 465 |
<span class="wpbc_ui_el__vert_nav_title hide_in_compact_mode"><?php echo wp_kses_post( $menu_item_arr['title'] ); ?></span> |
| 466 |
<i class="wpbc_ui_el__vert_nav_icon_right tooltip_right menu_icon icon-1x wpbc_ui_el__vert_nav_icon_expanded hide_in_compact_mode wpbc-bi-dash-square-dotted" data-original-title="<?php echo esc_attr_e( 'Collapse', 'booking' ); ?>"></i> |
| 467 |
<i class="wpbc_ui_el__vert_nav_icon_right tooltip_right menu_icon icon-1x wpbc_ui_el__vert_nav_icon_collapsed hide_in_compact_mode wpbc-bi-plus-square-dotted" data-original-title="<?php echo esc_attr_e( 'Expand', 'booking' ); ?>"></i> |
| 468 |
</a> |
| 469 |
<?php |
| 470 |
} else { |
| 471 |
// Single Item Link. |
| 472 |
?> |
| 473 |
<a <?php if ( ! empty( $menu_item_arr['onclick'] ) ) { ?> |
| 474 |
onclick="javascript:<?php echo $menu_item_arr['onclick']; /* phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped */ ?>" |
| 475 |
href="javascript:void(0);" |
| 476 |
<?php } else { ?> |
| 477 |
href="<?php echo esc_url( $menu_item_arr['url'] ); ?>" |
| 478 |
<?php } ?> |
| 479 |
class="wpbc_ui_el__vert_nav_item__a wpbc_ui_el__vert_nav_item__single"> |
| 480 |
<?php if ( ! empty( $menu_item_arr['font_icon'] ) ) { ?> |
| 481 |
<i class="wpbc_ui_el__vert_nav_icon menu_icon icon-1x <?php echo esc_attr( $menu_item_arr['font_icon'] ); ?>" |
| 482 |
title="<?php echo ( ! empty( $menu_item_arr['hint'] ) ) ? esc_attr( wp_strip_all_tags( $menu_item_arr['hint'] ) ) : esc_attr( wp_strip_all_tags( $menu_item_arr['title'] ) ); ?>" |
| 483 |
></i> |
| 484 |
<?php } ?> |
| 485 |
<span class="wpbc_ui_el__vert_nav_title hide_in_compact_mode"><?php echo wp_kses_post( $menu_item_arr['title'] ); ?></span> |
| 486 |
<?php |
| 487 |
// Icon at Right side. Usually: 'wpbc-bi-question-circle' | 'wpbc-bi-arrow-down-short' | 'wpbc-bi-arrow-up-right-square'. |
| 488 |
if ( ! empty( $menu_item_arr['font_icon_right'] ) ) { ?> |
| 489 |
<i class="hide_in_compact_mode tooltip_right menu_icon icon-1x <?php echo esc_attr( $menu_item_arr['font_icon_right'] ); ?>" |
| 490 |
data-original-title="<?php echo ( ! empty( $menu_item_arr['hint'] ) ) ? esc_attr( wp_strip_all_tags( $menu_item_arr['hint'] ) ) : esc_attr( wp_strip_all_tags( $menu_item_arr['title'] ) ); ?>"></i> |
| 491 |
<?php |
| 492 |
} |
| 493 |
?> |
| 494 |
</a> |
| 495 |
<?php |
| 496 |
} |
| 497 |
?> |
| 498 |
</div> |
| 499 |
<?php |
| 500 |
} |
| 501 |
|
| 502 |
/** |
| 503 |
* Sub - Single Item. |
| 504 |
* |
| 505 |
* @param string $menu_slug - 'calendar_appearance'. |
| 506 |
* @param array $menu_item_arr - [ |
| 507 |
* 'type' => "subtab", |
| 508 |
* title = "Skin Search Form Layout 1" |
| 509 |
* page_title = "Skin Search Settings 2" |
| 510 |
* hint = "Skin Search Settings 3" |
| 511 |
* position = "" |
| 512 |
* css_classes = "" |
| 513 |
* default = true |
| 514 |
* disabled = false |
| 515 |
* checkbox = false |
| 516 |
* content = "content" |
| 517 |
* show_checked_icon = false |
| 518 |
* is_use_new_settings_skin = true |
| 519 |
* is_active = true |
| 520 |
* url = "http://beta/wp-admin/admin.php?page=wpbc-settings&tab=calendar_appearance&subtab=calendar_appearance_skin" |
| 521 |
* ]. |
| 522 |
* |
| 523 |
* @return void |
| 524 |
*/ |
| 525 |
function wpbc_ui__vert_menu__item_sub( $menu_slug, $menu_item_arr ) { |
| 526 |
|
| 527 |
// CSS Classes. |
| 528 |
$menu_css_arr = array(); |
| 529 |
$menu_css_arr[] = 'wpbc_ui_el__vert_nav_item'; |
| 530 |
$menu_css_arr[] = 'wpbc_ui_el__vert_nav_item_sub'; |
| 531 |
// $menu_css_arr[] = 'hide_in_compact_mode'; |
| 532 |
$menu_css_arr[] = 'wpbc_ui_el__vert_nav_item__' . esc_attr( $menu_slug ); |
| 533 |
if ( ! empty( $menu_item_arr['is_active'] ) ) { |
| 534 |
$menu_css_arr[] = 'active'; |
| 535 |
} |
| 536 |
if ( isset( $menu_item_arr['css_classes'] ) ) { |
| 537 |
$menu_css_arr[] = $menu_item_arr['css_classes']; |
| 538 |
} |
| 539 |
$menu_css_str = implode( ' ', $menu_css_arr ); |
| 540 |
|
| 541 |
// Styles. |
| 542 |
$menu_style_str = ( isset( $menu_item_arr['style'] ) ) ? $menu_item_arr['style'] : ''; |
| 543 |
|
| 544 |
|
| 545 |
?> |
| 546 |
<div class="<?php echo esc_attr( $menu_css_str ); ?>" style="<?php echo esc_attr( $menu_style_str ); ?>"> |
| 547 |
<a class="wpbc_ui_el__vert_nav_item__a wpbc_ui_el__vert_nav_item__single" |
| 548 |
<?php if ( ! empty( $menu_item_arr['onclick'] ) ) { ?> |
| 549 |
onclick="javascript:<?php echo $menu_item_arr['onclick']; /* phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped */ ?>" |
| 550 |
href="javascript:void(0);" |
| 551 |
<?php } else { ?> |
| 552 |
href="<?php echo esc_url( $menu_item_arr['url'] ); ?>" |
| 553 |
<?php } ?> |
| 554 |
> |
| 555 |
<?php if ( ! empty( $menu_item_arr['font_icon'] ) ) { ?> |
| 556 |
<i class="wpbc_ui_el__vert_nav_icon menu_icon icon-1x <?php echo esc_attr( $menu_item_arr['font_icon'] ); ?>" |
| 557 |
title="<?php echo ( ! empty( $menu_item_arr['hint'] ) ) ? esc_attr( wp_strip_all_tags( $menu_item_arr['hint'] ) ) : esc_attr( wp_strip_all_tags( $menu_item_arr['title'] ) ); ?>" |
| 558 |
></i> |
| 559 |
<?php } ?> |
| 560 |
<span class="wpbc_ui_el__vert_nav_title hide_in_compact_mode"><?php echo wp_kses_post( $menu_item_arr['title'] ); ?></span> |
| 561 |
<?php |
| 562 |
|
| 563 |
|
| 564 |
// Show Togles for "Emails" and "Payment gateways", maybe for some other pages. |
| 565 |
if ( |
| 566 |
( ! empty( $menu_item_arr['show_checked_icon'] ) ) && |
| 567 |
( ! empty( $menu_item_arr['checked_data'] ) ) |
| 568 |
) { |
| 569 |
$is_checked_data = get_bk_option( $menu_item_arr['checked_data'] ); |
| 570 |
if ( |
| 571 |
( ( ! empty( $is_checked_data ) ) && ( isset( $is_checked_data['enabled'] ) ) && ( 'On' === $is_checked_data['enabled'] ) ) || |
| 572 |
( ( ! empty( $is_checked_data ) ) && ( 'On' === $is_checked_data ) ) |
| 573 |
) { |
| 574 |
echo '<i class="wpbc_ui_el__vert_nav_icon_right menu_icon icon-1x wpbc-bi-toggle2-on" style="margin-left: auto;margin-top: 3px;color: #036aab;"></i>'; |
| 575 |
} else { |
| 576 |
echo '<i class="wpbc_ui_el__vert_nav_icon_right menu_icon icon-1x wpbc-bi-toggle2-off" style="margin-left: auto;margin-top: 3px;"></i>'; |
| 577 |
} |
| 578 |
} |
| 579 |
|
| 580 |
// Icon at Right side. Usually: 'wpbc-bi-question-circle' | 'wpbc-bi-arrow-down-short' | 'wpbc-bi-arrow-up-right-square'. |
| 581 |
if ( ! empty( $menu_item_arr['font_icon_right'] ) ) { ?> |
| 582 |
<i class="hide_in_compact_mode tooltip_right menu_icon icon-1x <?php echo esc_attr( $menu_item_arr['font_icon_right'] ); ?>" |
| 583 |
data-original-title="<?php echo ( ! empty( $menu_item_arr['hint'] ) ) ? esc_attr( wp_strip_all_tags( $menu_item_arr['hint'] ) ) : esc_attr( wp_strip_all_tags( $menu_item_arr['title'] ) ); ?>"></i> |
| 584 |
<?php |
| 585 |
} |
| 586 |
?> |
| 587 |
</a> |
| 588 |
</div> |
| 589 |
<?php |
| 590 |
} |
| 591 |
|
| 592 |
/** |
| 593 |
* Show horizontal divider. |
| 594 |
* |
| 595 |
* @param string $menu_slug - 'calendar_appearance'. |
| 596 |
* @param array $menu_item_arr - [ |
| 597 |
* 'type' => "separator", |
| 598 |
* 'is_active' => false, |
| 599 |
* 'url' => "http://beta/wp-admin/admin.php?page=wpbc-settings&tab=calendar_appearance&subtab=calendar_appearance_skin_sep" |
| 600 |
* ]. |
| 601 |
* |
| 602 |
* @return void |
| 603 |
*/ |
| 604 |
function wpbc_ui__vert_menu__item_separtor( $menu_slug, $menu_item_arr ) { |
| 605 |
|
| 606 |
$args = array( 'container_class' => 'wpbc_ui_el__vert_nav_item_sub' ); |
| 607 |
wpbc_ui_el__divider_horizontal( $args ); |
| 608 |
} |
| 609 |
|
| 610 |
/** |
| 611 |
* HTML |
| 612 |
* |
| 613 |
* @param string $menu_slug - 'calendar_appearance'. |
| 614 |
* @param array $menu_item_arr - [ |
| 615 |
* 'type' = "htnl" |
| 616 |
* 'html' = "Form Fields" |
| 617 |
* ]. |
| 618 |
* |
| 619 |
* @return void |
| 620 |
*/ |
| 621 |
function wpbc_ui__vert_menu__item_html( $menu_slug, $menu_item_arr ) { |
| 622 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 623 |
echo $menu_item_arr['html']; |
| 624 |
} |
| 625 |
|