PluginProbe
VikBooking Hotel Booking Engine & PMS / 1.8.11
VikBooking Hotel Booking Engine & PMS v1.8.11
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 / widget.php

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

86 lines 1.9 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 jimport('adapter.module.widget');
15
16 /**
17 * VikBooking Chat module implementation for WP.
18 *
19 * @see JWidget
20 * @since 1.0
21 */
22 class ModVikbookingChat_Widget extends JWidget
23 {
24 /**
25 * Class constructor.
26 */
27 public function __construct()
28 {
29 // attach the absolute path of the module folder
30 parent::__construct(dirname(__FILE__));
31
32 try
33 {
34 // add support as block
35 $this->registerBlockType(
36 VIKBOOKING_ADMIN_ASSETS_URI,
37 [
38 'icon' => 'format-chat',
39 'keywords' => [
40 __('VikBooking', 'vikbooking'),
41 __('Chat', 'vikbooking'),
42 __('Widget'),
43 ],
44 ]
45 );
46 }
47 catch (Throwable $error)
48 {
49 // there's a conflict with an outdated plugin
50 }
51 }
52
53 /**
54 * Sanitize widget form values as they are saved.
55 *
56 * @param array $new_instance Values just sent to be saved.
57 * @param array $old_instance Previously saved values from database.
58 *
59 * @return array Updated safe values to be saved.
60 */
61 public function update($new_instance, $old_instance)
62 {
63 $new_instance['title'] = !empty($new_instance['title']) ? strip_tags($new_instance['title']) : '';
64
65 return $new_instance;
66 }
67
68 /**
69 * Front-end display of widget.
70 *
71 * @param array $args Widget arguments.
72 * @param array $config Saved values from database.
73 *
74 * @return void
75 */
76 public function widget($args, $config)
77 {
78 // define a callback to hide the title even if it was specified
79 $hideTitle = fn($title) => '';
80
81 add_filter('widget_title', $hideTitle);
82 parent::widget($args, $config);
83 remove_filter('widget_title', $hideTitle);
84 }
85 }
86