Changeset 2568075
- Timestamp:
- 07/20/2021 11:07:45 AM (5 years ago)
- Location:
- booking-x/trunk
- Files:
-
- 1 added
- 25 edited
-
README.txt (modified) (3 diffs)
-
admin/class-bookingx-admin.php (modified) (14 diffs)
-
admin/settings.php (modified) (2 diffs)
-
admin/settings/bkx_biz-view.php (modified) (1 diff)
-
admin/settings/bkx_general-view.php (modified) (1 diff)
-
admin/settings/bkx_licence-view.php (added)
-
admin/settings/bkx_payment-view.php (modified) (1 diff)
-
admin/settings/setting-functions.php (modified) (3 diffs)
-
admin/settings/settings_save.php (modified) (1 diff)
-
bookingx.php (modified) (2 diffs)
-
includes/class-bookingx-activator.php (modified) (1 diff)
-
includes/class-bookingx.php (modified) (2 diffs)
-
includes/core/ajax/class-bkx-ajax-loader.php (modified) (6 diffs)
-
includes/core/booking/class-bkx-booking.php (modified) (9 diffs)
-
includes/core/functions/bkx-core-functions.php (modified) (2 diffs)
-
includes/core/functions/filter-actions-functions.php (modified) (4 diffs)
-
includes/core/script/class-bkx-script-loader.php (modified) (1 diff)
-
public/js/booking-form/bkx-booking-form.js (modified) (8 diffs)
-
public/js/booking-form/calendar.js (modified) (3 diffs)
-
public/js/bookingx.js (modified) (2 diffs)
-
templates/booking-form/additional/fields.php (modified) (1 diff)
-
templates/dashboard/nav-content.php (modified) (2 diffs)
-
templates/single-bkx_addition.php (modified) (1 diff)
-
templates/single-bkx_base.php (modified) (1 diff)
-
templates/single-bkx_seat.php (modified) (1 diff)
-
templates/single.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
booking-x/trunk/README.txt
r2550218 r2568075 4 4 Requires at least: 5.0 5 5 Tested up to: 5.7.2 6 Requires PHP: 5.07 Stable tag: 1.0. 56 Requires PHP: 7.0 or higher 7 Stable tag: 1.0.6 8 8 License: GPLv2 or later 9 9 License URI: https://booking-x.com/gpl-licence/ … … 134 134 == Upgrade Notice == 135 135 136 = 1.0.5 = 137 Improvements to administration monthly and weekly booking views 136 = 1.0.6 = 137 Added functionality to handle add-on licensing. 138 UI improvements - including booking ordering. 138 139 139 140 == Updating == … … 148 149 = 1.0.4 - Improvements to edit booking UI and UX. 2021-04-06 = 149 150 = 1.0.5 - Improvements to administration monthly and weekly booking views. 2021-18-06 = 151 = 1.0.6 - Added functionality to handle add-on licensing. UI improvements - including booking ordering. 2021-20-07 = -
booking-x/trunk/admin/class-bookingx-admin.php
r2550218 r2568075 4 4 * 5 5 * @link https://dunskii.com 6 * @since 1.0. 56 * @since 1.0.6 7 7 * 8 8 * @package Bookingx … … 14 14 * The ID of this plugin. 15 15 * 16 * @since 1.0. 516 * @since 1.0.6 17 17 * @access private 18 18 * @var string $plugin_name The ID of this plugin. … … 23 23 * The version of this plugin. 24 24 * 25 * @since 1.0. 525 * @since 1.0.6 26 26 * @access private 27 27 * @var string $version The current version of this plugin. … … 34 34 * @param string $plugin_name The name of this plugin. 35 35 * @param string $version The version of this plugin. 36 * @since 1.0. 536 * @since 1.0.6 37 37 */ 38 38 public function __construct( $plugin_name = null, $version = null ) { … … 42 42 add_filter( 'bkx_calender_unavailable_days', array( $this, 'bkx_calender_unavailable_days' ) ); 43 43 add_filter( 'register_post_type_args', array( $this, 'bkx_seat_post_type_args' ), 10, 2 ); 44 } 44 45 } 46 47 48 45 49 46 50 /** … … 358 362 // phpcs:disable WordPress.DateTime.RestrictedFunctions.date_date 359 363 global $pagenow; 364 if ( ! is_admin() || ! $query->is_main_query() ) { 365 return; 366 } 367 360 368 if ( isset( $pagenow ) && 'edit.php' !== $pagenow || 'bkx_booking' !== $query->query_vars['post_type'] ) { 361 369 return; … … 556 564 } 557 565 566 567 558 568 /** 559 569 * Register_bookingx_post_status … … 622 632 * Register the stylesheets for the admin area. 623 633 * 624 * @since 1.0. 5634 * @since 1.0.6 625 635 */ 626 636 public function enqueue_styles() { … … 644 654 * Register the JavaScript for the admin area. 645 655 * 646 * @since 1.0. 5656 * @since 1.0.6 647 657 */ 648 658 public function enqueue_scripts() { … … 757 767 public function import_now() { 758 768 if ( isset( $_POST['import_xml'] ) && 'Import Xml' === sanitize_text_field( $_POST['import_xml'] ) ) : //phpcs:ignore 759 $bkx_import = new BkxImport();769 $bkx_import = new BkxImport(); 760 770 $bkx_import->import_now(); 761 771 endif; … … 825 835 public function render_bkx_booking_columns( $column ) { 826 836 global $post; 827 828 837 if ( empty( $post->ID ) ) { 829 838 return; … … 838 847 $total_time = getDateDuration( $order_meta ); 839 848 $duration = getDuration( $order_meta ); 840 $date_data = sprintf( __( '%s', 'bookingx' ), date( $date_format, strtotime( $order_meta['booking_ date'] ) ) ); //phpcs:ignore849 $date_data = sprintf( __( '%s', 'bookingx' ), date( $date_format, strtotime( $order_meta['booking_start_date'] ) ) ); //phpcs:ignore 841 850 } else { 842 851 list($date_data, $duration) = getDayDateDuration( $post->ID ); … … 933 942 934 943 /** 944 * @return string 945 */ 946 public function sorting_bkx_booking_columns() { 947 $columns['booking_date'] = 'booking_date'; 948 return $columns; 949 } 950 951 /** 935 952 * Bkx_change_view_link 936 953 * … … 1217 1234 $search['by'] = 'future'; 1218 1235 $search['type'] = $type; 1219 1236 $order_statuses = array( 'bkx-pending', 'bkx-ack', 'bkx-completed', 'bkx-missed' ); 1237 $search['status'] = $order_statuses; 1220 1238 $bkx_calendar_json_data = $bkx_booking->CalendarJsonData( $search ); 1221 1222 1223 1239 if ( isset( $bkx_calendar_json_data ) && ! empty( $bkx_calendar_json_data ) ) { 1224 1240 ?> 1225 1226 document.addEventListener('DOMContentLoaded', function() { 1227 var calendarEl = document.getElementById('calendar'); 1228 1229 var calendar = new FullCalendar.Calendar(calendarEl, { 1230 initialDate: '<?php echo date('Y-m-d'); ?>', 1231 initialView: '<?php echo $default_view;?>', 1232 nowIndicator: true, 1233 headerToolbar: { 1234 left: 'prev,next today', 1235 center: 'title', 1236 right: 'dayGridMonth,timeGridWeek,timeGridDay,listWeek' 1237 }, 1238 navLinks: true, // can click day/week names to navigate views 1239 editable: true, 1240 selectable: true, 1241 selectMirror: true, 1242 dayMaxEvents: true, // allow "more" link when too many events 1243 events: [ 1241 document.addEventListener('DOMContentLoaded', function() { 1242 var calendarEl = document.getElementById('calendar'); 1243 1244 var calendar = new FullCalendar.Calendar(calendarEl, { 1245 initialDate: '<?php echo date( 'Y-m-d' ); ?>', 1246 initialView: '<?php echo $default_view; ?>', 1247 nowIndicator: true, 1248 headerToolbar: { 1249 left: 'prev,next today', 1250 center: 'title', 1251 right: 'dayGridMonth,timeGridWeek,timeGridDay,listWeek' 1252 }, 1253 navLinks: true, // can click day/week names to navigate views 1254 editable: true, 1255 selectable: true, 1256 selectMirror: true, 1257 dayMaxEvents: true, // allow "more" link when too many events 1258 events: [ 1244 1259 <?php echo $bkx_calendar_json_data; //phpcs:ignore ?> 1245 ]1246 });1247 1248 calendar.render();1249 });1260 ] 1261 }); 1262 1263 calendar.render(); 1264 }); 1250 1265 <?php 1251 1266 } -
booking-x/trunk/admin/settings.php
r2550218 r2568075 4 4 * 5 5 * @package Bookingx/admin 6 * @since 1.0. 56 * @since 1.0.6 7 7 */ 8 8 … … 69 69 $bkx_general_submenu_html .= '</ul><p> </p>'; 70 70 } 71 echo $bkx_general_submenu_html; //phpcs:ignore71 echo $bkx_general_submenu_html; //phpcs:ignore 72 72 $bkx_general_submenu_label = $bkx_general_submenu[ $current_submenu_active ]; 73 73 $bkx_submenu_active_label = explode( '|', $bkx_general_submenu_label ); -
booking-x/trunk/admin/settings/bkx_biz-view.php
r2550218 r2568075 4 4 * 5 5 * @package Bookingx/admin 6 * @since 1.0. 56 * @since 1.0.6 7 7 */ 8 8 -
booking-x/trunk/admin/settings/bkx_general-view.php
r2550218 r2568075 4 4 * 5 5 * @package Bookingx/admin 6 * @since 1.0. 56 * @since 1.0.6 7 7 */ 8 8 -
booking-x/trunk/admin/settings/bkx_payment-view.php
r2550218 r2568075 4 4 * 5 5 * @package Bookingx/admin 6 * @since 1.0. 56 * @since 1.0.6 7 7 */ 8 8 -
booking-x/trunk/admin/settings/setting-functions.php
r2550218 r2568075 4 4 * 5 5 * @package Bookingx/admin 6 * @since 1.0. 56 * @since 1.0.6 7 7 */ 8 8 … … 17 17 if ( isset( $_POST['bkx_setting_form_init'] ) && ( 1 === sanitize_text_field( wp_unslash( $_POST['bkx_setting_form_init'] ) ) || '1' === sanitize_text_field( wp_unslash( $_POST['bkx_setting_form_init'] ) ) ) ) { // phpcs:ignore 18 18 bkx_setting_save_action(); 19 } 20 if ( isset( $_POST['bkx_license_activation'] ) ) { 21 bookingx_addon_activate_license(); 19 22 } 20 23 } … … 60 63 ), 61 64 'default' => apply_filters( 'bkx_setting_biz_default', 'biz_info' ), 65 ); 66 67 $tab['bkx_licence'] = array( 68 'label' => 'Licences', 69 'submenu' => array( 70 'all_license' => esc_html( 'Booking X Addon Licences' ), 71 ), 72 'default' => apply_filters( 'bkx_setting_licence_default', 'all_license' ), 62 73 ); 63 74 -
booking-x/trunk/admin/settings/settings_save.php
r2550218 r2568075 4 4 * 5 5 * @package Bookingx/admin 6 * @since 1.0. 56 * @since 1.0.6 7 7 */ 8 8 -
booking-x/trunk/bookingx.php
r2550218 r2568075 4 4 * Plugin URI: https://booking-x.com/ 5 5 * Description: Booking X is a booking and appointments plugin for WordPress 6 * Version: 1.0. 56 * Version: 1.0.6 7 7 * Requires at least: 5.0 8 * Requires PHP: 5.08 * Requires PHP: 7.0 or higher 9 9 * Author: Booking X 10 10 * Author URI: https://booking-x.com/ … … 40 40 define( 'BKX_PLUGIN_PUBLIC_URL', BKX_PLUGIN_DIR_URL . 'public' ); 41 41 define( 'BKX_PLUGIN_PUBLIC_PATH', BKX_PLUGIN_DIR_PATH . 'public' ); 42 define( 'BKX_PLUGIN_VER', '1.0.5' ); 42 define( 'BKX_PLUGIN_VER', '1.0.6' ); 43 define( 'BKX_STORE_URL', 'https://booking-x.com' ); 43 44 define( 'BKX_BLOCKS_ASSETS', BKX_PLUGIN_DIR_URL . 'includes/core/blocks/assets/' ); 44 45 define( 'BKX_BLOCKS_ASSETS_BASE_PATH', BKX_PLUGIN_DIR_PATH . "includes\core\blocks\assets" ); -
booking-x/trunk/includes/class-bookingx-activator.php
r2550218 r2568075 5 5 * This class defines all code necessary to run during the plugin's activation. 6 6 * 7 * @since 1.0. 57 * @since 1.0.6 8 8 * @package Bookingx 9 9 * @subpackage Bookingx/includes -
booking-x/trunk/includes/class-bookingx.php
r2550218 r2568075 22 22 * version of the plugin. 23 23 * 24 * @since 1.0. 524 * @since 1.0.6 25 25 * @package Bookingx 26 26 * @subpackage Bookingx/includes … … 332 332 $this->loader->add_action( 'init', $plugin_admin, 'register_bookingx_post_status' ); 333 333 $this->loader->add_action( 'manage_bkx_booking_posts_custom_column', $plugin_admin, 'render_bkx_booking_columns' ); 334 $this->loader->add_action( 'manage_edit-bkx_booking_sortable_columns', $plugin_admin, 'sorting_bkx_booking_columns' ); 334 335 $this->loader->add_action( 'admin_menu', $plugin_admin, 'bkx_notification_bubble_menu' ); 335 336 -
booking-x/trunk/includes/core/ajax/class-bkx-ajax-loader.php
r2550218 r2568075 93 93 'booking_cancel' => true, 94 94 'customer_details' => true, 95 'dashboard_sort' => true 95 96 ); 96 97 … … 112 113 } 113 114 115 public function dashboard_sort(){ 116 check_ajax_referer( 'dashboard-sort', 'security' ); 117 if ( ! is_user_logged_in() ) { 118 return; 119 } 120 $sort_by = sanitize_text_field( $_POST['sort_by'] ); 121 $type = sanitize_text_field( $_POST['type'] ); 122 $BkxBooking = new BkxBooking(); 123 $search_args['search_date'] = date( 'Y-m-d' ); // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date 124 $search_args['search_by'] = $type; 125 $search_args['user_id'] = get_current_user_id(); 126 $search_args['sort_by'] = isset($sort_by) && $sort_by == 'up' ? 'DESC' : 'ASC'; 127 $BkxDashboard = new BkxDashboard(); 128 $BookedRecords = $BkxBooking->GetBookedRecordsByUser( $search_args ); 129 if ( ! empty( $BookedRecords ) ) { 130 echo $BkxDashboard->booking_html( $BookedRecords ); // phpcs:ignore 131 } else { 132 echo "<tr><td colspan='5'>No Booking's Found</td></tr>"; 133 } 134 wp_die(); 135 } 136 114 137 /** 115 138 * On My account Page Save Customer Details on Submit events … … 117 140 */ 118 141 public static function customer_details() { 119 check_ajax_referer( 'customer-details', 'security' );142 check_ajax_referer( 'customer-details', 'security' ); 120 143 parse_str( $_POST['form_data'], $post_data ); 121 144 $nonce_value = $post_data['bkx-customer-details-nonce']; 122 145 if ( ! wp_verify_nonce( $nonce_value, 'bkx-customer-details' ) && ! is_user_logged_in() ) { 123 return;124 }146 return; 147 } 125 148 $user_id = get_current_user_id(); 126 149 $user = get_user_by( 'ID', $user_id ); … … 516 539 } 517 540 $args['booking_date'] = sanitize_text_field( wp_unslash( $_POST['booking_date'] ) ); 518 $args['user_time_zone'] = ''; 541 $args['bkx_selected_slots'] = isset($_POST['bkx_selected_slots']) ? sanitize_text_field( wp_unslash( $_POST['bkx_selected_slots'] ) ) : ''; 542 543 $args['user_time_zone'] = ''; 519 544 if ( isset( $_POST['user_time_zone'] ) ) { 520 545 $args['user_time_zone'] = sanitize_text_field( $_POST['user_time_zone'] ); 521 }546 } 522 547 // $bkx_booking_style = bkx_crud_option_multisite('bkx_booking_style'); 523 548 // $booking_style = ( ( !isset($bkx_booking_style) || $bkx_booking_style == "" ) ? "default" : $bkx_booking_style); … … 586 611 check_ajax_referer( 'get-verify-slot', 'security' ); 587 612 $BkxBooking = new BkxBooking(); 613 $timezone = array(); 588 614 $args['seat_id'] = sanitize_text_field( wp_unslash( $_POST['seat_id'] ) ); 589 615 $args['base_id'] = sanitize_text_field( wp_unslash( $_POST['base_id'] ) ); … … 596 622 $args['self_edit'] = isset( $_POST['self_edit'] ) && ! empty( $_POST['self_edit'] ) ? sanitize_text_field( wp_unslash( $_POST['self_edit'] ) ) : 0; 597 623 $args['user_time_zone'] = ''; 624 $args['type_data'] = isset($_POST['type_data']) ? sanitize_text_field( wp_unslash( $_POST['type_data'] ) ) : ''; 598 625 if ( isset( $_POST['edit_booking_id'] ) ) { 599 626 $args['edit_booking_id'] = sanitize_text_field( wp_unslash( $_POST['edit_booking_id'] ) ); 600 627 } 601 628 if ( isset( $_POST['user_time_zone'] ) ) { 602 $args['user_time_zone'] = sanitize_text_field( $_POST['user_time_zone'] );603 }629 $args['user_time_zone'] = sanitize_text_field( $_POST['user_time_zone'] ); 630 } 604 631 $BkxBooking->get_verify_slot( $args ); 605 632 } -
booking-x/trunk/includes/core/booking/class-bkx-booking.php
r2544756 r2568075 410 410 endif; 411 411 412 $finalarr = array(); 413 $date = $search['booking_date']; 414 $status = ( empty( $search['status'] ) ) ? 'bkx-pending' : $search['status']; 415 $seat_by_base = ''; 412 $finalarr = array(); 413 $date = $search['booking_date']; 414 $order_statuses = array( 'bkx-pending', 'bkx-ack', 'bkx-completed', 'bkx-missed' ); 415 $status = ( empty( $search['status'] ) ) ? $order_statuses : $search['status']; 416 $seat_by_base = ''; 416 417 if ( isset( $search['service_id'] ) && $search['service_id'] != '' ) { 417 418 $base_id = $search['service_id']; … … 1191 1192 $arr_output['selected_order_id'] = $selected_order_id; 1192 1193 $arr_output['current_order_id'] = $current_order_id; 1194 $arr_output['json_args'] = json_encode( $args ); 1193 1195 $output = ( $res == 1 ) ? wp_json_encode( $arr_output ) : 'NORF'; 1194 1196 if ( $echo == true ) { … … 2434 2436 $user_max_times_allowed = $datetime->format( 'Y-m-d H:i' ); 2435 2437 $is_time_zone_checking = true; 2438 date_default_timezone_set( $default_time_zone ); 2439 $current_time = date( 'Y-m-d H:i' ); 2436 2440 } 2437 2441 } … … 2471 2475 // $sys_time = $user_max_times_allowed;. 2472 2476 } 2473 2477 // echo "$sys_time < $current_time"; 2474 2478 $is_past_time = false; 2475 2479 if ( $sys_time < $current_time && date( 'Ymd' ) == date( 'Ymd', strtotime( $args['booking_date'] ) ) ) { … … 2482 2486 $results .= '<tr>'; 2483 2487 } 2488 $class_time_zone = ''; 2484 2489 if ( $is_time_zone_checking == true ) { 2485 2490 $date = new \DateTime( date( $secs2hours ), new DateTimeZone( $sys_time_zone ) ); 2486 2491 $date->setTimezone( new \DateTimeZone( $args['user_time_zone'] ) ); 2487 $secs2hours = $date->format( 'H:i' ); 2488 $slot_sys_time = $date->format( 'Y-m-d H:i' ); 2492 $secs2hours = $date->format( 'H:i' ); 2493 $slot_sys_time = $date->format( 'Y-m-d H:i' ); 2494 $class_time_zone = 'timezone timezone-' . strtolower( $args['user_time_zone'] ); 2489 2495 } 2490 2496 … … 2505 2511 $data_verify = ' data-verify=' . $args['booking_date'] . '-' . $counter; 2506 2512 } 2513 $bkx_selected_slots = json_decode( $args['bkx_selected_slots'] ); 2514 $selected_class = ''; 2515 if ( ! empty( $bkx_selected_slots ) && in_array( $counter, $bkx_selected_slots ) ) { 2516 $selected_class = ' selected '; 2517 } 2507 2518 2508 2519 if ( ! empty( $booked_slots ) && in_array( $counter, $booked_slots ) ) { 2509 $results .= "<td> <a href=\"javascript:void(0);\" class=\"{$edit_current_class}\" {$self_edit} {$data_verify} data-date='" . $args['booking_date'] . "' data-time='" . bkx_secs2hours( $cell_start ) . "' data-slot='" . $counter . "'>" . $secs2hours . '</a></td>';2520 $results .= "<td> <a href=\"javascript:void(0);\" id=\"booking-{$args['booking_date']}-{$counter}\" class=\"{$class_time_zone} {$edit_current_class}\" {$self_edit} {$data_verify} data-date='" . $args['booking_date'] . "' data-time='" . bkx_secs2hours( $cell_start ) . "' data-slot='" . $counter . "'>" . $secs2hours . '</a></td>'; 2510 2521 } else { 2511 2522 if ( ! empty( $booked_day_dates ) ) { 2512 2523 if ( in_array( $args['booking_date'], $booked_day_dates ) ) { 2513 $results .= "<td> <a href=\"javascript:void(0);\" class=\"disabled\" data-date='" . $args['booking_date'] . "' data-time='" . bkx_secs2hours( $cell_start ) . "' data-slot='" . $counter . "'>" . $secs2hours . '</a></td>';2524 $results .= "<td> <a href=\"javascript:void(0);\" id=\"booking-{$args['booking_date']}-{$counter}\" class=\"disabled {$class_time_zone} \" data-date='" . $args['booking_date'] . "' data-time='" . bkx_secs2hours( $cell_start ) . "' data-slot='" . $counter . "'>" . $secs2hours . '</a></td>'; 2514 2525 } else { 2515 2526 if ( $is_past_time == true || $is_restricted_time == true ) { 2516 $results .= "<td> <a href=\"javascript:void(0);\" class=\"disabled\" data-date='" . $args['booking_date'] . "' data-time='" . bkx_secs2hours( $cell_start ) . "' data-slot='" . $counter . "'>" . $secs2hours . '</a></td>';2527 $results .= "<td> <a href=\"javascript:void(0);\" id=\"booking-{$args['booking_date']}-{$counter}\" class=\"disabled {$class_time_zone} \" data-date='" . $args['booking_date'] . "' data-time='" . bkx_secs2hours( $cell_start ) . "' data-slot='" . $counter . "'>" . $secs2hours . '</a></td>'; 2517 2528 } else { 2518 $results .= "<td> <a href=\"javascript:void(0);\" class=\"available\" data-verify='" . $args['booking_date'] . '-' . $counter . "' data-date='" . $args['booking_date'] . "' data-time='" . bkx_secs2hours( $cell_start ) . "' data-slot='" . $counter . "'>" . $secs2hours . '</a></td>';2529 $results .= "<td> <a href=\"javascript:void(0);\" id=\"booking-{$args['booking_date']}-{$counter}\" class=\"available {$selected_class} {$class_time_zone} \" data-verify='" . $args['booking_date'] . '-' . $counter . "' data-date='" . $args['booking_date'] . "' data-time='" . bkx_secs2hours( $cell_start ) . "' data-slot='" . $counter . "'>" . $secs2hours . '</a></td>'; 2519 2530 } 2520 2531 } … … 2522 2533 // $results .= "<td> <a href=\"javascript:void(0);\" class=\"available\" data-verify='" . $args['booking_date'] . "-" . $counter . "' data-date='" . $args['booking_date'] . "' data-time='" . bkx_secs2hours($cell_start) . "' data-slot='" . $counter . "'>" . bkx_secs2hours($cell_start) . "</a></td>"; 2523 2534 if ( $is_past_time == true || $is_restricted_time == true ) { 2524 $results .= "<td> <a href=\"javascript:void(0);\" class=\"disabled\" data-date='" . $args['booking_date'] . "' data-time='" . bkx_secs2hours( $cell_start ) . "' data-slot='" . $counter . "'>" . $secs2hours . '</a></td>';2535 $results .= "<td> <a href=\"javascript:void(0);\" id=\"booking-{$args['booking_date']}-{$counter}\" class=\"disabled {$class_time_zone} \" data-date='" . $args['booking_date'] . "' data-time='" . bkx_secs2hours( $cell_start ) . "' data-slot='" . $counter . "'>" . $secs2hours . '</a></td>'; 2525 2536 } else { 2526 $results .= "<td> <a href=\"javascript:void(0);\" class=\"available\" data-verify='" . $args['booking_date'] . '-' . $counter . "' data-date='" . $args['booking_date'] . "' data-time='" . bkx_secs2hours( $cell_start ) . "' data-slot='" . $counter . "'>" . $secs2hours . '</a></td>';2537 $results .= "<td> <a href=\"javascript:void(0);\" id=\"booking-{$args['booking_date']}-{$counter}\" class=\"available {$selected_class} {$class_time_zone} \" data-verify='" . $args['booking_date'] . '-' . $counter . "' data-date='" . $args['booking_date'] . "' data-time='" . bkx_secs2hours( $cell_start ) . "' data-slot='" . $counter . "'>" . $secs2hours . '</a></td>'; 2527 2538 } 2528 2539 } … … 2726 2737 $search_by = ( empty( $search['search_by'] ) ) ? '' : $search['search_by']; 2727 2738 $search_date = ( empty( $search['search_date'] ) ) ? '' : $search['search_date']; 2739 $sort_by = ( empty( $search['sort_by'] ) ) ? 'DESC' : $search['sort_by']; 2728 2740 if ( is_admin() ) { 2729 2741 $seat_id = get_current_user_id(); … … 2806 2818 break; 2807 2819 } 2808 $args = apply_filters( 'bkx_get_bookings_by_user', $args ); 2809 $booked_result = new WP_Query( $args ); 2820 2821 $args['meta_key'] = 'booking_start_date'; 2822 $args['orderby'] = 'meta_value'; 2823 $args['order'] = $sort_by; 2824 $args = apply_filters( 'bkx_get_bookings_by_user', $args ); 2825 $booked_result = new WP_Query( $args ); 2810 2826 if ( $booked_result->have_posts() ) : 2811 2827 while ( $booked_result->have_posts() ) : -
booking-x/trunk/includes/core/functions/bkx-core-functions.php
r2544756 r2568075 1796 1796 $extra_data = ''; 1797 1797 foreach ( $order_meta['extra_arr'] as $extra_obj ) { 1798 $main_obj = $extra_obj['main_obj']->post; 1799 $extra_title = $main_obj->post_title; 1800 $extra_data .= " {$extra_title} " . ','; 1798 if(!empty($extra_obj) && !empty($extra_obj['main_obj']->post)){ 1799 $main_obj = $extra_obj['main_obj']->post; 1800 $extra_title = $main_obj->post_title; 1801 $extra_data .= " {$extra_title} " . ','; 1802 } 1801 1803 } 1802 1804 $extra_data = rtrim( $extra_data, ',' ); … … 1956 1958 } 1957 1959 } 1960 1961 function bkx_check_is_active_addons( $info ){ 1962 if(empty($info)) 1963 return; 1964 $is_our_addon = false; 1965 if( trim( $info['AuthorName'] ) == 'Booking X' && trim($info['AuthorURI']) == 'https://dunskii.com' && $info['Name'] != 'Booking X'){ 1966 $is_our_addon = true; 1967 } 1968 return $is_our_addon; 1969 } 1970 1971 function generate_addon_license_section_fields( $info ){ 1972 $license = get_option( $info['key_name'] ); 1973 $status = get_option( $info['status'] ); 1974 $error = get_option( "{$info['status']}_errors" ); 1975 if ( $status !== false && $status == 'valid' ) { 1976 $addon_status_text = '<span style="color:green;">'.__('Active').'</span>'; 1977 }else{ 1978 $addon_status_text = '<span style="color:red;">'.__($error).'</span>'; 1979 } 1980 1981 return '<tr valign="top"> 1982 <th scope="row" valign="top"> 1983 '.__( $info['addon_name']).' 1984 </th> 1985 <td> 1986 <input placeholder="'.__( 'Enter your license key' ).'" id="'.esc_attr($info['key_name']).'" name="'.esc_attr($info['key_name']).'" type="text" class="regular-text" value="'.esc_attr( $license ).'" /> 1987 <input name="'.esc_attr($info['key_name']).'_data" type="hidden" value="'.esc_attr( $license ).'|'.esc_attr($info['key_name']).'|'.esc_attr($info['status']).'|'.esc_attr($info['addon_name']).'" /> 1988 '.$addon_status_text.' 1989 </td> 1990 </tr>'; 1991 } 1992 1993 /** 1994 * @param $new 1995 * @param $key 1996 * @param $status 1997 * 1998 * @return mixed 1999 */ 2000 function bookingx_sanitize_license( $new , $key ,$status) { 2001 $old = get_option( $key ); 2002 if ( $old != $new ) { 2003 delete_option( $status ); // new license has been entered, so must reactivate 2004 update_option( $key, $new ); 2005 } 2006 return $new; 2007 } 2008 2009 function bookingx_addon_activate_license() { 2010 2011 // listen for our activate button to be clicked 2012 if ( isset( $_POST['bkx_license_activation'] ) ) { 2013 // run a quick security check 2014 if ( ! check_admin_referer( 'bkx_license_activation_nonce', 'bkx_license_activation_nonce' ) ) { 2015 return; // get out if we didn't click the Activate button 2016 } 2017 2018 if ( ! current_user_can( 'manage_options' ) ) { 2019 return; 2020 } 2021 2022 if(!empty($_POST)){ 2023 foreach ($_POST as $key => $license_value ){ 2024 2025 if (strpos($key, 'license_key_data') !== false) { 2026 $license_key_data = explode("|", $license_value ); 2027 $license_key = $license_key_data[1]; 2028 $license_status = $license_key_data[2]; 2029 $addon_name = $license_key_data[3]; 2030 if ( isset( $_POST[$license_key] ) ) { 2031 bookingx_sanitize_license( $_POST[$license_key], $license_key, $license_status ); 2032 } 2033 // retrieve the license from the database 2034 $license = trim( get_option( $license_key ) ); 2035 2036 // data to send in our API request 2037 $api_params = array( 2038 'edd_action' => 'activate_license', 2039 'license' => $license, 2040 'item_name' => urlencode( $addon_name ), // the name of our product in EDD 2041 'url' => home_url(), 2042 ); 2043 // Call the custom API. 2044 $response = wp_remote_post( 2045 BKX_STORE_URL, 2046 array( 2047 'timeout' => 15, 2048 'sslverify' => false, 2049 'body' => $api_params, 2050 ) 2051 ); 2052 $message = ""; 2053 // make sure the response came back okay 2054 if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) { 2055 2056 if ( is_wp_error( $response ) ) { 2057 $message = $response->get_error_message(); 2058 } else { 2059 $message = __( 'An error occurred, please try again.' ); 2060 } 2061 } else { 2062 $license_data = json_decode( wp_remote_retrieve_body( $response ) ); 2063 2064 if ( false === $license_data->success ) { 2065 2066 switch ( $license_data->error ) { 2067 2068 case 'expired': 2069 $message = sprintf( 2070 __( 'Your license key expired on %s.' ), 2071 date_i18n( get_option( 'date_format' ), strtotime( $license_data->expires, current_time( 'timestamp' ) ) ) 2072 ); 2073 break; 2074 2075 case 'disabled': 2076 case 'revoked': 2077 $message = __( 'Your license key has been disabled.' ); 2078 break; 2079 2080 case 'missing': 2081 $message = __( 'Invalid license.' ); 2082 break; 2083 2084 case 'invalid': 2085 case 'site_inactive': 2086 $message = __( 'Your license is not active for this URL.' ); 2087 break; 2088 2089 case 'item_name_mismatch': 2090 $message = sprintf( __( 'This appears to be an invalid license key for %s.' ), TIMEZONE_ITEM_NAME ); 2091 break; 2092 2093 case 'no_activations_left': 2094 $message = __( 'Your license key has reached its activation limit.' ); 2095 break; 2096 2097 default: 2098 $message = __( 'An error occurred, please try again.' ); 2099 break; 2100 } 2101 } 2102 update_option( $license_status, $license_data->license ); 2103 update_option( "{$license_status}_errors", $message ); 2104 } 2105 } 2106 } 2107 } 2108 } 2109 } 2110 2111 function booking_license_setting_page(){ 2112 return admin_url('edit.php?post_type=bkx_booking&page=bkx-setting&bkx_tab=bkx_licence'); 2113 } 2114 -
booking-x/trunk/includes/core/functions/filter-actions-functions.php
r2544756 r2568075 417 417 } 418 418 419 // add_action( 'load-edit.php', 'bkx_bulk_action' );419 // add_action( 'load-edit.php', 'bkx_bulk_action' ); 420 420 /** 421 421 * @throws Exception … … 447 447 $report_action => false, 448 448 'changed' => $changed, 449 // 'ids' => join( ',', $post_ids ),449 // 'ids' => join( ',', $post_ids ), 450 450 ), 451 451 '' … … 454 454 $sendback = add_query_arg( 'post_status', sanitize_text_field( wp_unslash( $_GET['post_status'] ) ), $sendback ); 455 455 } 456 echo "<pre>".print_r($sendback, true)."</pre>";die; 456 echo '<pre>' . print_r( $sendback, true ) . '</pre>'; 457 die; 457 458 wp_redirect( esc_url_raw( $sendback ) ); 458 459 exit(); … … 995 996 return $booking_detail; 996 997 } 998 999 add_action( 'bkx_dashboard_lable_action', 'bkx_dashboard_lable_action_call_back', 10, 2 ); 1000 function bkx_dashboard_lable_action_call_back( $column_id, $tab ) { 1001 if ( empty( $column_id ) ) { 1002 return; 1003 } 1004 if ( $column_id == 'booking-date' ) { 1005 echo '<a href="javascript:void(0);" data-sort="up" data-type="'.$tab.'" class="bkx-dashboard-sort-up-'.$tab.'"><span>↑</span> </a> <a href="javascript:void(0);" data-sort="down" data-type="'.$tab.'" class="bkx-dashboard-sort-down-'.$tab.'"><span>↓</span></a>'; 1006 } 1007 } -
booking-x/trunk/includes/core/script/class-bkx-script-loader.php
r2550218 r2568075 403 403 'customer_details_nonce' => wp_create_nonce( 'customer-details' ), 404 404 'booking_cancel_nonce' => wp_create_nonce( 'booking-cancel' ), 405 'dashboard_sort_nonce' => wp_create_nonce( 'dashboard-sort' ), 405 406 ); 406 407 -
booking-x/trunk/public/js/booking-form/bkx-booking-form.js
r2550218 r2568075 303 303 if(time_zone && time_zone != ''){ 304 304 if (GetCurrentStep() == 2 && booking_form.booking_style == 'default') { 305 booking_form.BookingFormGetCalendarAvailability(moment().format("Y-M-D")); 305 var selected_date = $('#bkx_date_selected_date').val(); 306 var s_date = selected_date.split("-"); 307 var date = new Date(s_date[0], s_date[1]-1, s_date[2]); 308 var bkx_selected_slots = $('#bkx_selected_slots_no').val(); 309 booking_form.BookingFormGetCalendarAvailability(moment(date).format("Y-M-D"), bkx_selected_slots); 310 306 311 } 307 312 } … … 830 835 date: $(this).data('date'), 831 836 time: $(this).data('time'), 832 user_time_zone: user_time_zone 837 user_time_zone: user_time_zone, 838 type_data : '' 833 839 }; 834 840 … … 849 855 $('.booking-slots').data("starting_slot", starting_slot); 850 856 $('.booking-slots').data("date", booking_date); 851 booking_form.date = booking_date 857 $('#bkx_selected_slots').val(result.json_args); 858 booking_form.date = booking_date; 859 var bkx_selected_slots_no = []; 852 860 for (var slot = starting_slot; slot <= end_slot; slot++) { 853 861 if ($('.booking-slots').find("a[data-date='" + booking_date + "']").attr('data-date') == booking_date) { 862 bkx_selected_slots_no.push(slot); 854 863 $('.booking-slots').find("a[data-verify='" + booking_date + "-" + slot + "']").addClass('selected'); 855 864 } 856 865 } 866 if(bkx_selected_slots_no.length > 0){ 867 $('#bkx_selected_slots_no').val(JSON.stringify(bkx_selected_slots_no)); 868 } 869 857 870 booking_form.get_step_3_details(); 858 871 } else { … … 920 933 }); 921 934 }, 922 BookingFormGetCalendarAvailability: function (currentSelected ) {935 BookingFormGetCalendarAvailability: function (currentSelected, bkx_selected_slots) { 923 936 block($('div.step-2')); 924 937 var data = { … … 928 941 extra_id: booking_form.extra_id 929 942 }; 943 930 944 var current_day = {}; 931 945 current_day.currentSelected = currentSelected; 932 booking_form.BookingFormGetAvailableSlotByDate(current_day );946 booking_form.BookingFormGetAvailableSlotByDate(current_day, '', bkx_selected_slots); 933 947 $.ajax({ 934 948 type: 'POST', … … 947 961 }; 948 962 //calendar.diasResal = [4, 15, 26]; //Selected Days 963 calendar.bkx_selected_date = currentSelected; 949 964 calendar.staffAvailableCertainMonths = staffAvailableCertainMonths; 950 965 calendar.staffAvailableCertainDays = staffAvailableCertainDays; … … 960 975 }); 961 976 }, 962 BookingFormGetAvailableSlotByDate: function (calendar, availability_slots = "" ) {977 BookingFormGetAvailableSlotByDate: function (calendar, availability_slots = "", bkx_selected_slots = "") { 963 978 block($('div.step-2')); 964 booking_form.total_slots = 0; 965 booking_form.starting_slot = 0; 966 $('.booking-slots').data("total_slots", 0); 967 $('.booking-slots').data("starting_slot", 0); 979 if(bkx_selected_slots == '' ){ 980 booking_form.total_slots = 0; 981 booking_form.starting_slot = 0; 982 $('.booking-slots').data("total_slots", 0); 983 $('.booking-slots').data("starting_slot", 0); 984 } 968 985 booking_form.date = calendar.currentSelected; 969 986 var service_extend = $('.bkx-booking-form .step-1 .bkx-services-extend').val(); 970 987 var user_time_zone = $('#bkx_user_time_zone').val(); 988 $('#bkx_date_selected_date').val(calendar.currentSelected); 971 989 var data = { 972 990 security: bkx_booking_form_params.display_availability_slots_nonce, … … 976 994 service_extend: service_extend, 977 995 booking_date: calendar.currentSelected, 978 user_time_zone : user_time_zone 996 user_time_zone : user_time_zone, 997 bkx_selected_slots : bkx_selected_slots 979 998 }; 980 999 if (availability_slots == "") { -
booking-x/trunk/public/js/booking-form/calendar.js
r2544756 r2568075 23 23 this.unavailable_days = []; // Resource be available at certain days only 24 24 this.diasResal = []; // dias importantes 25 this.bkx_selected_date = ""; 25 26 this.colorResal = "#ebebeb"; // Color of important days 26 27 this.textResalt = "#fff"; // Preload Selected Days Color … … 132 133 var fechNow = this.anioSeleccionado + "-" + this.mesSeleccionado + "-" + (i + 1); 133 134 // dia seleccionado 134 if (this.diaSeleccionado == moment( fechNow ).format( "Y-MM-DD" )) { 135 136 if (this.diaSeleccionado == moment( fechNow ).format( "Y-MM-DD" ) ) { 135 137 current_date_selected = ' current-date-selected '; 136 138 } … … 141 143 var current_day = moment( fechNow ).format( "dddd" ); 142 144 143 if ( this.diaSeleccionado == moment( fechNow ).format( "Y-MM-DD" )) {145 if (fechNow == moment().format( "Y-MM-DD" ) || fechNow == moment().format( "Y-M-D" )) { 144 146 div = $( "<div class='current-date-selected d-flex flex-fill w-100 justify-content-center btn " + this.btnD + "' data-date='" + fechNow + "'>" ).html( i + 1 ); 145 147 } 146 148 149 if (fechNow == this.bkx_selected_date) { 150 div = $( "<div class='on-click-selected d-flex flex-fill w-100 justify-content-center btn " + this.btnD + "' data-date='" + fechNow + "'>" ).html( i + 1 ); 151 } 147 152 // Start Less than today date will be disable 148 153 if (moment( fechNow ).format( "Y-MM-DD" ) < moment().format( "Y-MM-DD" )) { -
booking-x/trunk/public/js/bookingx.js
r2496574 r2568075 75 75 //$(document).on('click', '.booking-x .bkx-dashboard-booking .bkx-booking-cancel-view', this.booking_cancel); 76 76 $(document).on('click button', '.booking-x .bkx-dashboard-booking #bkx-booking-cancel-modal', this.booking_cancel); 77 $(document).on('click a', '.booking-x #bkx-dashboard-bookings .bkx-dashboard-sort-up-future', this.dashboard_sort); 78 $(document).on('click a', '.booking-x #bkx-dashboard-bookings .bkx-dashboard-sort-down-future', this.dashboard_sort); 79 $(document).on('click a', '.booking-x #bkx-dashboard-bookings .bkx-dashboard-sort-up-past', this.dashboard_sort); 80 $(document).on('click a', '.booking-x #bkx-dashboard-bookings .bkx-dashboard-sort-down-past', this.dashboard_sort); 77 81 }, 78 82 booking_cancel : function (){ … … 213 217 }); 214 218 }, 219 dashboard_sort : function () { 220 block($('.bkx-dashboard-tabContent')); 221 var sort_by = $(this).data('sort'); 222 var type = $(this).data('type'); 223 $('.bkx-dashboard-bookings-tbody.'+type).html('Please wait...'); 224 var data = { 225 security: bookingx_params.dashboard_sort_nonce, 226 sort_by: sort_by, 227 type : type 228 } 229 $.ajax({ 230 type: 'POST', 231 url: get_url('dashboard_sort'), 232 data: data, 233 dataType: 'html', 234 success: function (response) { 235 if (response) { 236 $('.bkx-dashboard-bookings-tbody.'+type).html(response) 237 } 238 unblock($('.bkx-dashboard-tabContent')); 239 }, 240 complete: function () { 241 unblock($('.bkx-dashboard-tabContent')); 242 }, 243 error: function () { 244 245 unblock($('.bkx-dashboard-tabContent')); 246 } 247 }); 248 } 215 249 } 216 250 -
booking-x/trunk/templates/booking-form/additional/fields.php
r2544756 r2568075 15 15 <input type="hidden" name="bkx_gateway_flag" id="bkx_gateway_flag" class="bkx_gateway_flag" value="1"> 16 16 <input type="hidden" name="bkx_is_prepayment" id="bkx_is_prepayment" value="false"> 17 <input type="hidden" name="bkx_date_selected_date" id="bkx_date_selected_date" value=""> 18 <input type="hidden" name="bkx_selected_slots" id="bkx_selected_slots" value=""> 19 <input type="hidden" name="bkx_selected_slots_no" id="bkx_selected_slots_no" value=""> -
booking-x/trunk/templates/dashboard/nav-content.php
r2544756 r2568075 29 29 <tr> 30 30 <?php foreach ( $dashboard_columns as $column_id => $column_name ) : ?> 31 <th scope="col" class="<?php echo esc_attr( $column_id ); ?>"><?php echo esc_html( $column_name ); ?></th> 31 <th scope="col" class="<?php echo esc_attr( $column_id ); ?>"><?php echo esc_html( $column_name ); ?> <?php do_action('bkx_dashboard_lable_action', $column_id, 'future'); ?></th> 32 32 33 <?php endforeach; ?> 33 34 </tr> 34 35 </thead> 35 <tbody >36 <tbody class="bkx-dashboard-bookings-tbody future"> 36 37 <?php 37 38 if ( ! empty( $GetFutureBookedRecords ) ) { … … 49 50 <tr> 50 51 <?php foreach ( $dashboard_columns as $column_id => $column_name ) : ?> 51 <th scope="col" class="<?php echo esc_attr( $column_id ); ?>"><?php echo esc_html( $column_name ); ?>< /th>52 <th scope="col" class="<?php echo esc_attr( $column_id ); ?>"><?php echo esc_html( $column_name ); ?><?php do_action('bkx_dashboard_lable_action', $column_id, 'past'); ?></th> 52 53 <?php endforeach; ?> 53 54 </tr> 54 55 </thead> 55 <tbody >56 <tbody class="bkx-dashboard-bookings-tbody past"> 56 57 <?php 57 58 if ( ! empty( $GetPastBookedRecords ) ) { -
booking-x/trunk/templates/single-bkx_addition.php
r2550218 r2568075 5 5 * @package Bookingx 6 6 * @subpackage bookingx 7 * @since 1.0. 57 * @since 1.0.6 8 8 */ 9 9 -
booking-x/trunk/templates/single-bkx_base.php
r2550218 r2568075 5 5 * @package Bookingx 6 6 * @subpackage bookingx 7 * @since 1.0. 57 * @since 1.0.6 8 8 */ 9 9 -
booking-x/trunk/templates/single-bkx_seat.php
r2550218 r2568075 5 5 * @package Bookingx 6 6 * @subpackage bookingx 7 * @since 1.0. 57 * @since 1.0.6 8 8 */ 9 9 -
booking-x/trunk/templates/single.php
r2550218 r2568075 5 5 * @package Bookingx 6 6 * @subpackage bookingx 7 * @since 1.0. 57 * @since 1.0.6 8 8 */ 9 9
Note: See TracChangeset
for help on using the changeset viewer.