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
vikbooking / modules / mod_vikbooking_chat / mod_vikbooking_chat.php

mod_vikbooking_chat.php in VikBooking Hotel Booking Engine & PMS 1.8.16, at modules/mod_vikbooking_chat/mod_vikbooking_chat.php

70 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @package VikBooking
4 * @subpackage mod_vikbooking_chat
5 * @author E4J s.r.l
6 * @copyright Copyright (C) 2026 E4J s.r.l. All rights reserved.
7 * @license GNU General Public License version 2 or later; see LICENSE
8 * @link https://vikwp.com
9 */
10
11 // no direct access
12 defined('ABSPATH') or die('No script kiddies please!');
13
14 $app = JFactory::getApplication();
15 $document = JFactory::getDocument();
16
17 if ($app->input->get('option') === 'com_vikbooking' && $app->input->get('view') === 'chat') {
18 // do not display the module if we are inside a chat view
19 return;
20 }
21
22 require_once VBO_SITE_PATH . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'lib.vikbooking.php';
23
24 $document->addStyleSheet(VIKBOOKING_SITE_ASSETS_URI . 'vikbooking_styles.css', ['version' => VIKBOOKING_SOFTWARE_VERSION]);
25 VikBooking::loadPreferredColorStyles();
26 VikBooking::loadFontAwesome();
27
28 $options = [
29 'version' => '1.0',
30 ];
31
32 JHtml::fetch('script', VBO_MODULES_URI . 'modules/mod_vikbooking_chat/assets/script.js', $options);
33 JHtml::fetch('stylesheet', VBO_MODULES_URI . 'modules/mod_vikbooking_chat/assets/style.css', $options);
34
35 // security measure: register a new CSRF token to avoid spammers
36 JHtml::fetch('vbohtml.scripts.ajaxcsrf');
37
38 $document->addStyleDeclaration(
39 <<<CSS
40 .vbo-chat-session-widget {
41 --vbo-chat-widget-btn-background: {$params->get('background')};
42 --vbo-chat-widget-btn-color: {$params->get('color')};
43 }
44 CSS
45 );
46
47 // get widget id
48 $moduleId = $module->id ?? rand(1, 999);
49
50 // get session from cookie
51 $session = (new VBOChatSessionModel)->getFromCookie();
52
53 $faqs = [];
54
55 // prepare FAQs
56 for ($i = 1; $i <= 3; $i++) {
57 $short = $params->get('faq_' . $i . '_short');
58 $long = $params->get('faq_' . $i . '_long');
59
60 if ($short && $long) {
61 $faqs[] = (object) [
62 'summary' => $short,
63 'question' => $long,
64 ];
65 }
66 }
67
68 // load preferred layout
69 require JModuleHelper::getLayoutPath('mod_vikbooking_chat', $params->get('layout', 'default'));
70