| 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 Link (usually button) |
| 22 |
* |
| 23 |
* @param array $args - parameters. |
| 24 |
* |
| 25 |
* @return void |
| 26 |
*/ |
| 27 |
function wpbc_ui_el__a( $args ) { |
| 28 |
|
| 29 |
$defaults = array( |
| 30 |
'title' => '', |
| 31 |
'hint' => '', |
| 32 |
// Example: array( 'title' => __('Manage bookings' ,'booking') , 'position' => 'top' ). |
| 33 |
'font_icon' => '', |
| 34 |
'position' => '', |
| 35 |
'style' => '', |
| 36 |
'container_class' => '', |
| 37 |
'container_style' => '', |
| 38 |
'attr' => array(), |
| 39 |
'onclick' => 'javascript:void(0)', |
| 40 |
'permalink' => 'javascript:void(0)', |
| 41 |
'onmouseover' => 'javascript:void(0)', |
| 42 |
'onmouseout' => 'javascript:void(0)', |
| 43 |
); |
| 44 |
$params = wp_parse_args( $args, $defaults ); |
| 45 |
|
| 46 |
|
| 47 |
?><div class="wpbc_ui_el_container wpbc_ui_el__a <?php echo esc_attr( $params['container_class'] ); ?>" style="<?php echo esc_attr( $params['container_style'] ); ?>"><a |
| 48 |
onmouseover="<?php echo $params['onmouseover']; /* phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped */ ?>" |
| 49 |
onmouseout="<?php echo $params['onmouseout']; /* phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped */ ?>" |
| 50 |
onclick="<?php echo $params['onclick']; /* phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped */ ?>" |
| 51 |
href="<?php echo $params['permalink']; /* phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped */ ?>" |
| 52 |
class="<?php echo esc_attr( ( ! empty( $params['hint'] ) ) ? 'tooltip_' . $params['hint']['position'] . ' ' : '' ); ?>" |
| 53 |
style="<?php echo esc_attr( $params['style'] ); ?>" |
| 54 |
<?php |
| 55 |
if ( ! empty( $params['hint'] ) ) { |
| 56 |
echo ' title="' . esc_attr( $params['hint']['title'] ) . '" '; |
| 57 |
} |
| 58 |
echo wpbc_get_custom_attr( $params ); /* phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped */ |
| 59 |
?> |
| 60 |
> |
| 61 |
<?php |
| 62 |
if ( ! empty( $params['font_icon'] ) ) { |
| 63 |
// Font Icon. |
| 64 |
?><i class="menu_icon icon-1x <?php echo wp_kses_post( $params['font_icon'] ); ?>"></i><?php |
| 65 |
} |
| 66 |
if ( ! empty( $params['title'] ) ){ |
| 67 |
?><span class="nav-tab-text"><?php echo wp_kses_post( $params['title'] ); ?></span><?php |
| 68 |
} |
| 69 |
?></a></div><?php |
| 70 |
} |
| 71 |
|
| 72 |
/** |
| 73 |
* Usage Example: |
| 74 |
* |
| 75 |
$el_arr = array( |
| 76 |
'title' => __( 'Booking Calendar', 'booking' ), |
| 77 |
'font_icon' => 'wpbc-bi-calendar2-range', |
| 78 |
'position' => 'left', |
| 79 |
'items' => array( |
| 80 |
array( |
| 81 |
'type' => 'link', |
| 82 |
'title' => __( 'FAQ', 'booking' ), |
| 83 |
'url' => 'https://wpbookingcalendar.com/faq/', |
| 84 |
), |
| 85 |
array( 'type' => 'divider' ), |
| 86 |
array( |
| 87 |
'type' => 'link', |
| 88 |
'title' => __( 'Support Forum', 'booking' ), |
| 89 |
'url' => 'https://wpbookingcalendar.com/support/', |
| 90 |
), |
| 91 |
array( |
| 92 |
'type' => 'html', |
| 93 |
'html' => '<span class="wpbc_flex_settings_containers" style="flex-flow:row nowrap;display:flex;"> |
| 94 |
<div id="wpbc_general_settings_calendar_tab" class="wpbc_settings_navigation_item wpbc_settings_navigation_item_active" style="min-width:350px;"> |
| 95 |
<a class="" original-title="" onclick="javascript:wpbc_navigation_click_show_section(this,\'#wpbc_general_settings_calendar_metabox\' );" href="javascript:void(0);"> |
| 96 |
<i class="menu_icon icon-1x wpbc-bi-calendar3-week"></i> |
| 97 |
<div class="wpbc_text_inside"> |
| 98 |
<div class="wpbc_flex_settings_title"><div>Calendar Look</div><div>01</div></div> |
| 99 |
<div class="wpbc_flex_settings_description">Set Calendar Skin, Max Months to Scroll, Calendar Legend</div> |
| 100 |
</div> |
| 101 |
</a> |
| 102 |
</div> |
| 103 |
<div id="wpbc_general_settings_calendar_tab" class="wpbc_settings_navigation_item wpbc_settings_navigation_item_active" style="min-width:350px;"> |
| 104 |
<a class="" original-title="" onclick="javascript:wpbc_navigation_click_show_section(this,\'#wpbc_general_settings_calendar_metabox\' );" href="javascript:void(0);"> |
| 105 |
<i class="menu_icon icon-1x wpbc-bi-calendar3-week"></i> |
| 106 |
<div class="wpbc_text_inside"> |
| 107 |
<div class="wpbc_flex_settings_title"><div>Days Selection</div><div>02</div></div> |
| 108 |
<div class="wpbc_flex_settings_description">Single Day, Multi Days or Range Days Selection (Min/Max days )</div> |
| 109 |
</div> |
| 110 |
</a> |
| 111 |
</div> |
| 112 |
</span>', |
| 113 |
), |
| 114 |
array( |
| 115 |
'type' => 'header', |
| 116 |
'title' => __( 'Contact Support', 'booking' ), |
| 117 |
), |
| 118 |
array( |
| 119 |
'type' => 'link', |
| 120 |
'title' => __( 'Contact Support', 'booking' ), |
| 121 |
'url' => 'mailto:support@wpbookingcalendar.com', |
| 122 |
'attr' => array( 'style' => 'font-weight: 600;' ), |
| 123 |
), |
| 124 |
array( |
| 125 |
'type' => 'link', |
| 126 |
'title' => "What's New", |
| 127 |
'url' => esc_url( admin_url( add_query_arg( array( 'page' => 'wpbc-about' ), 'index.php' ) ) ), |
| 128 |
), |
| 129 |
array( |
| 130 |
'type' => 'link', |
| 131 |
'title' => __( 'About', 'booking' ), |
| 132 |
'url' => 'https://wpbookingcalendar.com/', |
| 133 |
), |
| 134 |
), |
| 135 |
); |
| 136 |
wpbc_ui_el__dropdown_menu( $el_arr ); |
| 137 |
*/ |