PluginProbe
HubSpot All-In-One Marketing – Forms, Popups, Live Chat / 11.3.75
HubSpot All-In-One Marketing – Forms, Popups, Live Chat v11.3.75
11.3.75 11.3.73 11.3.71 11.3.70 11.3.69 11.3.64 11.3.65 11.3.62 11.3.61 11.3.56 11.3.58 11.0.31 11.0.52 11.0.54 11.0.56 11.0.58 11.0.7 11.1.10 11.1.11 11.1.13 11.1.14 11.1.15 11.1.2 11.1.20 11.1.21 All 73 releases
leadin / public / admin / widgets / class-elementormeeting.php

class-elementormeeting.php in HubSpot All-In-One Marketing – Forms, Popups, Live Chat 11.3.75, at public/admin/widgets/class-elementormeeting.php

139 lines 2.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Leadin\admin\widgets;
3
4 use Leadin\utils\ShortcodeRenderUtils;
5 use Elementor\Plugin;
6 use Elementor\Widget_Base;
7
8 /**
9 * ElementorMeeting Widget
10 */
11 class ElementorMeeting extends Widget_Base {
12
13 /**
14 * Widget internal name.
15 */
16 public function get_name() {
17 return 'hubspot-meeting';
18 }
19
20 /**
21 * Widget title.
22 */
23 public function get_title() {
24 return esc_html( 'HubSpot Meeting' );
25 }
26
27 /**
28 * Widget display icon.
29 */
30 public function get_icon() {
31 return 'eicon-calendar';
32 }
33
34 /**
35 * Widget help url.
36 */
37 public function get_custom_help_url() {
38 return 'https://wordpress.org/support/plugin/leadin/';
39 }
40
41 /**
42 * Widget category.
43 */
44 public function get_categories() {
45 return array( 'general', 'hubspot' );
46 }
47
48 /**
49 * Widget keywords.
50 */
51 public function get_keywords() {
52 return array( 'hubspot', 'meeting', 'leadin' );
53 }
54
55 /**
56 * Widget style.
57 */
58 public function get_style_depends() {
59 wp_register_style( 'leadin-elementor', LEADIN_JS_BASE_PATH . '/elementor.css', array(), LEADIN_PLUGIN_VERSION );
60 wp_register_style( 'leadin-css', LEADIN_ASSETS_PATH . '/style/leadin.css', array(), LEADIN_PLUGIN_VERSION );
61 return array( 'leadin-elementor', 'leadin-css' );
62 }
63
64 /**
65 * Widget script.
66 */
67 public function get_script_depends() {
68 wp_register_script(
69 'leadin-meeting',
70 'https://static.hsappstatic.net/MeetingsEmbed/ex/MeetingsEmbedCode.js',
71 array(),
72 LEADIN_PLUGIN_VERSION,
73 true
74 );
75 return array( 'leadin-meeting' );
76 }
77
78 /**
79 * Widget controls.
80 */
81 protected function register_controls() {
82 $this->start_controls_section(
83 'content_section',
84 array(
85 'label' => esc_html( __( 'Meetings Scheduler', 'leadin' ) ),
86 'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
87 )
88 );
89
90 $this->add_control(
91 'content',
92 array(
93 'type' => 'leadinmeetingselect',
94 )
95 );
96
97 $this->end_controls_section();
98 }
99
100 /**
101 * Render the widget
102 */
103 protected function render() {
104 $settings = $this->get_settings_for_display();
105 $content = $settings['content'];
106 $parsed_parameters = array(
107 'url' => isset( $content['url'] ) && filter_var( $content['url'], FILTER_VALIDATE_URL ) ? esc_url_raw( $content['url'] ) : '',
108 );
109 $is_edit_mode = Plugin::$instance->editor->is_edit_mode();
110
111 if ( $is_edit_mode ) {
112
113 ?>
114 <div class="hubspot-meeting-edit-mode" data-attributes=<?php echo esc_attr( json_encode( $parsed_parameters ) ); ?>>
115 &nbsp;
116 </div>
117
118 <?php
119 if ( empty( $parsed_parameters['url'] ) ) {
120 ?>
121 <div class="hubspot-widget-empty">
122
123 </div>
124 <?php
125 }
126 }
127
128 if ( ! empty( $parsed_parameters['url'] ) ) {
129 $embed = do_shortcode( '[hubspot url="' . $parsed_parameters['url'] . '" type="meeting"]' );
130
131 if ( $is_edit_mode ) {
132 $embed = ShortcodeRenderUtils::wrap_embed_for_elementor_editor( $embed );
133 }
134
135 echo $embed; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- shortcode output.
136 }
137 }
138 }
139