Plugin Directory

Changeset 2568075


Ignore:
Timestamp:
07/20/2021 11:07:45 AM (5 years ago)
Author:
dunskii
Message:

Added functionality to handle add-on licensing.
UI improvements - including booking ordering.

Location:
booking-x/trunk
Files:
1 added
25 edited

Legend:

Unmodified
Added
Removed
  • booking-x/trunk/README.txt

    r2550218 r2568075  
    44Requires at least: 5.0
    55Tested up to: 5.7.2
    6 Requires PHP: 5.0
    7 Stable tag: 1.0.5
     6Requires PHP: 7.0 or higher
     7Stable tag: 1.0.6
    88License: GPLv2 or later
    99License URI: https://booking-x.com/gpl-licence/
     
    134134== Upgrade Notice ==
    135135
    136 = 1.0.5 =
    137 Improvements to administration monthly and weekly booking views
     136= 1.0.6 =
     137Added functionality to handle add-on licensing.
     138UI improvements - including booking ordering.
    138139
    139140== Updating ==
     
    148149= 1.0.4 - Improvements to edit booking UI and UX. 2021-04-06 =
    149150= 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  
    44 *
    55 * @link       https://dunskii.com
    6  * @since      1.0.5
     6 * @since      1.0.6
    77 *
    88 * @package    Bookingx
     
    1414     * The ID of this plugin.
    1515     *
    16      * @since      1.0.5
     16     * @since      1.0.6
    1717     * @access   private
    1818     * @var      string $plugin_name The ID of this plugin.
     
    2323     * The version of this plugin.
    2424     *
    25      * @since      1.0.5
     25     * @since      1.0.6
    2626     * @access   private
    2727     * @var      string $version The current version of this plugin.
     
    3434     * @param string $plugin_name The name of this plugin.
    3535     * @param string $version The version of this plugin.
    36      * @since      1.0.5
     36     * @since      1.0.6
    3737     */
    3838    public function __construct( $plugin_name = null, $version = null ) {
     
    4242        add_filter( 'bkx_calender_unavailable_days', array( $this, 'bkx_calender_unavailable_days' ) );
    4343        add_filter( 'register_post_type_args', array( $this, 'bkx_seat_post_type_args' ), 10, 2 );
    44     }
     44
     45    }
     46
     47
     48
    4549
    4650    /**
     
    358362        // phpcs:disable WordPress.DateTime.RestrictedFunctions.date_date
    359363        global $pagenow;
     364        if ( ! is_admin() || ! $query->is_main_query() ) {
     365            return;
     366        }
     367
    360368        if ( isset( $pagenow ) && 'edit.php' !== $pagenow || 'bkx_booking' !== $query->query_vars['post_type'] ) {
    361369            return;
     
    556564    }
    557565
     566
     567
    558568    /**
    559569     * Register_bookingx_post_status
     
    622632     * Register the stylesheets for the admin area.
    623633     *
    624      * @since      1.0.5
     634     * @since      1.0.6
    625635     */
    626636    public function enqueue_styles() {
     
    644654     * Register the JavaScript for the admin area.
    645655     *
    646      * @since      1.0.5
     656     * @since      1.0.6
    647657     */
    648658    public function enqueue_scripts() {
     
    757767    public function import_now() {
    758768        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();
    760770            $bkx_import->import_now();
    761771        endif;
     
    825835    public function render_bkx_booking_columns( $column ) {
    826836        global $post;
    827 
    828837        if ( empty( $post->ID ) ) {
    829838            return;
     
    838847            $total_time = getDateDuration( $order_meta );
    839848            $duration   = getDuration( $order_meta );
    840             $date_data  = sprintf( __( '%s', 'bookingx' ), date( $date_format, strtotime( $order_meta['booking_date'] ) ) ); //phpcs:ignore
     849            $date_data  = sprintf( __( '%s', 'bookingx' ), date( $date_format, strtotime( $order_meta['booking_start_date'] ) ) ); //phpcs:ignore
    841850        } else {
    842851            list($date_data, $duration) = getDayDateDuration( $post->ID );
     
    933942
    934943    /**
     944     * @return string
     945     */
     946    public function sorting_bkx_booking_columns() {
     947        $columns['booking_date'] = 'booking_date';
     948        return $columns;
     949    }
     950
     951    /**
    935952     * Bkx_change_view_link
    936953     *
     
    12171234            $search['by']           = 'future';
    12181235            $search['type']         = $type;
    1219 
     1236            $order_statuses         = array( 'bkx-pending', 'bkx-ack', 'bkx-completed', 'bkx-missed' );
     1237            $search['status']       = $order_statuses;
    12201238            $bkx_calendar_json_data = $bkx_booking->CalendarJsonData( $search );
    1221 
    1222 
    12231239            if ( isset( $bkx_calendar_json_data ) && ! empty( $bkx_calendar_json_data ) ) {
    12241240                ?>
    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: [
    12441259                <?php echo $bkx_calendar_json_data; //phpcs:ignore ?>
    1245                 ]
    1246                 });
    1247 
    1248                 calendar.render();
    1249                 });
     1260                ]
     1261                });
     1262
     1263                calendar.render();
     1264                });
    12501265                <?php
    12511266            }
  • booking-x/trunk/admin/settings.php

    r2550218 r2568075  
    44 *
    55 * @package Bookingx/admin
    6  * @since      1.0.5
     6 * @since      1.0.6
    77 */
    88
     
    6969            $bkx_general_submenu_html .= '</ul><p> &nbsp;</p>';
    7070        }
    71      echo $bkx_general_submenu_html; //phpcs:ignore
     71        echo $bkx_general_submenu_html; //phpcs:ignore
    7272        $bkx_general_submenu_label = $bkx_general_submenu[ $current_submenu_active ];
    7373        $bkx_submenu_active_label  = explode( '|', $bkx_general_submenu_label );
  • booking-x/trunk/admin/settings/bkx_biz-view.php

    r2550218 r2568075  
    44 *
    55 * @package Bookingx/admin
    6  * @since      1.0.5
     6 * @since      1.0.6
    77 */
    88
  • booking-x/trunk/admin/settings/bkx_general-view.php

    r2550218 r2568075  
    44 *
    55 * @package Bookingx/admin
    6  * @since      1.0.5
     6 * @since      1.0.6
    77 */
    88
  • booking-x/trunk/admin/settings/bkx_payment-view.php

    r2550218 r2568075  
    44 *
    55 * @package Bookingx/admin
    6  * @since      1.0.5
     6 * @since      1.0.6
    77 */
    88
  • booking-x/trunk/admin/settings/setting-functions.php

    r2550218 r2568075  
    44 *
    55 * @package Bookingx/admin
    6  * @since      1.0.5
     6 * @since      1.0.6
    77 */
    88
     
    1717    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
    1818        bkx_setting_save_action();
     19    }
     20    if ( isset( $_POST['bkx_license_activation'] ) ) {
     21        bookingx_addon_activate_license();
    1922    }
    2023}
     
    6063            ),
    6164            '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' ),
    6273        );
    6374
  • booking-x/trunk/admin/settings/settings_save.php

    r2550218 r2568075  
    44 *
    55 * @package Bookingx/admin
    6  * @since      1.0.5
     6 * @since      1.0.6
    77 */
    88
  • booking-x/trunk/bookingx.php

    r2550218 r2568075  
    44 *  Plugin URI: https://booking-x.com/
    55 *  Description: Booking X is a booking and appointments plugin for WordPress
    6  *  Version: 1.0.5
     6 *  Version: 1.0.6
    77 *  Requires at least: 5.0
    8  *  Requires PHP: 5.0
     8 *  Requires PHP: 7.0 or higher
    99 *  Author: Booking X
    1010 *  Author URI: https://booking-x.com/
     
    4040define( 'BKX_PLUGIN_PUBLIC_URL', BKX_PLUGIN_DIR_URL . 'public' );
    4141define( 'BKX_PLUGIN_PUBLIC_PATH', BKX_PLUGIN_DIR_PATH . 'public' );
    42 define( 'BKX_PLUGIN_VER', '1.0.5' );
     42define( 'BKX_PLUGIN_VER', '1.0.6' );
     43define( 'BKX_STORE_URL', 'https://booking-x.com' );
    4344define( 'BKX_BLOCKS_ASSETS', BKX_PLUGIN_DIR_URL . 'includes/core/blocks/assets/' );
    4445define( 'BKX_BLOCKS_ASSETS_BASE_PATH', BKX_PLUGIN_DIR_PATH . "includes\core\blocks\assets" );
  • booking-x/trunk/includes/class-bookingx-activator.php

    r2550218 r2568075  
    55 * This class defines all code necessary to run during the plugin's activation.
    66 *
    7  * @since      1.0.5
     7 * @since      1.0.6
    88 * @package    Bookingx
    99 * @subpackage Bookingx/includes
  • booking-x/trunk/includes/class-bookingx.php

    r2550218 r2568075  
    2222 * version of the plugin.
    2323 *
    24  * @since      1.0.5
     24 * @since      1.0.6
    2525 * @package    Bookingx
    2626 * @subpackage Bookingx/includes
     
    332332        $this->loader->add_action( 'init', $plugin_admin, 'register_bookingx_post_status' );
    333333        $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' );
    334335        $this->loader->add_action( 'admin_menu', $plugin_admin, 'bkx_notification_bubble_menu' );
    335336
  • booking-x/trunk/includes/core/ajax/class-bkx-ajax-loader.php

    r2550218 r2568075  
    9393         'booking_cancel'              => true,
    9494         'customer_details'            => true,
     95         'dashboard_sort'              => true
    9596        );
    9697
     
    112113    }
    113114
     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
    114137    /**
    115138     * On My account Page Save Customer Details on Submit events
     
    117140     */
    118141    public static function customer_details() {
    119          check_ajax_referer( 'customer-details', 'security' );
     142        check_ajax_referer( 'customer-details', 'security' );
    120143        parse_str( $_POST['form_data'], $post_data );
    121144        $nonce_value = $post_data['bkx-customer-details-nonce'];
    122145        if ( ! wp_verify_nonce( $nonce_value, 'bkx-customer-details' ) && ! is_user_logged_in() ) {
    123          return;
    124               }
     146          return;
     147        }
    125148        $user_id       = get_current_user_id();
    126149        $user          = get_user_by( 'ID', $user_id );
     
    516539              }
    517540        $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'] = '';
    519544        if ( isset( $_POST['user_time_zone'] ) ) {
    520545         $args['user_time_zone'] = sanitize_text_field( $_POST['user_time_zone'] );
    521               }
     546        }
    522547        // $bkx_booking_style = bkx_crud_option_multisite('bkx_booking_style');
    523548        // $booking_style = ( ( !isset($bkx_booking_style) || $bkx_booking_style == "" ) ? "default" : $bkx_booking_style);
     
    586611        check_ajax_referer( 'get-verify-slot', 'security' );
    587612        $BkxBooking      = new BkxBooking();
     613        $timezone = array();
    588614        $args['seat_id'] = sanitize_text_field( wp_unslash( $_POST['seat_id'] ) );
    589615        $args['base_id'] = sanitize_text_field( wp_unslash( $_POST['base_id'] ) );
     
    596622        $args['self_edit']      = isset( $_POST['self_edit'] ) && ! empty( $_POST['self_edit'] ) ? sanitize_text_field( wp_unslash( $_POST['self_edit'] ) ) : 0;
    597623        $args['user_time_zone'] = '';
     624        $args['type_data'] = isset($_POST['type_data']) ? sanitize_text_field( wp_unslash( $_POST['type_data'] ) ) : '';
    598625        if ( isset( $_POST['edit_booking_id'] ) ) {
    599626            $args['edit_booking_id'] = sanitize_text_field( wp_unslash( $_POST['edit_booking_id'] ) );
    600627        }
    601628        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        }
    604631        $BkxBooking->get_verify_slot( $args );
    605632    }
  • booking-x/trunk/includes/core/booking/class-bkx-booking.php

    r2544756 r2568075  
    410410        endif;
    411411
    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   = '';
    416417        if ( isset( $search['service_id'] ) && $search['service_id'] != '' ) {
    417418            $base_id      = $search['service_id'];
     
    11911192        $arr_output['selected_order_id'] = $selected_order_id;
    11921193        $arr_output['current_order_id']  = $current_order_id;
     1194        $arr_output['json_args']         = json_encode( $args );
    11931195        $output                          = ( $res == 1 ) ? wp_json_encode( $arr_output ) : 'NORF';
    11941196        if ( $echo == true ) {
     
    24342436                $user_max_times_allowed = $datetime->format( 'Y-m-d H:i' );
    24352437                $is_time_zone_checking  = true;
     2438                date_default_timezone_set( $default_time_zone );
     2439                $current_time = date( 'Y-m-d H:i' );
    24362440            }
    24372441        }
     
    24712475                        // $sys_time = $user_max_times_allowed;.
    24722476                    }
    2473 
     2477                    // echo "$sys_time < $current_time";
    24742478                    $is_past_time = false;
    24752479                    if ( $sys_time < $current_time && date( 'Ymd' ) == date( 'Ymd', strtotime( $args['booking_date'] ) ) ) {
     
    24822486                            $results .= '<tr>';
    24832487                        }
     2488                        $class_time_zone = '';
    24842489                        if ( $is_time_zone_checking == true ) {
    24852490                            $date = new \DateTime( date( $secs2hours ), new DateTimeZone( $sys_time_zone ) );
    24862491                            $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'] );
    24892495                        }
    24902496
     
    25052511                            $data_verify        = ' data-verify=' . $args['booking_date'] . '-' . $counter;
    25062512                        }
     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                        }
    25072518
    25082519                        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>';
    25102521                        } else {
    25112522                            if ( ! empty( $booked_day_dates ) ) {
    25122523                                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>';
    25142525                                } else {
    25152526                                    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>';
    25172528                                    } 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>';
    25192530                                    }
    25202531                                }
     
    25222533                                // $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>";
    25232534                                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>';
    25252536                                } 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>';
    25272538                                }
    25282539                            }
     
    27262737        $search_by     = ( empty( $search['search_by'] ) ) ? '' : $search['search_by'];
    27272738        $search_date   = ( empty( $search['search_date'] ) ) ? '' : $search['search_date'];
     2739        $sort_by       = ( empty( $search['sort_by'] ) ) ? 'DESC' : $search['sort_by'];
    27282740        if ( is_admin() ) {
    27292741            $seat_id = get_current_user_id();
     
    28062818                break;
    28072819        }
    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 );
    28102826        if ( $booked_result->have_posts() ) :
    28112827            while ( $booked_result->have_posts() ) :
  • booking-x/trunk/includes/core/functions/bkx-core-functions.php

    r2544756 r2568075  
    17961796        $extra_data = '';
    17971797        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            }
    18011803        }
    18021804        $extra_data  = rtrim( $extra_data, ',' );
     
    19561958    }
    19571959}
     1960
     1961function 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
     1971function 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 */
     2000function 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
     2009function 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
     2111function 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  
    417417}
    418418
    419 //add_action( 'load-edit.php', 'bkx_bulk_action' );
     419// add_action( 'load-edit.php', 'bkx_bulk_action' );
    420420/**
    421421 * @throws Exception
     
    447447            $report_action => false,
    448448            'changed'      => $changed,
    449             //'ids'          => join( ',', $post_ids ),
     449            // 'ids'          => join( ',', $post_ids ),
    450450        ),
    451451        ''
     
    454454        $sendback = add_query_arg( 'post_status', sanitize_text_field( wp_unslash( $_GET['post_status'] ) ), $sendback );
    455455    }
    456     echo "<pre>".print_r($sendback, true)."</pre>";die;
     456    echo '<pre>' . print_r( $sendback, true ) . '</pre>';
     457    die;
    457458    wp_redirect( esc_url_raw( $sendback ) );
    458459    exit();
     
    995996    return $booking_detail;
    996997}
     998
     999add_action( 'bkx_dashboard_lable_action', 'bkx_dashboard_lable_action_call_back', 10, 2  );
     1000function 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>&#8593;</span> </a> <a href="javascript:void(0);" data-sort="down" data-type="'.$tab.'" class="bkx-dashboard-sort-down-'.$tab.'"><span>&#8595;</span></a>';
     1006    }
     1007}
  • booking-x/trunk/includes/core/script/class-bkx-script-loader.php

    r2550218 r2568075  
    403403            'customer_details_nonce'                    => wp_create_nonce( 'customer-details' ),
    404404            'booking_cancel_nonce'                      => wp_create_nonce( 'booking-cancel' ),
     405            'dashboard_sort_nonce'                      => wp_create_nonce( 'dashboard-sort' ),
    405406        );
    406407
  • booking-x/trunk/public/js/booking-form/bkx-booking-form.js

    r2550218 r2568075  
    303303            if(time_zone && time_zone != ''){
    304304                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
    306311                }
    307312            }
     
    830835                date: $(this).data('date'),
    831836                time: $(this).data('time'),
    832                 user_time_zone: user_time_zone
     837                user_time_zone: user_time_zone,
     838                type_data : ''
    833839            };
    834840
     
    849855                        $('.booking-slots').data("starting_slot", starting_slot);
    850856                        $('.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 = [];
    852860                        for (var slot = starting_slot; slot <= end_slot; slot++) {
    853861                            if ($('.booking-slots').find("a[data-date='" + booking_date + "']").attr('data-date') == booking_date) {
     862                                bkx_selected_slots_no.push(slot);
    854863                                $('.booking-slots').find("a[data-verify='" + booking_date + "-" + slot + "']").addClass('selected');
    855864                            }
    856865                        }
     866                        if(bkx_selected_slots_no.length > 0){
     867                            $('#bkx_selected_slots_no').val(JSON.stringify(bkx_selected_slots_no));
     868                        }
     869
    857870                        booking_form.get_step_3_details();
    858871                    } else {
     
    920933            });
    921934        },
    922         BookingFormGetCalendarAvailability: function (currentSelected) {
     935        BookingFormGetCalendarAvailability: function (currentSelected, bkx_selected_slots) {
    923936            block($('div.step-2'));
    924937            var data = {
     
    928941                extra_id: booking_form.extra_id
    929942            };
     943
    930944            var current_day = {};
    931945            current_day.currentSelected = currentSelected;
    932             booking_form.BookingFormGetAvailableSlotByDate(current_day);
     946            booking_form.BookingFormGetAvailableSlotByDate(current_day, '', bkx_selected_slots);
    933947            $.ajax({
    934948                type: 'POST',
     
    947961                        };
    948962                        //calendar.diasResal = [4, 15, 26]; //Selected Days
     963                        calendar.bkx_selected_date = currentSelected;
    949964                        calendar.staffAvailableCertainMonths = staffAvailableCertainMonths;
    950965                        calendar.staffAvailableCertainDays = staffAvailableCertainDays;
     
    960975            });
    961976        },
    962         BookingFormGetAvailableSlotByDate: function (calendar, availability_slots = "") {
     977        BookingFormGetAvailableSlotByDate: function (calendar, availability_slots = "", bkx_selected_slots = "") {
    963978            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            }
    968985            booking_form.date = calendar.currentSelected;
    969986            var service_extend = $('.bkx-booking-form .step-1 .bkx-services-extend').val();
    970987            var user_time_zone = $('#bkx_user_time_zone').val();
     988            $('#bkx_date_selected_date').val(calendar.currentSelected);
    971989            var data = {
    972990                security: bkx_booking_form_params.display_availability_slots_nonce,
     
    976994                service_extend: service_extend,
    977995                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
    979998            };
    980999            if (availability_slots == "") {
  • booking-x/trunk/public/js/booking-form/calendar.js

    r2544756 r2568075  
    2323        this.unavailable_days            = []; // Resource be available at certain days only
    2424        this.diasResal                   = []; // dias importantes
     25        this.bkx_selected_date           = "";
    2526        this.colorResal                  = "#ebebeb"; // Color of important days
    2627        this.textResalt                  = "#fff"; // Preload Selected Days Color
     
    132133            var fechNow = this.anioSeleccionado + "-" + this.mesSeleccionado + "-" + (i + 1);
    133134            // dia seleccionado
    134             if (this.diaSeleccionado == moment( fechNow ).format( "Y-MM-DD" )) {
     135
     136            if (this.diaSeleccionado == moment( fechNow ).format( "Y-MM-DD" ) ) {
    135137                current_date_selected = ' current-date-selected ';
    136138            }
     
    141143            var current_day   = moment( fechNow ).format( "dddd" );
    142144
    143             if (this.diaSeleccionado == moment( fechNow ).format( "Y-MM-DD" )) {
     145            if (fechNow == moment().format( "Y-MM-DD" ) || fechNow == moment().format( "Y-M-D" )) {
    144146                div = $( "<div class='current-date-selected d-flex flex-fill w-100 justify-content-center btn " + this.btnD + "' data-date='" + fechNow + "'>" ).html( i + 1 );
    145147            }
    146148
     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            }
    147152            // Start Less than today date will be disable
    148153            if (moment( fechNow ).format( "Y-MM-DD" ) < moment().format( "Y-MM-DD" )) {
  • booking-x/trunk/public/js/bookingx.js

    r2496574 r2568075  
    7575            //$(document).on('click', '.booking-x .bkx-dashboard-booking .bkx-booking-cancel-view', this.booking_cancel);
    7676            $(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);
    7781        },
    7882        booking_cancel : function (){
     
    213217            });
    214218        },
     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        }
    215249    }
    216250
  • booking-x/trunk/templates/booking-form/additional/fields.php

    r2544756 r2568075  
    1515<input type="hidden" name="bkx_gateway_flag" id="bkx_gateway_flag" class="bkx_gateway_flag" value="1">
    1616<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  
    2929            <tr>
    3030                <?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
    3233                <?php endforeach; ?>
    3334            </tr>
    3435            </thead>
    35             <tbody>
     36            <tbody class="bkx-dashboard-bookings-tbody future">
    3637            <?php
    3738            if ( ! empty( $GetFutureBookedRecords ) ) {
     
    4950            <tr>
    5051                <?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>
    5253                <?php endforeach; ?>
    5354            </tr>
    5455            </thead>
    55             <tbody>
     56            <tbody class="bkx-dashboard-bookings-tbody past">
    5657            <?php
    5758            if ( ! empty( $GetPastBookedRecords ) ) {
  • booking-x/trunk/templates/single-bkx_addition.php

    r2550218 r2568075  
    55 * @package    Bookingx
    66 * @subpackage bookingx
    7  * @since      1.0.5
     7 * @since      1.0.6
    88 */
    99
  • booking-x/trunk/templates/single-bkx_base.php

    r2550218 r2568075  
    55 * @package    Bookingx
    66 * @subpackage bookingx
    7  * @since      1.0.5
     7 * @since      1.0.6
    88 */
    99
  • booking-x/trunk/templates/single-bkx_seat.php

    r2550218 r2568075  
    55 * @package    Bookingx
    66 * @subpackage bookingx
    7  * @since      1.0.5
     7 * @since      1.0.6
    88 */
    99
  • booking-x/trunk/templates/single.php

    r2550218 r2568075  
    55 * @package    Bookingx
    66 * @subpackage bookingx
    7  * @since      1.0.5
     7 * @since      1.0.6
    88 */
    99
Note: See TracChangeset for help on using the changeset viewer.