PluginProbe
VikBooking Hotel Booking Engine & PMS / 1.8.16
VikBooking Hotel Booking Engine & PMS v1.8.16
1.8.16 1.8.15 1.8.14 1.8.13 1.8.12 1.8.11 1.8.10 1.8.9 1.8.6 1.8.7 1.8.8 trunk 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9 1.7.0 1.7.1 1.7.2 All 37 releases
← All changes | vikbooking.php +122 -15 1.7.2 → 1.8.16 View file →
@@ -2,9 +2,9 @@
2 2 /*
3 3 Plugin Name: VikBooking
4 4 Plugin URI: https://vikwp.com/plugin/vikbooking
5 5 Description: Certified Booking Engine for Hotels and Accommodations.
6 -Version: 1.7.2
6 +Version: 1.8.16
7 7 Author: E4J s.r.l.
8 8 Author URI: https://vikwp.com
9 9 License: GPL2
10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -77,8 +77,9 @@
77 77 add_action('plugins_loaded', array('VikBookingBuilder', 'setupOverridesManager'));
78 78
79 79 // setup lite system
80 80 add_action('plugins_loaded', array('VikBookingLiteManager', 'setup'));
81 +add_action('plugins_loaded', array('VikChannelManagerLiteManager', 'setup'));
81 82
82 83 /**
83 84 * Added support for screen options.
84 85 * Parameters such as the list limit can be changed from there.
@@ -105,21 +106,8 @@
105 106 {
106 107 // installer class will check the update status
107 108 VikBookingInstaller::update();
108 109
109 - /**
110 - *
111 - * Fires once the plugins have loaded.
112 - *
113 - * Language is loaded through the filter 'plugins_loaded' in order to avoid to load language
114 - * before the correct one has been set by WordPress or by another third-party plugin.
115 - *
116 - * @link https://developer.wordpress.org/reference/hooks/plugins_loaded/
117 - *
118 - * @since 1.4.2
119 - */
120 - VikBookingBuilder::loadLanguage();
121 -
122 110 global $pagenow;
123 111
124 112 $app = JFactory::getApplication();
125 113 $input = $app->input;
@@ -161,8 +149,15 @@
161 149
162 150 // process the request and obtain the response
163 151 add_action('init', function()
164 152 {
153 + /**
154 + * Language files should no longer be loaded during 'plugins_loaded'.
155 + *
156 + * @since 1.7.6
157 + */
158 + VikBookingBuilder::loadLanguage();
159 +
165 160 $app = JFactory::getApplication();
166 161 $input = $app->input;
167 162
168 163 // if we are in the front-end, try to parse the URL to inject
@@ -220,8 +215,16 @@
220 215
221 216 // register widgets
222 217 add_action('widgets_init', array('VikBookingBuilder', 'setupWidgets'));
223 218
219 +/**
220 + * Load plugin language when registering the widgets as well.
221 + * Since translations are now loaded at "init", they might not be available yet.
222 + *
223 + * @since 1.8.4
224 + */
225 +add_action('widgets_init', ['VikBookingBuilder', 'loadLanguage'], 1);
226 +
224 227 // handle shortcodes (SITE controller dispatcher)
225 228 add_shortcode('vikbooking', function($atts, $content = null)
226 229 {
227 230 $app = JFactory::getApplication();
@@ -343,8 +346,18 @@
343 346 VikBooking::getTracker();
344 347 VikBooking::loadPreferredColorStyles();
345 348 }
346 349
350 + /**
351 + * Prevent some pages from performing an auto-redirect when running
352 + * the Bricks plugin preview.
353 + *
354 + * @since 1.7.7
355 + */
356 + if ($app->input->get('bricks') === 'run' && in_array($app->input->get('view'), ['tinyurl']))
357 + {
358 + $app->input->set('view', '');
359 + }
347 360 });
348 361
349 362 // instead using the default server timezone, try to use the one
350 363 // specified within the WordPress configuration
@@ -603,17 +616,49 @@
603 616 * Action used to register a periodic performance cleaning check.
604 617 * This hook will be called by a scheduled event in WP-Cron.
605 618 *
606 619 * @since 1.7.2
620 + * @since 1.8.7 scheduled DAC expired passcodes cleaning.
607 621 */
608 -add_action('vikbooking_cron_performance_cleaner', ['VBOPerformanceCleaner', 'runCheck']);
622 +add_action('vikbooking_cron_performance_cleaner', function()
623 +{
624 + // performance cleaning check
625 + VBOPerformanceCleaner::runCheck();
626 + // clean up expired passcodes from smart locks
627 + VBOFactory::getDoorAccessControl()->cleanExpiredPasscodes();
628 +});
609 629
610 630 /**
631 + * Action used to register a periodic check of door-access-control framework.
632 + * This hook will be called by a scheduled event in WP-Cron.
633 + *
634 + * @since 1.8.4
635 + * @since 1.8.6 added support to watch the devices first access.
636 + */
637 +add_action('vikbooking_cron_door_access_control', function()
638 +{
639 + // watch if any booking is approaching the check-in date
640 + VBOFactory::getDoorAccessControl()->handleUpcomingArrivals();
641 + // watch if passcodes get used for the first time
642 + VBOFactory::getDoorAccessControl()->watchFirstAccess();
643 +});
644 +
645 +/**
646 + * Action used to register a periodic database cleaning check.
647 + * This hook will be called by a scheduled event in WP-Cron.
648 + *
649 + * @since 1.8.5
650 + */
651 +add_action('vikbooking_cron_db_optimization', ['VBOPerformanceCleaner', 'optimizeDatabase']);
652 +
653 +/**
611 654 * Install the scheduling of the hook within WP-Cron needed
612 655 * to watch and process the automatic payments scheduled.
613 656 *
614 657 * @since 1.6.10
615 658 * @since 1.7.2 registered "vikbooking_cron_performance_cleaner".
659 + * @since 1.8.4 registered "vikbooking_cron_door_access_control".
660 + * @since 1.8.5 registered "vikbooking_cron_db_optimization".
616 661 */
617 662 add_action('plugins_loaded', function()
618 663 {
619 664 // make sure the cron event hasn't been yet scheduled.
@@ -629,8 +674,22 @@
629 674 {
630 675 // schedule event starting from the current time for "every week"
631 676 wp_schedule_event(time(), 'weekly', 'vikbooking_cron_performance_cleaner');
632 677 }
678 +
679 + // make sure the cron event hasn't been yet scheduled.
680 + if (!wp_next_scheduled('vikbooking_cron_door_access_control'))
681 + {
682 + // schedule event starting from the current time for "every hour"
683 + wp_schedule_event(time(), 'hourly', 'vikbooking_cron_door_access_control');
684 + }
685 +
686 + // make sure the cron event hasn't been yet scheduled.
687 + if (!wp_next_scheduled('vikbooking_cron_db_optimization'))
688 + {
689 + // schedule event starting from the current time for "every hour"
690 + wp_schedule_event(time(), 'hourly', 'vikbooking_cron_db_optimization');
691 + }
633 692 }, (PHP_INT_MAX - 1));
634 693
635 694 /**
636 695 * Filters the action links displayed for each plugin in the Plugins list table.
@@ -812,8 +871,46 @@
812 871 <?php
813 872 });
814 873
815 874 /**
875 + * Detect outdated VCM versions.
876 + *
877 + * @since 1.8.13
878 + */
879 +add_action('admin_notices', function()
880 +{
881 + global $pagenow;
882 +
883 + if (wp_doing_ajax())
884 + {
885 + // nothing to check
886 + return;
887 + }
888 +
889 + $option = JFactory::getApplication()->input->get('option');
890 + $inPlugins = in_array($option, ['com_vikbooking', 'com_vikchannelmanager']);
891 +
892 + if (!$inPlugins && $pagenow != 'plugins.php')
893 + {
894 + // nothing to check
895 + return;
896 + }
897 +
898 + if (!defined('VIKCHANNELMANAGER_SOFTWARE_VERSION') || version_compare(VIKCHANNELMANAGER_SOFTWARE_VERSION, VIKCHANNELMANAGER_MINIMUM_VERSION, '>='))
899 + {
900 + // check passed
901 + return;
902 + }
903 +
904 + echo JLayoutHelper::render(
905 + 'html.vcm.version',
906 + ['page' => $inPlugins ? preg_replace('/^com_/', '', $option) : $pagenow],
907 + null,
908 + ['component' => 'com_vikbooking']
909 + );
910 +});
911 +
912 +/**
816 913 * Downloads the RSS feeds after loading the dashboard of VikBooking.
817 914 *
818 915 * @since 1.3.9
819 916 */
@@ -885,8 +982,18 @@
885 982 $input = $app->input;
886 983
887 984 // make sure we are not inside Vik Booking
888 985 if ($input->get('option') == 'com_vikbooking' || $input->get('page') == 'vikbooking' || $input->get('action') == 'vikbooking')
986 + {
987 + return;
988 + }
989 +
990 + /**
991 + * Avoid conflicts with third-party page-builder plugins that may simulate the front-end.
992 + *
993 + * @since 1.8.1
994 + */
995 + if (!$app->isClient('administrator'))
889 996 {
890 997 return;
891 998 }
892 999