PluginProbe
VikBooking Hotel Booking Engine & PMS / trunk
VikBooking Hotel Booking Engine & PMS vtrunk
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 1.7.3 All 36 releases
vikbooking / libraries / lite / vcm / manager.php

manager.php in VikBooking Hotel Booking Engine & PMS trunk, at libraries/lite/vcm/manager.php

72 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @package VikBooking - Libraries
4 * @subpackage lite
5 * @author E4J s.r.l.
6 * @copyright Copyright (C) 2022 E4J s.r.l. All Rights Reserved.
7 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
8 * @link https://vikwp.com
9 */
10
11 // No direct access
12 defined('ABSPATH') or die('No script kiddies please!');
13
14 /**
15 * Manager class used to sponsor the missing VikChannelManager features.
16 *
17 * @since 1.8
18 */
19 abstract class VikChannelManagerLiteManager
20 {
21 /**
22 * Flag used to avoid initializing the setup more than once.
23 *
24 * @var boolean
25 */
26 private static $setup = false;
27
28 /**
29 * Accessor used to start the setup.
30 *
31 * @param mixed $helper The implementor instance or a static class.
32 *
33 * @return void
34 */
35 final public static function setup($helper = null)
36 {
37 if (!static::$setup && !VikBookingLicense::hasVcm())
38 {
39 if (!$helper)
40 {
41 // use the default implementor
42 VikBookingLoader::import('lite.vcm.helper');
43 $helper = new VikChannelManagerLiteHelper();
44 }
45
46 // set up only once and in case VCM is missing
47 static::$setup = static::doSetup($helper);
48 }
49 }
50
51 /**
52 * Setup implementor.
53 *
54 * @param mixed $helper The implementor instance or a static class.
55 *
56 * @return boolean
57 */
58 protected static function doSetup($helper)
59 {
60 /**
61 * Fires before the controller of VikBooking/VikChannelManager is dispatched.
62 * Useful to require libraries and to check user global permissions.
63 *
64 * @since 1.0
65 */
66 add_action('init', [$helper, 'hijackChannelManager'], 1);
67 add_action('vikbooking_before_dispatch', [$helper, 'displayViewBanners']);
68 add_action('vikbooking_before_dispatch', [$helper, 'displayWidgetBanners']);
69 add_action('vikbooking_before_dispatch', [$helper, 'hijackWidgetMultitask']);
70 }
71 }
72