$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-event-ticket' ) ),
'txtUnavail' => esc_js( __( 'Unavailable', 'abp-event-ticket' ) )
];
}
//==============================//
public static function load_admin_globally(): void {
?>
âšī¸
' . esc_html( $data ) . '
';
}
}
public static function layout_warning_info_xs( $key, $data = '' ): void {
$data = empty( $data ) ? ABPET_Static::array_info( $key ) : $data;
if ( $data ) {
echo '' . esc_html( $data ) . '
';
}
}
public static function layout_info_xs( $key, $data = '' ): void {
$data = empty( $data ) ? ABPET_Static::array_info( $key ) : $data;
if ( $data ) {
echo '' . esc_html( $data ) . '
';
}
}
public static function on(): bool|string {
ob_start();
?>
= $min_qty ) {
if ( ! empty( $collapse_id ) ) {
?>
*
0 ) {
?>
0 ) {
?>
0 ) {
?>
0 || $image_id ) ? ABPET_Function::get_image_url( $post_id, $image_id ) : $url;
$post_url = $post_id > 0 ? get_the_permalink( $post_id ) : '';
$image_url = $image_url ?: ABPET_BLANK_IMG_URL;
if ( $image_url ) {
?>
data-href="" >
â
0 ) {
foreach ( $all_images as $image ) {
$img_url = ABPET_Function::get_image_url( '', $image, 'medium' ) ?: ABPET_BLANK_IMG_URL;
?>
__( 'Seat Plan', 'abp-event-ticket' ),
'ticket' => __( 'Ticket', 'abp-event-ticket' ),
];
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-event-ticket' ),
'tuesday' => __( 'Tuesday', 'abp-event-ticket' ),
'wednesday' => __( 'Wednesday', 'abp-event-ticket' ),
'thursday' => __( 'Thursday', 'abp-event-ticket' ),
'friday' => __( 'Friday', 'abp-event-ticket' ),
'saturday' => __( 'Saturday', 'abp-event-ticket' ),
'sunday' => __( 'Sunday', 'abp-event-ticket' ),
];
}
public static function date_option_rules(): array {
$rules = [
'weekend' => __( 'Weekend', 'abp-event-ticket' ),
'specific_off_dates' => __( 'Specific Off Dates', 'abp-event-ticket' ),
'special_on_dates' => __( 'Special On Dates', 'abp-event-ticket' ),
'off_date_range' => __( 'Off Dates Range', 'abp-event-ticket' ),
];
return apply_filters( 'abpet_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 selection_area(): void {
?>
0 ) {
$display_sku = $post_infos['display_sku'] ?? ABPET_Function::get_post_info( $post_id, 'display_sku', 'off' );
$post_sku = $post_infos['post_sku'] ?? ABPET_Function::get_post_info( $post_id, 'post_sku' );
if ( ABPET_Function::on_off( 'post_icon' ) ) {
ABPET_Layout::image_icon( ( $post_infos['post_icon'] ?? ABPET_Function::get_post_info( $post_id, 'post_icon' ) ) );
}
echo esc_html( get_the_title( $post_id ) ); ?>
()
0 ) {
$value = $post_infos['sub_title'] ?? ABPET_Function::get_post_info( $post_id, 'sub_title' );
if ( ! empty( $value ) ) { ?>
0 ) {
$display = $post_infos['display_capacity'] ?? ABPET_Function::get_post_info( $post_id, 'display_capacity', 'on' );
$capacity = $post_infos['capacity'] ?? ABPET_Function::get_total_qty( $post_id, $post_infos );
if ( ! empty( $capacity ) && $display === 'on' ) { ?>
0 ) {
$display = $post_infos['display_category'] ?? ABPET_Function::get_post_info( $post_id, 'display_category', 'on' );
$value = $post_infos['abpet_category'] ?? ABPET_Function::get_post_info( $post_id, 'abpet_category' );
if ( ! empty( $value ) && $display === 'on' ) {
$values = explode( ',', $value );
if ( ! empty( $values ) ) {
foreach ( $values as $value ) {
$value = ABPET_Function::category_value( $value ); ?>
0 ) {
$display = $post_infos['display_brand'] ?? ABPET_Function::get_post_info( $post_id, 'display_brand', 'off' );
$value = $post_infos['abpet_brand'] ?? ABPET_Function::get_post_info( $post_id, 'abpet_brand' );
if ( ! empty( $value ) && $display === 'on' ) {
$values = explode( ',', $value );
if ( ! empty( $values ) ) {
foreach ( $values as $value ) {
$value = ABPET_Function::brand_value( $value ); ?>
0 ) {
$display = $post_infos['display_organizer'] ?? ABPET_Function::get_post_info( $post_id, 'display_organizer', 'off' );
$value = $post_infos['abpet_organizer'] ?? ABPET_Function::get_post_info( $post_id, 'abpet_organizer' );
if ( ! empty( $value ) && $display === 'on' ) {
$values = explode( ',', $value );
if ( ! empty( $values ) ) {
foreach ( $values as $value ) {
$value = ABPET_Function::organizer_value( $value );
?>
';
ABPET_Static::icon_svg( 'location_1' );
echo esc_html( $value ) . '';
}
}
}
public static function description( $post_infos = [], $class = '' ): void {
$post_id = absint( $post_infos['post_id'] ?? 0 );
if ( ABPET_Function::on_off( 'post_des' ) && $post_id > 0 ) {
$value = $post_infos['post_description'] ?? ABPET_Function::get_post_info( $post_id, 'post_description' );
if ( ! empty( $value ) ) { ?>
';print_r($all_dates); echo '';
if ( sizeof( $all_dates ) > 0 ) {
$now = ABPET_Function::date_format( current_time( 'Y-m-d' ) );
$date = $date ?: current( $all_dates );
$hidden_date = ! empty( $date ) ? gmdate( 'Y-m-d', strtotime( $date ) ) : '';
$visible_date = ! empty( $date ) ? ABPET_Function::date_format( $date, 'date' ) : '';
if ( sizeof( $all_dates ) > 1 ) {
?>
0 ) { ?>
';print_r($abpet_feature);echo '';
?>
';
ABPET_Layout::image_icon( $icon );
$output = implode( ' - ', array_filter( [ $label, $value ] ) );
echo esc_html( $output );
echo '';
}
} ?>
';print_r($min_qty);echo '';
if ( $max_qty >= $min_qty ) {
$collapse_id = '#ticket_' . $key;
?>
$min_qty ) {
$input_info = [
'name' => 'item_qty[]',
'price' => $price,
'available' => $available_qty,
'min_qty' => $min_qty,
'max_qty' => $max_qty,
'collapse_id' => $collapse_id,
];
ABPET_Layout::quantity_input( $input_info );
} else { ?>
'validation_name',
'number' => 'validation_number',
default => '',
};
?>
ABPET_Layout::select( $name, $d_value, $label, $required, $options ),
'checkbox' => ABPET_Layout::checkbox( $name, $d_value, $label, $required, $options ),
'radio' => ABPET_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 = ABPET_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 ? ABPET_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;
}
}
}
}
$post_id = $form_data['post_id'] ?? '';
$event_date = $form_data['event_date'] ?? ($form_data['start_date'] ?? '');
$session_time = $form_data['session_time'] ?? ($form_data['start_time'] ?? '');
$price_info = [];
$sold_seat = [];
$reserved_seat = [];
$sale = false;
if ( ! empty( $event_date ) && ! empty( $session_time ) && ! empty( $post_id ) && $post_id > 0 ) {
foreach ( $meta_info as $tic_id => $ticket_num ) {
$price_info[ $tic_id ] = ABPET_Function::get_price( $post_infos, $tic_id, $session_time );
}
$form_data['sp_id'] = $id;
$sold_seat = ABPET_Query::get_sold_seat( $form_data );
$sale = true;
}
//echo ''; print_r($form_data); echo '
';
// echo ''; print_r($sold_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' : '';
$title = $sale && $is_seat ? __( 'Available !', 'abp-event-ticket' ) : '';
$seat_type_class = $sale && in_array( $name, $sold_seat ) ? 'sold' : $seat_type_class;
$title = $sale && in_array( $name, $sold_seat ) ? __( 'Sold !', 'abp-event-ticket' ) : $title;
$class = $is_seat ? "sp_cell " . $seat_type_class : "sp_decor";
$tag_attr = $sale && $is_seat && $seat_type_class == 'available' ? 'data-name="' . $name . '" data-id="' . $type_id . '" data-price="' . ( $price_info[ $type_id ] ?? 0 ) . '"' : '';
if ( ! empty( $title ) ) {
$tag_attr = $tag_attr . ' title="' . $title . '"';
}
$color = $is_seat ? ABPET_Function::ticket_color( $type_id ) : ABPET_Function::decor_color( $type_id );
$icon_image = $is_seat ? ABPET_Function::ticket_icon( $type_id ) : ABPET_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 = ABPET_Function::get_image_url( '', $icon_image );
}
}
?>
>
" style="background-image: url('');">
$ticket_info ) {
if ( ! empty( $ticket_info ) && sizeof( $ticket_info ) > 0 ) {
$current_seat_type = $ticket_info['seat_type'] ?? $seat_type;
$qty = $ticket_info['qty'] ?? 1;
$price = $ticket_info['price'] ?? 0;
$total = $price * $qty;
$name = $ticket_info['name'] ?? '';
if ( $current_seat_type === 'sp' ) {
$name = $name . ' - ' . ABPET_Function::sp_label( $post_id, ( $ticket_info['sp_id'] ?? $sp_id ) );
}
?>
-
0 ? wp_kses_post( wc_price( $total ) ) : esc_html__( 'FREE', 'abp-event-ticket' ) ); ?>
0 ) {
$name = $ex_info['name'] ?? '';
$qty = $ex_info['qty'] ?? 1;
$price = $ex_info['price'] ?? 0;
$total = $price * $qty;
$returnable = $ex_info['returnable'] ?? 'no';
if ( ! empty( $name ) ) { ?>
-
0 ? wp_kses_post( wc_price( $total ) ) : esc_html__( 'FREE', 'abp-event-ticket' ) ); ?>
-
0 ) {
foreach ( $pas_form as $info ) {
$label = $info['label'] ?? '';
$value = $info['value'] ?? '';
if ( ! empty( $label ) && ! empty( $value ) ) { ?>
-
:
';print_r($configuration);echo '';
?>
array( 'ID', 'display_name' ),
) );
?>