$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-rentalforge')), 'txtUnavail' => esc_js(__('Unavailable', 'abp-rentalforge')) ]; } //==============================// public static function load_admin_globally(): void { ABPRF_Layout::popup_empty('#abprf_global_popup'); ABPRF_Layout::icon_popup(); ?>
â„šī¸  

' . esc_html($data) . '

'; } } public static function layout_warning_info_xs($key): void { $data = ABPRF_Static::array_info($key); if ($data) { echo '
' . esc_html($data) . '
'; } } public static function image($post_id = '', $image_id = '', $url = '', $class = ''): void { $image_url = ($post_id > 0 || $image_id) ? ABPRF_Function::get_image_url($post_id, $image_id) : $url; $post_url = $post_id > 0 ? get_the_permalink($post_id) : ''; $image_url = $image_url ?: ABPRF_BLANK_IMG_URL; if ($image_url) { ?>
data-href="" > <?php echo esc_attr(max($post_id, $image_id)); ?>
0) { asort($infos); ?> = $min_qty) { if (!empty($collapse_id)) { ?>
➖
➕
* 0) { ?> 0) { ?>
0) { ?>
<?php echo esc_attr($image_id); ?>
0) { foreach ($all_images as $image) { $img_url = ABPRF_Function::get_image_url('', $image, 'medium') ?: ABPRF_BLANK_IMG_URL; ?>
<?php echo esc_attr($image); ?>
image
__('Pending', 'abp-rentalforge'), '1' => __('Waiting', 'abp-rentalforge'), '2' => __('In Rent', 'abp-rentalforge'), '3' => __('Completed', 'abp-rentalforge'), '4' => __('Delay', 'abp-rentalforge'), '5' => __('Canceled', 'abp-rentalforge') ]; $rules = apply_filters('abprf_filter_book_status_rule', $rules); $key = is_numeric($key) ? (string)$key : $key; if (!is_string($key) && !is_int($key)) { return ''; } return is_array($rules) ? ($rules[$key] ?? (string)$key) : (string)$key; } public static function get_book_status($order_id, $start_time, $end_time, $book_status): int { $now = current_time('Y-m-d H:i:s'); if (!empty($book_status) && $book_status < 5 && $book_status > 0) { $_book_status = (int)$book_status; if ($_book_status === 1 && ABPRF_Function::on_off('auto_delivery') && !empty($start_time) && strtotime($now) >= strtotime($start_time)) { $_book_status = 2; } elseif ($_book_status === 2 && ABPRF_Function::on_off('auto_return') && !empty($end_time) && strtotime($now) >= strtotime($end_time)) { $_book_status = 3; } if ($_book_status > $book_status) { $book_status = $_book_status; global $wpdb; $table_name = $wpdb->prefix . 'abprf_orders'; $booking_lists = ABPRF_Query::get_booking_query(['order_id' => $order_id]); if (!empty($booking_lists) && is_array($booking_lists)) { $data = [ 'book_status' => intval($book_status), 'updated_at' => current_time('Y-m-d H:i:s') ]; $where = ['order_id' => (int)$order_id]; // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching $wpdb->update($table_name, $data, $where, ['%d', '%s'], ['%d']); } } } return $book_status; } public static function sync_book_status(): void { global $wpdb; $auto_delivery = ABPRF_Function::on_off('auto_delivery'); $auto_return = ABPRF_Function::on_off('auto_return'); if (!$auto_delivery && !$auto_return) { return; } $statuses = array_filter(array_map('sanitize_text_field', explode(',', (string)ABPRF_Function::booking_status()))); if (empty($statuses) || current($statuses) === 'all') { return; } $table = $wpdb->prefix . 'abprf_orders'; $now = current_time('Y-m-d H:i:s'); $in = implode(',', array_fill(0, count($statuses), '%s')); if ($auto_delivery) { $delivery_params = array_merge([$table, $now, $now], $statuses); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.InterpolatedNotPrepared, WordPress.DB.PreparedSQLPlaceholders.ReplacementsWrongNumber $wpdb->query($wpdb->prepare("UPDATE %i SET book_status = 2, updated_at = %s WHERE book_status = 1 AND start_time <> '' AND start_time <= %s AND order_status IN ($in)", ...$delivery_params)); } if ($auto_return) { $return_params = array_merge([$table, $now], $statuses); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.InterpolatedNotPrepared, WordPress.DB.PreparedSQLPlaceholders.ReplacementsWrongNumber $rows = $wpdb->get_results($wpdb->prepare("SELECT item_id, price_info FROM %i WHERE book_status = 2 AND end_time <> '' AND end_time <= %s AND order_status IN ($in)", ...$return_params), ARRAY_A); if (!empty($rows) && is_array($rows)) { foreach ($rows as $row) { $update_data = ['book_status' => 3, 'updated_at' => $now]; $formats = ['%d', '%s']; $price_info = json_decode($row['price_info'] ?? '', true); if (is_array($price_info) && !empty($price_info['deposit'])) { $deposit = (float)$price_info['deposit']; $price_info['deposit'] = 0; if (isset($price_info['item_total'])) { $price_info['item_total'] = (float)$price_info['item_total'] - $deposit; } $update_data['price_info'] = wp_json_encode($price_info); $formats[] = '%s'; } // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching $wpdb->update($table, $update_data, ['item_id' => (int)$row['item_id']], $formats, ['%d']); } } } } public static function week_day(): array { return [ 'monday' => __('Monday', 'abp-rentalforge'), 'tuesday' => __('Tuesday', 'abp-rentalforge'), 'wednesday' => __('Wednesday', 'abp-rentalforge'), 'thursday' => __('Thursday', 'abp-rentalforge'), 'friday' => __('Friday', 'abp-rentalforge'), 'saturday' => __('Saturday', 'abp-rentalforge'), 'sunday' => __('Sunday', 'abp-rentalforge'), ]; } public static function date_option_rules(): array { $rules = [ 'weekend' => __('Weekend', 'abp-rentalforge'), 'specific_of_date' => __('Specific Off Dates', 'abp-rentalforge'), 'off_date_range' => __('Off Dates Range', 'abp-rentalforge'), 'special_on_dates' => __('Special On Dates', 'abp-rentalforge'), 'day_wise_time' => __('Operation Time day Wise', 'abp-rentalforge'), ]; return apply_filters('abprf_filter_rent_rule', $rules); } public static function rent_rules_options(): array { $options = (ABPRF_On_Off['rent_rule'] ?? null) ?: self::rent_rules_string(); $options = !empty($options) ? explode(',', $options) : []; $rent_rules = []; foreach ($options as $option) { if (!empty($option)) { $rent_rules[$option] = self::rent_rules($option); } } return $rent_rules; } public static function rent_rules($key = '') { $rules = [ 'hourly' => __('Hourly Rate', 'abp-rentalforge'), 'daily' => __('Daily Rate', 'abp-rentalforge'), 'multi_day' => __('Daily & Hourly Rate', 'abp-rentalforge'), 'monthly' => __('Monthly Rate', 'abp-rentalforge'), 'multi_month' => __('Monthly & Daily Rate', 'abp-rentalforge') ]; $rules = apply_filters('abprf_filter_rent_rule', $rules); if (!is_string($key) && !is_int($key)) { return is_array($rules) ? $rules : []; } if ($key === '') { return is_array($rules) ? $rules : []; } return is_array($rules) ? ($rules[$key] ?? '') : ''; } public static function rent_rules_string() { return apply_filters('abprf_filter_rent_rule_string', 'hourly,daily,multi_day,monthly,multi_month'); } public static function per_rent_rules($key = '') { $rules = [ 'hourly' => __('/hr', 'abp-rentalforge'), 'daily' => __('/day', 'abp-rentalforge'), 'multi_day' => __('/day', 'abp-rentalforge'), 'monthly' => __('/month', 'abp-rentalforge'), 'multi_month' => __('/month', 'abp-rentalforge') ]; $rules = apply_filters('abprf_filter_per_rent_rule', $rules); if (!is_string($key) && !is_int($key)) { return is_array($rules) ? $rules : []; } if ($key === '') { return is_array($rules) ? $rules : []; } return is_array($rules) ? ($rules[$key] ?? '') : ''; } public static function rent_rules_sin_plu($key = '') { $rules = [ 'hourly' => ['sin' => __('Hour', 'abp-rentalforge'), 'plu' => __('Hours', 'abp-rentalforge')], 'daily' => ['sin' => __('Day', 'abp-rentalforge'), 'plu' => __('Days', 'abp-rentalforge')], 'multi_day' => ['sin' => __('Day', 'abp-rentalforge'), 'plu' => __('Days', 'abp-rentalforge')], 'monthly' => ['sin' => __('Month', 'abp-rentalforge'), 'plu' => __('Months', 'abp-rentalforge')], 'multi_month' => ['sin' => __('Month', 'abp-rentalforge'), 'plu' => __('Months', 'abp-rentalforge')] ]; $rules = apply_filters('abprf_filter_sin_plu_rent_rule', $rules); if (!is_string($key) && !is_int($key)) { return is_array($rules) ? $rules : []; } if ($key === '') { return is_array($rules) ? $rules : []; } return is_array($rules) ? ($rules[$key] ?? []) : []; } 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 location_select($post_id = '', $location = ''): void { if (ABPRF_Function::on_off('location') && ABPRF_Function::on_off('location_stock')) { $all_locations = ABPRF_Locations; if (!empty($all_locations)) { if (!empty($post_id)) { $location_array = !empty($location) ? explode(',', $location) : []; if (!empty($location_array)) { if (sizeof($location_array) > 1) { ?>
0) { ?> ';print_r($all_dates);echo ''; if (sizeof($all_dates) > 0) { ?> ';print_r($all_dates); echo ''; if (sizeof($all_dates) > 0) { $date_format = ABPRF_Function::date_format_php(); $now = date_i18n($date_format, strtotime(current_time('Y-m-d'))); $date = $date ?: current($all_dates); //if ( sizeof( $all_dates ) > 10 ) { $hidden_date = !empty($date) ? gmdate('Y-m-d', strtotime($date)) : ''; $visible_date = !empty($date) ? date_i18n($date_format, strtotime($date)) : ''; ?> 0) { $date = current($all_dates); //if ( sizeof( $all_dates ) > 10 ) { $hidden_date = !empty($date) ? gmdate('Y-m-d', strtotime($date)) : ''; $visible_date = !empty($date) ? date_i18n($date_format, strtotime($date)) : ''; ?>

'; ABPRF_Layout::image_icon($icon); echo esc_html($label . ' - ' . $value); echo ''; } } ?>
0) ? ABPRF_Function::tax_with_price($post_id, $price) : 0; echo ($price > 0) ? wp_kses_post(wc_price($price)) : esc_html__('Free', 'abp-rentalforge'); echo esc_html(ABPRF_Layout::per_rent_rules($rent_rule)); if ($rent_rule === 'multi_day' || $rent_rule === 'multi_month') { $price_multi = $price_info['price_multi'] ?? ''; $price_multi = apply_filters('abprf_filter_price_multi', $price_multi, $rent_rule, $price_info); $price_multi = ($price_multi !== '' && $price_multi > 0) ? ABPRF_Function::tax_with_price($post_id, $price_multi) : 0; esc_html_e(' & ', 'abp-rentalforge'); echo ($price_multi > 0) ? wp_kses_post(wc_price($price_multi)) : esc_html__('Free', 'abp-rentalforge'); echo ($rent_rule === 'multi_day') ? esc_html(ABPRF_Layout::per_rent_rules('hourly')) : esc_html(ABPRF_Layout::per_rent_rules('daily')); } ?>
0 ? wp_kses_post(wc_price($total_price)) : esc_html__('Free ', 'abp-rentalforge'); ?>
= $min_qty) { $collapse_id = '#' . $post_id . '_' . $property_id; ?>

$min_qty) { $input_info = [ 'name' => 'property_qty[]', 'price' => $total_price, 'available' => $available_qty, 'min_qty' => $min_qty, 'max_qty' => $max_qty, 'collapse_id' => $collapse_id, ]; ABPRF_Layout::quantity_input($input_info); } else { ?>
'validation_name', 'number' => 'validation_number', default => '', }; ?> ABPRF_Layout::select($name, $d_value, $label, $required, $options), 'checkbox' => ABPRF_Layout::checkbox($name, $d_value, $label, $required, $options), 'radio' => ABPRF_Layout::radio($name, $d_value, $label, $required, $options), default => null, }; } } //=============================// public static function ticket_info($ticket_infos): void { if (!empty($ticket_infos) && is_array($ticket_infos)) { ?> 0 ? $post_id : ''; $title = $post_id > 0 ? get_the_title($post_id) : ''; // echo '
';print_r($configuration);echo '
'; ?>
0) { ?>
array('ID', 'display_name'), )); ?>