Changeset 3685965
- Timestamp:
- 09/08/2026 05:41:49 AM (3 months ago)
- Location:
- wp-restaurant-booking
- Files:
-
- 21 added
- 2 deleted
- 35 edited
- 1 copied
-
assets/screenshot-1.png (modified) ( previous)
-
assets/screenshot-10.png (added)
-
assets/screenshot-11.png (added)
-
assets/screenshot-12.png (added)
-
assets/screenshot-2.png (modified) ( previous)
-
assets/screenshot-3.png (modified) ( previous)
-
assets/screenshot-4.png (modified) ( previous)
-
assets/screenshot-5.png (modified) ( previous)
-
assets/screenshot-6.png (modified) ( previous)
-
assets/screenshot-7.png (modified) ( previous)
-
assets/screenshot-8.png (modified) ( previous)
-
assets/screenshot-9.png (modified) ( previous)
-
tags/1.3.0 (copied) (copied from wp-restaurant-booking/trunk )
-
tags/1.3.0/admin/class-wprb-admin.php (modified) (20 diffs)
-
tags/1.3.0/admin/wprb-set-bookables-template.php (modified) (3 diffs)
-
tags/1.3.0/admin/wprb-set-closing-days-template.php (modified) (4 diffs)
-
tags/1.3.0/admin/wprb-set-general-template.php (modified) (2 diffs)
-
tags/1.3.0/admin/wprb-set-last-minute-template.php (deleted)
-
tags/1.3.0/admin/wprb-set-notifications-template.php (modified) (2 diffs)
-
tags/1.3.0/admin/wprb-set-premium-template.php (added)
-
tags/1.3.0/admin/wprb-set-tables-template.php (modified) (1 diff)
-
tags/1.3.0/css/wprb-admin.css (modified) (4 diffs)
-
tags/1.3.0/css/wprb.css (modified) (12 diffs)
-
tags/1.3.0/includes/class-wprb-notifications.php (modified) (2 diffs)
-
tags/1.3.0/includes/class-wprb-reservation-widget.php (modified) (2 diffs)
-
tags/1.3.0/js/wprb-admin.js (modified) (10 diffs)
-
tags/1.3.0/readme.txt (modified) (4 diffs)
-
tags/1.3.0/vendor (added)
-
tags/1.3.0/vendor/harvesthq (added)
-
tags/1.3.0/vendor/harvesthq/chosen (added)
-
tags/1.3.0/vendor/harvesthq/chosen/LICENSE.md (added)
-
tags/1.3.0/vendor/harvesthq/chosen/chosen-sprite.png (added)
-
tags/1.3.0/vendor/harvesthq/chosen/chosen-sprite@2x.png (added)
-
tags/1.3.0/vendor/harvesthq/chosen/chosen.jquery.min.js (added)
-
tags/1.3.0/vendor/harvesthq/chosen/chosen.min.css (added)
-
tags/1.3.0/wp-restaurant-booking.php (modified) (1 diff)
-
trunk/admin/class-wprb-admin.php (modified) (20 diffs)
-
trunk/admin/wprb-set-bookables-template.php (modified) (3 diffs)
-
trunk/admin/wprb-set-closing-days-template.php (modified) (4 diffs)
-
trunk/admin/wprb-set-general-template.php (modified) (2 diffs)
-
trunk/admin/wprb-set-last-minute-template.php (deleted)
-
trunk/admin/wprb-set-notifications-template.php (modified) (2 diffs)
-
trunk/admin/wprb-set-premium-template.php (added)
-
trunk/admin/wprb-set-tables-template.php (modified) (1 diff)
-
trunk/css/wprb-admin.css (modified) (4 diffs)
-
trunk/css/wprb.css (modified) (12 diffs)
-
trunk/includes/class-wprb-notifications.php (modified) (2 diffs)
-
trunk/includes/class-wprb-reservation-widget.php (modified) (2 diffs)
-
trunk/js/wprb-admin.js (modified) (10 diffs)
-
trunk/readme.txt (modified) (4 diffs)
-
trunk/vendor (added)
-
trunk/vendor/harvesthq (added)
-
trunk/vendor/harvesthq/chosen (added)
-
trunk/vendor/harvesthq/chosen/LICENSE.md (added)
-
trunk/vendor/harvesthq/chosen/chosen-sprite.png (added)
-
trunk/vendor/harvesthq/chosen/chosen-sprite@2x.png (added)
-
trunk/vendor/harvesthq/chosen/chosen.jquery.min.js (added)
-
trunk/vendor/harvesthq/chosen/chosen.min.css (added)
-
trunk/wp-restaurant-booking.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
wp-restaurant-booking/tags/1.3.0/admin/class-wprb-admin.php
r3650036 r3685965 29 29 30 30 add_action( 'admin_init', array( $this, 'save_reservations_settings' ) ); 31 add_action( 'admin_init', array( $this, 'save_ last_minute_settings' ) );31 add_action( 'admin_init', array( $this, 'save_closing_days_settings' ) ); 32 32 add_action( 'admin_init', array( $this, 'save_rooms_tables_settings' ) ); 33 33 add_action( 'admin_init', array( $this, 'save_notifications_settings' ) ); … … 35 35 add_action( 'admin_menu', array( $this, 'register_wprb_admin' ) ); 36 36 add_action( 'wp_ajax_wprb-add-hours', array( $this, 'hours_element_callback' ) ); 37 add_action( 'wp_ajax_wprb-add-last-minute', array( $this, 'last_minute_element_callback' ) );38 37 add_action( 'wp_ajax_wprb-add-closing-period', array( $this, 'closing_period_element_callback' ) ); 39 38 add_action( 'wp_ajax_wprb-add-room-tables', array( $this, 'room_tables_element_callback' ) ); 40 41 add_action(42 'in_plugin_update_message-' . basename( WPRB_DIR ) . '/wp-restaurant-booking.php',43 array(44 $this,45 'wprb_update_message',46 ),47 10,48 249 );50 39 51 40 } … … 77 66 /*Nonce*/ 78 67 $add_hours_nonce = wp_create_nonce( 'wprb-add-hours' ); 79 $add_last_minute_nonce = wp_create_nonce( 'wprb-add-last-minute' );80 68 $add_closing_period_nonce = wp_create_nonce( 'wprb-add-closing-period' ); 81 69 $add_room_tables_nonce = wp_create_nonce( 'wprb-add-room-tables' ); … … 88 76 wp_enqueue_style( 'wprb-admin-style', WPRB_URI . 'css/wprb-admin.css' ); 89 77 wp_enqueue_style( 'tzcheckbox-style', WPRB_URI . 'js/tzCheckbox/jquery.tzCheckbox/jquery.tzCheckbox.css' ); 78 wp_enqueue_style( 'wp-color-picker' ); 90 79 91 80 /*js*/ 92 81 wp_enqueue_script( 'wprb-admin-js', WPRB_URI . 'js/wprb-admin.js', array( 'jquery' ), '1.0', true ); 93 82 wp_enqueue_script( 'tzcheckbox', WPRB_URI . 'js/tzCheckbox/jquery.tzCheckbox/jquery.tzCheckbox.js', array( 'jquery' ) ); 83 wp_enqueue_script( 'wp-color-picker' ); 94 84 95 85 /*Pass data to the script file*/ … … 99 89 array( 100 90 'addHoursNonce' => $add_hours_nonce, 101 'addLastMinuteNonce' => $add_last_minute_nonce,102 91 'addClosingPeriodNonce' => $add_closing_period_nonce, 103 92 'addRoomTablesNonce' => $add_room_tables_nonce, … … 244 233 245 234 /** 246 * Go premium button247 */248 public function go_premium() {249 250 $title = __( 'This is a premium functionality, click here for more information', 'wp-restaurant-booking' );251 $output = '<span class="wprb label label-warning premium">';252 $output .= '<a href="https://www.ilghera.com/product/wp-restaurant-booking-premium" target="_blank" title="' . esc_attr( $title ) . '">Premium</a>';253 $output .= '</span>';254 255 $allowed = array(256 'span' => array(257 'class' => [],258 ),259 'a' => array(260 'target' => [],261 'title' => [],262 'href' => [],263 ),264 );265 266 echo wp_kses( $output, $allowed );267 268 }269 270 /**271 235 * Return a single hours element as ajax callback 272 236 */ … … 298 262 $to = isset( $data['to'] ) ? $data['to'] : ''; 299 263 $every = isset( $data['every'] ) ? $data['every'] : ''; 300 $disabled = 1 !== $number ? ' disabled' : '';301 264 302 265 echo '<div class="wprb-hours-element-' . esc_attr( $number ) . ' hours-element">'; 303 266 304 267 echo '<label for="wprb-bookable-hours-from">' . esc_html__( 'From', 'wp-restaurant-booking' ) . '</label>'; 305 echo '<input type="time" name="wprb-' . esc_attr( $day ) . '-bookable-hours-from-' . esc_attr( $number ) . '" id="wprb-' . esc_attr( $day ) . '-bookable-hours-from" class="wprb-bookable-hours-from" max="23:59" value="' . esc_attr( $from ) . '" required' . $disabled . '>';268 echo '<input type="time" name="wprb-' . esc_attr( $day ) . '-bookable-hours-from-' . esc_attr( $number ) . '" id="wprb-' . esc_attr( $day ) . '-bookable-hours-from" class="wprb-bookable-hours-from" max="23:59" value="' . esc_attr( $from ) . '">'; 306 269 307 270 echo '<label for="wprb-bookable-hours-to">' . esc_html__( 'to', 'wp-restaurant-booking' ) . '</label>'; 308 echo '<input type="time" name="wprb-' . esc_attr( $day ) . '-bookable-hours-to-' . esc_attr( $number ) . '" id="wprb-' . esc_attr( $day ) . '-bookable-hours-to" class="wprb-bookable-hours-to" max="23:59" value="' . esc_attr( $to ) . '" required' . $disabled . '>';271 echo '<input type="time" name="wprb-' . esc_attr( $day ) . '-bookable-hours-to-' . esc_attr( $number ) . '" id="wprb-' . esc_attr( $day ) . '-bookable-hours-to" class="wprb-bookable-hours-to" max="23:59" value="' . esc_attr( $to ) . '">'; 309 272 310 273 echo '<label for="wprb-bookable-hours-every">' . esc_html__( 'every (minutes)', 'wp-restaurant-booking' ) . '</label>'; 311 echo '<input type="number" name="wprb-' . esc_attr( $day ) . '-bookable-hours-every-' . esc_attr( $number ) . '" id="wprb-' . esc_attr( $day ) . '-bookable-hours-every" class="wprb-bookable-hours-every" min="5" max="60" step="5" placeholder="15" value="' . esc_attr( $every ) . '" required' . $disabled . '>';274 echo '<input type="number" name="wprb-' . esc_attr( $day ) . '-bookable-hours-every-' . esc_attr( $number ) . '" id="wprb-' . esc_attr( $day ) . '-bookable-hours-every" class="wprb-bookable-hours-every" min="5" max="60" step="5" placeholder="15" value="' . esc_attr( $every ) . '">'; 312 275 313 276 if ( 1 === $number ) { … … 342 305 if ( $this->saved_hours && isset( $this->saved_hours[ $day ] )) { 343 306 344 $this->hours_element( $day, 1, $this->saved_hours[ $day ][1] ); 307 $count = count( $this->saved_hours[ $day ] ); 308 309 for ( $i = 1; $i <= $count; $i++ ) { 310 311 $this->hours_element( $day, $i, $this->saved_hours[ $day ][ $i ] ); 312 313 } 345 314 346 315 } else { … … 350 319 } 351 320 352 echo '<div class="go-premium">';353 354 $this->go_premium();355 356 echo '</div>';357 358 321 echo '</div>'; 359 360 }361 362 /**363 * Return a single last minute element as ajax callback364 */365 public function last_minute_element_callback() {366 367 if ( isset( $_POST['number'], $_POST['wprb-add-last-minute-nonce'] ) && wp_verify_nonce( wp_unslash( $_POST['wprb-add-last-minute-nonce'] ), 'wprb-add-last-minute' ) ) {368 369 $number = sanitize_text_field( wp_unslash( $_POST['number'] ) );370 371 $this->last_minute( $number );372 373 }374 375 exit;376 377 }378 379 /**380 * Display a single last minute381 *382 * @param int $number the number of hours element.383 * @param array $data single element data coming from the db.384 */385 public function last_minute( $number = 0, $data = array() ) {386 387 $date = null;388 $from = null;389 $to = null;390 $people = null;391 392 echo '<div class="wprb-last-minute-element-' . esc_attr( $number ) . ' last-minute-element">';393 394 echo '<label for="wprb-last-minute-date">' . esc_html__( 'On', 'wp-restaurant-booking' ) . '</label>';395 echo '<input type="date" name="wprb-last-minute-date-' . esc_attr( $number ) . '" id="wprb-last-minute-date" class="wprb-last-minute-date" min="' . esc_html( date( 'Y-m-d' ) ) . '" value="' . esc_attr( $date ) . '" disabled>';396 397 echo '<label for="wprb-last-minute-from">' . esc_html__( 'from', 'wp-restaurant-booking' ) . '</label>';398 echo '<input type="time" name="wprb-last-minute-from-' . esc_attr( $number ) . '" id="wprb-last-minute-from" class="wprb-last-minute-from" min="12:00" max="23:00" value="' . esc_attr( $from ) . '" required disabled>';399 400 echo '<label for="wprb-last-minute-to">' . esc_html__( 'to', 'wp-restaurant-booking' ) . '</label>';401 echo '<input type="time" name="wprb-last-minute-to-' . esc_attr( $number ) . '" id="wprb-last-minute-to" class="wprb-last-minute-to" min="12:00" max="23:00" value="' . esc_attr( $to ) . '" required disabled>';402 403 echo '<label for="wprb-last-minute-people">' . esc_html__( 'people', 'wp-restaurant-booking' ) . '</label>';404 echo '<input type="number" name="wprb-last-minute-people-' . esc_attr( $number ) . '" id="wprb-last-minute-people" class="wprb-last-minute-people" step="1" placeholder="0" value="' . esc_attr( $people ) . '" required disabled>';405 406 if ( 0 === $number ) {407 408 echo '<div class="wprb-add-last-minute-container">';409 echo '<img class="add-last-minute" src="' . esc_url( WPRB_URI . 'images/add-icon.png' ) . '">';410 echo '<img class="add-last-minute-hover" src="' . esc_url( WPRB_URI . 'images/add-icon-hover.png' ) . '">';411 echo '</div>';412 413 } else {414 415 echo '<div class="wprb-remove-last-minute-container">';416 echo '<img class="remove-last-minute" src="' . esc_url( WPRB_URI . 'images/remove-icon.png' ) . '">';417 echo '<img class="remove-last-minute-hover" src="' . esc_url( WPRB_URI . 'images/remove-icon-hover.png' ) . '">';418 echo '</div>';419 420 }421 422 echo '</div>';423 424 }425 426 /**427 * Display the last minute element in the plugin admin area428 */429 public function display_last_minute_elements() {430 431 $this->last_minute();432 322 433 323 } … … 441 331 public function room_tables( $number = 0, $data = array() ) { 442 332 443 $name = isset( $data['name'] ) ? $data['name'] : ''; 444 $tables = isset( $data['tables'] ) ? $data['tables'] : 0; 445 $disabled = 0 !== $number ? ' disabled' : ''; 333 $name = isset( $data['name'] ) ? $data['name'] : ''; 334 $tables = isset( $data['tables'] ) ? $data['tables'] : 0; 446 335 447 336 echo '<tr class="wprb-room-tables-element-' . esc_attr( $number ) . ' room-tables-element">'; … … 452 341 453 342 echo '<label>' . esc_html__( 'Name', 'wp-restaurant-booking' ) . '</label>'; 454 echo '<input type="text" name="room-name-' . esc_attr( $number ) . '" value="' . esc_attr( $name ) . '" placeholder="' . sprintf( esc_attr( 'Room %d', 'wp-restaurant-booking' ), esc_attr( $number + 1 ) ) . '" ' . $disabled . '>';343 echo '<input type="text" name="room-name-' . esc_attr( $number ) . '" value="' . esc_attr( $name ) . '" placeholder="' . sprintf( esc_attr( 'Room %d', 'wp-restaurant-booking' ), esc_attr( $number + 1 ) ) . '">'; 455 344 456 345 echo '<label>' . esc_html__( 'Tables', 'wp-restaurant-booking' ) . '</label>'; 457 echo '<input type="number" name="tables-number-' . esc_attr( $number ) . '" min="1" value="' . esc_attr( $tables ) . '"' . $disabled . '>'; 458 459 if ( 0 === $number ) { 460 461 echo '<div class="wprb-add-room-tables-container">'; 462 echo '<img class="add-room-tables" src="' . esc_url( WPRB_URI . 'images/add-icon.png' ) . '">'; 463 echo '<img class="add-room-tables-hover" src="' . esc_url( WPRB_URI . 'images/add-icon-hover.png' ) . '">'; 464 echo '</div>'; 465 466 } else { 467 468 echo '<div class="wprb-remove-room-tables-container">'; 469 echo '<img class="remove-room-tables" src="' . esc_url( WPRB_URI . 'images/remove-icon.png' ) . '">'; 470 echo '<img class="remove-room-tables-hover" src="' . esc_url( WPRB_URI . 'images/remove-icon-hover.png' ) . '">'; 471 echo '</div>'; 472 473 } 474 346 echo '<input type="number" name="tables-number-' . esc_attr( $number ) . '" min="1" value="' . esc_attr( $tables ) . '">'; 347 475 348 echo '<p class="description">' . esc_html__( 'Add a name and the number of tables to this restaurant room', 'wp-restaurant-booking' ) . '</p>'; 476 349 … … 531 404 public function closing_period( $number = 0, $data = array() ) { 532 405 533 $from = null;534 $to = null;406 $from = isset( $data['from'] ) ? $data['from'] : ''; 407 $to = isset( $data['to'] ) ? $data['to'] : ''; 535 408 536 409 echo '<div class="wprb-closing-period-element-' . esc_attr( $number ) . ' closing-period-element">'; … … 563 436 564 437 /** 565 * Display the last minute element in the plugin admin area 438 * Return a single closing period element as ajax callback 439 */ 440 public function closing_period_element_callback() { 441 442 if ( isset( $_POST['number'], $_POST['wprb-add-closing-period-nonce'] ) && wp_verify_nonce( wp_unslash( $_POST['wprb-add-closing-period-nonce'] ), 'wprb-add-closing-period' ) ) { 443 444 $number = sanitize_text_field( wp_unslash( $_POST['number'] ) ); 445 446 $this->closing_period( $number ); 447 448 } 449 450 exit; 451 452 } 453 454 /** 455 * Auto-delete the closing periods out of date 456 */ 457 public function get_filtered_closing_periods() { 458 459 $output = null; 460 461 $closing_periods = get_option( 'wprb-closing-periods' ); 462 463 if ( $closing_periods ) { 464 465 $count = count( $closing_periods ); 466 467 for ( $i = 0; $i < $count; $i++ ) { 468 469 $to = isset( $closing_periods[ $i ]['to'] ) ? $closing_periods[ $i ]['to'] : ''; 470 471 /*Check for expired elements*/ 472 if ( $to ) { 473 474 $to = strtotime( $to ); 475 $now = strtotime( 'now' ); 476 477 if ( $now > $to ) { 478 479 unset( $closing_periods[ $i ] ); 480 481 } 482 483 } 484 485 } 486 487 $output = array_values( $closing_periods ); 488 489 update_option( 'wprb-closing-periods', $output ); 490 491 return $output; 492 493 } 494 495 } 496 497 /** 498 * Display the closing period elements in the plugin admin area 566 499 */ 567 500 public function display_closing_period_elements() { 568 501 569 $this->closing_period(); 502 $closing_periods = $this->get_filtered_closing_periods(); 503 504 if ( $closing_periods ) { 505 506 $count = count( $closing_periods ); 507 508 for ( $i = 0; $i < $count; $i++ ) { 509 510 $this->closing_period( $i, $closing_periods[ $i ] ); 511 512 } 513 514 } else { 515 516 $this->closing_period(); 517 518 } 570 519 571 520 } … … 607 556 update_option( 'wprb-expiration-time', $expiration_time ); 608 557 558 /*Widget color*/ 559 $widget_color = isset( $_POST['wprb-widget-color'] ) ? sanitize_hex_color( wp_unslash( $_POST['wprb-widget-color'] ) ) : ''; 560 update_option( 'wprb-widget-color', $widget_color ); 561 562 /*Widget text color*/ 563 $widget_text_color = isset( $_POST['wprb-widget-text-color'] ) ? sanitize_hex_color( wp_unslash( $_POST['wprb-widget-text-color'] ) ) : ''; 564 update_option( 'wprb-widget-text-color', $widget_text_color ); 565 609 566 } 610 567 … … 660 617 foreach ( self::week() as $key => $value ) { 661 618 662 $from = isset( $_POST[ 'wprb-' . $key . '-bookable-hours-from-1' ] ) ? sanitize_text_field( wp_unslash( $_POST[ 'wprb-' . $key . '-bookable-hours-from-1' ] ) ) : null; 663 664 $to = isset( $_POST[ 'wprb-' . $key . '-bookable-hours-to-1' ] ) ? sanitize_text_field( wp_unslash( $_POST[ 'wprb-' . $key . '-bookable-hours-to-1' ] ) ) : null; 665 666 $every = isset( $_POST[ 'wprb-' . $key . '-bookable-hours-every-1' ] ) ? sanitize_text_field( wp_unslash( $_POST[ 'wprb-' . $key . '-bookable-hours-every-1' ] ) ) : null; 667 668 if ( $from && $to && $every ) { 669 670 $save_hours[ $key ][1] = array( 671 'from' => $from, 672 'to' => $to, 673 'every' => $every, 674 ); 619 /*10 is the current limit*/ 620 for ( $i = 1; $i <= 10; $i++ ) { 621 622 $from = isset( $_POST[ 'wprb-' . $key . '-bookable-hours-from-' . $i ] ) ? sanitize_text_field( wp_unslash( $_POST[ 'wprb-' . $key . '-bookable-hours-from-' . $i ] ) ) : null; 623 624 $to = isset( $_POST[ 'wprb-' . $key . '-bookable-hours-to-' . $i ] ) ? sanitize_text_field( wp_unslash( $_POST[ 'wprb-' . $key . '-bookable-hours-to-' . $i ] ) ) : null; 625 626 $every = isset( $_POST[ 'wprb-' . $key . '-bookable-hours-every-' . $i ] ) ? sanitize_text_field( wp_unslash( $_POST[ 'wprb-' . $key . '-bookable-hours-every-' . $i ] ) ) : null; 627 628 if ( $from && $to && $every ) { 629 630 $save_hours[ $key ][ $i ] = array( 631 'from' => $from, 632 'to' => $to, 633 'every' => $every, 634 ); 635 636 } else { 637 638 break; 639 640 } 675 641 676 642 } … … 685 651 686 652 /** 687 * Save last minute 688 */ 689 public function save_last_minute_settings() { 690 691 if ( isset( $_POST['wprb-set-last-minute-sent'], $_POST['wprb-set-last-minute-nonce'] ) && wp_verify_nonce( wp_unslash( $_POST['wprb-set-last-minute-nonce'] ), 'wprb-set-last-minute' ) ) { 692 693 /*Last minute activate*/ 694 $activate = isset( $_POST['wprb-activate-last-minute'] ) ? sanitize_text_field( wp_unslash( $_POST['wprb-activate-last-minute'] ) ) : 0; 695 update_option( 'wprb-activate-last-minute', $activate ); 696 697 /*Last minute description*/ 698 $description = isset( $_POST['wprb-last-minute-description'] ) ? sanitize_text_field( wp_unslash( $_POST['wprb-last-minute-description'] ) ) : ''; 699 update_option( 'wprb-last-minute-description', $description ); 700 701 /*Set last minute*/ 702 $last_minute = array(); 653 * Save closing days 654 */ 655 public function save_closing_days_settings() { 656 657 if ( isset( $_POST['wprb-set-closing-days-sent'], $_POST['wprb-set-closing-days-nonce'] ) && wp_verify_nonce( wp_unslash( $_POST['wprb-set-closing-days-nonce'] ), 'wprb-set-closing-days' ) ) { 658 659 /*Closing days*/ 660 $closing_days = isset( $_POST['wprb-closing-days'] ) ? $_POST['wprb-closing-days'] : ''; 661 update_option( 'wprb-closing-days', $closing_days ); 662 663 /*Closing periods*/ 664 $closing_periods = array(); 703 665 704 666 /*20 is the current limit*/ 705 667 for ( $i = 0; $i <= 20; $i++ ) { 706 668 707 $date = isset( $_POST[ 'wprb-last-minute-date-' . $i ] ) ? sanitize_text_field( wp_unslash( $_POST[ 'wprb-last-minute-date-' . $i ] ) ) : null; 708 $from = isset( $_POST[ 'wprb-last-minute-from-' . $i ] ) ? sanitize_text_field( wp_unslash( $_POST[ 'wprb-last-minute-from-' . $i ] ) ) : null; 709 $to = isset( $_POST[ 'wprb-last-minute-to-' . $i ] ) ? sanitize_text_field( wp_unslash( $_POST[ 'wprb-last-minute-to-' . $i ] ) ) : null; 710 $people = isset( $_POST[ 'wprb-last-minute-people-' . $i ] ) ? sanitize_text_field( wp_unslash( $_POST[ 'wprb-last-minute-people-' . $i ] ) ) : null; 711 if ( $date && $from && $to && $people ) { 712 713 $last_minute[ $i ] = array( 714 'date' => $date, 669 $from = isset( $_POST[ 'wprb-closing-period-from-' . $i ] ) ? sanitize_text_field( wp_unslash( $_POST[ 'wprb-closing-period-from-' . $i ] ) ) : null; 670 $to = isset( $_POST[ 'wprb-closing-period-to-' . $i ] ) ? sanitize_text_field( wp_unslash( $_POST[ 'wprb-closing-period-to-' . $i ] ) ) : null; 671 672 if ( $from && $to ) { 673 674 $closing_periods[ $i ] = array( 715 675 'from' => $from, 716 676 'to' => $to, 717 'people' => $people,718 677 ); 719 678 … … 726 685 } 727 686 728 update_option( 'wprb- last-minute', $last_minute);687 update_option( 'wprb-closing-periods', $closing_periods ); 729 688 730 689 } … … 781 740 $admin_recipients = isset( $_POST['wprb-admin-recipients'] ) && '' !== $_POST['wprb-admin-recipients'] ? explode( ' ', sanitize_text_field( wp_unslash( $_POST['wprb-admin-recipients'] ) ) ) : ''; 782 741 update_option( 'wprb-admin-recipients', $admin_recipients ); 742 743 $user_activate = isset( $_POST['wprb-activate-user-notification'] ) ? sanitize_text_field( wp_unslash( $_POST['wprb-activate-user-notification'] ) ) : ''; 744 update_option( 'wprb-activate-user-notification', $user_activate ); 783 745 784 746 } … … 811 773 echo '<a href="#" data-link="wprb-set-hours" class="nav-tab" onclick="return false;">' . esc_html( __( 'Hours', 'wp-restaurant-booking' ) ) . '</a>'; 812 774 echo '<a href="#" data-link="wprb-set-closing-days" class="nav-tab" onclick="return false;">' . esc_html( __( 'Closing days', 'wp-restaurant-booking' ) ) . '</a>'; 813 echo '<a href="#" data-link="wprb-set-last-minute" class="nav-tab" onclick="return false;">' . esc_html( __( 'Last minute', 'wp-restaurant-booking' ) ) . '</a>';814 775 echo '<a href="#" data-link="wprb-set-notifications" class="nav-tab" onclick="return false;">' . esc_html( __( 'Notifications', 'wp-restaurant-booking' ) ) . '</a>'; 776 echo '<a href="#" data-link="wprb-set-premium" class="nav-tab nav-tab-premium" onclick="return false;"><span class="dashicons dashicons-star-filled"></span> ' . esc_html( __( 'Premium', 'wp-restaurant-booking' ) ) . '</a>'; 815 777 echo '</h2>'; 816 778 … … 850 812 echo '</div>'; 851 813 852 /*Set last minute*/853 echo '<div id="wprb-set-last-minute" class="wprb-admin">';854 855 include( WPRB_ADMIN . 'wprb-set-last-minute-template.php' );856 857 echo '</div>';858 859 814 /*Set notifications*/ 860 815 echo '<div id="wprb-set-notifications" class="wprb-admin">'; 861 816 862 817 include( WPRB_ADMIN . 'wprb-set-notifications-template.php' ); 818 819 echo '</div>'; 820 821 /*Premium features*/ 822 echo '<div id="wprb-set-premium" class="wprb-admin">'; 823 824 include( WPRB_ADMIN . 'wprb-set-premium-template.php' ); 863 825 864 826 echo '</div>'; -
wp-restaurant-booking/tags/1.3.0/admin/wprb-set-bookables-template.php
r3650036 r3685965 15 15 16 16 <table class="form-table"> 17 <tr class="wprb-activate-external-seats-field">18 <th scope="row"><?php esc_html_e( 'External seats', 'wp-restaurant-booking' ); ?></th>19 <td>20 <input type="checkbox" name="wprb-activate-external-seats" id="wprb-activate-external-seats" value="1">21 <p class="description"><?php esc_html_e( 'Activate if external seats are available in your restaurant in this season.', 'wp-restaurant-booking' ); ?></p>22 <?php $admin->go_premium(); ?>23 </td>24 </tr>25 17 <tr> 26 18 <th scope="row"><?php esc_html_e( 'Bookable seats', 'wp-restaurant-booking' ); ?></th> … … 33 25 if ( 'mon' === $key ) { 34 26 echo '<div class="wprb-col"><h4>' . esc_html__( 'Internal seats', 'wp-restaurant-booking' ) . '</h4></div>'; 35 echo '<div class="wprb-col external"><h4>' . esc_html__( 'External seats', 'wp-restaurant-booking' ) . '</h4></div>';36 27 echo '<div class="wprb-col min-bookable"><h4>' . esc_html__( 'Minimum bookable number', 'wp-restaurant-booking' ) . '</h4></div>'; 37 28 echo '<div class="wprb-col max-bookable"><h4>' . esc_html__( 'Maximum bookable number', 'wp-restaurant-booking' ) . '</h4></div>'; … … 48 39 49 40 echo '<input type="number" name="wprb-bookable-seats-' . esc_attr( $key ) . '" id="wprb-bookable-seats" class="' . esc_attr( $key ) . '" placeholder="0" value="' . esc_attr( $bookable_value ) . '">'; 50 echo '</div>';51 52 echo '<div class="wprb-col external">';53 54 echo '<input type="number" name="wprb-external-seats-' . esc_attr( $key ) . '" id="wprb-external-seats" class="' . esc_attr( $key ) . '" placeholder="0" value="0" disabled>';55 56 41 echo '</div>'; 57 42 -
wp-restaurant-booking/tags/1.3.0/admin/wprb-set-closing-days-template.php
r3650036 r3685965 5 5 * @author ilGhera 6 6 * @package wp-restaurant-booking/admin 7 * @since 1.1. 77 * @since 1.1.8 8 8 */ 9 9 10 $closing_days = get_option( 'wprb-closing-days' ); 10 11 ?> 11 12 <!-- Form --> … … 20 21 foreach ( WPRB_Admin::week() as $key => $value ) { 21 22 22 echo '<option value="' . esc_attr( $key ) . '" >' . esc_html( ucfirst( $value ) ) . '</option>';23 echo '<option value="' . esc_attr( $key ) . '"' . ( is_array( $closing_days ) && in_array( $key , $closing_days) ? ' selected="selected"' : '' ) . '>' . esc_html( ucfirst( $value ) ) . '</option>'; 23 24 24 25 } … … 37 38 </td> 38 39 </tr> 39 <tr>40 <th></th>41 <td><?php $admin->go_premium(); ?></td>42 </tr>43 40 </table> 44 41 … … 46 43 47 44 <input type="hidden" name="wprb-set-closing-days-sent" value="1"> 48 <input type="submit" class="button-primary wprb" value="<?php esc_html_e( 'Save settings', 'wp-restaurant-booking' ); ?>" disabled>45 <input type="submit" class="button-primary wprb" value="<?php esc_html_e( 'Save settings', 'wp-restaurant-booking' ); ?>"> 49 46 50 47 </form> -
wp-restaurant-booking/tags/1.3.0/admin/wprb-set-general-template.php
r3650036 r3685965 17 17 $expiration_time = get_option( 'wprb-expiration-time' ); 18 18 $policy_page = get_option( 'wprb-policy-page' ); 19 $widget_color = get_option( 'wprb-widget-color' ); 20 $widget_text_color = get_option( 'wprb-widget-text-color' ); 19 21 ?> 20 22 <!-- Form --> … … 97 99 </td> 98 100 </tr> 101 <tr> 102 <th scope="row"><?php esc_html_e( 'Widget color', 'wp-restaurant-booking' ); ?></th> 103 <td> 104 <input type="text" class="wprb-color-field" name="wprb-widget-color" value="<?php echo esc_attr( $widget_color ); ?>"> 105 <p class="description"><?php esc_html_e( 'Main color of the booking widget. Leave empty to use the default yellow.', 'wp-restaurant-booking' ); ?></p> 106 </td> 107 </tr> 108 <tr> 109 <th scope="row"><?php esc_html_e( 'Widget text color', 'wp-restaurant-booking' ); ?></th> 110 <td> 111 <input type="text" class="wprb-color-field" name="wprb-widget-text-color" value="<?php echo esc_attr( $widget_text_color ); ?>"> 112 <p class="description"><?php esc_html_e( 'Text color used on top of the widget main color, for contrast. Leave empty to use the default white.', 'wp-restaurant-booking' ); ?></p> 113 </td> 114 </tr> 99 115 </table> 100 116 -
wp-restaurant-booking/tags/1.3.0/admin/wprb-set-notifications-template.php
r3650036 r3685965 11 11 $admin_activate = get_option( 'wprb-activate-admin-notification' ); 12 12 $admin_recipients = get_option( 'wprb-admin-recipients' ) ? get_option( 'wprb-admin-recipients' ) : array( get_option( 'admin_email' ) ); 13 14 /*Define the user object*/ 15 $default_user_object = WPRB_Notifications::default_user_object(); 16 $user_object = null; 17 18 /*Define the admin object*/ 19 $default_user_message = WPRB_Notifications::default_user_message(); 20 $user_message = null; 13 $user_activate = get_option( 'wprb-activate-user-notification' ); 21 14 ?> 22 15 … … 53 46 <th scope="row"><?php esc_html_e( 'User notifications', 'wp-restaurant-booking' ); ?></th> 54 47 <td> 55 <input type="checkbox" name="wprb-activate-user-notification" id="wprb-activate-user-notification" value="1" >48 <input type="checkbox" name="wprb-activate-user-notification" id="wprb-activate-user-notification" value="1"<?php echo ( 1 == $user_activate ? ' checked="checked"' : '' ); ?>> 56 49 <p class="description"><?php esc_html_e( 'Activate email notifications for the user.', 'wp-restaurant-booking' ); ?></p> 57 </td>58 </tr>59 <tr class="wprb-user-notification-field" style="display: none;">60 <th scope="row"><?php esc_html_e( 'Object', 'wp-restaurant-booking' ); ?></th>61 <td>62 <input type="text" name="wprb-user-notification-object" class="wprb-user-notification-object regular-text" placeholder="<?php echo esc_attr( $default_user_object ); ?>" value="<?php echo esc_attr( $user_object ); ?>" disabled>63 <p class="description"><?php esc_html_e( 'Specify a different email object.', 'wp-restaurant-booking' ); ?></p>64 </td>65 </tr>66 <tr class="wprb-user-notification-field" style="display: none;">67 <th scope="row"><?php esc_html_e( 'Message', 'wp-restaurant-booking' ); ?></th>68 <td>69 <textarea type="text" name="wprb-user-notification-message" class="wprb-user-notification-message regular-text" rows="6" placeholder="<?php echo esc_attr( $default_user_message ); ?>" disabled><?php echo esc_html( $user_message ); ?></textarea>70 <p class="description">71 <?php72 echo '<span class="shortcodes">';73 echo '<code>[first-name]</code> <code>[last-name]</code> <code>[email]</code> <code>[phone]</code>';74 echo '<code>[people]</code> <code>[in-outdoor]</code> <code>[date]</code> <code>[time]</code> <code>[until]</code> <code>[notes]</code>';75 echo '</span>';76 esc_html_e( 'Specify a different email message.', 'wp-restaurant-booking' );77 ?>78 </p>79 <?php $admin->go_premium(); ?>80 50 </td> 81 51 </tr> -
wp-restaurant-booking/tags/1.3.0/admin/wprb-set-tables-template.php
r3650036 r3685965 14 14 15 15 <?php $admin->display_rooms_tables_elements(); ?> 16 17 <tr class="go-premium">18 <th></th>19 <td><?php $admin->go_premium(); ?></td>20 </tr>21 16 22 17 </table> -
wp-restaurant-booking/tags/1.3.0/css/wprb-admin.css
r3650036 r3685965 68 68 #submit-key:active { 69 69 top: 2px; 70 }71 72 .nav-tab.not-available, .nav-tab.not-available:hover {73 border-width: 1px 1px medium;74 border-style: solid solid none;75 border-color: #CCC #CCC -moz-use-text-color;76 -moz-border-top-colors: none;77 -moz-border-right-colors: none;78 -moz-border-bottom-colors: none;79 -moz-border-left-colors: none;80 border-image: none;81 background: #E4E4E4 none repeat scroll 0% 0%;82 display: inline-block;83 text-decoration: none;84 opacity:0.4;85 70 } 86 71 … … 544 529 } 545 530 546 .wprb.label-warning.premium {547 display: inline-block;548 margin: 10px 0 0;549 padding: 7px 14px;550 font-size: 12px;551 font-weight: bold;552 line-height: 1;553 text-align: center;554 white-space: nowrap;555 vertical-align: baseline;556 border-radius: .25em;557 background-color: #f0ad4e;558 cursor: pointer;559 }560 561 .label-warning a {562 color: #ffffff;563 text-decoration: none;564 }565 566 .label-warning a:hover {567 color: #0073aa;568 }569 570 .go-premium {571 display: none;572 }573 574 531 .old-table { 575 532 display: block; … … 590 547 591 548 .wrap-right { 592 float: none; 593 width: 100%; 594 text-align: center; 549 float: none; 550 width: 100%; 551 text-align: center; 595 552 padding-top: 3rem; 596 553 } … … 598 555 599 556 } 557 558 .nav-tab-premium { 559 color: #b8860b !important; 560 font-weight: 600; 561 } 562 563 .nav-tab-premium:hover, 564 .nav-tab-premium:focus { 565 color: #8b6508 !important; 566 } 567 568 .nav-tab-premium .dashicons { 569 font-size: 14px; 570 width: 14px; 571 height: 14px; 572 vertical-align: text-bottom; 573 margin-right: 2px; 574 } 575 576 .nav-tab-premium.nav-tab-active { 577 color: #f0b90b !important; 578 border-bottom-color: #f0b90b !important; 579 } 580 581 .wprb-premium-upsell { 582 max-width: 860px; 583 margin-top: 1.5rem; 584 } 585 586 .wprb-premium-header { 587 text-align: center; 588 padding: 2rem 1rem; 589 background: #fff; 590 border: 1px solid #e0e0e0; 591 border-radius: 4px; 592 margin-bottom: 1.5rem; 593 } 594 595 .wprb-premium-header .dashicons { 596 font-size: 2.5rem; 597 width: 2.5rem; 598 height: 2.5rem; 599 color: #f0b90b; 600 } 601 602 .wprb-premium-header h2 { 603 font-size: 1.6rem; 604 margin: 0.5rem 0; 605 color: #23282d; 606 } 607 608 .wprb-premium-header .description { 609 font-size: 1rem; 610 color: #666; 611 } 612 613 .wprb-premium-features { 614 display: grid; 615 grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); 616 gap: 1rem; 617 margin-bottom: 1.5rem; 618 } 619 620 .wprb-feature { 621 background: #fff; 622 border: 1px solid #e0e0e0; 623 border-radius: 4px; 624 padding: 1.5rem; 625 transition: box-shadow 0.2s ease; 626 } 627 628 .wprb-feature:hover { 629 box-shadow: 0 2px 8px rgba(0,0,0,0.1); 630 } 631 632 .wprb-feature .dashicons { 633 font-size: 2rem; 634 width: 2rem; 635 height: 2rem; 636 color: #f0b90b; 637 } 638 639 .wprb-feature h3 { 640 margin: 0.5rem 0; 641 font-size: 1rem; 642 color: #23282d; 643 } 644 645 .wprb-feature p { 646 margin: 0; 647 color: #666; 648 font-size: 0.9rem; 649 } 650 651 .wprb-premium-cta { 652 text-align: center; 653 padding: 2rem; 654 background: #fff; 655 border: 1px solid #e0e0e0; 656 border-radius: 4px; 657 } 658 659 .wprb-premium-cta .button-hero { 660 background: #f0b90b; 661 border-color: #d4a009; 662 color: #fff; 663 font-size: 1.1rem; 664 padding: 0.6rem 2rem; 665 } 666 667 .wprb-premium-cta .button-hero:hover { 668 background: #d4a009; 669 border-color: #b8860b; 670 color: #fff; 671 } 672 673 .wprb-premium-cta .description { 674 margin-top: 0.75rem; 675 color: #666; 676 } -
wp-restaurant-booking/tags/1.3.0/css/wprb.css
r3650036 r3685965 16 16 display: inline-block; 17 17 padding: 2px 20px; 18 background: #f5b016;18 background: var(--wprb-widget-color, #f5b016); 19 19 border-radius: 5px; 20 20 cursor: pointer; … … 48 48 .wprb-booking-button a, 49 49 .wprb-booking-button a:hover { 50 color: #fff!important;50 color: var(--wprb-widget-text-color, #fff) !important; 51 51 text-decoration: none; 52 52 font-family: "Helvetica Neue",Helvetica,Arial,sans-serif; … … 80 80 #wprb-booking-modal h2 { 81 81 text-align: center; 82 background: #f5b016;82 background: var(--wprb-widget-color, #f5b016); 83 83 margin: 0; 84 84 padding: 40px 0 20px; 85 color: #fff;85 color: var(--wprb-widget-text-color, #fff); 86 86 font-size: 2em; 87 87 -webkit-border-radius: 8px 8px 0 0; … … 105 105 #wprb-booking-modal .header-bar { 106 106 display: block; 107 background: #f5b016;107 background: var(--wprb-widget-color, #f5b016); 108 108 min-height: 100px; 109 109 } … … 121 121 position: relative; 122 122 margin: 0; 123 } 124 125 .header-bar_steps li { 126 color: var(--wprb-widget-text-color, #333); 127 } 128 129 .header-bar_steps li.active span i { 130 color: var(--wprb-widget-color, #333); 123 131 } 124 132 … … 141 149 #wprb-booking-modal ul li span { 142 150 text-align: center; 143 background-color: #f5b016;151 background-color: var(--wprb-widget-color, #f5b016); 144 152 width: 44px; 145 153 height: 44px; … … 153 161 opacity: 1; 154 162 background-color: #fff; 155 border: 2px solid #f0a417;163 border: 2px solid var(--wprb-widget-accent-color, #f0a417); 156 164 cursor: pointer; 157 165 } … … 226 234 .booking-people_numbers__number input[type="button"]:hover, 227 235 .booking-people_numbers__number input[type="button"].active { 228 background: #f5b016!important;236 background: var(--wprb-widget-color, #f5b016) !important; 229 237 text-decoration: none; 230 color: #fff;238 color: var(--wprb-widget-text-color, #fff); 231 239 } 232 240 … … 277 285 278 286 .booking-people_numbers__number.active select { 279 background: #f5b016;280 color: #fff;287 background: var(--wprb-widget-color, #f5b016); 288 color: var(--wprb-widget-text-color, #fff); 281 289 } 282 290 … … 403 411 .booking-hours ul li input:hover, 404 412 .booking-hours ul li input.active { 405 color: #fff;413 color: var(--wprb-widget-text-color, #fff); 406 414 text-decoration: none; 407 background: #f5b016;415 background: var(--wprb-widget-color, #f5b016); 408 416 } 409 417 … … 474 482 475 483 #wprb-reservation input[type="checkbox"]:checked { 476 background-color: #f5b016;484 background-color: var(--wprb-widget-color, #f5b016); 477 485 } 478 486 479 487 #wprb-reservation input[type="checkbox"]:checked:after { 480 488 content: '✔'; 481 color: white;489 color: var(--wprb-widget-text-color, white); 482 490 position: relative; 483 491 top: -3px; … … 555 563 .booking-end .fa-check-circle { 556 564 font-size: 400%; 557 color: #f5b016; /*temp*/565 color: var(--wprb-widget-color, #f5b016); 558 566 margin-bottom: 1.5rem; 559 567 } 560 568 569 /* 570 * Override the air-datepicker library's own default theme (#ff9a19) 571 * so the calendar follows the widget color too. Needs !important: 572 * the library's stylesheet is enqueued after wprb.css and its own 573 * rules don't use !important, so source order alone isn't enough. 574 */ 575 .datepicker--day-name { 576 color: var(--wprb-widget-color, #ff9a19) !important; 577 } 578 579 .-current-, 580 .-selected-, 581 .datepicker--cell.-selected-.-current- { 582 background: var(--wprb-widget-color, #ff9a19) !important; 583 color: var(--wprb-widget-text-color, #fff) !important; 584 } 585 586 .-focus-, 587 .-selected-.-focus- { 588 background: var(--wprb-widget-color, #ff9a19) !important; 589 } 590 561 591 @media screen and (max-width: 1000px) { 562 592 -
wp-restaurant-booking/tags/1.3.0/includes/class-wprb-notifications.php
r3650036 r3685965 48 48 $this->define_shortcodes(); 49 49 $this->send_admin_notification(); 50 $this->send_user_notification(); 50 51 51 52 } … … 263 264 264 265 } 266 267 268 /** 269 * Send user notification if activated 270 */ 271 public function send_user_notification() { 272 273 if ( get_option( 'wprb-activate-user-notification' ) ) { 274 275 $to = $this->email; 276 277 $subject = do_shortcode( self::default_user_object() ); 278 279 $message = do_shortcode( self::default_user_message( $this->until, $this->notes ) ); 280 281 $this->mail_from_filters(); 282 283 $sent = wp_mail( $to, $subject, $message ); 284 285 } 286 287 } 265 288 } 266 289 -
wp-restaurant-booking/tags/1.3.0/includes/class-wprb-reservation-widget.php
r3650036 r3685965 108 108 109 109 /** 110 * Darken a hex color by the given percentage 111 * 112 * @param string $hex the hex color (with or without #). 113 * @param int $percent darken percentage. 114 * @return string the darkened hex color, empty string if invalid input. 115 */ 116 private function darken_color( $hex, $percent = 12 ) { 117 118 $hex = ltrim( $hex, '#' ); 119 120 if ( 3 === strlen( $hex ) ) { 121 $hex = $hex[0] . $hex[0] . $hex[1] . $hex[1] . $hex[2] . $hex[2]; 122 } 123 124 if ( 6 !== strlen( $hex ) || ! ctype_xdigit( $hex ) ) { 125 return ''; 126 } 127 128 list( $r, $g, $b ) = array_map( 'hexdec', str_split( $hex, 2 ) ); 129 130 $r = max( 0, round( $r * ( 1 - $percent / 100 ) ) ); 131 $g = max( 0, round( $g * ( 1 - $percent / 100 ) ) ); 132 $b = max( 0, round( $b * ( 1 - $percent / 100 ) ) ); 133 134 return sprintf( '#%02x%02x%02x', $r, $g, $b ); 135 136 } 137 138 139 /** 140 * Build the CSS custom properties for the widget colors, if set 141 * 142 * @param string $color the main widget color. 143 * @param string $text_color the widget text color. 144 * @return string the CSS, empty string if no color is set. 145 */ 146 private function widget_color_css( $color, $text_color ) { 147 148 $vars = array(); 149 150 if ( $color ) { 151 152 $vars[] = '--wprb-widget-color: ' . $color . ';'; 153 154 $accent = $this->darken_color( $color ); 155 156 if ( $accent ) { 157 $vars[] = '--wprb-widget-accent-color: ' . $accent . ';'; 158 } 159 } 160 161 if ( $text_color ) { 162 $vars[] = '--wprb-widget-text-color: ' . $text_color . ';'; 163 } 164 165 if ( empty( $vars ) ) { 166 return ''; 167 } 168 169 return ':root{' . implode( ' ', $vars ) . '}'; 170 171 } 172 173 174 /** 110 175 * Scripts and style 111 176 */ … … 114 179 /*css*/ 115 180 wp_enqueue_style( 'wprb-style', WPRB_URI . 'css/wprb.css' ); 181 182 $widget_color = get_option( 'wprb-widget-color' ); 183 $widget_text_color = get_option( 'wprb-widget-text-color' ); 184 $widget_color_css = $this->widget_color_css( $widget_color, $widget_text_color ); 185 186 if ( $widget_color_css ) { 187 wp_add_inline_style( 'wprb-style', $widget_color_css ); 188 } 189 116 190 wp_enqueue_style( 'modal-style', WPRB_URI . 'css/jquery.modal.min.css' ); 117 191 wp_enqueue_style( 'font-awesome', WPRB_URI . 'css/fontawesome/all.min.css' ); -
wp-restaurant-booking/tags/1.3.0/js/wprb-admin.js
r3650036 r3685965 17 17 self.chosen(); 18 18 self.tzCheckbox(); 19 self.externalSeats();20 19 self.addHours(); 21 20 self.removeHours(); 22 self.addLastMinute();23 self.removeLastMinute();24 21 self.addclosingPeriod(); 25 22 self.removeClosingPeriod(); … … 28 25 self.minDateClosingPeriodTo(); 29 26 self.autoCompleteFields('internal'); 30 self.autoCompleteFields('external');31 27 self.autoCompleteFields('min'); 32 28 self.autoCompleteFields('max'); 33 self.lastMinuteElement();34 29 self.notificationsElement(); 35 self. notificationsShortcodes();30 self.widgetColorPicker(); 36 31 } 37 32 … … 129 124 130 125 /** 131 *External seats option132 */133 self.externalSeats = function() {134 135 jQuery(function($){136 137 var col = $('.wprb-col.external');138 var fieldContainer = $('.wprb-activate-external-seats-field');139 var field = $('input', fieldContainer);140 141 var fieldCheck = function() {142 143 if ( 'checked' == field.attr('checked') ) {144 145 col.show();146 147 } else {148 149 col.hide();150 151 }152 153 }154 fieldCheck();155 156 $('span.tzCheckBox', fieldContainer).on('click', function(){157 158 fieldCheck();159 160 })161 162 })163 164 }165 166 167 /**168 126 * Add a new hours element 169 127 */ … … 190 148 $(prev).after(response); 191 149 192 /*Display go premium*/193 $('.go-premium', container).show('slow');194 195 150 }) 196 151 … … 216 171 $(element).remove(); 217 172 218 /*Hide go premium*/ 219 if ( $('.wprb-hours-element-2', container).length == 0 ) { 220 221 $('.go-premium', container).hide(); 222 223 } 224 225 }) 226 227 }) 228 229 } 230 231 232 /** 233 * Auto-complete the bookable and external fields of every day, copying the values from the firsts setted 173 }) 174 175 }) 176 177 } 178 179 180 /** 181 * Auto-complete the bookable fields of every day, copying the values from the firsts setted 234 182 * 235 * @param { Boolean} external true for external field, default for bookable.183 * @param {string} type field type. 236 184 */ 237 185 self.autoCompleteFields = function( type = 'internal' ) { … … 244 192 switch (type) { 245 193 246 case 'internal': 247 element = '#wprb-bookable-seats'; 248 249 break; 250 251 case 'external': 252 element = '#wprb-external-seats'; 253 254 break; 255 256 case 'min': 194 case 'internal': 195 element = '#wprb-bookable-seats'; 196 197 break; 198 199 case 'min': 257 200 element = '#wprb-min-bookable'; 258 201 … … 279 222 280 223 }) 281 282 })283 284 })285 286 }287 288 289 /**290 * Handles the visibility of the last minute fields291 */292 self.lastMinuteElement = function() {293 294 jQuery(function($){295 296 var toggle = $('.wprb-activate-last-minute-field .tzCheckBox');297 var lastMinute = $('.wprb-add-last-minute-field');298 299 if ($(toggle).hasClass('checked')) {300 301 lastMinute.show();302 303 }304 305 $(toggle).on('click', function(){306 307 if ($(this).hasClass('checked')) {308 309 lastMinute.show('slow');310 311 } else {312 313 lastMinute.hide();314 315 }316 317 })318 319 })320 321 }322 323 324 /**325 * Add a new last minute326 */327 self.addLastMinute = function() {328 329 jQuery(function($){330 331 $(document).on('click', '.add-last-minute-hover', function(){332 333 334 var count = $('.last-minute-element').length;335 var prev = $('.wprb-last-minute-element-' + ( count - 1 ) );336 var next = count;337 var data = {338 'action': 'wprb-add-last-minute',339 'wprb-add-last-minute-nonce': wprbSettings.addLastMinuteNonce,340 'number': next341 }342 343 $.post(ajaxurl, data, function(response){344 345 $(prev).after(response);346 347 })348 349 })350 351 })352 353 }354 355 356 /**357 * Remove a last minute358 */359 self.removeLastMinute = function() {360 361 jQuery(function($){362 363 $(document).on('click', '.remove-last-minute-hover', function(){364 365 var element = $(this).closest('.last-minute-element');366 367 $(element).remove();368 224 369 225 }) … … 463 319 $.post(ajaxurl, data, function(response){ 464 320 465 /*Display go premium*/466 $('.wprb-set-rooms-tables .go-premium').show('slow');467 468 321 $(prev).after(response); 469 322 … … 489 342 490 343 $(element).remove(); 491 492 /*Hide go premium*/493 if ( $('.wprb-room-tables-element-1').length == 0 ) {494 495 $('.wprb-set-rooms-tables .go-premium').hide();496 497 }498 344 499 345 }) … … 564 410 565 411 /** 566 * Copy shortcodes to use in user notification 567 */ 568 self.notificationsShortcodes = function() { 569 570 jQuery(function($){ 571 572 var $temp; 573 var shortcode; 574 575 /*Add title*/ 576 $('.shortcodes code').each( function(){ 577 578 $(this).attr('title', 'Click to copy'); 579 580 }) 581 582 /*Copy shortcode*/ 583 $('.shortcodes code').on( 'click', function(){ 584 585 $temp = $('<input>'); 586 shortcode = $(this); 587 588 $('body').append($temp); 589 $temp.val($(shortcode).text()).select(); 590 document.execCommand('copy'); 591 $temp.remove(); 592 593 }) 594 595 }) 596 597 } 412 * Widget colors picker 413 */ 414 self.widgetColorPicker = function() { 415 416 jQuery(function($){ 417 418 if ( typeof $.fn.wpColorPicker === 'function' ) { 419 420 $('.wprb-color-field').wpColorPicker(); 421 422 } 423 424 }) 425 426 } 427 598 428 599 429 } -
wp-restaurant-booking/tags/1.3.0/readme.txt
r3658642 r3685965 2 2 Contributors: ghera74 3 3 Tags: booking, ticket, reservation, restaurant, bar 4 Version: 1. 2.45 Stable tag: 1. 2.44 Version: 1.3.0 5 Stable tag: 1.3.0 6 6 Requires at least: 5.0 7 7 Tested up to: 7.1 … … 16 16 **AVAILABLE FUNCTIONALITIES** 17 17 18 * Activate/ deactivate the booking functionlityin a click.18 * Activate/deactivate the booking function in a click. 19 19 * Booking widget position, even using the shortcode *[booking-button]*. 20 * Set a number of bookable seats for each day of the week.21 * Define the time slots that can be booked every day22 * Outdoor tables option (Premium).23 * Last minute table option (Premium).24 * Set time limit within which to book a table.20 * Customizable widget colors (background and text color). 21 * Set a number of bookable seats for each day of the week, with a minimum and a maximum bookable. 22 * Multiple bookable time slots for each day (for example lunch and dinner), with the interval between one time and the next. 23 * Closing days: days of the week and closing periods on specific dates (holidays). 24 * Set a time limit within which to book a table. 25 25 * Set an average time of the customer at the table, useful for calculating availability. 26 26 * Assign a table to each reservation. … … 29 29 * Admin and user email notifications. 30 30 31 **PREMIUM VERSION** 32 33 The premium version of **ilGhera Restaurant Booking for WordPress** adds the following functionalities: 34 35 * Outdoor seats, with availability calculated separately. 36 * Last minute tables. 37 * Multiple rooms, each with its own number of tables. 38 * HTML email templates with custom header and footer. 39 * Inline booking form using the shortcode *[booking-form]*. 40 41 https://www.ilghera.com/product/wp-restaurant-booking-premium/ 42 31 43 https://youtu.be/fAk2Hzm2E7k 32 44 … … 47 59 == Screenshots == 48 60 49 1. Select date andnumber of people61 1. Select the date and the number of people 50 62 2. Select the booking time 51 63 3. Add your data 52 64 4. The reservation was completed 53 5. General settings 54 6. Last minute settings (Premium) 55 7. Admin and user email settings 56 8. Admin reservations 57 9. Edit single reservation 65 5. General settings, with the booking widget colors 66 6. Bookable seats for each day of the week 67 7. Bookable time slots, more than one for each day 68 8. Closing days and closing periods 69 9. Admin and user email notifications 70 10. Admin reservations 71 11. Edit single reservation 72 12. The functionalities available in the premium version 58 73 59 74 60 75 == Changelog == 76 77 = 1.3.0 = 78 Release Date: 7 September 2026 79 80 * New: multiple bookable time slots for each day, now included in the free version. 81 * New: closing days, both weekdays and closing periods on specific dates, now included in the free version. 82 * New: customizable booking widget colors (background and text color). 83 * New: Premium tab with the list of the features available in the premium version. 84 * Tweak: settings pages cleaned up, the options reserved to the premium version are no longer shown as disabled fields. 85 * Fix: the confirmation email was never sent to the customer, and the User notifications switch was not saved. 86 * Fix: the Chosen library used by the multiple selects was enqueued but not included in the package, so both files returned a 404. 87 * Fix: the link to the premium version pointed to a page that no longer exists. 88 61 89 62 90 = 1.2.4 = -
wp-restaurant-booking/tags/1.3.0/wp-restaurant-booking.php
r3660604 r3685965 2 2 /** 3 3 * Plugin Name: ilGhera Restaurant Booking for WordPress 4 * Plugin URI: https://www.ilghera.com/product/w ordpress-restaurant-booking-premium4 * Plugin URI: https://www.ilghera.com/product/wp-restaurant-booking-premium 5 5 * Description: A feature-rich and easy to use reservation system for bars and restaurants. 6 6 * Author: ilGhera 7 * Version: 1. 2.47 * Version: 1.3.0 8 8 * Author URI: https://ilghera.com 9 9 * Requires at least: 5.0 -
wp-restaurant-booking/trunk/admin/class-wprb-admin.php
r3650036 r3685965 29 29 30 30 add_action( 'admin_init', array( $this, 'save_reservations_settings' ) ); 31 add_action( 'admin_init', array( $this, 'save_ last_minute_settings' ) );31 add_action( 'admin_init', array( $this, 'save_closing_days_settings' ) ); 32 32 add_action( 'admin_init', array( $this, 'save_rooms_tables_settings' ) ); 33 33 add_action( 'admin_init', array( $this, 'save_notifications_settings' ) ); … … 35 35 add_action( 'admin_menu', array( $this, 'register_wprb_admin' ) ); 36 36 add_action( 'wp_ajax_wprb-add-hours', array( $this, 'hours_element_callback' ) ); 37 add_action( 'wp_ajax_wprb-add-last-minute', array( $this, 'last_minute_element_callback' ) );38 37 add_action( 'wp_ajax_wprb-add-closing-period', array( $this, 'closing_period_element_callback' ) ); 39 38 add_action( 'wp_ajax_wprb-add-room-tables', array( $this, 'room_tables_element_callback' ) ); 40 41 add_action(42 'in_plugin_update_message-' . basename( WPRB_DIR ) . '/wp-restaurant-booking.php',43 array(44 $this,45 'wprb_update_message',46 ),47 10,48 249 );50 39 51 40 } … … 77 66 /*Nonce*/ 78 67 $add_hours_nonce = wp_create_nonce( 'wprb-add-hours' ); 79 $add_last_minute_nonce = wp_create_nonce( 'wprb-add-last-minute' );80 68 $add_closing_period_nonce = wp_create_nonce( 'wprb-add-closing-period' ); 81 69 $add_room_tables_nonce = wp_create_nonce( 'wprb-add-room-tables' ); … … 88 76 wp_enqueue_style( 'wprb-admin-style', WPRB_URI . 'css/wprb-admin.css' ); 89 77 wp_enqueue_style( 'tzcheckbox-style', WPRB_URI . 'js/tzCheckbox/jquery.tzCheckbox/jquery.tzCheckbox.css' ); 78 wp_enqueue_style( 'wp-color-picker' ); 90 79 91 80 /*js*/ 92 81 wp_enqueue_script( 'wprb-admin-js', WPRB_URI . 'js/wprb-admin.js', array( 'jquery' ), '1.0', true ); 93 82 wp_enqueue_script( 'tzcheckbox', WPRB_URI . 'js/tzCheckbox/jquery.tzCheckbox/jquery.tzCheckbox.js', array( 'jquery' ) ); 83 wp_enqueue_script( 'wp-color-picker' ); 94 84 95 85 /*Pass data to the script file*/ … … 99 89 array( 100 90 'addHoursNonce' => $add_hours_nonce, 101 'addLastMinuteNonce' => $add_last_minute_nonce,102 91 'addClosingPeriodNonce' => $add_closing_period_nonce, 103 92 'addRoomTablesNonce' => $add_room_tables_nonce, … … 244 233 245 234 /** 246 * Go premium button247 */248 public function go_premium() {249 250 $title = __( 'This is a premium functionality, click here for more information', 'wp-restaurant-booking' );251 $output = '<span class="wprb label label-warning premium">';252 $output .= '<a href="https://www.ilghera.com/product/wp-restaurant-booking-premium" target="_blank" title="' . esc_attr( $title ) . '">Premium</a>';253 $output .= '</span>';254 255 $allowed = array(256 'span' => array(257 'class' => [],258 ),259 'a' => array(260 'target' => [],261 'title' => [],262 'href' => [],263 ),264 );265 266 echo wp_kses( $output, $allowed );267 268 }269 270 /**271 235 * Return a single hours element as ajax callback 272 236 */ … … 298 262 $to = isset( $data['to'] ) ? $data['to'] : ''; 299 263 $every = isset( $data['every'] ) ? $data['every'] : ''; 300 $disabled = 1 !== $number ? ' disabled' : '';301 264 302 265 echo '<div class="wprb-hours-element-' . esc_attr( $number ) . ' hours-element">'; 303 266 304 267 echo '<label for="wprb-bookable-hours-from">' . esc_html__( 'From', 'wp-restaurant-booking' ) . '</label>'; 305 echo '<input type="time" name="wprb-' . esc_attr( $day ) . '-bookable-hours-from-' . esc_attr( $number ) . '" id="wprb-' . esc_attr( $day ) . '-bookable-hours-from" class="wprb-bookable-hours-from" max="23:59" value="' . esc_attr( $from ) . '" required' . $disabled . '>';268 echo '<input type="time" name="wprb-' . esc_attr( $day ) . '-bookable-hours-from-' . esc_attr( $number ) . '" id="wprb-' . esc_attr( $day ) . '-bookable-hours-from" class="wprb-bookable-hours-from" max="23:59" value="' . esc_attr( $from ) . '">'; 306 269 307 270 echo '<label for="wprb-bookable-hours-to">' . esc_html__( 'to', 'wp-restaurant-booking' ) . '</label>'; 308 echo '<input type="time" name="wprb-' . esc_attr( $day ) . '-bookable-hours-to-' . esc_attr( $number ) . '" id="wprb-' . esc_attr( $day ) . '-bookable-hours-to" class="wprb-bookable-hours-to" max="23:59" value="' . esc_attr( $to ) . '" required' . $disabled . '>';271 echo '<input type="time" name="wprb-' . esc_attr( $day ) . '-bookable-hours-to-' . esc_attr( $number ) . '" id="wprb-' . esc_attr( $day ) . '-bookable-hours-to" class="wprb-bookable-hours-to" max="23:59" value="' . esc_attr( $to ) . '">'; 309 272 310 273 echo '<label for="wprb-bookable-hours-every">' . esc_html__( 'every (minutes)', 'wp-restaurant-booking' ) . '</label>'; 311 echo '<input type="number" name="wprb-' . esc_attr( $day ) . '-bookable-hours-every-' . esc_attr( $number ) . '" id="wprb-' . esc_attr( $day ) . '-bookable-hours-every" class="wprb-bookable-hours-every" min="5" max="60" step="5" placeholder="15" value="' . esc_attr( $every ) . '" required' . $disabled . '>';274 echo '<input type="number" name="wprb-' . esc_attr( $day ) . '-bookable-hours-every-' . esc_attr( $number ) . '" id="wprb-' . esc_attr( $day ) . '-bookable-hours-every" class="wprb-bookable-hours-every" min="5" max="60" step="5" placeholder="15" value="' . esc_attr( $every ) . '">'; 312 275 313 276 if ( 1 === $number ) { … … 342 305 if ( $this->saved_hours && isset( $this->saved_hours[ $day ] )) { 343 306 344 $this->hours_element( $day, 1, $this->saved_hours[ $day ][1] ); 307 $count = count( $this->saved_hours[ $day ] ); 308 309 for ( $i = 1; $i <= $count; $i++ ) { 310 311 $this->hours_element( $day, $i, $this->saved_hours[ $day ][ $i ] ); 312 313 } 345 314 346 315 } else { … … 350 319 } 351 320 352 echo '<div class="go-premium">';353 354 $this->go_premium();355 356 echo '</div>';357 358 321 echo '</div>'; 359 360 }361 362 /**363 * Return a single last minute element as ajax callback364 */365 public function last_minute_element_callback() {366 367 if ( isset( $_POST['number'], $_POST['wprb-add-last-minute-nonce'] ) && wp_verify_nonce( wp_unslash( $_POST['wprb-add-last-minute-nonce'] ), 'wprb-add-last-minute' ) ) {368 369 $number = sanitize_text_field( wp_unslash( $_POST['number'] ) );370 371 $this->last_minute( $number );372 373 }374 375 exit;376 377 }378 379 /**380 * Display a single last minute381 *382 * @param int $number the number of hours element.383 * @param array $data single element data coming from the db.384 */385 public function last_minute( $number = 0, $data = array() ) {386 387 $date = null;388 $from = null;389 $to = null;390 $people = null;391 392 echo '<div class="wprb-last-minute-element-' . esc_attr( $number ) . ' last-minute-element">';393 394 echo '<label for="wprb-last-minute-date">' . esc_html__( 'On', 'wp-restaurant-booking' ) . '</label>';395 echo '<input type="date" name="wprb-last-minute-date-' . esc_attr( $number ) . '" id="wprb-last-minute-date" class="wprb-last-minute-date" min="' . esc_html( date( 'Y-m-d' ) ) . '" value="' . esc_attr( $date ) . '" disabled>';396 397 echo '<label for="wprb-last-minute-from">' . esc_html__( 'from', 'wp-restaurant-booking' ) . '</label>';398 echo '<input type="time" name="wprb-last-minute-from-' . esc_attr( $number ) . '" id="wprb-last-minute-from" class="wprb-last-minute-from" min="12:00" max="23:00" value="' . esc_attr( $from ) . '" required disabled>';399 400 echo '<label for="wprb-last-minute-to">' . esc_html__( 'to', 'wp-restaurant-booking' ) . '</label>';401 echo '<input type="time" name="wprb-last-minute-to-' . esc_attr( $number ) . '" id="wprb-last-minute-to" class="wprb-last-minute-to" min="12:00" max="23:00" value="' . esc_attr( $to ) . '" required disabled>';402 403 echo '<label for="wprb-last-minute-people">' . esc_html__( 'people', 'wp-restaurant-booking' ) . '</label>';404 echo '<input type="number" name="wprb-last-minute-people-' . esc_attr( $number ) . '" id="wprb-last-minute-people" class="wprb-last-minute-people" step="1" placeholder="0" value="' . esc_attr( $people ) . '" required disabled>';405 406 if ( 0 === $number ) {407 408 echo '<div class="wprb-add-last-minute-container">';409 echo '<img class="add-last-minute" src="' . esc_url( WPRB_URI . 'images/add-icon.png' ) . '">';410 echo '<img class="add-last-minute-hover" src="' . esc_url( WPRB_URI . 'images/add-icon-hover.png' ) . '">';411 echo '</div>';412 413 } else {414 415 echo '<div class="wprb-remove-last-minute-container">';416 echo '<img class="remove-last-minute" src="' . esc_url( WPRB_URI . 'images/remove-icon.png' ) . '">';417 echo '<img class="remove-last-minute-hover" src="' . esc_url( WPRB_URI . 'images/remove-icon-hover.png' ) . '">';418 echo '</div>';419 420 }421 422 echo '</div>';423 424 }425 426 /**427 * Display the last minute element in the plugin admin area428 */429 public function display_last_minute_elements() {430 431 $this->last_minute();432 322 433 323 } … … 441 331 public function room_tables( $number = 0, $data = array() ) { 442 332 443 $name = isset( $data['name'] ) ? $data['name'] : ''; 444 $tables = isset( $data['tables'] ) ? $data['tables'] : 0; 445 $disabled = 0 !== $number ? ' disabled' : ''; 333 $name = isset( $data['name'] ) ? $data['name'] : ''; 334 $tables = isset( $data['tables'] ) ? $data['tables'] : 0; 446 335 447 336 echo '<tr class="wprb-room-tables-element-' . esc_attr( $number ) . ' room-tables-element">'; … … 452 341 453 342 echo '<label>' . esc_html__( 'Name', 'wp-restaurant-booking' ) . '</label>'; 454 echo '<input type="text" name="room-name-' . esc_attr( $number ) . '" value="' . esc_attr( $name ) . '" placeholder="' . sprintf( esc_attr( 'Room %d', 'wp-restaurant-booking' ), esc_attr( $number + 1 ) ) . '" ' . $disabled . '>';343 echo '<input type="text" name="room-name-' . esc_attr( $number ) . '" value="' . esc_attr( $name ) . '" placeholder="' . sprintf( esc_attr( 'Room %d', 'wp-restaurant-booking' ), esc_attr( $number + 1 ) ) . '">'; 455 344 456 345 echo '<label>' . esc_html__( 'Tables', 'wp-restaurant-booking' ) . '</label>'; 457 echo '<input type="number" name="tables-number-' . esc_attr( $number ) . '" min="1" value="' . esc_attr( $tables ) . '"' . $disabled . '>'; 458 459 if ( 0 === $number ) { 460 461 echo '<div class="wprb-add-room-tables-container">'; 462 echo '<img class="add-room-tables" src="' . esc_url( WPRB_URI . 'images/add-icon.png' ) . '">'; 463 echo '<img class="add-room-tables-hover" src="' . esc_url( WPRB_URI . 'images/add-icon-hover.png' ) . '">'; 464 echo '</div>'; 465 466 } else { 467 468 echo '<div class="wprb-remove-room-tables-container">'; 469 echo '<img class="remove-room-tables" src="' . esc_url( WPRB_URI . 'images/remove-icon.png' ) . '">'; 470 echo '<img class="remove-room-tables-hover" src="' . esc_url( WPRB_URI . 'images/remove-icon-hover.png' ) . '">'; 471 echo '</div>'; 472 473 } 474 346 echo '<input type="number" name="tables-number-' . esc_attr( $number ) . '" min="1" value="' . esc_attr( $tables ) . '">'; 347 475 348 echo '<p class="description">' . esc_html__( 'Add a name and the number of tables to this restaurant room', 'wp-restaurant-booking' ) . '</p>'; 476 349 … … 531 404 public function closing_period( $number = 0, $data = array() ) { 532 405 533 $from = null;534 $to = null;406 $from = isset( $data['from'] ) ? $data['from'] : ''; 407 $to = isset( $data['to'] ) ? $data['to'] : ''; 535 408 536 409 echo '<div class="wprb-closing-period-element-' . esc_attr( $number ) . ' closing-period-element">'; … … 563 436 564 437 /** 565 * Display the last minute element in the plugin admin area 438 * Return a single closing period element as ajax callback 439 */ 440 public function closing_period_element_callback() { 441 442 if ( isset( $_POST['number'], $_POST['wprb-add-closing-period-nonce'] ) && wp_verify_nonce( wp_unslash( $_POST['wprb-add-closing-period-nonce'] ), 'wprb-add-closing-period' ) ) { 443 444 $number = sanitize_text_field( wp_unslash( $_POST['number'] ) ); 445 446 $this->closing_period( $number ); 447 448 } 449 450 exit; 451 452 } 453 454 /** 455 * Auto-delete the closing periods out of date 456 */ 457 public function get_filtered_closing_periods() { 458 459 $output = null; 460 461 $closing_periods = get_option( 'wprb-closing-periods' ); 462 463 if ( $closing_periods ) { 464 465 $count = count( $closing_periods ); 466 467 for ( $i = 0; $i < $count; $i++ ) { 468 469 $to = isset( $closing_periods[ $i ]['to'] ) ? $closing_periods[ $i ]['to'] : ''; 470 471 /*Check for expired elements*/ 472 if ( $to ) { 473 474 $to = strtotime( $to ); 475 $now = strtotime( 'now' ); 476 477 if ( $now > $to ) { 478 479 unset( $closing_periods[ $i ] ); 480 481 } 482 483 } 484 485 } 486 487 $output = array_values( $closing_periods ); 488 489 update_option( 'wprb-closing-periods', $output ); 490 491 return $output; 492 493 } 494 495 } 496 497 /** 498 * Display the closing period elements in the plugin admin area 566 499 */ 567 500 public function display_closing_period_elements() { 568 501 569 $this->closing_period(); 502 $closing_periods = $this->get_filtered_closing_periods(); 503 504 if ( $closing_periods ) { 505 506 $count = count( $closing_periods ); 507 508 for ( $i = 0; $i < $count; $i++ ) { 509 510 $this->closing_period( $i, $closing_periods[ $i ] ); 511 512 } 513 514 } else { 515 516 $this->closing_period(); 517 518 } 570 519 571 520 } … … 607 556 update_option( 'wprb-expiration-time', $expiration_time ); 608 557 558 /*Widget color*/ 559 $widget_color = isset( $_POST['wprb-widget-color'] ) ? sanitize_hex_color( wp_unslash( $_POST['wprb-widget-color'] ) ) : ''; 560 update_option( 'wprb-widget-color', $widget_color ); 561 562 /*Widget text color*/ 563 $widget_text_color = isset( $_POST['wprb-widget-text-color'] ) ? sanitize_hex_color( wp_unslash( $_POST['wprb-widget-text-color'] ) ) : ''; 564 update_option( 'wprb-widget-text-color', $widget_text_color ); 565 609 566 } 610 567 … … 660 617 foreach ( self::week() as $key => $value ) { 661 618 662 $from = isset( $_POST[ 'wprb-' . $key . '-bookable-hours-from-1' ] ) ? sanitize_text_field( wp_unslash( $_POST[ 'wprb-' . $key . '-bookable-hours-from-1' ] ) ) : null; 663 664 $to = isset( $_POST[ 'wprb-' . $key . '-bookable-hours-to-1' ] ) ? sanitize_text_field( wp_unslash( $_POST[ 'wprb-' . $key . '-bookable-hours-to-1' ] ) ) : null; 665 666 $every = isset( $_POST[ 'wprb-' . $key . '-bookable-hours-every-1' ] ) ? sanitize_text_field( wp_unslash( $_POST[ 'wprb-' . $key . '-bookable-hours-every-1' ] ) ) : null; 667 668 if ( $from && $to && $every ) { 669 670 $save_hours[ $key ][1] = array( 671 'from' => $from, 672 'to' => $to, 673 'every' => $every, 674 ); 619 /*10 is the current limit*/ 620 for ( $i = 1; $i <= 10; $i++ ) { 621 622 $from = isset( $_POST[ 'wprb-' . $key . '-bookable-hours-from-' . $i ] ) ? sanitize_text_field( wp_unslash( $_POST[ 'wprb-' . $key . '-bookable-hours-from-' . $i ] ) ) : null; 623 624 $to = isset( $_POST[ 'wprb-' . $key . '-bookable-hours-to-' . $i ] ) ? sanitize_text_field( wp_unslash( $_POST[ 'wprb-' . $key . '-bookable-hours-to-' . $i ] ) ) : null; 625 626 $every = isset( $_POST[ 'wprb-' . $key . '-bookable-hours-every-' . $i ] ) ? sanitize_text_field( wp_unslash( $_POST[ 'wprb-' . $key . '-bookable-hours-every-' . $i ] ) ) : null; 627 628 if ( $from && $to && $every ) { 629 630 $save_hours[ $key ][ $i ] = array( 631 'from' => $from, 632 'to' => $to, 633 'every' => $every, 634 ); 635 636 } else { 637 638 break; 639 640 } 675 641 676 642 } … … 685 651 686 652 /** 687 * Save last minute 688 */ 689 public function save_last_minute_settings() { 690 691 if ( isset( $_POST['wprb-set-last-minute-sent'], $_POST['wprb-set-last-minute-nonce'] ) && wp_verify_nonce( wp_unslash( $_POST['wprb-set-last-minute-nonce'] ), 'wprb-set-last-minute' ) ) { 692 693 /*Last minute activate*/ 694 $activate = isset( $_POST['wprb-activate-last-minute'] ) ? sanitize_text_field( wp_unslash( $_POST['wprb-activate-last-minute'] ) ) : 0; 695 update_option( 'wprb-activate-last-minute', $activate ); 696 697 /*Last minute description*/ 698 $description = isset( $_POST['wprb-last-minute-description'] ) ? sanitize_text_field( wp_unslash( $_POST['wprb-last-minute-description'] ) ) : ''; 699 update_option( 'wprb-last-minute-description', $description ); 700 701 /*Set last minute*/ 702 $last_minute = array(); 653 * Save closing days 654 */ 655 public function save_closing_days_settings() { 656 657 if ( isset( $_POST['wprb-set-closing-days-sent'], $_POST['wprb-set-closing-days-nonce'] ) && wp_verify_nonce( wp_unslash( $_POST['wprb-set-closing-days-nonce'] ), 'wprb-set-closing-days' ) ) { 658 659 /*Closing days*/ 660 $closing_days = isset( $_POST['wprb-closing-days'] ) ? $_POST['wprb-closing-days'] : ''; 661 update_option( 'wprb-closing-days', $closing_days ); 662 663 /*Closing periods*/ 664 $closing_periods = array(); 703 665 704 666 /*20 is the current limit*/ 705 667 for ( $i = 0; $i <= 20; $i++ ) { 706 668 707 $date = isset( $_POST[ 'wprb-last-minute-date-' . $i ] ) ? sanitize_text_field( wp_unslash( $_POST[ 'wprb-last-minute-date-' . $i ] ) ) : null; 708 $from = isset( $_POST[ 'wprb-last-minute-from-' . $i ] ) ? sanitize_text_field( wp_unslash( $_POST[ 'wprb-last-minute-from-' . $i ] ) ) : null; 709 $to = isset( $_POST[ 'wprb-last-minute-to-' . $i ] ) ? sanitize_text_field( wp_unslash( $_POST[ 'wprb-last-minute-to-' . $i ] ) ) : null; 710 $people = isset( $_POST[ 'wprb-last-minute-people-' . $i ] ) ? sanitize_text_field( wp_unslash( $_POST[ 'wprb-last-minute-people-' . $i ] ) ) : null; 711 if ( $date && $from && $to && $people ) { 712 713 $last_minute[ $i ] = array( 714 'date' => $date, 669 $from = isset( $_POST[ 'wprb-closing-period-from-' . $i ] ) ? sanitize_text_field( wp_unslash( $_POST[ 'wprb-closing-period-from-' . $i ] ) ) : null; 670 $to = isset( $_POST[ 'wprb-closing-period-to-' . $i ] ) ? sanitize_text_field( wp_unslash( $_POST[ 'wprb-closing-period-to-' . $i ] ) ) : null; 671 672 if ( $from && $to ) { 673 674 $closing_periods[ $i ] = array( 715 675 'from' => $from, 716 676 'to' => $to, 717 'people' => $people,718 677 ); 719 678 … … 726 685 } 727 686 728 update_option( 'wprb- last-minute', $last_minute);687 update_option( 'wprb-closing-periods', $closing_periods ); 729 688 730 689 } … … 781 740 $admin_recipients = isset( $_POST['wprb-admin-recipients'] ) && '' !== $_POST['wprb-admin-recipients'] ? explode( ' ', sanitize_text_field( wp_unslash( $_POST['wprb-admin-recipients'] ) ) ) : ''; 782 741 update_option( 'wprb-admin-recipients', $admin_recipients ); 742 743 $user_activate = isset( $_POST['wprb-activate-user-notification'] ) ? sanitize_text_field( wp_unslash( $_POST['wprb-activate-user-notification'] ) ) : ''; 744 update_option( 'wprb-activate-user-notification', $user_activate ); 783 745 784 746 } … … 811 773 echo '<a href="#" data-link="wprb-set-hours" class="nav-tab" onclick="return false;">' . esc_html( __( 'Hours', 'wp-restaurant-booking' ) ) . '</a>'; 812 774 echo '<a href="#" data-link="wprb-set-closing-days" class="nav-tab" onclick="return false;">' . esc_html( __( 'Closing days', 'wp-restaurant-booking' ) ) . '</a>'; 813 echo '<a href="#" data-link="wprb-set-last-minute" class="nav-tab" onclick="return false;">' . esc_html( __( 'Last minute', 'wp-restaurant-booking' ) ) . '</a>';814 775 echo '<a href="#" data-link="wprb-set-notifications" class="nav-tab" onclick="return false;">' . esc_html( __( 'Notifications', 'wp-restaurant-booking' ) ) . '</a>'; 776 echo '<a href="#" data-link="wprb-set-premium" class="nav-tab nav-tab-premium" onclick="return false;"><span class="dashicons dashicons-star-filled"></span> ' . esc_html( __( 'Premium', 'wp-restaurant-booking' ) ) . '</a>'; 815 777 echo '</h2>'; 816 778 … … 850 812 echo '</div>'; 851 813 852 /*Set last minute*/853 echo '<div id="wprb-set-last-minute" class="wprb-admin">';854 855 include( WPRB_ADMIN . 'wprb-set-last-minute-template.php' );856 857 echo '</div>';858 859 814 /*Set notifications*/ 860 815 echo '<div id="wprb-set-notifications" class="wprb-admin">'; 861 816 862 817 include( WPRB_ADMIN . 'wprb-set-notifications-template.php' ); 818 819 echo '</div>'; 820 821 /*Premium features*/ 822 echo '<div id="wprb-set-premium" class="wprb-admin">'; 823 824 include( WPRB_ADMIN . 'wprb-set-premium-template.php' ); 863 825 864 826 echo '</div>'; -
wp-restaurant-booking/trunk/admin/wprb-set-bookables-template.php
r3650036 r3685965 15 15 16 16 <table class="form-table"> 17 <tr class="wprb-activate-external-seats-field">18 <th scope="row"><?php esc_html_e( 'External seats', 'wp-restaurant-booking' ); ?></th>19 <td>20 <input type="checkbox" name="wprb-activate-external-seats" id="wprb-activate-external-seats" value="1">21 <p class="description"><?php esc_html_e( 'Activate if external seats are available in your restaurant in this season.', 'wp-restaurant-booking' ); ?></p>22 <?php $admin->go_premium(); ?>23 </td>24 </tr>25 17 <tr> 26 18 <th scope="row"><?php esc_html_e( 'Bookable seats', 'wp-restaurant-booking' ); ?></th> … … 33 25 if ( 'mon' === $key ) { 34 26 echo '<div class="wprb-col"><h4>' . esc_html__( 'Internal seats', 'wp-restaurant-booking' ) . '</h4></div>'; 35 echo '<div class="wprb-col external"><h4>' . esc_html__( 'External seats', 'wp-restaurant-booking' ) . '</h4></div>';36 27 echo '<div class="wprb-col min-bookable"><h4>' . esc_html__( 'Minimum bookable number', 'wp-restaurant-booking' ) . '</h4></div>'; 37 28 echo '<div class="wprb-col max-bookable"><h4>' . esc_html__( 'Maximum bookable number', 'wp-restaurant-booking' ) . '</h4></div>'; … … 48 39 49 40 echo '<input type="number" name="wprb-bookable-seats-' . esc_attr( $key ) . '" id="wprb-bookable-seats" class="' . esc_attr( $key ) . '" placeholder="0" value="' . esc_attr( $bookable_value ) . '">'; 50 echo '</div>';51 52 echo '<div class="wprb-col external">';53 54 echo '<input type="number" name="wprb-external-seats-' . esc_attr( $key ) . '" id="wprb-external-seats" class="' . esc_attr( $key ) . '" placeholder="0" value="0" disabled>';55 56 41 echo '</div>'; 57 42 -
wp-restaurant-booking/trunk/admin/wprb-set-closing-days-template.php
r3650036 r3685965 5 5 * @author ilGhera 6 6 * @package wp-restaurant-booking/admin 7 * @since 1.1. 77 * @since 1.1.8 8 8 */ 9 9 10 $closing_days = get_option( 'wprb-closing-days' ); 10 11 ?> 11 12 <!-- Form --> … … 20 21 foreach ( WPRB_Admin::week() as $key => $value ) { 21 22 22 echo '<option value="' . esc_attr( $key ) . '" >' . esc_html( ucfirst( $value ) ) . '</option>';23 echo '<option value="' . esc_attr( $key ) . '"' . ( is_array( $closing_days ) && in_array( $key , $closing_days) ? ' selected="selected"' : '' ) . '>' . esc_html( ucfirst( $value ) ) . '</option>'; 23 24 24 25 } … … 37 38 </td> 38 39 </tr> 39 <tr>40 <th></th>41 <td><?php $admin->go_premium(); ?></td>42 </tr>43 40 </table> 44 41 … … 46 43 47 44 <input type="hidden" name="wprb-set-closing-days-sent" value="1"> 48 <input type="submit" class="button-primary wprb" value="<?php esc_html_e( 'Save settings', 'wp-restaurant-booking' ); ?>" disabled>45 <input type="submit" class="button-primary wprb" value="<?php esc_html_e( 'Save settings', 'wp-restaurant-booking' ); ?>"> 49 46 50 47 </form> -
wp-restaurant-booking/trunk/admin/wprb-set-general-template.php
r3650036 r3685965 17 17 $expiration_time = get_option( 'wprb-expiration-time' ); 18 18 $policy_page = get_option( 'wprb-policy-page' ); 19 $widget_color = get_option( 'wprb-widget-color' ); 20 $widget_text_color = get_option( 'wprb-widget-text-color' ); 19 21 ?> 20 22 <!-- Form --> … … 97 99 </td> 98 100 </tr> 101 <tr> 102 <th scope="row"><?php esc_html_e( 'Widget color', 'wp-restaurant-booking' ); ?></th> 103 <td> 104 <input type="text" class="wprb-color-field" name="wprb-widget-color" value="<?php echo esc_attr( $widget_color ); ?>"> 105 <p class="description"><?php esc_html_e( 'Main color of the booking widget. Leave empty to use the default yellow.', 'wp-restaurant-booking' ); ?></p> 106 </td> 107 </tr> 108 <tr> 109 <th scope="row"><?php esc_html_e( 'Widget text color', 'wp-restaurant-booking' ); ?></th> 110 <td> 111 <input type="text" class="wprb-color-field" name="wprb-widget-text-color" value="<?php echo esc_attr( $widget_text_color ); ?>"> 112 <p class="description"><?php esc_html_e( 'Text color used on top of the widget main color, for contrast. Leave empty to use the default white.', 'wp-restaurant-booking' ); ?></p> 113 </td> 114 </tr> 99 115 </table> 100 116 -
wp-restaurant-booking/trunk/admin/wprb-set-notifications-template.php
r3650036 r3685965 11 11 $admin_activate = get_option( 'wprb-activate-admin-notification' ); 12 12 $admin_recipients = get_option( 'wprb-admin-recipients' ) ? get_option( 'wprb-admin-recipients' ) : array( get_option( 'admin_email' ) ); 13 14 /*Define the user object*/ 15 $default_user_object = WPRB_Notifications::default_user_object(); 16 $user_object = null; 17 18 /*Define the admin object*/ 19 $default_user_message = WPRB_Notifications::default_user_message(); 20 $user_message = null; 13 $user_activate = get_option( 'wprb-activate-user-notification' ); 21 14 ?> 22 15 … … 53 46 <th scope="row"><?php esc_html_e( 'User notifications', 'wp-restaurant-booking' ); ?></th> 54 47 <td> 55 <input type="checkbox" name="wprb-activate-user-notification" id="wprb-activate-user-notification" value="1" >48 <input type="checkbox" name="wprb-activate-user-notification" id="wprb-activate-user-notification" value="1"<?php echo ( 1 == $user_activate ? ' checked="checked"' : '' ); ?>> 56 49 <p class="description"><?php esc_html_e( 'Activate email notifications for the user.', 'wp-restaurant-booking' ); ?></p> 57 </td>58 </tr>59 <tr class="wprb-user-notification-field" style="display: none;">60 <th scope="row"><?php esc_html_e( 'Object', 'wp-restaurant-booking' ); ?></th>61 <td>62 <input type="text" name="wprb-user-notification-object" class="wprb-user-notification-object regular-text" placeholder="<?php echo esc_attr( $default_user_object ); ?>" value="<?php echo esc_attr( $user_object ); ?>" disabled>63 <p class="description"><?php esc_html_e( 'Specify a different email object.', 'wp-restaurant-booking' ); ?></p>64 </td>65 </tr>66 <tr class="wprb-user-notification-field" style="display: none;">67 <th scope="row"><?php esc_html_e( 'Message', 'wp-restaurant-booking' ); ?></th>68 <td>69 <textarea type="text" name="wprb-user-notification-message" class="wprb-user-notification-message regular-text" rows="6" placeholder="<?php echo esc_attr( $default_user_message ); ?>" disabled><?php echo esc_html( $user_message ); ?></textarea>70 <p class="description">71 <?php72 echo '<span class="shortcodes">';73 echo '<code>[first-name]</code> <code>[last-name]</code> <code>[email]</code> <code>[phone]</code>';74 echo '<code>[people]</code> <code>[in-outdoor]</code> <code>[date]</code> <code>[time]</code> <code>[until]</code> <code>[notes]</code>';75 echo '</span>';76 esc_html_e( 'Specify a different email message.', 'wp-restaurant-booking' );77 ?>78 </p>79 <?php $admin->go_premium(); ?>80 50 </td> 81 51 </tr> -
wp-restaurant-booking/trunk/admin/wprb-set-tables-template.php
r3650036 r3685965 14 14 15 15 <?php $admin->display_rooms_tables_elements(); ?> 16 17 <tr class="go-premium">18 <th></th>19 <td><?php $admin->go_premium(); ?></td>20 </tr>21 16 22 17 </table> -
wp-restaurant-booking/trunk/css/wprb-admin.css
r3650036 r3685965 68 68 #submit-key:active { 69 69 top: 2px; 70 }71 72 .nav-tab.not-available, .nav-tab.not-available:hover {73 border-width: 1px 1px medium;74 border-style: solid solid none;75 border-color: #CCC #CCC -moz-use-text-color;76 -moz-border-top-colors: none;77 -moz-border-right-colors: none;78 -moz-border-bottom-colors: none;79 -moz-border-left-colors: none;80 border-image: none;81 background: #E4E4E4 none repeat scroll 0% 0%;82 display: inline-block;83 text-decoration: none;84 opacity:0.4;85 70 } 86 71 … … 544 529 } 545 530 546 .wprb.label-warning.premium {547 display: inline-block;548 margin: 10px 0 0;549 padding: 7px 14px;550 font-size: 12px;551 font-weight: bold;552 line-height: 1;553 text-align: center;554 white-space: nowrap;555 vertical-align: baseline;556 border-radius: .25em;557 background-color: #f0ad4e;558 cursor: pointer;559 }560 561 .label-warning a {562 color: #ffffff;563 text-decoration: none;564 }565 566 .label-warning a:hover {567 color: #0073aa;568 }569 570 .go-premium {571 display: none;572 }573 574 531 .old-table { 575 532 display: block; … … 590 547 591 548 .wrap-right { 592 float: none; 593 width: 100%; 594 text-align: center; 549 float: none; 550 width: 100%; 551 text-align: center; 595 552 padding-top: 3rem; 596 553 } … … 598 555 599 556 } 557 558 .nav-tab-premium { 559 color: #b8860b !important; 560 font-weight: 600; 561 } 562 563 .nav-tab-premium:hover, 564 .nav-tab-premium:focus { 565 color: #8b6508 !important; 566 } 567 568 .nav-tab-premium .dashicons { 569 font-size: 14px; 570 width: 14px; 571 height: 14px; 572 vertical-align: text-bottom; 573 margin-right: 2px; 574 } 575 576 .nav-tab-premium.nav-tab-active { 577 color: #f0b90b !important; 578 border-bottom-color: #f0b90b !important; 579 } 580 581 .wprb-premium-upsell { 582 max-width: 860px; 583 margin-top: 1.5rem; 584 } 585 586 .wprb-premium-header { 587 text-align: center; 588 padding: 2rem 1rem; 589 background: #fff; 590 border: 1px solid #e0e0e0; 591 border-radius: 4px; 592 margin-bottom: 1.5rem; 593 } 594 595 .wprb-premium-header .dashicons { 596 font-size: 2.5rem; 597 width: 2.5rem; 598 height: 2.5rem; 599 color: #f0b90b; 600 } 601 602 .wprb-premium-header h2 { 603 font-size: 1.6rem; 604 margin: 0.5rem 0; 605 color: #23282d; 606 } 607 608 .wprb-premium-header .description { 609 font-size: 1rem; 610 color: #666; 611 } 612 613 .wprb-premium-features { 614 display: grid; 615 grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); 616 gap: 1rem; 617 margin-bottom: 1.5rem; 618 } 619 620 .wprb-feature { 621 background: #fff; 622 border: 1px solid #e0e0e0; 623 border-radius: 4px; 624 padding: 1.5rem; 625 transition: box-shadow 0.2s ease; 626 } 627 628 .wprb-feature:hover { 629 box-shadow: 0 2px 8px rgba(0,0,0,0.1); 630 } 631 632 .wprb-feature .dashicons { 633 font-size: 2rem; 634 width: 2rem; 635 height: 2rem; 636 color: #f0b90b; 637 } 638 639 .wprb-feature h3 { 640 margin: 0.5rem 0; 641 font-size: 1rem; 642 color: #23282d; 643 } 644 645 .wprb-feature p { 646 margin: 0; 647 color: #666; 648 font-size: 0.9rem; 649 } 650 651 .wprb-premium-cta { 652 text-align: center; 653 padding: 2rem; 654 background: #fff; 655 border: 1px solid #e0e0e0; 656 border-radius: 4px; 657 } 658 659 .wprb-premium-cta .button-hero { 660 background: #f0b90b; 661 border-color: #d4a009; 662 color: #fff; 663 font-size: 1.1rem; 664 padding: 0.6rem 2rem; 665 } 666 667 .wprb-premium-cta .button-hero:hover { 668 background: #d4a009; 669 border-color: #b8860b; 670 color: #fff; 671 } 672 673 .wprb-premium-cta .description { 674 margin-top: 0.75rem; 675 color: #666; 676 } -
wp-restaurant-booking/trunk/css/wprb.css
r3650036 r3685965 16 16 display: inline-block; 17 17 padding: 2px 20px; 18 background: #f5b016;18 background: var(--wprb-widget-color, #f5b016); 19 19 border-radius: 5px; 20 20 cursor: pointer; … … 48 48 .wprb-booking-button a, 49 49 .wprb-booking-button a:hover { 50 color: #fff!important;50 color: var(--wprb-widget-text-color, #fff) !important; 51 51 text-decoration: none; 52 52 font-family: "Helvetica Neue",Helvetica,Arial,sans-serif; … … 80 80 #wprb-booking-modal h2 { 81 81 text-align: center; 82 background: #f5b016;82 background: var(--wprb-widget-color, #f5b016); 83 83 margin: 0; 84 84 padding: 40px 0 20px; 85 color: #fff;85 color: var(--wprb-widget-text-color, #fff); 86 86 font-size: 2em; 87 87 -webkit-border-radius: 8px 8px 0 0; … … 105 105 #wprb-booking-modal .header-bar { 106 106 display: block; 107 background: #f5b016;107 background: var(--wprb-widget-color, #f5b016); 108 108 min-height: 100px; 109 109 } … … 121 121 position: relative; 122 122 margin: 0; 123 } 124 125 .header-bar_steps li { 126 color: var(--wprb-widget-text-color, #333); 127 } 128 129 .header-bar_steps li.active span i { 130 color: var(--wprb-widget-color, #333); 123 131 } 124 132 … … 141 149 #wprb-booking-modal ul li span { 142 150 text-align: center; 143 background-color: #f5b016;151 background-color: var(--wprb-widget-color, #f5b016); 144 152 width: 44px; 145 153 height: 44px; … … 153 161 opacity: 1; 154 162 background-color: #fff; 155 border: 2px solid #f0a417;163 border: 2px solid var(--wprb-widget-accent-color, #f0a417); 156 164 cursor: pointer; 157 165 } … … 226 234 .booking-people_numbers__number input[type="button"]:hover, 227 235 .booking-people_numbers__number input[type="button"].active { 228 background: #f5b016!important;236 background: var(--wprb-widget-color, #f5b016) !important; 229 237 text-decoration: none; 230 color: #fff;238 color: var(--wprb-widget-text-color, #fff); 231 239 } 232 240 … … 277 285 278 286 .booking-people_numbers__number.active select { 279 background: #f5b016;280 color: #fff;287 background: var(--wprb-widget-color, #f5b016); 288 color: var(--wprb-widget-text-color, #fff); 281 289 } 282 290 … … 403 411 .booking-hours ul li input:hover, 404 412 .booking-hours ul li input.active { 405 color: #fff;413 color: var(--wprb-widget-text-color, #fff); 406 414 text-decoration: none; 407 background: #f5b016;415 background: var(--wprb-widget-color, #f5b016); 408 416 } 409 417 … … 474 482 475 483 #wprb-reservation input[type="checkbox"]:checked { 476 background-color: #f5b016;484 background-color: var(--wprb-widget-color, #f5b016); 477 485 } 478 486 479 487 #wprb-reservation input[type="checkbox"]:checked:after { 480 488 content: '✔'; 481 color: white;489 color: var(--wprb-widget-text-color, white); 482 490 position: relative; 483 491 top: -3px; … … 555 563 .booking-end .fa-check-circle { 556 564 font-size: 400%; 557 color: #f5b016; /*temp*/565 color: var(--wprb-widget-color, #f5b016); 558 566 margin-bottom: 1.5rem; 559 567 } 560 568 569 /* 570 * Override the air-datepicker library's own default theme (#ff9a19) 571 * so the calendar follows the widget color too. Needs !important: 572 * the library's stylesheet is enqueued after wprb.css and its own 573 * rules don't use !important, so source order alone isn't enough. 574 */ 575 .datepicker--day-name { 576 color: var(--wprb-widget-color, #ff9a19) !important; 577 } 578 579 .-current-, 580 .-selected-, 581 .datepicker--cell.-selected-.-current- { 582 background: var(--wprb-widget-color, #ff9a19) !important; 583 color: var(--wprb-widget-text-color, #fff) !important; 584 } 585 586 .-focus-, 587 .-selected-.-focus- { 588 background: var(--wprb-widget-color, #ff9a19) !important; 589 } 590 561 591 @media screen and (max-width: 1000px) { 562 592 -
wp-restaurant-booking/trunk/includes/class-wprb-notifications.php
r3650036 r3685965 48 48 $this->define_shortcodes(); 49 49 $this->send_admin_notification(); 50 $this->send_user_notification(); 50 51 51 52 } … … 263 264 264 265 } 266 267 268 /** 269 * Send user notification if activated 270 */ 271 public function send_user_notification() { 272 273 if ( get_option( 'wprb-activate-user-notification' ) ) { 274 275 $to = $this->email; 276 277 $subject = do_shortcode( self::default_user_object() ); 278 279 $message = do_shortcode( self::default_user_message( $this->until, $this->notes ) ); 280 281 $this->mail_from_filters(); 282 283 $sent = wp_mail( $to, $subject, $message ); 284 285 } 286 287 } 265 288 } 266 289 -
wp-restaurant-booking/trunk/includes/class-wprb-reservation-widget.php
r3650036 r3685965 108 108 109 109 /** 110 * Darken a hex color by the given percentage 111 * 112 * @param string $hex the hex color (with or without #). 113 * @param int $percent darken percentage. 114 * @return string the darkened hex color, empty string if invalid input. 115 */ 116 private function darken_color( $hex, $percent = 12 ) { 117 118 $hex = ltrim( $hex, '#' ); 119 120 if ( 3 === strlen( $hex ) ) { 121 $hex = $hex[0] . $hex[0] . $hex[1] . $hex[1] . $hex[2] . $hex[2]; 122 } 123 124 if ( 6 !== strlen( $hex ) || ! ctype_xdigit( $hex ) ) { 125 return ''; 126 } 127 128 list( $r, $g, $b ) = array_map( 'hexdec', str_split( $hex, 2 ) ); 129 130 $r = max( 0, round( $r * ( 1 - $percent / 100 ) ) ); 131 $g = max( 0, round( $g * ( 1 - $percent / 100 ) ) ); 132 $b = max( 0, round( $b * ( 1 - $percent / 100 ) ) ); 133 134 return sprintf( '#%02x%02x%02x', $r, $g, $b ); 135 136 } 137 138 139 /** 140 * Build the CSS custom properties for the widget colors, if set 141 * 142 * @param string $color the main widget color. 143 * @param string $text_color the widget text color. 144 * @return string the CSS, empty string if no color is set. 145 */ 146 private function widget_color_css( $color, $text_color ) { 147 148 $vars = array(); 149 150 if ( $color ) { 151 152 $vars[] = '--wprb-widget-color: ' . $color . ';'; 153 154 $accent = $this->darken_color( $color ); 155 156 if ( $accent ) { 157 $vars[] = '--wprb-widget-accent-color: ' . $accent . ';'; 158 } 159 } 160 161 if ( $text_color ) { 162 $vars[] = '--wprb-widget-text-color: ' . $text_color . ';'; 163 } 164 165 if ( empty( $vars ) ) { 166 return ''; 167 } 168 169 return ':root{' . implode( ' ', $vars ) . '}'; 170 171 } 172 173 174 /** 110 175 * Scripts and style 111 176 */ … … 114 179 /*css*/ 115 180 wp_enqueue_style( 'wprb-style', WPRB_URI . 'css/wprb.css' ); 181 182 $widget_color = get_option( 'wprb-widget-color' ); 183 $widget_text_color = get_option( 'wprb-widget-text-color' ); 184 $widget_color_css = $this->widget_color_css( $widget_color, $widget_text_color ); 185 186 if ( $widget_color_css ) { 187 wp_add_inline_style( 'wprb-style', $widget_color_css ); 188 } 189 116 190 wp_enqueue_style( 'modal-style', WPRB_URI . 'css/jquery.modal.min.css' ); 117 191 wp_enqueue_style( 'font-awesome', WPRB_URI . 'css/fontawesome/all.min.css' ); -
wp-restaurant-booking/trunk/js/wprb-admin.js
r3650036 r3685965 17 17 self.chosen(); 18 18 self.tzCheckbox(); 19 self.externalSeats();20 19 self.addHours(); 21 20 self.removeHours(); 22 self.addLastMinute();23 self.removeLastMinute();24 21 self.addclosingPeriod(); 25 22 self.removeClosingPeriod(); … … 28 25 self.minDateClosingPeriodTo(); 29 26 self.autoCompleteFields('internal'); 30 self.autoCompleteFields('external');31 27 self.autoCompleteFields('min'); 32 28 self.autoCompleteFields('max'); 33 self.lastMinuteElement();34 29 self.notificationsElement(); 35 self. notificationsShortcodes();30 self.widgetColorPicker(); 36 31 } 37 32 … … 129 124 130 125 /** 131 *External seats option132 */133 self.externalSeats = function() {134 135 jQuery(function($){136 137 var col = $('.wprb-col.external');138 var fieldContainer = $('.wprb-activate-external-seats-field');139 var field = $('input', fieldContainer);140 141 var fieldCheck = function() {142 143 if ( 'checked' == field.attr('checked') ) {144 145 col.show();146 147 } else {148 149 col.hide();150 151 }152 153 }154 fieldCheck();155 156 $('span.tzCheckBox', fieldContainer).on('click', function(){157 158 fieldCheck();159 160 })161 162 })163 164 }165 166 167 /**168 126 * Add a new hours element 169 127 */ … … 190 148 $(prev).after(response); 191 149 192 /*Display go premium*/193 $('.go-premium', container).show('slow');194 195 150 }) 196 151 … … 216 171 $(element).remove(); 217 172 218 /*Hide go premium*/ 219 if ( $('.wprb-hours-element-2', container).length == 0 ) { 220 221 $('.go-premium', container).hide(); 222 223 } 224 225 }) 226 227 }) 228 229 } 230 231 232 /** 233 * Auto-complete the bookable and external fields of every day, copying the values from the firsts setted 173 }) 174 175 }) 176 177 } 178 179 180 /** 181 * Auto-complete the bookable fields of every day, copying the values from the firsts setted 234 182 * 235 * @param { Boolean} external true for external field, default for bookable.183 * @param {string} type field type. 236 184 */ 237 185 self.autoCompleteFields = function( type = 'internal' ) { … … 244 192 switch (type) { 245 193 246 case 'internal': 247 element = '#wprb-bookable-seats'; 248 249 break; 250 251 case 'external': 252 element = '#wprb-external-seats'; 253 254 break; 255 256 case 'min': 194 case 'internal': 195 element = '#wprb-bookable-seats'; 196 197 break; 198 199 case 'min': 257 200 element = '#wprb-min-bookable'; 258 201 … … 279 222 280 223 }) 281 282 })283 284 })285 286 }287 288 289 /**290 * Handles the visibility of the last minute fields291 */292 self.lastMinuteElement = function() {293 294 jQuery(function($){295 296 var toggle = $('.wprb-activate-last-minute-field .tzCheckBox');297 var lastMinute = $('.wprb-add-last-minute-field');298 299 if ($(toggle).hasClass('checked')) {300 301 lastMinute.show();302 303 }304 305 $(toggle).on('click', function(){306 307 if ($(this).hasClass('checked')) {308 309 lastMinute.show('slow');310 311 } else {312 313 lastMinute.hide();314 315 }316 317 })318 319 })320 321 }322 323 324 /**325 * Add a new last minute326 */327 self.addLastMinute = function() {328 329 jQuery(function($){330 331 $(document).on('click', '.add-last-minute-hover', function(){332 333 334 var count = $('.last-minute-element').length;335 var prev = $('.wprb-last-minute-element-' + ( count - 1 ) );336 var next = count;337 var data = {338 'action': 'wprb-add-last-minute',339 'wprb-add-last-minute-nonce': wprbSettings.addLastMinuteNonce,340 'number': next341 }342 343 $.post(ajaxurl, data, function(response){344 345 $(prev).after(response);346 347 })348 349 })350 351 })352 353 }354 355 356 /**357 * Remove a last minute358 */359 self.removeLastMinute = function() {360 361 jQuery(function($){362 363 $(document).on('click', '.remove-last-minute-hover', function(){364 365 var element = $(this).closest('.last-minute-element');366 367 $(element).remove();368 224 369 225 }) … … 463 319 $.post(ajaxurl, data, function(response){ 464 320 465 /*Display go premium*/466 $('.wprb-set-rooms-tables .go-premium').show('slow');467 468 321 $(prev).after(response); 469 322 … … 489 342 490 343 $(element).remove(); 491 492 /*Hide go premium*/493 if ( $('.wprb-room-tables-element-1').length == 0 ) {494 495 $('.wprb-set-rooms-tables .go-premium').hide();496 497 }498 344 499 345 }) … … 564 410 565 411 /** 566 * Copy shortcodes to use in user notification 567 */ 568 self.notificationsShortcodes = function() { 569 570 jQuery(function($){ 571 572 var $temp; 573 var shortcode; 574 575 /*Add title*/ 576 $('.shortcodes code').each( function(){ 577 578 $(this).attr('title', 'Click to copy'); 579 580 }) 581 582 /*Copy shortcode*/ 583 $('.shortcodes code').on( 'click', function(){ 584 585 $temp = $('<input>'); 586 shortcode = $(this); 587 588 $('body').append($temp); 589 $temp.val($(shortcode).text()).select(); 590 document.execCommand('copy'); 591 $temp.remove(); 592 593 }) 594 595 }) 596 597 } 412 * Widget colors picker 413 */ 414 self.widgetColorPicker = function() { 415 416 jQuery(function($){ 417 418 if ( typeof $.fn.wpColorPicker === 'function' ) { 419 420 $('.wprb-color-field').wpColorPicker(); 421 422 } 423 424 }) 425 426 } 427 598 428 599 429 } -
wp-restaurant-booking/trunk/readme.txt
r3658642 r3685965 2 2 Contributors: ghera74 3 3 Tags: booking, ticket, reservation, restaurant, bar 4 Version: 1. 2.45 Stable tag: 1. 2.44 Version: 1.3.0 5 Stable tag: 1.3.0 6 6 Requires at least: 5.0 7 7 Tested up to: 7.1 … … 16 16 **AVAILABLE FUNCTIONALITIES** 17 17 18 * Activate/ deactivate the booking functionlityin a click.18 * Activate/deactivate the booking function in a click. 19 19 * Booking widget position, even using the shortcode *[booking-button]*. 20 * Set a number of bookable seats for each day of the week.21 * Define the time slots that can be booked every day22 * Outdoor tables option (Premium).23 * Last minute table option (Premium).24 * Set time limit within which to book a table.20 * Customizable widget colors (background and text color). 21 * Set a number of bookable seats for each day of the week, with a minimum and a maximum bookable. 22 * Multiple bookable time slots for each day (for example lunch and dinner), with the interval between one time and the next. 23 * Closing days: days of the week and closing periods on specific dates (holidays). 24 * Set a time limit within which to book a table. 25 25 * Set an average time of the customer at the table, useful for calculating availability. 26 26 * Assign a table to each reservation. … … 29 29 * Admin and user email notifications. 30 30 31 **PREMIUM VERSION** 32 33 The premium version of **ilGhera Restaurant Booking for WordPress** adds the following functionalities: 34 35 * Outdoor seats, with availability calculated separately. 36 * Last minute tables. 37 * Multiple rooms, each with its own number of tables. 38 * HTML email templates with custom header and footer. 39 * Inline booking form using the shortcode *[booking-form]*. 40 41 https://www.ilghera.com/product/wp-restaurant-booking-premium/ 42 31 43 https://youtu.be/fAk2Hzm2E7k 32 44 … … 47 59 == Screenshots == 48 60 49 1. Select date andnumber of people61 1. Select the date and the number of people 50 62 2. Select the booking time 51 63 3. Add your data 52 64 4. The reservation was completed 53 5. General settings 54 6. Last minute settings (Premium) 55 7. Admin and user email settings 56 8. Admin reservations 57 9. Edit single reservation 65 5. General settings, with the booking widget colors 66 6. Bookable seats for each day of the week 67 7. Bookable time slots, more than one for each day 68 8. Closing days and closing periods 69 9. Admin and user email notifications 70 10. Admin reservations 71 11. Edit single reservation 72 12. The functionalities available in the premium version 58 73 59 74 60 75 == Changelog == 76 77 = 1.3.0 = 78 Release Date: 7 September 2026 79 80 * New: multiple bookable time slots for each day, now included in the free version. 81 * New: closing days, both weekdays and closing periods on specific dates, now included in the free version. 82 * New: customizable booking widget colors (background and text color). 83 * New: Premium tab with the list of the features available in the premium version. 84 * Tweak: settings pages cleaned up, the options reserved to the premium version are no longer shown as disabled fields. 85 * Fix: the confirmation email was never sent to the customer, and the User notifications switch was not saved. 86 * Fix: the Chosen library used by the multiple selects was enqueued but not included in the package, so both files returned a 404. 87 * Fix: the link to the premium version pointed to a page that no longer exists. 88 61 89 62 90 = 1.2.4 = -
wp-restaurant-booking/trunk/wp-restaurant-booking.php
r3660604 r3685965 2 2 /** 3 3 * Plugin Name: ilGhera Restaurant Booking for WordPress 4 * Plugin URI: https://www.ilghera.com/product/w ordpress-restaurant-booking-premium4 * Plugin URI: https://www.ilghera.com/product/wp-restaurant-booking-premium 5 5 * Description: A feature-rich and easy to use reservation system for bars and restaurants. 6 6 * Author: ilGhera 7 * Version: 1. 2.47 * Version: 1.3.0 8 8 * Author URI: https://ilghera.com 9 9 * Requires at least: 5.0
Note:
See TracChangeset
for help on using the changeset viewer.