Skip to content

Commit

Permalink
v1.1.5 (#5)
Browse files Browse the repository at this point in the history
* MPI-9331 add params to room type calendar
  • Loading branch information
Dreaminsider authored Oct 20, 2022
1 parent 17fd51c commit dc14003
Show file tree
Hide file tree
Showing 14 changed files with 164 additions and 98 deletions.
50 changes: 37 additions & 13 deletions languages/mphb-elementor.pot
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# Copyright (C) 2021 MotoPress
# This file is distributed under the same license as the Hotel Booking & Elementor Integration plugin.
# Copyright (C) 2022 MotoPress
# This file is distributed under the GPLv2 or later.
msgid ""
msgstr ""
"Project-Id-Version: Hotel Booking & Elementor Integration 1.1.4\n"
"Project-Id-Version: Hotel Booking & Elementor Integration 1.1.5\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/mphb-elementor\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2021-11-22T23:17:12+00:00\n"
"POT-Creation-Date: 2022-10-04T06:20:10+00:00\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"X-Generator: WP-CLI 2.4.0\n"
"X-Generator: WP-CLI 2.6.0\n"
"X-Domain: mphb-elementor\n"

#. Plugin Name of the plugin
Expand All @@ -38,11 +38,11 @@ msgstr ""
msgid "MotoPress Hotel Booking"
msgstr ""

#: widgets/availability-calendar-widget.php:16
#: widgets/availability-calendar-widget.php:14
msgid "Availability Calendar"
msgstr ""

#: widgets/availability-calendar-widget.php:33
#: widgets/availability-calendar-widget.php:31
#: widgets/availability-widget.php:33
#: widgets/booking-confirmation-widget.php:33
#: widgets/checkout-widget.php:33
Expand All @@ -55,27 +55,51 @@ msgstr ""
msgid "Parameters"
msgstr ""

#: widgets/availability-calendar-widget.php:39
#: widgets/availability-calendar-widget.php:40
#: widgets/availability-widget.php:39
#: widgets/rates-widget.php:39
#: widgets/room-widget.php:39
msgid "ID"
msgstr ""

#: widgets/availability-calendar-widget.php:40
#: widgets/availability-calendar-widget.php:41
#: widgets/rates-widget.php:40
msgid "ID of accommodation type."
msgstr ""

#: widgets/availability-calendar-widget.php:46
#: widgets/availability-calendar-widget.php:50
msgid "How many months to show"
msgstr ""

#: widgets/availability-calendar-widget.php:47
#: widgets/availability-calendar-widget.php:51
msgid "Set the number of columns or the number of rows and columns separated by comma. Example: \"3\" or \"2,3\""
msgstr ""

#: widgets/availability-calendar-widget.php:53
#: widgets/availability-calendar-widget.php:60
msgid "Display prices"
msgstr ""

#: widgets/availability-calendar-widget.php:61
msgid "Display per-night prices in the availability calendar."
msgstr ""

#: widgets/availability-calendar-widget.php:70
msgid "Truncate prices"
msgstr ""

#: widgets/availability-calendar-widget.php:71
msgid "Truncate per-night prices in the availability calendar."
msgstr ""

#: widgets/availability-calendar-widget.php:80
msgid "Display currency"
msgstr ""

#: widgets/availability-calendar-widget.php:81
msgid "Display the currency sign in the availability calendar."
msgstr ""

#: widgets/availability-calendar-widget.php:90
#: widgets/availability-widget.php:46
#: widgets/booking-confirmation-widget.php:38
#: widgets/checkout-widget.php:38
Expand All @@ -88,7 +112,7 @@ msgstr ""
msgid "Class"
msgstr ""

#: widgets/availability-calendar-widget.php:54
#: widgets/availability-calendar-widget.php:91
#: widgets/availability-widget.php:47
#: widgets/booking-confirmation-widget.php:39
#: widgets/checkout-widget.php:39
Expand Down
2 changes: 1 addition & 1 deletion mphb-elementor.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Plugin Name: Hotel Booking & Elementor Integration
* Plugin URI: https://motopress.com/products/hotel-booking-elementor-integration/
* Description: Manage hotel booking shortcodes in Elementor builder.
* Version: 1.1.4
* Version: 1.1.5
* Author: MotoPress
* Author URI: https://motopress.com/
* License: GPLv2 or later
Expand Down
7 changes: 5 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ Contributors: MotoPress
Donate link: https://motopress.com/
Tags: hotel, booking, reservation, elementor, hotel booking, booking form
Requires at least: 4.6
Tested up to: 5.8
Tested up to: 6.0
Requires PHP: 5.6
Stable tag: 1.1.4
Stable tag: 1.1.5
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -51,6 +51,9 @@ Hotel Booking & Elementor Integration plugin is distributed under the terms of t

== Changelog ==

= 1.1.5, Oct 7 2022 =
* Added support for displaying prices in the availability calendars.

= 1.1.4, Nov 23 2021 =
* Security - sanitization and escaping.

Expand Down
2 changes: 1 addition & 1 deletion widgets/abstract-widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ public function get_categories() {
* Written as a Backbone JavaScript template and used to generate the live
* preview.
*/
protected function _content_template() {}
protected function content_template() {}
}
183 changes: 111 additions & 72 deletions widgets/availability-calendar-widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,78 +4,117 @@

use \Elementor\Controls_Manager;

class AvailabilityCalendarWidget extends AbstractCalendarWidget
{
public function get_name()
{
return 'mphbe-availability-calendar';
}

public function get_title()
{
return __('Availability Calendar', 'mphb-elementor');
}

public function get_icon()
{
// Elementor icon class ( https://pojome.github.io/elementor-icons/ ) or
// Font Awesome icon class ( https://fontawesome.com/ ), like:
return 'eicon-archive-posts';
}

/**
* Adds different input fields to allow the user to change and customize the
* widget settings.
*/
protected function _register_controls()
{
$this->start_controls_section('section_parameters', array(
'label' => __('Parameters', 'mphb-elementor')
));

// "id" required, but it will cause Backbone error "A "url" property or function must be specified"
$this->add_control('type_id', array(
'type' => Controls_Manager::TEXT,
'label' => __('ID', 'mphb-elementor'),
'description' => __('ID of accommodation type.', 'mphb-elementor'),
'default' => ''
));

$this->add_control('monthstoshow', array(
'type' => Controls_Manager::TEXT,
'label' => __('How many months to show', 'mphb-elementor'),
'description' => __('Set the number of columns or the number of rows and columns separated by comma. Example: "3" or "2,3"', 'mphb-elementor'),
'default' => '2'
));

$this->add_control('class', array(
'type' => Controls_Manager::TEXT,
'label' => __('Class', 'mphb-elementor'),
'description' => __('Custom CSS class for shortcode wrapper.', 'mphb-elementor'),
'default' => ''
));

$this->end_controls_section();
}

/**
* Render the widget output on the frontend.
*
* Written in PHP and used to generate the final HTML.
*/
protected function render()
{

$atts = $this->get_settings();
$atts['id'] = $atts['type_id'];

do_action('mphbe_before_availability_calendar_widget_render', $atts);

$shortcode = MPHB()->getShortcodes()->getAvailabilityCalendar();
class AvailabilityCalendarWidget extends AbstractCalendarWidget {

public function get_name() {
return 'mphbe-availability-calendar';
}

public function get_title() {
return __( 'Availability Calendar', 'mphb-elementor' );
}

public function get_icon() {
// Elementor icon class ( https://pojome.github.io/elementor-icons/ ) or
// Font Awesome icon class ( https://fontawesome.com/ ), like:
return 'eicon-archive-posts';
}

/**
* Adds different input fields to allow the user to change and customize the
* widget settings.
*/
protected function register_controls() {
$this->start_controls_section(
'section_parameters',
array(
'label' => __( 'Parameters', 'mphb-elementor' ),
)
);

// "id" required, but it will cause Backbone error "A "url" property or function must be specified"
$this->add_control(
'type_id',
array(
'type' => Controls_Manager::TEXT,
'label' => __( 'ID', 'mphb-elementor' ),
'description' => __( 'ID of accommodation type.', 'mphb-elementor' ),
'default' => '',
)
);

$this->add_control(
'monthstoshow',
array(
'type' => Controls_Manager::TEXT,
'label' => __( 'How many months to show', 'mphb-elementor' ),
'description' => __( 'Set the number of columns or the number of rows and columns separated by comma. Example: "3" or "2,3"', 'mphb-elementor' ),
'default' => '2',
)
);

$this->add_control(
'display_price',
array(
'type' => Controls_Manager::SWITCHER,
'label' => __( 'Display prices', 'mphb-elementor' ),
'description' => __( 'Display per-night prices in the availability calendar.', 'mphb-elementor' ),
'default' => false,
)
);

$this->add_control(
'truncate_price',
array(
'type' => Controls_Manager::SWITCHER,
'label' => __( 'Truncate prices', 'mphb-elementor' ),
'description' => __( 'Truncate per-night prices in the availability calendar.', 'mphb-elementor' ),
'default' => true,
)
);

$this->add_control(
'display_currency',
array(
'type' => Controls_Manager::SWITCHER,
'label' => __( 'Display currency', 'mphb-elementor' ),
'description' => __( 'Display the currency sign in the availability calendar.', 'mphb-elementor' ),
'default' => false,
)
);

$this->add_control(
'class',
array(
'type' => Controls_Manager::TEXT,
'label' => __( 'Class', 'mphb-elementor' ),
'description' => __( 'Custom CSS class for shortcode wrapper.', 'mphb-elementor' ),
'default' => '',
)
);

$this->end_controls_section();
}

/**
* Render the widget output on the frontend.
* Written in PHP and used to generate the final HTML.
*/
protected function render() {

$atts = $this->get_settings();
$atts['id'] = absint( $atts['type_id'] );
$atts['monthstoshow'] = sanitize_text_field( $atts['monthstoshow'] );
$atts['display_price'] = boolval( $atts['display_price'] );
$atts['truncate_price'] = boolval( $atts['truncate_price'] );
$atts['display_currency'] = boolval( $atts['display_currency'] );

do_action( 'mphbe_before_availability_calendar_widget_render', $atts );

$shortcode = MPHB()->getShortcodes()->getAvailabilityCalendar();
echo $shortcode->render($atts, null, $shortcode->getName()); // phpcs:ignore
parent::render();
parent::render();

do_action('mphbe_after_availability_calendar_widget_render', $atts);

}
do_action( 'mphbe_after_availability_calendar_widget_render', $atts );
}
}
2 changes: 1 addition & 1 deletion widgets/availability-widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function get_icon()
* Adds different input fields to allow the user to change and customize the
* widget settings.
*/
protected function _register_controls()
protected function register_controls()
{
$this->start_controls_section('section_parameters', array(
'label' => __('Parameters', 'mphb-elementor')
Expand Down
2 changes: 1 addition & 1 deletion widgets/booking-confirmation-widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function get_icon()
* Adds different input fields to allow the user to change and customize the
* widget settings.
*/
protected function _register_controls()
protected function register_controls()
{
$this->start_controls_section('section_parameters', array(
'label' => __('Parameters', 'mphb-elementor')
Expand Down
2 changes: 1 addition & 1 deletion widgets/checkout-widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function get_icon()
* Adds different input fields to allow the user to change and customize the
* widget settings.
*/
protected function _register_controls()
protected function register_controls()
{
$this->start_controls_section('section_parameters', array(
'label' => __('Parameters', 'mphb-elementor')
Expand Down
2 changes: 1 addition & 1 deletion widgets/rates-widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function get_icon()
* Adds different input fields to allow the user to change and customize the
* widget settings.
*/
protected function _register_controls()
protected function register_controls()
{
$this->start_controls_section('section_parameters', array(
'label' => __('Parameters', 'mphb-elementor')
Expand Down
2 changes: 1 addition & 1 deletion widgets/room-widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function get_icon()
* Adds different input fields to allow the user to change and customize the
* widget settings.
*/
protected function _register_controls()
protected function register_controls()
{
$this->start_controls_section('section_parameters', array(
'label' => __('Parameters', 'mphb-elementor')
Expand Down
2 changes: 1 addition & 1 deletion widgets/rooms-widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function get_icon()
* Adds different input fields to allow the user to change and customize the
* widget settings.
*/
protected function _register_controls()
protected function register_controls()
{
$this->start_controls_section('section_parameters', array(
'label' => __('Parameters', 'mphb-elementor')
Expand Down
2 changes: 1 addition & 1 deletion widgets/search-form-widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function get_icon()
* Adds different input fields to allow the user to change and customize the
* widget settings.
*/
protected function _register_controls()
protected function register_controls()
{
$minAdults = MPHB()->settings()->main()->getMinAdults();
$maxAdults = MPHB()->settings()->main()->getSearchMaxAdults();
Expand Down
Loading

0 comments on commit dc14003

Please sign in to comment.