$start_year, 'minMonth' => $start_month, 'minDay' => $start_day, 'maxYear' => $end_year, 'maxMonth' => $end_month, 'maxDay' => $end_day, 'activeDates' => $all_dates, 'txtAvail' => esc_js(__('Available', 'abp-transport-booking')), 'txtUnavail' => esc_js(__('Unavailable', 'abp-transport-booking')) ]; } //==============================// public static function load_admin_globally(): void { ?>
â„šī¸  

' . esc_html($data) . '

'; } } public static function layout_warning_info_xs($key, $data = ''): void { $data = empty($data) ? ABPTB_Static::array_info($key) : $data; if ($data) { echo '
' . esc_html($data) . '
'; } } public static function layout_info_xs($key, $data = ''): void { $data = empty($data) ? ABPTB_Static::array_info($key) : $data; if ($data) { echo '
' . esc_html($data) . '
'; } } public static function on(): bool|string { ob_start(); ?> 0 ? $value : $min_qty; $class = $input_info['class'] ?? ''; $collapse_id = $input_info['collapse_id'] ?? ''; $active_class = $input_info['active_class'] ?? ''; if ($name && $max_qty >= $min_qty) { if (!empty($collapse_id)) { ?>
* 0) { ?> 0) { ?>
0) { ?>
0 || $image_id) ? ABPTB_Function::get_image_url($post_id, $image_id) : $url; $post_url = $post_id > 0 ? get_the_permalink($post_id) : ''; $image_url = $image_url ?: ABPTB_BLANK_IMG_URL; if ($image_url) { ?>
data-href="" > <?php echo esc_attr(max($post_id, $image_id)); ?>
❌ <?php echo esc_attr($image_id); ?>
0) { foreach ($all_images as $image) { $img_url = ABPTB_Function::get_image_url('', $image, 'medium') ?: ABPTB_BLANK_IMG_URL; ?>
<?php echo esc_attr($image); ?>
image
__('Seat Plan', 'abp-transport-booking'), 'ticket' => __('Ticket', 'abp-transport-booking'), ]; return !empty($key) ? ($types[$key] ?? '') : $types; } public static function status_text($status): string { if (!is_string($status) && !is_int($status)) { return ''; } $status_array = function_exists('wc_get_order_statuses') ? wc_get_order_statuses() : []; return is_array($status_array) ? ($status_array[$status] ?? '') : ''; } public static function week_day(): array { return [ 'monday' => __('Monday', 'abp-transport-booking'), 'tuesday' => __('Tuesday', 'abp-transport-booking'), 'wednesday' => __('Wednesday', 'abp-transport-booking'), 'thursday' => __('Thursday', 'abp-transport-booking'), 'friday' => __('Friday', 'abp-transport-booking'), 'saturday' => __('Saturday', 'abp-transport-booking'), 'sunday' => __('Sunday', 'abp-transport-booking'), ]; } public static function date_option_rules(): array { $rules = [ 'weekend' => __('Weekend', 'abp-transport-booking'), 'specific_off_dates' => __('Specific Off Dates', 'abp-transport-booking'), 'special_on_dates' => __('Special On Dates', 'abp-transport-booking'), 'off_date_range' => __('Off Dates Range', 'abp-transport-booking'), ]; return apply_filters('abptb_filter_date_rule', $rules); } public static function array_date_format(): array { $current_date = current_time('Y-m-d'); return [ 'yy-mm-dd' => $current_date, 'yy/mm/dd' => date_i18n('Y/m/d', strtotime($current_date)), 'yy-dd-mm' => date_i18n('Y-d-m', strtotime($current_date)), 'yy/dd/mm' => date_i18n('Y/d/m', strtotime($current_date)), 'dd-mm-yy' => date_i18n('d-m-Y', strtotime($current_date)), 'dd/mm/yy' => date_i18n('d/m/Y', strtotime($current_date)), 'mm-dd-yy' => date_i18n('m-d-Y', strtotime($current_date)), 'mm/dd/yy' => date_i18n('m/d/Y', strtotime($current_date)), 'd M , yy' => date_i18n('j M , Y', strtotime($current_date)), 'D d M , yy' => date_i18n('D j M , Y', strtotime($current_date)), 'M d , yy' => date_i18n('M j, Y', strtotime($current_date)), 'D M d , yy' => date_i18n('D M j, Y', strtotime($current_date)), ]; } //=============================// public static function title($post_infos = []): void { $post_id = absint($post_infos['post_id'] ?? 0); if (!empty($post_id) && $post_id > 0) { $display_sku = $post_infos['display_sku'] ?? ABPTB_Function::get_post_info($post_id, 'display_sku', 'off'); $post_sku = $post_infos['post_sku'] ?? ABPTB_Function::get_post_info($post_id, 'post_sku'); if (ABPTB_Function::on_off('post_icon')) { ABPTB_Layout::image_icon(($post_infos['post_icon'] ?? ABPTB_Function::get_post_info($post_id, 'post_icon'))); } echo esc_html(get_the_title($post_id)); ?>  () 0) { $value = $post_infos['sub_title'] ?? ABPTB_Function::get_post_info($post_id, 'sub_title'); if (!empty($value)) { ?>

0) { $display = $post_infos['display_capacity'] ?? ABPTB_Function::get_post_info($post_id, 'display_capacity', 'on'); $capacity = $post_infos['capacity'] ?? ABPTB_Function::get_total_qty($post_id, $post_infos); if (!empty($capacity) && $display === 'on') { if ($list) { ?>
0) { $display = $post_infos['display_category'] ?? ABPTB_Function::get_post_info($post_id, 'display_category', 'on'); $value = $post_infos['abptb_category'] ?? ABPTB_Function::get_post_info($post_id, 'abptb_category'); if (!empty($value) && $display === 'on') { $value = ABPTB_Function::category_value($value); if ($list) { ?>
0) { $display = $post_infos['display_brand'] ?? ABPTB_Function::get_post_info($post_id, 'display_brand', 'off'); $value = $post_infos['abptb_brand'] ?? ABPTB_Function::get_post_info($post_id, 'abptb_brand'); if (!empty($value) && $display === 'on') { $value = ABPTB_Function::brand_value($value); ?> 0) { $display = $post_infos['display_organizer'] ?? ABPTB_Function::get_post_info($post_id, 'display_organizer', 'off'); $value = $post_infos['abptb_organizer'] ?? ABPTB_Function::get_post_info($post_id, 'abptb_organizer'); if (!empty($value) && $display === 'on') { $value = ABPTB_Function::organizer_value($value); ?>
0) { $value = $post_infos['post_description'] ?? ABPTB_Function::get_post_info($post_id, 'post_description'); if (!empty($value)) { ?>
() 1) { echo esc_html(' - ' . $difference . ' ' . __('Stops', 'abp-transport-booking')); } } } } } public static function journey_date($all_dates, $date = ''): void { //echo '
';print_r($all_dates);					echo '
'; if (sizeof($all_dates) > 0) { $now = ABPTB_Function::date_format(current_time('Y-m-d'), 'date'); $date = $date ?: current($all_dates); //if ( sizeof( $all_dates ) > 10 ) { $hidden_date = !empty($date) ? gmdate('Y-m-d', strtotime($date)) : ''; $visible_date = !empty($date) ? ABPTB_Function::date_format($date, 'date') : ''; ?> 0) { //if ( sizeof( $all_dates ) > 10 ) { $hidden_date = !empty($date) ? gmdate('Y-m-d', strtotime($date)) : ''; $visible_date = !empty($date) ? ABPTB_Function::date_format($date, 'date') : ''; ?>
'; ABPTB_Layout::image_icon($icon); $output = implode(' - ', array_filter([$label, $value])); echo esc_html($output); echo ''; } } ?>
';print_r($bp_dp);echo ''; if (!is_array($ticket_info) || empty($key)) { return; } $total_qty = intval($ticket_info['qty'] ?? 0); $max_qty = $ticket_info['max_qty'] ?? ''; $available_qty = $ticket_info['available'] ?? $total_qty; $max_qty = ($max_qty !== '' && intval($max_qty) <= $available_qty) ? intval($max_qty) : $available_qty; $min_qty = intval($ticket_info['min_qty'] ?? 1); $_value = $ticket_info['value'] ?? ''; $value = !empty($_value) ? $_value : $min_qty; //echo '
';print_r($min_qty);echo '
'; if ($max_qty >= $min_qty || !empty($value)) { $collapse_id = '#ticket_' . $key . $prefix; ?>

$min_qty) { $input_info = [ 'name' => $prefix . 'item_qty[]', 'price' => $price, 'available' => $available_qty, 'min_qty' => $min_qty, 'max_qty' => $max_qty, 'collapse_id' => $collapse_id, ]; if (!empty($_value)) { $input_info['value'] = $_value; $input_info['active_class'] = 'abp_active'; } ABPTB_Layout::quantity_input($input_info); } else { ?>
display_name; if ($checkin > 0) { ?> 'validation_name', 'number' => 'validation_number', default => '', }; ?> ABPTB_Layout::select($name, $d_value, $label, $required, $options), 'checkbox' => ABPTB_Layout::checkbox($name, $d_value, $label, $required, $options), 'radio' => ABPTB_Layout::radio($name, $d_value, $label, $required, $options), default => null, }; } } public static function sp($id = '', $sp_info = [], $post_infos = [], $form_data = []): void { if (empty($sp_info)) { if (!empty($id)) { $row = ABPTB_Query::get_sp($id); if (!empty($row)) { $sp_info = current($row); } } } if (!empty($sp_info)) { $others = json_decode($sp_info['others'] ?? '', true) ?: []; $cell_width = $others['width'] ?? 50; $cell_height = $others['height'] ?? 50; $gap = $others['gap'] ?? 0; $bg_image = $others['bg_image'] ?? ''; $img_url = !empty($bg_image) && $bg_image > 0 ? ABPTB_Function::get_image_url('', $bg_image) : ''; $bg_color = $others['bg_color'] ?? '#fff'; $radius = $others['radius'] ?? 0; $layout = json_decode($sp_info['layout_data'] ?? '', true) ?: []; //echo '
';                print_r($ticket_types);                echo '
'; $cols = intval($others['column'] ?? 10); $meta_info = json_decode($sp_info['seat_info'] ?? '', true) ?: []; $hidden_cells = []; foreach ($layout as $index => $cell) { $c_span = intval($cell['width_ratio'] ?? 1); $r_span = intval($cell['height_ratio'] ?? 1); if ($c_span > 1 || $r_span > 1) { for ($r = 0; $r < $r_span; $r++) { for ($c = 0; $c < $c_span; $c++) { if ($r === 0 && $c === 0) continue; $target_idx = $index + ($r * $cols) + $c; $hidden_cells[$target_idx] = true; } } } } $bp_dp = $form_data['bp_dp'] ?? ''; $post_id = $form_data['post_id'] ?? ''; $start_time = $form_data['start_time'] ?? ''; $price_info = []; $sold_seat = []; $reserved_seat = []; $sale = false; if (!empty($bp_dp) && !empty($start_time) && !empty($post_id) && $post_id > 0) { foreach ($meta_info as $tic_id => $ticket_num) { $price_info[$tic_id] = ABPTB_Function::get_price($post_infos, $bp_dp, $tic_id, $start_time); } $form_data['sp_id'] = $id; $sold_seat = ABPTB_Query::get_sold_seat($form_data); $sale = true; } //echo '
';                    print_r($form_data);                    echo '
'; // echo '
';                    print_r($sold_seat);                    echo '
'; $booking_item = $form_data['booking_item'] ?? []; $booking_tickets = json_decode($booking_item['ticket_info'] ?? '', true) ?: []; $selected_seat = []; if (!empty($booking_tickets) && is_array($booking_tickets)) { foreach ($booking_tickets as $booking_ticket) { if (!empty($booking_ticket) && sizeof($booking_ticket) > 0) { $seat = $booking_ticket['name'] ?? ''; if (!empty($seat)) { $selected_seat[] = $seat; } } } } //echo '
';                    print_r($selected_seat);                    echo '
'; ?>
$cell) { if (isset($hidden_cells[$index])) continue; $type_id = $cell['id'] ?? ''; $name = $cell['name'] ?? ''; $c_span = intval($cell['width_ratio'] ?? 1); $r_span = intval($cell['height_ratio'] ?? 1); $rotate = intval($cell['rotate'] ?? 0); $fs = $cell['fs'] ?? 12; $is_seat = ($cell['type'] === 'seat'); $seat_type_class = $sale && $is_seat ? 'available' : ''; $seat_type_class = $sale && in_array($name, $sold_seat) ? 'sold' : $seat_type_class; $seat_type_class = $sale && in_array($name, $selected_seat) ? 'available selected' : $seat_type_class; $title = $sale && in_array($name, $sold_seat) ? __('Sold !', 'abp-transport-booking') : ''; $class = $is_seat ? "sp_cell " . $seat_type_class : "sp_decor"; $tag_attr = $sale && $is_seat && ($seat_type_class == 'available' || $seat_type_class == 'available selected') ? 'data-name="' . $name . '" data-id="' . $type_id . '" data-price="' . ($price_info[$type_id] ?? 0) . '" data-label="' . ABPTB_Function::ticket_name($type_id) . '"' : ''; if (!empty($title)) { $tag_attr = $tag_attr . ' title="' . $title . '"'; } $color = $is_seat ? ABPTB_Function::ticket_color($type_id) : ABPTB_Function::decor_color($type_id); $icon_image = $is_seat ? ABPTB_Function::ticket_icon($type_id) : ABPTB_Function::decor_icon($type_id); $width = $cell_width * $c_span; $height = $cell_height * $r_span; if ($gap > 0) { $width = $c_span > 1 ? $width + ($c_span - 1) * $gap : $width; $height = $r_span > 1 ? $height + ($r_span - 1) * $gap : $height; } $style = "color: {$color}; grid-column: span {$c_span}; grid-row: span {$r_span}; width:{$width}px;height:{$height}px; border:1px solid {$color};font-size:{$fs}px;border-radius:{$radius}px;"; $image = ''; if (!empty($icon_image)) { if (is_numeric($icon_image)) { $image = ABPTB_Function::get_image_url('', $icon_image); } } ?>
>
" style="background-image: url('');">
0 ? wp_kses_post(ABPTB_WC >= 2 ? wc_price($price) : number_format_i18n((float)$price, 2)) : esc_html__('Free', 'abp-transport-booking'); ?>
0) { ?> ';print_r($configuration);echo ''; ?>
0) { ?>
array('ID', 'display_name'), )); ?>