Plugin Directory

Changeset 3397414


Ignore:
Timestamp:
11/17/2025 04:58:55 PM (5 months ago)
Author:
Rustaurius
Message:

v2.7.6 released and tagged

Location:
restaurant-reservations
Files:
16 edited
1 copied

Legend:

Unmodified
Added
Removed
  • restaurant-reservations/tags/2.7.6/assets/js/booking-form.js

    r3336820 r3397414  
    99     */
    1010    rtb_booking_form.init = function() {
    11 
    12         rtb_pickadate.init_complete = false;
    1311
    1412        // Scroll to the first error message on the booking form
     
    5654        // Enable datepickers on load
    5755        if ( typeof rtb_pickadate !== 'undefined' ) {
     56
     57            rtb_pickadate.init_complete = false;
    5858
    5959            // Declare datepicker
     
    251251    rtb_booking_form.update_disabled_dates = function() {
    252252
     253        if ( rtb_booking_form_js_localize.admin_ignore_schedule && rtb_booking_form_js_localize.is_admin ) {
     254            rtb_booking_form.datepicker.set( 'enable', true );
     255            return;
     256        }
     257
    253258        // Pass conditional configuration parameters
    254259        if ( rtb_pickadate.disable_dates.length ) {
     
    283288        rtb_booking_form.timepicker.set( 'enable', false );
    284289        rtb_booking_form.timepicker.set( 'disable', false );
     290
     291        if ( rtb_booking_form_js_localize.admin_ignore_schedule && rtb_booking_form_js_localize.is_admin ) {
     292            rtb_booking_form.timepicker.set( 'enable', true );
     293            return;
     294        }
    285295
    286296        if ( rtb_booking_form.datepicker.get() === '' ) {
  • restaurant-reservations/tags/2.7.6/includes/Booking.class.php

    r3351461 r3397414  
    508508                empty( $this->validation_errors )
    509509                && !empty( $exception_rules )
    510                 && !current_user_can( 'manage_bookings' )
     510                && ( ! empty( $rtb_controller->settings->get_setting( 'admin-ignore-schedule' ) ) && ! current_user_can( 'manage_bookings' ) )
    511511            ) {
    512512
     
    603603                empty( $this->validation_errors )
    604604                && !empty( $rules )
    605                 && !current_user_can( 'manage_bookings' )
     605                && ( ! empty( $rtb_controller->settings->get_setting( 'admin-ignore-schedule' ) ) && ! current_user_can( 'manage_bookings' ) )
    606606                && !$exception_is_active
    607607            ) {
     
    673673
    674674        // Name
    675         $this->name = empty( $_POST['rtb-name'] ) ? '' : wp_strip_all_tags( sanitize_text_field( $_POST['rtb-name'] ), true ); // @todo should I limit length?
     675        $this->name = empty( $_POST['rtb-name'] ) ? '' : wp_strip_all_tags( sanitize_text_field( $_POST['rtb-name'] ), true );
    676676        if ( empty( $this->name ) ) {
    677677            $this->validation_errors[] = array(
  • restaurant-reservations/tags/2.7.6/includes/Notification.class.php

    r3119660 r3397414  
    113113        $template_tags = array(
    114114            '{booking_id}'          => $this->booking->ID,
    115             '{user_email}'          => $this->booking->email,
    116             '{user_name}'           => $this->booking->name,
     115            '{user_email}'          => esc_html( $this->booking->email ),
     116            '{user_name}'           => esc_html( $this->booking->name ),
    117117            '{party}'               => $this->booking->party,
    118118            '{table}'               => implode(',', $this->booking->table ),
    119119            '{date}'                => $this->booking->format_date( $this->booking->date ),
    120             '{phone}'               => $this->booking->phone,
    121             '{message}'             => $this->booking->message,
     120            '{phone}'               => esc_html( $this->booking->phone ),
     121            '{message}'             => esc_html( $this->booking->message ),
    122122            '{booking_url}'         => $booking_page_url,
    123123            '{cancellation_url}'    => $cancellation_url,
  • restaurant-reservations/tags/2.7.6/includes/Notifications.class.php

    r3336820 r3397414  
    323323                            <?php if ( $multiple_locations ) { $term = get_term( $booking_object->location ); echo ( ! is_wp_error( $term ) ? "<td>{$term->name}</td>" : '<td></td>' ); } ?>
    324324                            <td><?php echo ( new DateTime( $booking_object->date ) )->format( 'H:i:s' ); ?></td>
    325                             <td><?php echo $booking_object->party; ?></td>
    326                             <td><?php echo $booking_object->name; ?></td>
    327                             <td><?php echo $booking_object->email; ?></td>
    328                             <td><?php echo $booking_object->phone; ?></td>
     325                            <td><?php echo esc_html( $booking_object->party ); ?></td>
     326                            <td><?php echo esc_html( $booking_object->name ); ?></td>
     327                            <td><?php echo esc_html( $booking_object->email ); ?></td>
     328                            <td><?php echo esc_html( $booking_object->phone ); ?></td>
    329329                            <?php if ( $display_table ) { $table = implode(', ', $booking_object->table ); echo "<td>{$table}</td>"; } ?>
    330330                            <td><?php echo $rtb_controller->cpts->booking_statuses[$booking_object->post_status]['label'] ?></td>
  • restaurant-reservations/tags/2.7.6/includes/Settings.class.php

    r3336820 r3397414  
    13021302        );
    13031303
     1304        $sap->add_setting(
     1305            'rtb-settings',
     1306            'rtb-schedule',
     1307            'toggle',
     1308            array(
     1309                'id'      => 'admin-ignore-schedule',
     1310                'title'     => __( 'Admin Ignore Schedule', 'restaurant-reservations' ),
     1311                'description'     => __( 'Allows bookings to be made at any time at all via the admin, ignoring all scheduling rules.', 'restaurant-reservations' )
     1312            )
     1313        );
     1314
    13041315        $sap->add_section(
    13051316            'rtb-settings',
  • restaurant-reservations/tags/2.7.6/includes/template-functions.php

    r3381412 r3397414  
    575575        wp_enqueue_script( 'rtb-columns', RTB_PLUGIN_URL . '/assets/js/columns.js', array( 'jquery' ), '', true );
    576576    }
    577 
    578     // Pass date and time format settings to the pickadate controls
    579     wp_localize_script(
    580         'rtb-booking-form',
    581         'rtb_pickadate',
    582         apply_filters(
    583             'rtb_pickadate_args',
    584             array(
    585                 'date_format'                   => rtb_esc_js( $rtb_controller->settings->get_setting( 'date-format' ) ),
    586                 'time_format'                   => rtb_esc_js( $rtb_controller->settings->get_setting( 'time-format' ) ),
    587                 'disable_dates'                 => rtb_get_datepicker_rules(),
    588                 'schedule_open'                 => $rtb_controller->settings->get_setting( 'schedule-open' ),
    589                 'schedule_closed'               => $rtb_controller->settings->get_setting( 'schedule-closed' ),
    590                 'multiple_locations_enabled'    => $rtb_controller->locations->do_locations_exist(),
    591                 'early_bookings'                => is_admin() && current_user_can( 'manage_bookings' ) ? '' : $rtb_controller->settings->get_setting( 'early-bookings' ),
    592                 'late_bookings'                 => is_admin() && current_user_can( 'manage_bookings' ) ? '' : $rtb_controller->settings->get_setting( 'late-bookings' ),
    593                 'enable_max_reservations'       => is_admin() && current_user_can( 'manage_bookings' ) ? false : $rtb_controller->settings->get_setting( 'rtb-enable-max-tables' ),
    594                 'max_people'                    => is_admin() && current_user_can( 'manage_bookings' ) ? 100 : $rtb_controller->settings->get_setting( 'rtb-max-people-count' ),
    595                 'enable_tables'                 => $rtb_controller->settings->get_setting( 'enable-tables' ),
    596                 'date_onload'                   => $rtb_controller->settings->get_setting( 'date-onload' ),
    597                 'time_interval'                 => $rtb_controller->settings->get_setting( 'time-interval' ),
    598                 'first_day'                     => $rtb_controller->settings->get_setting( 'week-start' ),
    599                 'allow_past'                    => is_admin() && current_user_can( 'manage_bookings' ),
    600                 'date_today_label'              => rtb_esc_js( $rtb_controller->settings->get_setting( 'label-date-today' ) ),
    601                 'date_clear_label'              => rtb_esc_js( $rtb_controller->settings->get_setting( 'label-date-clear' ) ),
    602                 'date_close_label'              => rtb_esc_js( $rtb_controller->settings->get_setting( 'label-date-close' ) ),
    603                 'time_clear_label'              => rtb_esc_js( $rtb_controller->settings->get_setting( 'label-time-clear' ) ),
    604             )
    605         )
    606     );
    607 
    608577}
    609578} // endif;
  • restaurant-reservations/tags/2.7.6/readme.txt

    r3381412 r3397414  
    33Tested Up To: 6.8
    44Tags: reservation, reservations, restaurant reservations, reservation form, restaurant, restaurant booking, restaurant reservation form, restaurant booking form, restaurant booking system, reservation system, online reservations, online restaurant booking, dinner reservations, restaurant form, gutenberg reservations, gutenberg restaurant reservations, gutenberg restaurant booking, mobile reservations, responsive reservations, table reservations, open table, book table, reserve table, easy reservations, simple reservations, quick restaurant reservations, custom reservation form, custom restaurant reservations
    5 Stable tag: 2.7.5
     5Stable tag: 2.7.6
    66License: GPLv3
    77License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    303303== Changelog ==
    304304
     305= 2.7.6 (2025-11-17) =
     306- Added a new "Admin Ignore Schedule" option, so admins can create bookings outside their created scheduling rules and exceptions.
     307- Fixed an issue with the booking widget not working correctly with Elementor.
     308
    305309= 2.7.5 (2025-10-20) =
    306310- Fixed an issue causing an error to sometimes display when clicking the "proceed to deposit" button in the booking form when using the Stripe gateway.
  • restaurant-reservations/tags/2.7.6/restaurant-reservations.php

    r3381412 r3397414  
    44 * Plugin URI: http://www.fivestarplugins.com/plugins/five-star-restaurant-reservations/
    55 * Description: Restaurant reservations made easy. Accept bookings online. Quickly confirm or reject reservations, send email notifications, set booking times and more.
    6  * Version: 2.7.5
     6 * Version: 2.7.6
    77 * Author: Five Star Plugins
    88 * Author URI: https://www.fivestarplugins.com/
     
    5959
    6060        // Common strings
    61         define( 'RTB_VERSION', '2.7.5' );
     61        define( 'RTB_VERSION', '2.7.6' );
    6262        define( 'RTB_PLUGIN_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
    6363        define( 'RTB_PLUGIN_URL', untrailingslashit( plugins_url( basename( plugin_dir_path( __FILE__ ) ), basename( __FILE__ ) ) ) );
     
    229229        add_action( 'admin_init', array( $this, 'maybe_delete_older_reservations' ) );
    230230        add_filter( 'sanitize_option_rtb-settings', array( $this, 'maybe_delete_older_reservations' ), 100 );
     231
     232        // Localize settings data if booking form is loaded
     233        add_action( 'wp_footer', array( $this, 'assets_footer' ), 2 );
     234        add_action( 'admin_footer', array( $this, 'assets_footer' ), 2 );
    231235
    232236        // Handle the helper notice
     
    630634                'is_admin'               => is_admin(),
    631635                'cancellation_cutoff'    => $rtb_controller->settings->get_setting( 'late-cancellations' ),
     636                'admin_ignore_schedule'  => $rtb_controller->settings->get_setting( 'admin-ignore-schedule' ),
    632637                'admin_ignore_maximums'  => $rtb_controller->settings->get_setting( 'rtb-admin-ignore-maximums' ),
    633638                'want_to_modify'         => esc_html( $rtb_controller->settings->get_setting( 'label-modify-reservation'  ) ),
     
    743748    }
    744749
     750    /**
     751     * Print out any PHP data needed for our JS to work correctly
     752     * @since 2.7.6
     753     */
     754    public function assets_footer() {
     755        global $rtb_controller;
     756
     757        $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false;
     758       
     759        if (
     760            empty( $rtb_controller->display_bookings_form_rendered ) and
     761            empty( $rtb_controller->form_rendered ) and
     762            ( ! empty( $screen) and $screen->base != 'toplevel_page_rtb-bookings' )
     763        ) {
     764            return;
     765        }
     766
     767        $rtb_pickadate = apply_filters(
     768            'rtb_pickadate_args',
     769            array(
     770                'date_format'                   => rtb_esc_js( $rtb_controller->settings->get_setting( 'date-format' ) ),
     771                'time_format'                   => rtb_esc_js( $rtb_controller->settings->get_setting( 'time-format' ) ),
     772                'disable_dates'                 => rtb_get_datepicker_rules(),
     773                'schedule_open'                 => $rtb_controller->settings->get_setting( 'schedule-open' ),
     774                'schedule_closed'               => $rtb_controller->settings->get_setting( 'schedule-closed' ),
     775                'multiple_locations_enabled'    => $rtb_controller->locations->do_locations_exist(),
     776                'early_bookings'                => is_admin() && current_user_can( 'manage_bookings' ) ? '' : $rtb_controller->settings->get_setting( 'early-bookings' ),
     777                'late_bookings'                 => is_admin() && current_user_can( 'manage_bookings' ) ? '' : $rtb_controller->settings->get_setting( 'late-bookings' ),
     778                'enable_max_reservations'       => is_admin() && current_user_can( 'manage_bookings' ) ? false : $rtb_controller->settings->get_setting( 'rtb-enable-max-tables' ),
     779                'max_people'                    => is_admin() && current_user_can( 'manage_bookings' ) ? 100 : $rtb_controller->settings->get_setting( 'rtb-max-people-count' ),
     780                'enable_tables'                 => $rtb_controller->settings->get_setting( 'enable-tables' ),
     781                'date_onload'                   => $rtb_controller->settings->get_setting( 'date-onload' ),
     782                'time_interval'                 => $rtb_controller->settings->get_setting( 'time-interval' ),
     783                'first_day'                     => $rtb_controller->settings->get_setting( 'week-start' ),
     784                'allow_past'                    => is_admin() && current_user_can( 'manage_bookings' ),
     785                'date_today_label'              => rtb_esc_js( $rtb_controller->settings->get_setting( 'label-date-today' ) ),
     786                'date_clear_label'              => rtb_esc_js( $rtb_controller->settings->get_setting( 'label-date-clear' ) ),
     787                'date_close_label'              => rtb_esc_js( $rtb_controller->settings->get_setting( 'label-date-close' ) ),
     788                'time_clear_label'              => rtb_esc_js( $rtb_controller->settings->get_setting( 'label-time-clear' ) ),
     789            )
     790        );
     791
     792        echo "<script type='text/javascript'>\n";
     793        echo "/* <![CDATA[ */\n";
     794        echo 'var rtb_pickadate = ' . wp_json_encode( $rtb_pickadate ) . "\n";
     795        echo "/* ]]> */\n";
     796        echo "</script>\n";
     797
     798    }
     799
    745800    public function maybe_display_helper_notice() {
    746801        global $rtb_controller;
  • restaurant-reservations/trunk/assets/js/booking-form.js

    r3336820 r3397414  
    99     */
    1010    rtb_booking_form.init = function() {
    11 
    12         rtb_pickadate.init_complete = false;
    1311
    1412        // Scroll to the first error message on the booking form
     
    5654        // Enable datepickers on load
    5755        if ( typeof rtb_pickadate !== 'undefined' ) {
     56
     57            rtb_pickadate.init_complete = false;
    5858
    5959            // Declare datepicker
     
    251251    rtb_booking_form.update_disabled_dates = function() {
    252252
     253        if ( rtb_booking_form_js_localize.admin_ignore_schedule && rtb_booking_form_js_localize.is_admin ) {
     254            rtb_booking_form.datepicker.set( 'enable', true );
     255            return;
     256        }
     257
    253258        // Pass conditional configuration parameters
    254259        if ( rtb_pickadate.disable_dates.length ) {
     
    283288        rtb_booking_form.timepicker.set( 'enable', false );
    284289        rtb_booking_form.timepicker.set( 'disable', false );
     290
     291        if ( rtb_booking_form_js_localize.admin_ignore_schedule && rtb_booking_form_js_localize.is_admin ) {
     292            rtb_booking_form.timepicker.set( 'enable', true );
     293            return;
     294        }
    285295
    286296        if ( rtb_booking_form.datepicker.get() === '' ) {
  • restaurant-reservations/trunk/includes/Booking.class.php

    r3351461 r3397414  
    508508                empty( $this->validation_errors )
    509509                && !empty( $exception_rules )
    510                 && !current_user_can( 'manage_bookings' )
     510                && ( ! empty( $rtb_controller->settings->get_setting( 'admin-ignore-schedule' ) ) && ! current_user_can( 'manage_bookings' ) )
    511511            ) {
    512512
     
    603603                empty( $this->validation_errors )
    604604                && !empty( $rules )
    605                 && !current_user_can( 'manage_bookings' )
     605                && ( ! empty( $rtb_controller->settings->get_setting( 'admin-ignore-schedule' ) ) && ! current_user_can( 'manage_bookings' ) )
    606606                && !$exception_is_active
    607607            ) {
     
    673673
    674674        // Name
    675         $this->name = empty( $_POST['rtb-name'] ) ? '' : wp_strip_all_tags( sanitize_text_field( $_POST['rtb-name'] ), true ); // @todo should I limit length?
     675        $this->name = empty( $_POST['rtb-name'] ) ? '' : wp_strip_all_tags( sanitize_text_field( $_POST['rtb-name'] ), true );
    676676        if ( empty( $this->name ) ) {
    677677            $this->validation_errors[] = array(
  • restaurant-reservations/trunk/includes/Notification.class.php

    r3119660 r3397414  
    113113        $template_tags = array(
    114114            '{booking_id}'          => $this->booking->ID,
    115             '{user_email}'          => $this->booking->email,
    116             '{user_name}'           => $this->booking->name,
     115            '{user_email}'          => esc_html( $this->booking->email ),
     116            '{user_name}'           => esc_html( $this->booking->name ),
    117117            '{party}'               => $this->booking->party,
    118118            '{table}'               => implode(',', $this->booking->table ),
    119119            '{date}'                => $this->booking->format_date( $this->booking->date ),
    120             '{phone}'               => $this->booking->phone,
    121             '{message}'             => $this->booking->message,
     120            '{phone}'               => esc_html( $this->booking->phone ),
     121            '{message}'             => esc_html( $this->booking->message ),
    122122            '{booking_url}'         => $booking_page_url,
    123123            '{cancellation_url}'    => $cancellation_url,
  • restaurant-reservations/trunk/includes/Notifications.class.php

    r3336820 r3397414  
    323323                            <?php if ( $multiple_locations ) { $term = get_term( $booking_object->location ); echo ( ! is_wp_error( $term ) ? "<td>{$term->name}</td>" : '<td></td>' ); } ?>
    324324                            <td><?php echo ( new DateTime( $booking_object->date ) )->format( 'H:i:s' ); ?></td>
    325                             <td><?php echo $booking_object->party; ?></td>
    326                             <td><?php echo $booking_object->name; ?></td>
    327                             <td><?php echo $booking_object->email; ?></td>
    328                             <td><?php echo $booking_object->phone; ?></td>
     325                            <td><?php echo esc_html( $booking_object->party ); ?></td>
     326                            <td><?php echo esc_html( $booking_object->name ); ?></td>
     327                            <td><?php echo esc_html( $booking_object->email ); ?></td>
     328                            <td><?php echo esc_html( $booking_object->phone ); ?></td>
    329329                            <?php if ( $display_table ) { $table = implode(', ', $booking_object->table ); echo "<td>{$table}</td>"; } ?>
    330330                            <td><?php echo $rtb_controller->cpts->booking_statuses[$booking_object->post_status]['label'] ?></td>
  • restaurant-reservations/trunk/includes/Settings.class.php

    r3336820 r3397414  
    13021302        );
    13031303
     1304        $sap->add_setting(
     1305            'rtb-settings',
     1306            'rtb-schedule',
     1307            'toggle',
     1308            array(
     1309                'id'      => 'admin-ignore-schedule',
     1310                'title'     => __( 'Admin Ignore Schedule', 'restaurant-reservations' ),
     1311                'description'     => __( 'Allows bookings to be made at any time at all via the admin, ignoring all scheduling rules.', 'restaurant-reservations' )
     1312            )
     1313        );
     1314
    13041315        $sap->add_section(
    13051316            'rtb-settings',
  • restaurant-reservations/trunk/includes/template-functions.php

    r3381412 r3397414  
    575575        wp_enqueue_script( 'rtb-columns', RTB_PLUGIN_URL . '/assets/js/columns.js', array( 'jquery' ), '', true );
    576576    }
    577 
    578     // Pass date and time format settings to the pickadate controls
    579     wp_localize_script(
    580         'rtb-booking-form',
    581         'rtb_pickadate',
    582         apply_filters(
    583             'rtb_pickadate_args',
    584             array(
    585                 'date_format'                   => rtb_esc_js( $rtb_controller->settings->get_setting( 'date-format' ) ),
    586                 'time_format'                   => rtb_esc_js( $rtb_controller->settings->get_setting( 'time-format' ) ),
    587                 'disable_dates'                 => rtb_get_datepicker_rules(),
    588                 'schedule_open'                 => $rtb_controller->settings->get_setting( 'schedule-open' ),
    589                 'schedule_closed'               => $rtb_controller->settings->get_setting( 'schedule-closed' ),
    590                 'multiple_locations_enabled'    => $rtb_controller->locations->do_locations_exist(),
    591                 'early_bookings'                => is_admin() && current_user_can( 'manage_bookings' ) ? '' : $rtb_controller->settings->get_setting( 'early-bookings' ),
    592                 'late_bookings'                 => is_admin() && current_user_can( 'manage_bookings' ) ? '' : $rtb_controller->settings->get_setting( 'late-bookings' ),
    593                 'enable_max_reservations'       => is_admin() && current_user_can( 'manage_bookings' ) ? false : $rtb_controller->settings->get_setting( 'rtb-enable-max-tables' ),
    594                 'max_people'                    => is_admin() && current_user_can( 'manage_bookings' ) ? 100 : $rtb_controller->settings->get_setting( 'rtb-max-people-count' ),
    595                 'enable_tables'                 => $rtb_controller->settings->get_setting( 'enable-tables' ),
    596                 'date_onload'                   => $rtb_controller->settings->get_setting( 'date-onload' ),
    597                 'time_interval'                 => $rtb_controller->settings->get_setting( 'time-interval' ),
    598                 'first_day'                     => $rtb_controller->settings->get_setting( 'week-start' ),
    599                 'allow_past'                    => is_admin() && current_user_can( 'manage_bookings' ),
    600                 'date_today_label'              => rtb_esc_js( $rtb_controller->settings->get_setting( 'label-date-today' ) ),
    601                 'date_clear_label'              => rtb_esc_js( $rtb_controller->settings->get_setting( 'label-date-clear' ) ),
    602                 'date_close_label'              => rtb_esc_js( $rtb_controller->settings->get_setting( 'label-date-close' ) ),
    603                 'time_clear_label'              => rtb_esc_js( $rtb_controller->settings->get_setting( 'label-time-clear' ) ),
    604             )
    605         )
    606     );
    607 
    608577}
    609578} // endif;
  • restaurant-reservations/trunk/readme.txt

    r3381412 r3397414  
    33Tested Up To: 6.8
    44Tags: reservation, reservations, restaurant reservations, reservation form, restaurant, restaurant booking, restaurant reservation form, restaurant booking form, restaurant booking system, reservation system, online reservations, online restaurant booking, dinner reservations, restaurant form, gutenberg reservations, gutenberg restaurant reservations, gutenberg restaurant booking, mobile reservations, responsive reservations, table reservations, open table, book table, reserve table, easy reservations, simple reservations, quick restaurant reservations, custom reservation form, custom restaurant reservations
    5 Stable tag: 2.7.5
     5Stable tag: 2.7.6
    66License: GPLv3
    77License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    303303== Changelog ==
    304304
     305= 2.7.6 (2025-11-17) =
     306- Added a new "Admin Ignore Schedule" option, so admins can create bookings outside their created scheduling rules and exceptions.
     307- Fixed an issue with the booking widget not working correctly with Elementor.
     308
    305309= 2.7.5 (2025-10-20) =
    306310- Fixed an issue causing an error to sometimes display when clicking the "proceed to deposit" button in the booking form when using the Stripe gateway.
  • restaurant-reservations/trunk/restaurant-reservations.php

    r3381412 r3397414  
    44 * Plugin URI: http://www.fivestarplugins.com/plugins/five-star-restaurant-reservations/
    55 * Description: Restaurant reservations made easy. Accept bookings online. Quickly confirm or reject reservations, send email notifications, set booking times and more.
    6  * Version: 2.7.5
     6 * Version: 2.7.6
    77 * Author: Five Star Plugins
    88 * Author URI: https://www.fivestarplugins.com/
     
    5959
    6060        // Common strings
    61         define( 'RTB_VERSION', '2.7.5' );
     61        define( 'RTB_VERSION', '2.7.6' );
    6262        define( 'RTB_PLUGIN_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
    6363        define( 'RTB_PLUGIN_URL', untrailingslashit( plugins_url( basename( plugin_dir_path( __FILE__ ) ), basename( __FILE__ ) ) ) );
     
    229229        add_action( 'admin_init', array( $this, 'maybe_delete_older_reservations' ) );
    230230        add_filter( 'sanitize_option_rtb-settings', array( $this, 'maybe_delete_older_reservations' ), 100 );
     231
     232        // Localize settings data if booking form is loaded
     233        add_action( 'wp_footer', array( $this, 'assets_footer' ), 2 );
     234        add_action( 'admin_footer', array( $this, 'assets_footer' ), 2 );
    231235
    232236        // Handle the helper notice
     
    630634                'is_admin'               => is_admin(),
    631635                'cancellation_cutoff'    => $rtb_controller->settings->get_setting( 'late-cancellations' ),
     636                'admin_ignore_schedule'  => $rtb_controller->settings->get_setting( 'admin-ignore-schedule' ),
    632637                'admin_ignore_maximums'  => $rtb_controller->settings->get_setting( 'rtb-admin-ignore-maximums' ),
    633638                'want_to_modify'         => esc_html( $rtb_controller->settings->get_setting( 'label-modify-reservation'  ) ),
     
    743748    }
    744749
     750    /**
     751     * Print out any PHP data needed for our JS to work correctly
     752     * @since 2.7.6
     753     */
     754    public function assets_footer() {
     755        global $rtb_controller;
     756
     757        $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false;
     758       
     759        if (
     760            empty( $rtb_controller->display_bookings_form_rendered ) and
     761            empty( $rtb_controller->form_rendered ) and
     762            ( ! empty( $screen) and $screen->base != 'toplevel_page_rtb-bookings' )
     763        ) {
     764            return;
     765        }
     766
     767        $rtb_pickadate = apply_filters(
     768            'rtb_pickadate_args',
     769            array(
     770                'date_format'                   => rtb_esc_js( $rtb_controller->settings->get_setting( 'date-format' ) ),
     771                'time_format'                   => rtb_esc_js( $rtb_controller->settings->get_setting( 'time-format' ) ),
     772                'disable_dates'                 => rtb_get_datepicker_rules(),
     773                'schedule_open'                 => $rtb_controller->settings->get_setting( 'schedule-open' ),
     774                'schedule_closed'               => $rtb_controller->settings->get_setting( 'schedule-closed' ),
     775                'multiple_locations_enabled'    => $rtb_controller->locations->do_locations_exist(),
     776                'early_bookings'                => is_admin() && current_user_can( 'manage_bookings' ) ? '' : $rtb_controller->settings->get_setting( 'early-bookings' ),
     777                'late_bookings'                 => is_admin() && current_user_can( 'manage_bookings' ) ? '' : $rtb_controller->settings->get_setting( 'late-bookings' ),
     778                'enable_max_reservations'       => is_admin() && current_user_can( 'manage_bookings' ) ? false : $rtb_controller->settings->get_setting( 'rtb-enable-max-tables' ),
     779                'max_people'                    => is_admin() && current_user_can( 'manage_bookings' ) ? 100 : $rtb_controller->settings->get_setting( 'rtb-max-people-count' ),
     780                'enable_tables'                 => $rtb_controller->settings->get_setting( 'enable-tables' ),
     781                'date_onload'                   => $rtb_controller->settings->get_setting( 'date-onload' ),
     782                'time_interval'                 => $rtb_controller->settings->get_setting( 'time-interval' ),
     783                'first_day'                     => $rtb_controller->settings->get_setting( 'week-start' ),
     784                'allow_past'                    => is_admin() && current_user_can( 'manage_bookings' ),
     785                'date_today_label'              => rtb_esc_js( $rtb_controller->settings->get_setting( 'label-date-today' ) ),
     786                'date_clear_label'              => rtb_esc_js( $rtb_controller->settings->get_setting( 'label-date-clear' ) ),
     787                'date_close_label'              => rtb_esc_js( $rtb_controller->settings->get_setting( 'label-date-close' ) ),
     788                'time_clear_label'              => rtb_esc_js( $rtb_controller->settings->get_setting( 'label-time-clear' ) ),
     789            )
     790        );
     791
     792        echo "<script type='text/javascript'>\n";
     793        echo "/* <![CDATA[ */\n";
     794        echo 'var rtb_pickadate = ' . wp_json_encode( $rtb_pickadate ) . "\n";
     795        echo "/* ]]> */\n";
     796        echo "</script>\n";
     797
     798    }
     799
    745800    public function maybe_display_helper_notice() {
    746801        global $rtb_controller;
Note: See TracChangeset for help on using the changeset viewer.