PluginProbe ʕ •ᴥ•ʔ
Essential Addons for Elementor – Popular Elementor Templates & Widgets / 5.1.4
Essential Addons for Elementor – Popular Elementor Templates & Widgets v5.1.4
6.6.5 6.6.4 6.6.3 5.7.3 5.7.4 5.8.0 5.8.1 5.8.10 5.8.11 5.8.12 5.8.13 5.8.14 5.8.15 5.8.16 5.8.18 5.8.2 5.8.3 5.8.4 5.8.5 5.8.6 5.8.7 5.8.8 5.8.9 5.9.0 5.9.1 5.9.10 5.9.11 5.9.12 5.9.13 5.9.14 5.9.15 5.9.16 5.9.17 5.9.18 5.9.19 5.9.2 5.9.20 5.9.21 5.9.22 5.9.23 5.9.24 5.9.25 5.9.26 5.9.27 5.9.3 5.9.4 5.9.5 5.9.6 5.9.7 5.9.8 5.9.9 6.0.0 6.0.1 6.0.10 6.0.11 6.0.12 6.0.13 6.0.14 6.0.15 6.0.2 6.0.3 6.0.4 6.0.5 6.0.6 6.0.7 6.0.8 6.0.9 6.1.0 6.1.1 6.1.10 6.1.11 trunk 6.1.12 1.0.0 6.1.13 1.0.1 6.1.14 1.1.0 6.1.15 2.0 6.1.17 2.1 6.1.18 2.10.0 6.1.19 2.10.1 6.1.2 2.10.2 6.1.20 2.10.3 6.1.3 2.10.4 6.1.4 2.10.5 6.1.5 2.2.0 6.1.6 2.2.1 6.1.7 2.2.2 6.1.8 2.2.3 6.1.9 2.2.4 6.2.0 2.2.5 6.2.1 2.3.0 6.2.2 2.3.1 6.2.3 2.4.0 6.2.4 2.4.1 6.3.0 2.4.2 6.3.1 2.4.3 6.3.2 2.5.0 6.3.3 2.6.0 6.4.0 2.7.0 6.5.0 2.7.1 6.5.1 2.7.10 6.5.10 2.7.11 6.5.11 2.7.2 6.5.12 2.7.3 6.5.13 2.7.4 6.5.2 2.7.5 6.5.3 2.7.6 6.5.4 2.7.7 6.5.5 2.7.8 6.5.6 2.7.9 6.5.7 2.8.0 6.5.8 2.8.1 6.5.9 2.8.2 6.6.0 2.8.3 6.6.1 2.8.4 6.6.2 2.8.5 2.8.6 2.8.7 2.9.0 2.9.1 2.9.2 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7 2.9.8 2.9.9 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.1.4.1 3.1.5 3.2.0 3.3.0 3.3.1 3.3.2 3.3.3 3.4.0 3.5.0 3.5.1 3.5.2 3.6.0 3.6.1 3.6.2 3.7.0 3.7.1 3.7.2 3.8.0 3.8.1 3.8.2 3.8.3 3.8.4 3.8.5 3.9.0 3.9.1 3.9.2 3.9.3 3.9.4 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.1.0 4.1.1 4.1.2 4.2.0 4.2.1 4.2.2 4.2.3 4.2.4 4.3.0 4.3.1 4.3.2 4.3.3 4.3.4 4.3.5 4.3.6 4.3.7 4.3.8 4.3.9 4.4.0 4.4.1 4.5.0 4.5.1 4.5.2 4.5.3 4.5.4 4.5.5 4.6.0 4.6.1 4.6.2 4.6.3 4.6.4 4.6.5 4.6.6 4.7.0 4.7.1 4.7.2 4.7.3 4.7.4 4.7.5 4.8.0 4.8.1 4.8.2 4.8.3 4.8.4 4.9.0 4.9.1 4.9.2 4.9.3 4.9.4 4.9.5 4.9.6 4.9.7 5.0.0 5.0.1 5.0.10 5.0.11 5.0.12 5.0.13 5.0.2 5.0.3 5.0.4 5.0.5 5.0.6 5.0.7 5.0.8 5.0.9 5.1.0 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.1.6 5.1.7 5.1.8 5.1.9 5.2.0 5.2.1 5.2.2 5.2.3 5.2.4 5.3.0 5.3.1 5.3.2 5.4.6 5.5.5 5.6.5 5.7.2
essential-addons-for-elementor-lite / includes / Elements / Event_Calendar.php
essential-addons-for-elementor-lite / includes / Elements Last commit date
Adv_Accordion.php 4 years ago Adv_Tabs.php 4 years ago Advanced_Data_Table.php 4 years ago Better_Payment.php 4 years ago Betterdocs_Category_Box.php 4 years ago Betterdocs_Category_Grid.php 4 years ago Betterdocs_Search_Form.php 4 years ago Caldera_Forms.php 4 years ago Career_Page.php 4 years ago Contact_Form_7.php 4 years ago Content_Ticker.php 4 years ago Countdown.php 4 years ago Creative_Button.php 4 years ago Crowdfundly_All_Campaign.php 4 years ago Crowdfundly_Organization.php 4 years ago Crowdfundly_Single_Campaign.php 4 years ago Cta_Box.php 4 years ago Data_Table.php 4 years ago Dual_Color_Header.php 4 years ago EmbedPress.php 4 years ago Event_Calendar.php 4 years ago Facebook_Feed.php 4 years ago Fancy_Text.php 4 years ago Feature_List.php 4 years ago Filterable_Gallery.php 4 years ago Flip_Box.php 4 years ago FluentForm.php 4 years ago Formstack.php 4 years ago GravityForms.php 4 years ago Image_Accordion.php 4 years ago Info_Box.php 4 years ago Interactive_Circle.php 4 years ago Login_Register.php 4 years ago NinjaForms.php 4 years ago Post_Grid.php 4 years ago Post_Timeline.php 4 years ago Pricing_Table.php 4 years ago Product_Grid.php 4 years ago Progress_Bar.php 4 years ago Simple_Menu.php 4 years ago Sticky_Video.php 4 years ago Team_Member.php 4 years ago Testimonial.php 4 years ago Tooltip.php 4 years ago Twitter_Feed.php 4 years ago TypeForm.php 4 years ago WeForms.php 4 years ago Woo_Cart.php 4 years ago Woo_Checkout.php 4 years ago Woo_Product_Carousel.php 4 years ago Woo_Product_Compare.php 4 years ago Woo_Product_Gallery.php 4 years ago Woocommerce_Review.php 4 years ago WpForms.php 4 years ago
Event_Calendar.php
2044 lines
1 <?php
2
3 namespace Essential_Addons_Elementor\Elements;
4
5 // If this file is called directly, abort.
6 if (!defined('ABSPATH')) {
7 exit;
8 }
9
10 use \Elementor\Controls_Manager;
11 use \Elementor\Group_Control_Background;
12 use \Elementor\Group_Control_Border;
13 use \Elementor\Group_Control_Box_Shadow;
14 use \Elementor\Group_Control_Typography;
15 use \Elementor\Repeater;
16 use \Elementor\Widget_Base;
17 use \Essential_Addons_Elementor\Classes\Helper;
18
19 class Event_Calendar extends Widget_Base
20 {
21
22
23 public function get_name()
24 {
25 return 'eael-event-calendar';
26 }
27
28 public function get_style_depends()
29 {
30 return [
31 'font-awesome-5-all',
32 'font-awesome-4-shim',
33 ];
34 }
35
36 public function get_title()
37 {
38 return esc_html__('Event Calendar', 'essential-addons-for-elementor-lite');
39 }
40
41 public function get_icon()
42 {
43 return 'eaicon-event-calendar';
44 }
45
46 public function get_categories()
47 {
48 return ['essential-addons-elementor'];
49 }
50
51 public function get_keywords()
52 {
53 return [
54 'event',
55 'events',
56 'calendar',
57 'ea calendar',
58 'ea event calendar',
59 'eventon',
60 'google calendar',
61 'event marketing',
62 'scheduled events',
63 'event calendar',
64 'modern events',
65 'ea',
66 'essential addons',
67 ];
68 }
69
70 public function get_custom_help_url()
71 {
72 return 'https://essential-addons.com/elementor/docs/event-calendar/';
73 }
74
75 protected function register_controls()
76 {
77 /**
78 * -------------------------------------------
79 * Events
80 * -------------------------------------------
81 */
82 $this->start_controls_section(
83 'eael_event_section',
84 [
85 'label' => __('Events', 'essential-addons-for-elementor-lite'),
86 'tab' => Controls_Manager::TAB_CONTENT,
87 ]
88 );
89
90 $this->add_control(
91 'eael_event_calendar_type',
92 [
93 'label' => __('Source', 'essential-addons-for-elementor-lite'),
94 'type' => Controls_Manager::SELECT,
95 'options' => apply_filters('eael/controls/event-calendar/source', [
96 'manual' => __('Manual', 'essential-addons-for-elementor-lite'),
97 'google' => __('Google', 'essential-addons-for-elementor-lite'),
98 'the_events_calendar' => __('The Events Calendar', 'essential-addons-for-elementor-lite'),
99
100 ]),
101 'default' => 'manual',
102 ]
103 );
104
105 if (!apply_filters('eael/is_plugin_active', 'the-events-calendar/the-events-calendar.php')) {
106 $this->add_control(
107 'eael_the_event_calendar_warning_text',
108 [
109 'type' => Controls_Manager::RAW_HTML,
110 'raw' => __('<strong>The Events Calendar</strong> is not installed/activated on your site. Please install and activate <a href="plugin-install.php?s=the-events-calendar&tab=search&type=term" target="_blank">The Events Calendar</a> first.',
111 'essential-addons-for-elementor'),
112 'content_classes' => 'eael-warning',
113 'condition' => [
114 'eael_event_calendar_type' => 'the_events_calendar',
115 ],
116 ]
117 );
118 }
119
120 if (!apply_filters('eael/pro_enabled', false)) {
121 $this->add_control(
122 'eael_event_calendar_pro_enable_warning',
123 [
124 'label' => sprintf( '<a target="_blank" href="https://wpdeveloper.com/upgrade/ea-pro">%s</a>', esc_html__('Only Available in Pro Version!', 'essential-addons-for-elementor-lite')),
125 'type' => Controls_Manager::RAW_HTML,
126 'condition' => [
127 'eael_event_calendar_type' => ['eventon'],
128 ],
129 ]
130 );
131 }
132
133 do_action('eael/event-calendar/activation-notice', $this);
134
135 $repeater = new Repeater;
136 $repeater->start_controls_tabs('eael_event_content_tabs');
137
138 $repeater->start_controls_tab(
139 'eaelec_event_info_tab',
140 [
141 'label' => __('General', 'essential-addons-for-elementor-lite'),
142 ]
143 );
144
145 $repeater->add_control(
146 'eael_event_title',
147 [
148 'label' => __('Title', 'essential-addons-for-elementor-lite'),
149 'type' => Controls_Manager::TEXT,
150 'dynamic' => [ 'active' => true ],
151 'label_block' => true,
152 ]
153 );
154
155 $repeater->add_control(
156 'eael_event_link',
157 [
158 'label' => __('Link', 'essential-addons-for-elementor-lite'),
159 'type' => Controls_Manager::URL,
160 'dynamic' => ['active' => true],
161 'placeholder' => __('https://sample-domain.com', 'essential-addons-for-elementor-lite'),
162 'show_external' => true,
163 ]
164 );
165
166 $repeater->add_control(
167 'eael_event_all_day',
168 [
169 'label' => __('All Day', 'essential-addons-for-elementor-lite'),
170 'type' => Controls_Manager::SWITCHER,
171 'label_block' => false,
172 'return_value' => 'yes',
173 ]
174 );
175
176 $repeater->add_control(
177 'eael_event_start_date',
178 [
179 'label' => __('Start Date', 'essential-addons-for-elementor-lite'),
180 'type' => Controls_Manager::DATE_TIME,
181 'default' => date('Y-m-d H:i', current_time('timestamp', 0)),
182 'condition' => [
183 'eael_event_all_day' => '',
184 ],
185 ]
186 );
187
188 $repeater->add_control(
189 'eael_event_end_date',
190 [
191 'label' => __('End Date', 'essential-addons-for-elementor-lite'),
192 'type' => Controls_Manager::DATE_TIME,
193 'default' => date('Y-m-d H:i', strtotime("+59 minute", current_time('timestamp', 0))),
194 'condition' => [
195 'eael_event_all_day' => '',
196 ],
197 ]
198 );
199
200 $repeater->add_control(
201 'eael_event_start_date_allday',
202 [
203 'label' => __('Start Date', 'essential-addons-for-elementor-lite'),
204 'type' => Controls_Manager::DATE_TIME,
205 'picker_options' => ['enableTime' => false],
206 'default' => date('Y-m-d', current_time('timestamp', 0)),
207 'condition' => [
208 'eael_event_all_day' => 'yes',
209 ],
210 ]
211 );
212
213 $repeater->add_control(
214 'eael_event_end_date_allday',
215 [
216 'label' => __('End Date', 'essential-addons-for-elementor-lite'),
217 'type' => Controls_Manager::DATE_TIME,
218 'picker_options' => ['enableTime' => false],
219 'default' => date('Y-m-d', current_time('timestamp', 0)),
220 'condition' => [
221 'eael_event_all_day' => 'yes',
222 ],
223 ]
224 );
225
226 $repeater->add_control(
227 'eael_event_bg_color',
228 [
229 'label' => __('Event Background Color', 'essential-addons-for-elementor-lite'),
230 'type' => Controls_Manager::COLOR,
231 'default' => '#5725ff',
232 ]
233 );
234
235 $repeater->add_control(
236 'eael_event_text_color',
237 [
238 'label' => __('Event Text Color', 'essential-addons-for-elementor-lite'),
239 'type' => Controls_Manager::COLOR,
240 'default' => '#ffffff',
241 ]
242 );
243
244 $repeater->add_control(
245 'eael_event_border_color',
246 [
247 'label' => __('Popup Ribbon Color', 'essential-addons-for-elementor-lite'),
248 'type' => Controls_Manager::COLOR,
249 'default' => '#E8E6ED',
250 ]
251 );
252
253 $repeater->end_controls_tab();
254
255 $repeater->start_controls_tab(
256 'eaelec_event_content_tab',
257 [
258 'label' => __('Content', 'essential-addons-for-elementor-lite'),
259 ]
260 );
261
262 $repeater->add_control(
263 'eael_event_description',
264 [
265 'label' => __('Description', 'essential-addons-for-elementor-lite'),
266 'type' => Controls_Manager::WYSIWYG,
267 ]
268 );
269
270 $repeater->end_controls_tab();
271
272 $this->add_control(
273 'eael_event_items',
274 [
275 'label' => __('Event', 'essential-addons-for-elementor-lite'),
276 'type' => Controls_Manager::REPEATER,
277 'fields' => $repeater->get_controls(),
278 'default' => [
279 ['eael_event_title' => 'Event Title'],
280 ],
281 'title_field' => '{{ eael_event_title }}',
282 'condition' => [
283 'eael_event_calendar_type' => 'manual',
284 ],
285 ]
286 );
287
288 $this->end_controls_tabs();
289
290 $this->end_controls_section();
291
292 $this->start_controls_section(
293 'eael_event_google_calendar',
294 [
295 'label' => __('Google Calendar', 'essential-addons-for-elementor-lite'),
296 'tab' => Controls_Manager::TAB_CONTENT,
297 'condition' => [
298 'eael_event_calendar_type' => 'google',
299 ],
300 ]
301 );
302
303 $this->add_control(
304 'eael_event_google_api_key',
305 [
306 'label' => __('APi Key', 'essential-addons-for-elementor-lite'),
307 'type' => Controls_Manager::TEXT,
308 'label_block' => true,
309 'description' => sprintf(__('<a href="https://essential-addons.com/elementor/docs/google-api-key/" class="eael-btn" target="_blank">%s</a>',
310 'essential-addons-for-elementor-lite'), 'Get API Key'),
311 ]
312 );
313
314 $this->add_control(
315 'eael_event_calendar_id',
316 [
317 'label' => __('Calendar ID', 'essential-addons-for-elementor-lite'),
318 'type' => Controls_Manager::TEXT,
319 'label_block' => true,
320 'description' => sprintf(__('<a href="https://essential-addons.com/elementor/docs/google-calendar-id/" class="eael-btn" target="_blank">%s</a>',
321 'essential-addons-for-elementor-lite'), 'Get google calendar ID'),
322 ]
323 );
324
325 $this->add_control(
326 'eael_google_calendar_start_date',
327 [
328 'label' => __('Start Date', 'essential-addons-for-elementor-lite'),
329 'type' => Controls_Manager::DATE_TIME,
330 'default' => date('Y-m-d H:i', current_time('timestamp', 0)),
331 ]
332 );
333
334 $this->add_control(
335 'eael_google_calendar_end_date',
336 [
337 'label' => __('End Date', 'essential-addons-for-elementor-lite'),
338 'type' => Controls_Manager::DATE_TIME,
339 'default' => date('Y-m-d H:i', strtotime("+6 months", current_time('timestamp', 0))),
340 ]
341 );
342
343 $this->add_control(
344 'eael_google_calendar_max_result',
345 [
346 'label' => __('Max Result', 'essential-addons-for-elementor-lite'),
347 'type' => Controls_Manager::NUMBER,
348 'min' => 1,
349 'default' => 100,
350 ]
351 );
352
353 $this->end_controls_section();
354
355 //the events calendar
356 if (apply_filters('eael/is_plugin_active', 'the-events-calendar/the-events-calendar.php')) {
357 $this->start_controls_section(
358 'eael_event_the_events_calendar',
359 [
360 'label' => __('The Event Calendar', 'essential-addons-for-elementor-lite'),
361 'tab' => Controls_Manager::TAB_CONTENT,
362 'condition' => [
363 'eael_event_calendar_type' => 'the_events_calendar',
364 ],
365 ]
366 );
367
368 $this->add_control(
369 'eael_the_events_calendar_fetch',
370 [
371 'label' => __('Get Events', 'essential-addons-for-elementor-lite'),
372 'type' => Controls_Manager::SELECT,
373 'label_block' => true,
374 'default' => ['all'],
375 'options' => [
376 'all' => __('All', 'essential-addons-for-elementor-lite'),
377 'date_range' => __('Date Range', 'essential-addons-for-elementor-lite'),
378 ],
379 'render_type' => 'none',
380 ]
381 );
382
383 $this->add_control(
384 'eael_the_events_calendar_start_date',
385 [
386 'label' => __('Start Date', 'essential-addons-for-elementor-lite'),
387 'type' => Controls_Manager::DATE_TIME,
388 'default' => date('Y-m-d H:i', current_time('timestamp', 0)),
389 'condition' => [
390 'eael_the_events_calendar_fetch' => 'date_range',
391 ],
392 ]
393 );
394
395 $this->add_control(
396 'eael_the_events_calendar_end_date',
397 [
398 'label' => __('End Date', 'essential-addons-for-elementor-lite'),
399 'type' => Controls_Manager::DATE_TIME,
400 'default' => date('Y-m-d H:i', strtotime("+6 months", current_time('timestamp', 0))),
401 'condition' => [
402 'eael_the_events_calendar_fetch' => 'date_range',
403 ],
404 ]
405 );
406
407 $this->add_control(
408 'eael_the_events_calendar_category',
409 [
410 'label' => __('Event Category', 'essential-addons-for-elementor-lite'),
411 'type' => Controls_Manager::SELECT2,
412 'multiple' => true,
413 'label_block' => true,
414 'default' => [],
415 'options' => Helper::get_tags_list(['taxonomy' => 'tribe_events_cat', 'hide_empty' => false]),
416 ]
417 );
418
419 $this->add_control(
420 'eael_the_events_calendar_max_result',
421 [
422 'label' => __('Max Result', 'essential-addons-for-elementor-lite'),
423 'type' => Controls_Manager::NUMBER,
424 'min' => 1,
425 'default' => 100,
426 ]
427 );
428
429 $this->end_controls_section();
430 }
431
432 do_action('eael/event-calendar/source/control', $this);
433
434 $this->start_controls_section(
435 'eael_event_calendar_section',
436 [
437 'label' => __('Calendar', 'essential-addons-for-elementor-lite'),
438 'tab' => Controls_Manager::TAB_CONTENT,
439 ]
440 );
441
442 $this->add_control(
443 'eael_event_calendar_language',
444 [
445 'label' => __('Language', 'essential-addons-for-elementor-lite'),
446 'type' => Controls_Manager::SELECT,
447 'options' => [
448 'af' => 'Afrikaans',
449 'sq' => 'Albanian',
450 'ar' => 'Arabic',
451 'az' => 'Azerbaijani',
452 'eu' => 'Basque',
453 'bn' => 'Bengali',
454 'bs' => 'Bosnian',
455 'bg' => 'Bulgarian',
456 'ca' => 'Catalan',
457 'zh-cn' => 'Chinese',
458 'zh-tw' => 'Chinese-tw',
459 'hr' => 'Croatian',
460 'cs' => 'Czech',
461 'da' => 'Danish',
462 'nl' => 'Dutch',
463 'en' => 'English',
464 'et' => 'Estonian',
465 'fi' => 'Finnish',
466 'fr' => 'French',
467 'gl' => 'Galician',
468 'ka' => 'Georgian',
469 'de' => 'German',
470 'el' => 'Greek (Modern)',
471 'he' => 'Hebrew',
472 'hi' => 'Hindi',
473 'hu' => 'Hungarian',
474 'is' => 'Icelandic',
475 'io' => 'Ido',
476 'id' => 'Indonesian',
477 'it' => 'Italian',
478 'ja' => 'Japanese',
479 'kk' => 'Kazakh',
480 'ko' => 'Korean',
481 'lv' => 'Latvian',
482 'lb' => 'Letzeburgesch',
483 'lt' => 'Lithuanian',
484 'lu' => 'Luba-Katanga',
485 'mk' => 'Macedonian',
486 'mg' => 'Malagasy',
487 'ms' => 'Malay',
488 'ro' => 'Moldovan, Moldavian, Romanian',
489 'nb' => 'Norwegian Bokmål',
490 'nn' => 'Norwegian Nynorsk',
491 'fa' => 'Persian',
492 'pl' => 'Polish',
493 'pt' => 'Portuguese',
494 'ru' => 'Russian',
495 'sr' => 'Serbian',
496 'sk' => 'Slovak',
497 'sl' => 'Slovenian',
498 'es' => 'Spanish',
499 'sv' => 'Swedish',
500 'tr' => 'Turkish',
501 'uk' => 'Ukrainian',
502 'vi' => 'Vietnamese',
503 ],
504 'default' => 'en',
505 ]
506 );
507
508 $this->add_control(
509 'eael_event_time_format',
510 [
511 'label' => __('24-hour Time format', 'essential-addons-for-elementor-lite'),
512 'type' => Controls_Manager::SWITCHER,
513 'label_block' => false,
514 'return_value' => 'yes',
515 'description' => __('Hide Event Details link in event popup', 'essential-addons-for-elementor-lite'),
516 ]
517 );
518
519 $this->add_control(
520 'eael_event_calendar_default_view',
521 [
522 'label' => __('Calendar Default View', 'essential-addons-for-elementor-lite'),
523 'type' => Controls_Manager::SELECT,
524 'options' => [
525 'timeGridDay' => __('Day', 'essential-addons-for-elementor-lite'),
526 'timeGridWeek' => __('Week', 'essential-addons-for-elementor-lite'),
527 'dayGridMonth' => __('Month', 'essential-addons-for-elementor-lite'),
528 'listMonth' => __('List', 'essential-addons-for-elementor-lite'),
529 ],
530 'default' => 'dayGridMonth',
531 ]
532 );
533
534 $default_date = date('Y-m-d');
535 $this->add_control(
536 'eael_event_calendar_default_date',
537 [
538 'label' => __('Calendar Default Start Date', 'essential-addons-for-elementor-lite'),
539 'type' => Controls_Manager::DATE_TIME,
540 'label_block' => true,
541 'picker_options' => [
542 'enableTime' => false,
543 'dateFormat' => 'Y-m-d',
544 ],
545 'default' => $default_date,
546 ]
547 );
548
549 $this->add_control(
550 'eael_event_calendar_first_day',
551 [
552 'label' => __('First Day of Week', 'essential-addons-for-elementor-lite'),
553 'type' => Controls_Manager::SELECT,
554 'options' => [
555 '0' => __('Sunday', 'essential-addons-for-elementor-lite'),
556 '1' => __('Monday', 'essential-addons-for-elementor-lite'),
557 '2' => __('Tuesday', 'essential-addons-for-elementor-lite'),
558 '3' => __('Wednesday', 'essential-addons-for-elementor-lite'),
559 '4' => __('Thursday', 'essential-addons-for-elementor-lite'),
560 '5' => __('Friday', 'essential-addons-for-elementor-lite'),
561 '6' => __('Saturday', 'essential-addons-for-elementor-lite'),
562 ],
563 'default' => '0',
564 ]
565 );
566
567 $this->add_control(
568 'eael_event_details_link_hide',
569 [
570 'label' => __('Hide Event Details Link', 'essential-addons-for-elementor-lite'),
571 'type' => Controls_Manager::SWITCHER,
572 'label_block' => false,
573 'return_value' => 'yes',
574 'description' => __('Hide Event Details link in event popup', 'essential-addons-for-elementor-lite'),
575 ]
576 );
577
578 $this->add_control(
579 'eael_event_details_text',
580 [
581 'label' => __('Event Details Text', 'essential-addons-for-elementor-lite'),
582 'type' => Controls_Manager::TEXT,
583 'default' => __('Event Details','essential-addons-for-elementor-lite'),
584 'condition' => [
585 'eael_event_details_link_hide!' => 'yes',
586 ],
587 ]
588 );
589
590 if (apply_filters('eael/is_plugin_active', 'eventON/eventon.php') && apply_filters('eael/pro_enabled', false)) {
591 $this->add_control(
592 'eael_event_on_featured_color',
593 [
594 'label' => __('Featured Event Color', 'essential-addons-for-elementor-lite'),
595 'type' => Controls_Manager::COLOR,
596 'default' => '#ffcb55',
597 'condition' => [
598 'eael_event_calendar_type' => 'eventon',
599 ],
600 ]
601 );
602 }
603
604 $this->add_control(
605 'eael_event_global_bg_color',
606 [
607 'label' => __('Event Background Color', 'essential-addons-for-elementor-lite'),
608 'type' => Controls_Manager::COLOR,
609 'default' => '#5725ff',
610 'condition' => [
611 'eael_event_calendar_type!' => 'manual',
612 ],
613 ]
614 );
615
616 $this->add_control(
617 'eael_event_global_text_color',
618 [
619 'label' => __('Event Text Color', 'essential-addons-for-elementor-lite'),
620 'type' => Controls_Manager::COLOR,
621 'default' => '#ffffff',
622 'condition' => [
623 'eael_event_calendar_type!' => 'manual',
624 ],
625 ]
626 );
627 $this->add_control(
628 'eael_event_global_popup_ribbon_color',
629 [
630 'label' => __('Popup Ribbon Color', 'essential-addons-for-elementor-lite'),
631 'type' => Controls_Manager::COLOR,
632 'default' => '#10ecab',
633 'condition' => [
634 'eael_event_calendar_type!' => 'manual',
635 ],
636 ]
637 );
638
639 $this->end_controls_section();
640
641
642 /**
643 * Data cache setting
644 */
645 $this->start_controls_section(
646 'eael_event_calendar_data_cache',
647 [
648 'label' => __('Data Cache Setting', 'essential-addons-for-elementor-lite'),
649 'condition' => [
650 'eael_event_calendar_type!' => 'manual',
651 ],
652 ]
653 );
654
655 $this->add_control(
656 'eael_event_calendar_data_cache_limit',
657 [
658 'label' => __('Data Cache Time', 'essential-addons-for-elementor-lite'),
659 'type' => Controls_Manager::NUMBER,
660 'min' => 1,
661 'default' => 60,
662 'description' => __('Cache expiration time (Minutes)', 'essential-addons-for-elementor-lite')
663 ]
664 );
665
666 $this->end_controls_section();
667
668 /**
669 * Style Tab Started
670 */
671 $this->start_controls_section(
672 'eael_event_calendar_interface',
673 [
674 'label' => __('Calendar', 'essential-addons-for-elementor-lite'),
675 'tab' => Controls_Manager::TAB_STYLE,
676 ]
677 );
678
679 $this->add_control(
680 'calendar_background_color',
681 [
682 'label' => __('Background', 'essential-addons-for-elementor-lite'),
683 'type' => Controls_Manager::COLOR,
684 'selectors' => [
685 '{{WRAPPER}} .eael-event-calendar-wrapper' => 'background: {{VALUE}}',
686 '{{WRAPPER}} .eael-event-calendar-wrapper table tbody > tr > td' => 'background: {{VALUE}}',
687 ],
688 ]
689 );
690
691 $this->add_control(
692 'calendar_border_color',
693 [
694 'label' => __('Border Color', 'essential-addons-for-elementor-lite'),
695 'type' => Controls_Manager::COLOR,
696 'default' => '#CFCFDA',
697 'selectors' => [
698 '{{WRAPPER}} .eael-event-calendar-wrapper .fc td' => 'border-color: {{VALUE}}',
699 '{{WRAPPER}} .eael-event-calendar-wrapper hr.fc-divider' => 'border-color: {{VALUE}}',
700 '{{WRAPPER}} .eael-event-calendar-wrapper .fc th' => 'border-color: {{VALUE}}',
701 '{{WRAPPER}} .eael-event-calendar-wrapper .fc-view td.fc-today' => 'border-left-color: {{VALUE}}',
702 '{{WRAPPER}} .eael-event-calendar-wrapper .fc-view table thead:first-child tr:first-child td' => 'border-top-color: {{VALUE}} !important;',
703 '{{WRAPPER}} .eael-event-calendar-wrapper .fc-view.fc-listWeek-view' => 'border-color: {{VALUE}} !important;',
704 '{{WRAPPER}} .eael-event-calendar-wrapper .fc-view.fc-listMonth-view' => 'border-color: {{VALUE}} !important;',
705 ],
706 ]
707 );
708
709 $this->add_group_control(
710 Group_Control_Box_Shadow::get_type(),
711 [
712 'name' => 'eael_calendar_box_shadow',
713 'label' => __('Box Shadow', 'essential-addons-for-elementor-lite'),
714 'selector' => '{{WRAPPER}} .eael-event-calendar-wrapper .fc-view-container .fc-view > table',
715 ]
716 );
717
718 $this->add_responsive_control(
719 'calendar_inside',
720 [
721 'label' => esc_html__('Inside Space', 'essential-addons-for-elementor-lite'),
722 'type' => Controls_Manager::DIMENSIONS,
723 'size_units' => ['px', '%'],
724 'selectors' => [
725 '{{WRAPPER}} .eael-event-calendar-wrapper' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
726 ],
727 ]
728 );
729
730 $this->add_responsive_control(
731 'calendar_outside',
732 [
733 'label' => esc_html__('Outside Space', 'essential-addons-for-elementor-lite'),
734 'type' => Controls_Manager::DIMENSIONS,
735 'size_units' => ['px', '%'],
736 'selectors' => [
737 '{{WRAPPER}} .eael-event-calendar-wrapper' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
738 ],
739 'separator' => 'after',
740 ]
741 );
742
743 $this->add_control(
744 'calendar_title_heading',
745 [
746 'label' => __('Title', 'essential-addons-for-elementor-lite'),
747 'type' => Controls_Manager::HEADING,
748 ]
749 );
750
751 $this->add_group_control(
752 Group_Control_Typography::get_type(),
753 [
754 'name' => 'calendar_title_typography',
755 'label' => __('Typography', 'essential-addons-for-elementor-lite'),
756 'selector' => '{{WRAPPER}} .fc-toolbar h2',
757 ]
758 );
759
760 $this->add_control(
761 'calendar_title_color',
762 [
763 'label' => __('Color', 'essential-addons-for-elementor-lite'),
764 'type' => Controls_Manager::COLOR,
765 'selectors' => [
766 '{{WRAPPER}} .fc-toolbar h2' => 'color: {{VALUE}};',
767 ],
768 ]
769 );
770
771 // Buttons style
772 $this->add_control(
773 'buttons_style_heading',
774 [
775 'label' => __('Button', 'essential-addons-for-elementor-lite'),
776 'type' => Controls_Manager::HEADING,
777 'separator' => 'before',
778 ]
779 );
780
781 $this->add_group_control(
782 Group_Control_Typography::get_type(),
783 [
784 'name' => 'calendar_button_typography_normal',
785 'label' => __('Typography', 'essential-addons-for-elementor-lite'),
786 'selector' => '{{WRAPPER}} .eael-event-calendar-wrapper .fc-toolbar.fc-header-toolbar .fc-button',
787 ]
788 );
789
790 $this->start_controls_tabs('calendar_buttons_style');
791
792 // Normal
793 $this->start_controls_tab(
794 'button_normal_state',
795 [
796 'label' => __('Normal', 'essential-addons-for-elementor-lite'),
797 ]
798 );
799
800 $this->add_control(
801 'button_color_normal',
802 [
803 'label' => __('Color', 'essential-addons-for-elementor-lite'),
804 'type' => Controls_Manager::COLOR,
805 'selectors' => [
806 '{{WRAPPER}} .fc-toolbar.fc-header-toolbar .fc-button:not(.fc-button-active)' => 'color: {{VALUE}};',
807 ],
808 ]
809 );
810
811 $this->add_control(
812 'button_background_normal',
813 [
814 'label' => __('Background', 'essential-addons-for-elementor-lite'),
815 'type' => Controls_Manager::COLOR,
816 'selectors' => [
817 '{{WRAPPER}} .fc-toolbar.fc-header-toolbar .fc-button:not(.fc-button-active)' => 'background-color: {{VALUE}};',
818 ],
819 ]
820 );
821
822 $this->add_group_control(
823 Group_Control_Border::get_type(),
824 [
825 'name' => 'button_border_normal',
826 'label' => __('Border', 'essential-addons-for-elementor-lite'),
827 'selector' => '{{WRAPPER}} .fc-toolbar.fc-header-toolbar .fc-button:not(.fc-button-active)',
828 ]
829 );
830
831 $this->add_responsive_control(
832 'button_border_radius_normal',
833 [
834 'label' => esc_html__('Border Radius', 'essential-addons-for-elementor-lite'),
835 'type' => Controls_Manager::DIMENSIONS,
836 'size_units' => ['px', '%'],
837 'selectors' => [
838 '{{WRAPPER}} .fc-toolbar.fc-header-toolbar .fc-button:not(.fc-button-active)' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
839 ],
840 ]
841 );
842
843 $this->add_responsive_control(
844 'buttons_margin',
845 [
846 'label' => esc_html__('Space', 'essential-addons-for-elementor-lite'),
847 'type' => Controls_Manager::DIMENSIONS,
848 'size_units' => ['px', '%'],
849 'selectors' => [
850 '{{WRAPPER}} .fc-toolbar.fc-header-toolbar .fc-button:not(.fc-button-active)' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
851 ],
852 'separator' => 'after',
853 ]
854 );
855 // Buttons style
856
857 $this->end_controls_tab();
858
859 // Hover
860 $this->start_controls_tab(
861 'button_hover_state',
862 [
863 'label' => __('Hover', 'essential-addons-for-elementor-lite'),
864 ]
865 );
866
867 $this->add_control(
868 'button_color_hover',
869 [
870 'label' => __('Color', 'essential-addons-for-elementor-lite'),
871 'type' => Controls_Manager::COLOR,
872 'selectors' => [
873 '{{WRAPPER}} .fc-toolbar.fc-header-toolbar .fc-button:hover' => 'color: {{VALUE}};',
874 ],
875 ]
876 );
877
878 $this->add_control(
879 'button_background_hover',
880 [
881 'label' => __('Background', 'essential-addons-for-elementor-lite'),
882 'type' => Controls_Manager::COLOR,
883 'selectors' => [
884 '{{WRAPPER}} .fc-toolbar.fc-header-toolbar .fc-button:hover' => 'background-color: {{VALUE}};',
885 ],
886 ]
887 );
888
889 $this->add_group_control(
890 Group_Control_Border::get_type(),
891 [
892 'name' => 'button_border_hover',
893 'label' => __('Border', 'essential-addons-for-elementor-lite'),
894 'selector' => '{{WRAPPER}} .fc-toolbar.fc-header-toolbar .fc-button:hover',
895 ]
896 );
897
898 $this->add_responsive_control(
899 'button_border_radius_hover',
900 [
901 'label' => esc_html__('Border Radius', 'essential-addons-for-elementor-lite'),
902 'type' => Controls_Manager::DIMENSIONS,
903 'size_units' => ['px', '%'],
904 'selectors' => [
905 '{{WRAPPER}} .fc-toolbar.fc-header-toolbar .fc-button:hover' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
906 ],
907 'separator' => 'after',
908 ]
909 );
910
911 $this->end_controls_tab();
912
913 // Active
914 $this->start_controls_tab(
915 'button_active_state',
916 [
917 'label' => __('Active', 'essential-addons-for-elementor-lite'),
918 ]
919 );
920
921 $this->add_control(
922 'button_color_active',
923 [
924 'label' => __('Color', 'essential-addons-for-elementor-lite'),
925 'type' => Controls_Manager::COLOR,
926 'selectors' => [
927 '{{WRAPPER}} .fc-toolbar.fc-header-toolbar .fc-button.fc-button-active' => 'color: {{VALUE}};',
928 ],
929 ]
930 );
931
932 $this->add_control(
933 'button_background_active',
934 [
935 'label' => __('Background', 'essential-addons-for-elementor-lite'),
936 'type' => Controls_Manager::COLOR,
937 'selectors' => [
938 '{{WRAPPER}} .fc-toolbar.fc-header-toolbar .fc-button.fc-button-active' => 'background-color: {{VALUE}};',
939 ],
940 ]
941 );
942
943 $this->add_group_control(
944 Group_Control_Border::get_type(),
945 [
946 'name' => 'button_border_active',
947 'label' => __('Border', 'essential-addons-for-elementor-lite'),
948 'selector' => '{{WRAPPER}} .fc-toolbar.fc-header-toolbar .fc-button.fc-button-active',
949 ]
950 );
951
952 $this->add_responsive_control(
953 'button_border_radius_active',
954 [
955 'label' => esc_html__('Border Radius', 'essential-addons-for-elementor-lite'),
956 'type' => Controls_Manager::DIMENSIONS,
957 'size_units' => ['px', '%'],
958 'selectors' => [
959 '{{WRAPPER}} .fc-toolbar.fc-header-toolbar .fc-button.fc-button-active' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
960 ],
961 ]
962 );
963
964 $this->add_responsive_control(
965 'buttons_margin_active',
966 [
967 'label' => esc_html__('Space', 'essential-addons-for-elementor-lite'),
968 'type' => Controls_Manager::DIMENSIONS,
969 'size_units' => ['px', '%'],
970 'selectors' => [
971 '{{WRAPPER}} .fc-toolbar.fc-header-toolbar .fc-button.fc-button-active' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
972 ],
973 'separator' => 'after',
974 ]
975 );
976
977 $this->end_controls_tab();
978
979 $this->end_controls_tabs(); # end of $this->add_controls_tabs('calendar_buttons_style');
980
981 $this->end_controls_section();
982
983 /**
984 * Tab: Style => Panel: Days
985 * -----------------------------------------------
986 */
987 $this->start_controls_section(
988 'calendar_week_days',
989 [
990 'label' => __('Day', 'essential-addons-for-elementor-lite'),
991 'tab' => Controls_Manager::TAB_STYLE,
992 ]
993 );
994
995 $this->add_group_control(
996 Group_Control_Typography::get_type(),
997 [
998 'name' => 'days_typography',
999 'label' => __('Typography', 'essential-addons-for-elementor-lite'),
1000 'selector' => '{{WRAPPER}} .fc-row table thead:first-child tr:first-child th > span,{{WRAPPER}} .fc-listWeek-view .fc-list-table .fc-widget-header span,{{WRAPPER}} .fc-listMonth-view .fc-list-table .fc-widget-header span',
1001 ]
1002 );
1003
1004 $this->add_control(
1005 'days_color',
1006 [
1007 'label' => __('Color', 'essential-addons-for-elementor-lite'),
1008 'type' => Controls_Manager::COLOR,
1009 'selectors' => [
1010 '{{WRAPPER}} .fc-row table thead:first-child tr:first-child th > span' => 'color: {{VALUE}};',
1011
1012 ],
1013 ]
1014 );
1015
1016 $this->add_responsive_control(
1017 'days_position_alignment',
1018 [
1019 'label' => __('Alignment', 'essential-addons-for-elementor-lite'),
1020 'type' => Controls_Manager::CHOOSE,
1021 'options' => [
1022 'left' => [
1023 'title' => __('Left', 'essential-addons-for-elementor-lite'),
1024 'icon' => 'eicon-text-align-left',
1025 ],
1026 'center' => [
1027 'title' => __('Center', 'essential-addons-for-elementor-lite'),
1028 'icon' => 'eicon-text-align-center',
1029 ],
1030 'right' => [
1031 'title' => __('Right', 'essential-addons-for-elementor-lite'),
1032 'icon' => 'eicon-text-align-right',
1033 ],
1034 ],
1035 'default' => 'center',
1036 'toggle' => true,
1037 'selectors' => [
1038 '{{WRAPPER}} .fc-row table thead:first-child tr:first-child th' => 'text-align: {{VALUE}};',
1039 ],
1040 ]
1041 );
1042
1043 $this->add_group_control(
1044 Group_Control_Background::get_type(),
1045 [
1046 'name' => 'days_background',
1047 'label' => __('Background', 'essential-addons-for-elementor-lite'),
1048 'types' => ['classic', 'gradient'],
1049 'selector' => '{{WRAPPER}} .fc-row table thead:first-child tr:first-child th',
1050 'exclude' => [
1051 'image',
1052 ],
1053 ]
1054 );
1055
1056 $this->end_controls_section();
1057
1058 /**
1059 * Tab: Style => Panel: Time
1060 * -----------------------------------------------
1061 */
1062 $this->start_controls_section(
1063 'calendar_week_time',
1064 [
1065 'label' => __('Time', 'essential-addons-for-elementor-lite'),
1066 'tab' => Controls_Manager::TAB_STYLE,
1067 ]
1068 );
1069
1070 $this->add_group_control(
1071 Group_Control_Typography::get_type(),
1072 [
1073 'name' => 'time_typography',
1074 'label' => __('Typography', 'essential-addons-for-elementor-lite'),
1075 'selector' => '{{WRAPPER}} .fc-unthemed .fc-timeGridDay-view .fc-bg table tbody tr>td span, {{WRAPPER}} .fc-unthemed .fc-timeGridWeek-view .fc-bg table tbody tr>td span ,{{WRAPPER}} .fc-unthemed .fc-timeGridDay-view .fc-slats table tbody tr>td span ,{{WRAPPER}} .fc-unthemed .fc-timeGridWeek-view .fc-slats table tbody tr>td span',
1076 ]
1077 );
1078
1079 $this->add_control(
1080 'time_color',
1081 [
1082 'label' => __('Color', 'essential-addons-for-elementor-lite'),
1083 'type' => Controls_Manager::COLOR,
1084 'selectors' => [
1085 '{{WRAPPER}} .fc-unthemed .fc-timeGridDay-view .fc-bg table tbody tr>td span' => 'color: {{VALUE}};',
1086 '{{WRAPPER}} .fc-unthemed .fc-timeGridWeek-view .fc-bg table tbody tr>td span' => 'color: {{VALUE}};',
1087 '{{WRAPPER}} .fc-unthemed .fc-timeGridWeek-view .fc-slats table tbody tr>td span' => 'color: {{VALUE}};',
1088 '{{WRAPPER}} .fc-unthemed .fc-timeGridDay-view .fc-slats table tbody tr>td span' => 'color: {{VALUE}};',
1089
1090 ],
1091 ]
1092 );
1093
1094 $this->end_controls_section();
1095
1096 $this->start_controls_section(
1097 'date_styles',
1098 [
1099 'label' => __('Date', 'essential-addons-for-elementor-lite'),
1100 'tab' => Controls_Manager::TAB_STYLE,
1101 ]
1102 );
1103
1104 $this->add_group_control(
1105 Group_Control_Typography::get_type(),
1106 [
1107 'name' => 'date_typography',
1108 'label' => __('Typography', 'essential-addons-for-elementor-lite'),
1109 'selector' => '{{WRAPPER}} .fc-day-number',
1110 ]
1111 );
1112
1113 $this->add_control(
1114 'date_color',
1115 [
1116 'label' => __('Color', 'essential-addons-for-elementor-lite'),
1117 'type' => Controls_Manager::COLOR,
1118 'selectors' => [
1119 '{{WRAPPER}} .fc-day-number' => 'color: {{VALUE}}',
1120 ],
1121 ]
1122 );
1123
1124 $this->add_control(
1125 'date_number_background',
1126 [
1127 'type' => Controls_Manager::COLOR,
1128 'label' => __('Number Background', 'essential-addons-for-elementor-lite'),
1129 'selectors' => [
1130 '{{WRAPPER}} .fc-day-number' => 'background: {{VALUE}}',
1131 ],
1132 ]
1133 );
1134
1135 $this->add_control(
1136 'date_background',
1137 [
1138 'type' => Controls_Manager::COLOR,
1139 'label' => __('Background', 'essential-addons-for-elementor-lite'),
1140 'selectors' => [
1141 '{{WRAPPER}} .fc-day' => 'background: {{VALUE}} !important',
1142 '{{WRAPPER}} .fc-unthemed td.fc-today' => 'background: {{VALUE}} !important',
1143 '{{WRAPPER}} table tbody > tr > td' => 'background: {{VALUE}} !important',
1144 ],
1145 ]
1146 );
1147
1148 $this->add_responsive_control(
1149 'date_position_alignment',
1150 [
1151 'label' => __('Alignment', 'essential-addons-for-elementor-lite'),
1152 'type' => Controls_Manager::CHOOSE,
1153 'options' => [
1154 'left' => [
1155 'title' => __('Left', 'essential-addons-for-elementor-lite'),
1156 'icon' => 'eicon-text-align-left',
1157 ],
1158 'center' => [
1159 'title' => __('Center', 'essential-addons-for-elementor-lite'),
1160 'icon' => 'eicon-text-align-center',
1161 ],
1162 'right' => [
1163 'title' => __('Right', 'essential-addons-for-elementor-lite'),
1164 'icon' => 'eicon-text-align-right',
1165 ],
1166 ],
1167 'default' => 'center',
1168 'toggle' => true,
1169 'selectors' => [
1170 '{{WRAPPER}} .fc-day-number' => 'float: unset',
1171 '{{WRAPPER}} .fc-view table thead:first-child tr:first-child td' => 'text-align: {{VALUE}};',
1172 ],
1173 ]
1174 );
1175
1176 $this->add_responsive_control(
1177 'date_padding',
1178 [
1179 'label' => esc_html__('Inside Space', 'essential-addons-for-elementor-lite'),
1180 'type' => Controls_Manager::DIMENSIONS,
1181 'size_units' => ['px', 'em', '%'],
1182 'selectors' => [
1183 '{{WRAPPER}} .fc-day-number' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1184 ],
1185 ]
1186 );
1187
1188 $this->add_responsive_control(
1189 'date_border_radius',
1190 [
1191 'label' => esc_html__('Border Radius', 'essential-addons-for-elementor-lite'),
1192 'type' => Controls_Manager::DIMENSIONS,
1193 'size_units' => ['px', '%'],
1194 'selectors' => [
1195 '{{WRAPPER}} .fc-day-number' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1196 ],
1197 ]
1198 );
1199
1200 $this->add_responsive_control(
1201 'date_margin',
1202 [
1203 'label' => esc_html__('Outside Space', 'essential-addons-for-elementor-lite'),
1204 'type' => Controls_Manager::DIMENSIONS,
1205 'size_units' => ['px', 'em', '%'],
1206 'selectors' => [
1207 '{{WRAPPER}} .fc-day-number' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1208 ],
1209 ]
1210 );
1211
1212 $this->add_control(
1213 'today_date_setting',
1214 [
1215 'label' => __('Today Date', 'essential-addons-for-elementor-lite'),
1216 'type' => Controls_Manager::HEADING,
1217 'separator' => 'before',
1218 ]
1219 );
1220
1221 $this->add_control(
1222 'today_date_color',
1223 [
1224 'type' => Controls_Manager::COLOR,
1225 'label' => __('Color', 'essential-addons-for-elementor-lite'),
1226 'default' => '#1111e1',
1227 'selectors' => [
1228 '{{WRAPPER}} .fc-today .fc-day-number' => 'color: {{VALUE}}',
1229 ],
1230 ]
1231 );
1232
1233 $this->add_control(
1234 'today_date_background',
1235 [
1236 'type' => Controls_Manager::COLOR,
1237 'label' => __('Background', 'essential-addons-for-elementor-lite'),
1238 'selectors' => [
1239 '{{WRAPPER}} .fc-unthemed td.fc-today' => 'background: {{VALUE}} !important',
1240 ],
1241 ]
1242 );
1243
1244 $this->end_controls_section();
1245
1246 /**
1247 * Tab: Style => Panel: List
1248 * -----------------------------------------------
1249 */
1250 $this->start_controls_section(
1251 'calendar_list_view',
1252 [
1253 'label' => __('List view', 'essential-addons-for-elementor-lite'),
1254 'tab' => Controls_Manager::TAB_STYLE,
1255 ]
1256 );
1257
1258 $this->add_control(
1259 'eael_list_view_header_heading',
1260 [
1261 'label' => __('Header', 'essential-addons-for-elementor-lite'),
1262 'type' => Controls_Manager::HEADING,
1263 ]
1264 );
1265
1266 $this->add_control(
1267 'list_row_header_color',
1268 [
1269 'label' => __('Text Color', 'essential-addons-for-elementor-lite'),
1270 'type' => Controls_Manager::COLOR,
1271 'selectors' => [
1272 '{{WRAPPER}} .eael-event-calendar-wrapper .fc-listWeek-view .fc-list-table .fc-widget-header span' => 'color: {{VALUE}};',
1273 '{{WRAPPER}} .eael-event-calendar-wrapper .fc-listMonth-view .fc-list-table .fc-widget-header span' => 'color: {{VALUE}};',
1274 ],
1275 ]
1276 );
1277
1278 $this->add_control(
1279 'list_header_background_color',
1280 [
1281 'label' => __('Background Color', 'essential-addons-for-elementor-lite'),
1282 'type' => Controls_Manager::COLOR,
1283 'default' => '#f1edf8',
1284 'selectors' => [
1285 '{{WRAPPER}} .eael-event-calendar-wrapper .fc-view.fc-listWeek-view .fc-list-table tr.fc-list-heading td.fc-widget-header' => 'background-color: {{VALUE}};',
1286 '{{WRAPPER}} .eael-event-calendar-wrapper .fc-view.fc-listMonth-view .fc-list-table tr.fc-list-heading td.fc-widget-header' => 'background-color: {{VALUE}};',
1287 ],
1288 ]
1289 );
1290
1291 $this->add_control(
1292 'eael_list_view_body_heading',
1293 [
1294 'label' => __('Body', 'essential-addons-for-elementor-lite'),
1295 'type' => Controls_Manager::HEADING,
1296 ]
1297 );
1298
1299 $this->add_control(
1300 'list_element_text_color',
1301 [
1302 'label' => __('Text Color', 'essential-addons-for-elementor-lite'),
1303 'type' => Controls_Manager::COLOR,
1304 'selectors' => [
1305 '{{WRAPPER}} .eael-event-calendar-wrapper .fc-listWeek-view .fc-list-table .fc-list-item' => 'color: {{VALUE}};',
1306 '{{WRAPPER}} .eael-event-calendar-wrapper .fc-listMonth-view .fc-list-table .fc-list-item' => 'color: {{VALUE}};',
1307 ],
1308 ]
1309 );
1310
1311 $this->add_control(
1312 'list_element_even_color',
1313 [
1314 'label' => __('Even row Color', 'essential-addons-for-elementor-lite'),
1315 'type' => Controls_Manager::COLOR,
1316 'default' => '#ffffff',
1317 'selectors' => [
1318 '{{WRAPPER}} .eael-event-calendar-wrapper .fc-view.fc-listWeek-view .fc-list-table tr.fc-list-item:nth-child(even) td' => 'background-color: {{VALUE}};',
1319 '{{WRAPPER}} .eael-event-calendar-wrapper .fc-view.fc-listMonth-view .fc-list-table tr.fc-list-item:nth-child(even) td' => 'background-color: {{VALUE}};',
1320 ],
1321 ]
1322 );
1323 $this->add_control(
1324 'list_element_odd_color',
1325 [
1326 'label' => __('Odd row Color', 'essential-addons-for-elementor-lite'),
1327 'type' => Controls_Manager::COLOR,
1328 'default' => '#ffffff',
1329 'selectors' => [
1330 '{{WRAPPER}} .eael-event-calendar-wrapper .fc-view.fc-listWeek-view .fc-list-table tr.fc-list-item:nth-child(odd) td' => 'background-color: {{VALUE}};',
1331 '{{WRAPPER}} .eael-event-calendar-wrapper .fc-view.fc-listMonth-view .fc-list-table tr.fc-list-item:nth-child(odd) td' => 'background-color: {{VALUE}};',
1332
1333 ],
1334 ]
1335 );
1336
1337 $this->end_controls_section();
1338
1339 $this->start_controls_section(
1340 'eaelec_event_section',
1341 [
1342 'label' => __('Events', 'essential-addons-for-elementor-lite'),
1343 'tab' => Controls_Manager::TAB_STYLE,
1344 ]
1345 );
1346
1347 $this->add_group_control(
1348 Group_Control_Typography::get_type(),
1349 [
1350 'name' => 'eael_event_typography',
1351 'label' => __('Typography', 'essential-addons-for-elementor-lite'),
1352 'selector' => '{{WRAPPER}} .fc-content .fc-title,{{WRAPPER}} .fc-content .fc-time,{{WRAPPER}} .eael-event-calendar-wrapper .fc-list-table .fc-list-item td',
1353 ]
1354 );
1355
1356 $this->add_responsive_control(
1357 'day_event_border_radius',
1358 [
1359 'label' => esc_html__('Border Radius', 'essential-addons-for-elementor-lite'),
1360 'type' => Controls_Manager::DIMENSIONS,
1361 'size_units' => ['px', '%'],
1362 'selectors' => [
1363 '{{WRAPPER}} .fc-day-grid-event' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1364 ],
1365 ]
1366 );
1367
1368 $this->add_responsive_control(
1369 'day_event_padding',
1370 [
1371 'label' => esc_html__('Inside Space', 'essential-addons-for-elementor-lite'),
1372 'type' => Controls_Manager::DIMENSIONS,
1373 'size_units' => ['px' . 'em', '%'],
1374 'selectors' => [
1375 '{{WRAPPER}} .fc-day-grid-event' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1376 ],
1377 ]
1378 );
1379
1380 $this->add_responsive_control(
1381 'day_event_margin',
1382 [
1383 'label' => esc_html__('Outside Space', 'essential-addons-for-elementor-lite'),
1384 'type' => Controls_Manager::DIMENSIONS,
1385 'size_units' => ['px' . 'em', '%'],
1386 'selectors' => [
1387 '{{WRAPPER}} .fc-day-grid-event' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1388 ],
1389 ]
1390 );
1391
1392 $this->end_controls_section();
1393
1394 $this->start_controls_section(
1395 'event_popup',
1396 [
1397 'label' => __('Event Popup', 'essential-addons-for-elementor-lite'),
1398 'tab' => Controls_Manager::TAB_STYLE,
1399 ]
1400 );
1401
1402 $this->add_control(
1403 'event_popup_title_heading',
1404 [
1405 'label' => __('Title', 'essential-addons-for-elementor-lite'),
1406 'type' => Controls_Manager::HEADING,
1407 ]
1408 );
1409
1410 $this->add_group_control(
1411 Group_Control_Typography::get_type(),
1412 [
1413 'name' => 'event_popup_title_typography',
1414 'label' => __('Typography', 'essential-addons-for-elementor-lite'),
1415 'selector' => '{{WRAPPER}} .eaelec-modal-header .eael-ec-modal-title',
1416 ]
1417 );
1418
1419 $this->add_control(
1420 'event_popup_title_color',
1421 [
1422 'label' => __('Title Color', 'essential-addons-for-elementor-lite'),
1423 'type' => Controls_Manager::COLOR,
1424 'selectors' => [
1425 '{{WRAPPER}} .eaelec-modal-header .eael-ec-modal-title' => 'color: {{VALUE}}',
1426 ],
1427 ]
1428 );
1429
1430 $this->add_control(
1431 'event_popup_date_heading',
1432 [
1433 'label' => __('Date', 'essential-addons-for-elementor-lite'),
1434 'type' => Controls_Manager::HEADING,
1435 'separator' => 'before',
1436 ]
1437 );
1438
1439 $this->add_group_control(
1440 Group_Control_Typography::get_type(),
1441 [
1442 'name' => 'event_popup_date_typography',
1443 'label' => __('Typography', 'essential-addons-for-elementor-lite'),
1444 'selector' => '{{WRAPPER}} .eaelec-modal-header > span.eaelec-event-popup-date',
1445 ]
1446 );
1447
1448 $this->add_control(
1449 'event_popup_date_color',
1450 [
1451 'label' => __('Date Color', 'essential-addons-for-elementor-lite'),
1452 'type' => Controls_Manager::COLOR,
1453 'selectors' => [
1454 '{{WRAPPER}} .eaelec-modal-header span.eaelec-event-date-start' => 'color: {{VALUE}};',
1455 '{{WRAPPER}} .eaelec-modal-header span.eaelec-event-date-end' => 'color: {{VALUE}};',
1456 ],
1457 ]
1458 );
1459
1460 $this->add_control(
1461 'event_popup_date_icon',
1462 [
1463 'label' => __('Date Icon', 'essential-addons-for-elementor-lite'),
1464 'type' => Controls_Manager::HEADING,
1465 'separator' => 'before',
1466 ]
1467 );
1468
1469 $this->add_control(
1470 'event_popup_date_icon_size',
1471 [
1472 'label' => __('Icon Size', 'essential-addons-for-elementor-lite'),
1473 'type' => Controls_Manager::SLIDER,
1474 'size_units' => ['px'],
1475 'range' => [
1476 'px' => [
1477 'min' => 0,
1478 'max' => 100,
1479 ],
1480 ],
1481 'selectors' => [
1482 '{{WRAPPER}} .eaelec-modal-header span.eaelec-event-date-start i' => 'font-size: {{SIZE}}{{UNIT}};',
1483 ],
1484 ]
1485 );
1486
1487 $this->add_control(
1488 'event_popup_date_icon_color',
1489 [
1490 'label' => __('Icon Color', 'essential-addons-for-elementor-lite'),
1491 'type' => Controls_Manager::COLOR,
1492 'selectors' => [
1493 '{{WRAPPER}} .eaelec-modal-header span.eaelec-event-date-start i' => 'color: {{VALUE}};',
1494 ],
1495 ]
1496 );
1497
1498 $this->add_control(
1499 'event_popup_content_heading',
1500 [
1501 'label' => __('Content', 'essential-addons-for-elementor-lite'),
1502 'type' => Controls_Manager::HEADING,
1503 'separator' => 'before',
1504 ]
1505 );
1506
1507 $this->add_group_control(
1508 Group_Control_Typography::get_type(),
1509 [
1510 'name' => 'event_popup_content_typography',
1511 'label' => __('Typography', 'essential-addons-for-elementor-lite'),
1512 'selector' => '{{WRAPPER}} .eaelec-modal-body',
1513 ]
1514 );
1515
1516 $this->add_control(
1517 'event_popup_content_color',
1518 [
1519 'label' => __('Content Color', 'essential-addons-for-elementor-lite'),
1520 'type' => Controls_Manager::COLOR,
1521 'selectors' => [
1522 '{{WRAPPER}} .eaelec-modal-body' => 'color: {{VALUE}};',
1523 ],
1524 ]
1525 );
1526
1527 $this->add_control(
1528 'event_popup_close_button_style',
1529 [
1530 'label' => __(' Close Button', 'essential-addons-for-elementor-lite'),
1531 'type' => Controls_Manager::HEADING,
1532 'separator' => 'before',
1533 ]
1534 );
1535
1536 $this->add_responsive_control(
1537 'close_button_icon_size',
1538 [
1539 'label' => __('Icon Size', 'essential-addons-for-elementor-lite'),
1540 'type' => Controls_Manager::SLIDER,
1541 'size_units' => ['px', 'em', '%'],
1542 'range' => [
1543 'px' => [
1544 'min' => 0,
1545 'max' => 100,
1546 ],
1547 'em' => [
1548 'min' => 0,
1549 'max' => 100,
1550 ],
1551 '%' => [
1552 'min' => 0,
1553 'max' => 100,
1554 ],
1555 ],
1556 'selectors' => [
1557 '{{WRAPPER}} .eaelec-modal-close > span' => 'font-size: {{SIZE}}{{UNIT}};',
1558 ],
1559 ]
1560 );
1561
1562 $this->add_responsive_control(
1563 'close_button_size',
1564 [
1565 'label' => __('Button Size', 'essential-addons-for-elementor-lite'),
1566 'type' => Controls_Manager::SLIDER,
1567 'size_units' => ['px', 'em', '%'],
1568 'range' => [
1569 'px' => [
1570 'min' => 0,
1571 'max' => 100,
1572 ],
1573 'em' => [
1574 'min' => 0,
1575 'max' => 100,
1576 ],
1577 '%' => [
1578 'min' => 0,
1579 'max' => 100,
1580 ],
1581 ],
1582 'selectors' => [
1583 '{{WRAPPER}} .eaelec-modal-close' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};',
1584 ],
1585 ]
1586 );
1587
1588 $this->add_control(
1589 'close_button_color',
1590 [
1591 'label' => __('Color', 'essential-addons-for-elementor-lite'),
1592 'type' => Controls_Manager::COLOR,
1593 'selectors' => [
1594 '{{WRAPPER}} .eaelec-modal-close > span' => 'color: {{VALUE}};',
1595 ],
1596 ]
1597 );
1598
1599 $this->add_group_control(
1600 Group_Control_Background::get_type(),
1601 [
1602 'name' => 'close_button_background',
1603 'label' => __('Background', 'essential-addons-for-elementor-lite'),
1604 'types' => [
1605 'classic',
1606 'gradient',
1607 ],
1608 'selector' => '{{WRAPPER}} .eael-event-calendar-wrapper .eaelec-modal-close',
1609 'exclude' => [
1610 'image',
1611 ],
1612 ]
1613 );
1614
1615 $this->add_group_control(
1616 Group_Control_Border::get_type(),
1617 [
1618 'name' => 'close_button_border',
1619 'label' => __('Border', 'essential-addons-for-elementor-lite'),
1620 'selector' => '{{WRAPPER}} .eael-event-calendar-wrapper .eaelec-modal-close',
1621 ]
1622 );
1623
1624 $this->add_responsive_control(
1625 'close_button_border_radius',
1626 [
1627 'label' => __('Border Radius', 'essential-addons-for-elementor-lite'),
1628 'type' => Controls_Manager::SLIDER,
1629 'size_units' => ['px', '%'],
1630 'range' => [
1631 'px' => [
1632 'min' => 0,
1633 'max' => 100,
1634 'step' => 1,
1635 ],
1636 '%' => [
1637 'min' => 0,
1638 'max' => 100,
1639 ],
1640 ],
1641 'selectors' => [
1642 '{{WRAPPER}} .eael-event-calendar-wrapper .eaelec-modal-close' => 'border-radius: {{SIZE}}{{UNIT}};',
1643 ],
1644 ]
1645 );
1646
1647 $this->add_group_control(
1648 Group_Control_Box_Shadow::get_type(),
1649 [
1650 'name' => 'close_button_box_shadow',
1651 'label' => __('Box Shadow', 'essential-addons-for-elementor-lite'),
1652 'selector' => '{{WRAPPER}} .eael-event-calendar-wrapper .eaelec-modal-close',
1653 ]
1654 );
1655
1656 $this->add_control(
1657 'event_popup_ext_link_heading',
1658 [
1659 'label' => __('External Link', 'essential-addons-for-elementor-lite'),
1660 'type' => Controls_Manager::HEADING,
1661 'separator' => 'before',
1662 ]
1663 );
1664
1665 $this->add_group_control(
1666 Group_Control_Typography::get_type(),
1667 [
1668 'name' => 'event_popup_ext_link_typography',
1669 'label' => __('Typography', 'essential-addons-for-elementor-lite'),
1670 'selector' => '{{WRAPPER}} .eaelec-modal-footer .eaelec-event-details-link',
1671 ]
1672 );
1673
1674 $this->add_control(
1675 'event_popup_ext_link_color',
1676 [
1677 'label' => __('Date Color', 'essential-addons-for-elementor-lite'),
1678 'type' => Controls_Manager::COLOR,
1679 'selectors' => [
1680 '{{WRAPPER}} .eaelec-modal-footer .eaelec-event-details-link' => 'color: {{VALUE}};',
1681 ],
1682 'separator' => 'after',
1683 ]
1684 );
1685
1686 $this->add_group_control(
1687 Group_Control_Border::get_type(),
1688 [
1689 'name' => 'event_popup_border',
1690 'label' => __('Border', 'essential-addons-for-elementor-lite'),
1691 'selector' => '{{WRAPPER}} .eaelec-modal .eaelec-modal-content',
1692 ]
1693 );
1694
1695 $this->add_responsive_control(
1696 'event_popup_border_radius',
1697 [
1698 'label' => esc_html__('Border Radius', 'essential-addons-for-elementor-lite'),
1699 'type' => Controls_Manager::DIMENSIONS,
1700 'size_units' => ['px', '%'],
1701 'selectors' => [
1702 '{{WRAPPER}} .eaelec-modal .eaelec-modal-content' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1703 ],
1704 'separator' => 'after',
1705 ]
1706 );
1707
1708 $this->add_group_control(
1709 Group_Control_Background::get_type(),
1710 [
1711 'name' => 'event_popup_background',
1712 'label' => __('Background', 'essential-addons-for-elementor-lite'),
1713 'types' => ['classic', 'gradient'],
1714 'selector' => '{{WRAPPER}} .eaelec-modal .eaelec-modal-content',
1715 'exclude' => [
1716 'image',
1717 ],
1718 ]
1719 );
1720
1721 $this->add_group_control(
1722 Group_Control_Box_Shadow::get_type(),
1723 [
1724 'name' => 'event_popup_box_shadow',
1725 'label' => __('Box Shadow', 'essential-addons-for-elementor-lite'),
1726 'selector' => '{{WRAPPER}} .eaelec-modal .eaelec-modal-content',
1727 ]
1728 );
1729
1730 $this->end_controls_section();
1731 }
1732
1733 protected function render()
1734 {
1735 $settings = $this->get_settings_for_display();
1736
1737 if (in_array($settings['eael_event_calendar_type'], ['eventon'])) {
1738 $data = apply_filters('eael/event-calendar/integration', [], $settings);
1739 } elseif ($settings['eael_event_calendar_type'] == 'google') {
1740 $data = $this->get_google_calendar_events($settings);
1741 } elseif ($settings['eael_event_calendar_type'] == 'the_events_calendar') {
1742 $data = $this->get_the_events_calendar_events($settings);
1743 } else {
1744 $data = $this->get_manual_calendar_events($settings);
1745 }
1746
1747 $local = $settings['eael_event_calendar_language'];
1748 $default_view = $settings['eael_event_calendar_default_view'];
1749 $default_date = $settings['eael_event_calendar_default_date'];
1750 $time_format = $settings['eael_event_time_format'];
1751 $translate_date = [
1752 'today' => __('Today', 'essential-addons-for-elementor-lite'),
1753 'tomorrow' => __('Tomorrow', 'essential-addons-for-elementor-lite'),
1754 ];
1755
1756 echo '<div class="eael-event-calendar-wrapper">';
1757
1758 echo '<div id="eael-event-calendar-' . $this->get_id() . '" class="eael-event-calendar-cls"
1759 data-cal_id = "' . $this->get_id() . '"
1760 data-locale = "' . $local . '"
1761 data-translate = "' . htmlspecialchars(json_encode($translate_date), ENT_QUOTES, 'UTF-8') . '"
1762 data-defaultview = "' . $default_view . '"
1763 data-defaultdate = "' . $default_date . '"
1764 data-time_format = "' . $time_format . '"
1765 data-events="' . htmlspecialchars(json_encode($data), ENT_QUOTES, 'UTF-8') . '"
1766 data-first_day="' . $settings['eael_event_calendar_first_day'] . '"></div>
1767 ' . $this->eaelec_load_event_details() . '
1768 </div>';
1769 }
1770
1771 protected function eaelec_load_event_details()
1772 {
1773 $event_details_text = $this->get_settings('eael_event_details_text');
1774 return '<div id="eaelecModal" class="eaelec-modal eael-zoom-in">
1775 <div class="eael-ec-modal-bg"></div>
1776 <div class="eaelec-modal-content">
1777 <div class="eaelec-modal-header">
1778 <div class="eaelec-modal-close"><span><i class="fas fa-times"></i></span></div>
1779 <h2 class="eael-ec-modal-title"></h2>
1780 <span class="eaelec-event-date-start eaelec-event-popup-date"></span>
1781 <span class="eaelec-event-date-end eaelec-event-popup-date"></span>
1782 </div>
1783 <div class="eaelec-modal-body">
1784 <p></p>
1785 </div>
1786 <div class="eaelec-modal-footer">
1787 <a class="eaelec-event-details-link">' . esc_html($event_details_text) . '</a>
1788 </div>
1789 </div>
1790 </div>';
1791 }
1792
1793 public function get_manual_calendar_events($settings)
1794 {
1795 $events = $settings['eael_event_items'];
1796 $data = [];
1797 if ($events) {
1798 $i = 0;
1799 foreach ($events as $event) {
1800
1801 if ($event['eael_event_all_day'] == 'yes') {
1802 $start = $event["eael_event_start_date_allday"];
1803 $end = date('Y-m-d', strtotime("+1 days", strtotime($event["eael_event_end_date_allday"])));
1804 } else {
1805 $start = $event["eael_event_start_date"];
1806 $end = date('Y-m-d H:i', strtotime($event["eael_event_end_date"])) . ":01";
1807 }
1808
1809 $settings_eael_event_global_bg_color = $this->fetch_color_or_global_color($event, 'eael_event_bg_color');
1810 $settings_eael_event_global_text_color = $this->fetch_color_or_global_color($event, 'eael_event_text_color');
1811 $settings_eael_event_global_popup_ribbon_color = $this->fetch_color_or_global_color($event, 'eael_event_border_color');
1812
1813 $_custom_attributes = $event['eael_event_link']['custom_attributes'];
1814 $_custom_attributes = explode(',', $_custom_attributes );
1815 $custom_attributes = [];
1816
1817 if ( $_custom_attributes ) {
1818 foreach ( $_custom_attributes as $attribute ) {
1819 if ( $attribute ) {
1820 $attribute_set = explode( '|', $attribute );
1821 $custom_attributes[] = [
1822 'key' => sanitize_text_field($attribute_set[0]),
1823 'value' => isset( $attribute_set[1] ) ? sanitize_text_field($attribute_set[1]) : ''
1824 ];
1825 }
1826 }
1827 }
1828
1829 $data[] = [
1830 'id' => $i,
1831 'title' => !empty($event["eael_event_title"]) ? $event["eael_event_title"] : 'No Title',
1832 'description' => $event["eael_event_description"],
1833 'start' => $start,
1834 'end' => $end,
1835 'borderColor' => !empty($settings_eael_event_global_popup_ribbon_color) ? $settings_eael_event_global_popup_ribbon_color : '#10ecab',
1836 'textColor' => $settings_eael_event_global_text_color,
1837 'color' => $settings_eael_event_global_bg_color,
1838 'url' => ($settings['eael_event_details_link_hide'] !== 'yes') ? $event["eael_event_link"]["url"] : '',
1839 'allDay' => $event['eael_event_all_day'],
1840 'external' => $event['eael_event_link']['is_external'],
1841 'nofollow' => $event['eael_event_link']['nofollow'],
1842 'custom_attributes' => $custom_attributes,
1843 ];
1844
1845 $i++;
1846 }
1847 }
1848 return $data;
1849 }
1850
1851 /**
1852 * get google calendar events
1853 *
1854 * @param $settings
1855 *
1856 * @return array
1857 */
1858 public function get_google_calendar_events($settings)
1859 {
1860
1861 if (empty($settings['eael_event_google_api_key']) && empty($settings['eael_event_calendar_id'])) {
1862 return [];
1863 }
1864
1865 $calendar_id = urlencode($settings['eael_event_calendar_id']);
1866 $base_url = "https://www.googleapis.com/calendar/v3/calendars/{$calendar_id}/events";
1867
1868 $start_date = strtotime($settings['eael_google_calendar_start_date']);
1869 $end_date = strtotime($settings['eael_google_calendar_end_date']);
1870
1871 $arg = [
1872 'key' => $settings['eael_event_google_api_key'],
1873 'maxResults' => $settings['eael_google_calendar_max_result'],
1874 'timeMin' => urlencode(date('c', $start_date)),
1875 'singleEvents' => 'true',
1876 'calendar_id' => urlencode($settings['eael_event_calendar_id']),
1877 ];
1878
1879 $transient_args = [
1880 'key' => $settings['eael_event_google_api_key'],
1881 'maxResults' => $settings['eael_google_calendar_max_result'],
1882 'timeMin' => urlencode(date('Y-m-d H', $start_date)),
1883 'singleEvents' => 'true',
1884 'calendar_id' => urlencode($settings['eael_event_calendar_id']),
1885 'cache_time' => $settings['eael_event_calendar_data_cache_limit']
1886 ];
1887
1888 if (!empty($end_date) && $end_date > $start_date) {
1889 $arg['timeMax'] = urlencode(date('c', $end_date));
1890 $transient_args['timeMax'] = urlencode(date('Y-m-d H', $end_date));
1891 }
1892
1893 $transient_key = 'eael_google_calendar_' . md5(implode('', $transient_args));
1894 $data = get_transient($transient_key);
1895
1896 if (isset($arg['calendar_id'])) {
1897 unset($arg['calendar_id']);
1898 }
1899
1900 if (empty($data)) {
1901 $data = wp_remote_retrieve_body(wp_remote_get(add_query_arg($arg, $base_url)));
1902 $check_error = json_decode($data);
1903
1904 if(!empty($check_error->error)){
1905 return [];
1906 }
1907 set_transient($transient_key, $data, $settings['eael_event_calendar_data_cache_limit'] * MINUTE_IN_SECONDS);
1908 }
1909
1910 $calendar_data = [];
1911 $data = json_decode($data);
1912 if (isset($data->items)) {
1913
1914 foreach ($data->items as $key => $item) {
1915 if ($item->status !== 'confirmed') {
1916 continue;
1917 }
1918 $all_day = '';
1919 if (isset($item->start->date)) {
1920 $all_day = 'yes';
1921 $ev_start_date = $item->start->date;
1922 $ev_end_date = $item->end->date;
1923 } else {
1924 $ev_start_date = $item->start->dateTime;
1925 $ev_end_date = $item->end->dateTime;
1926 }
1927
1928 $settings_eael_event_global_bg_color = $this->fetch_color_or_global_color($settings, 'eael_event_global_bg_color');
1929 $settings_eael_event_global_text_color = $this->fetch_color_or_global_color($settings, 'eael_event_global_text_color');
1930 $settings_eael_event_global_popup_ribbon_color = $this->fetch_color_or_global_color($settings, 'eael_event_global_popup_ribbon_color');
1931
1932 $calendar_data[] = [
1933 'id' => ++$key,
1934 'title' => !empty($item->summary) ? $item->summary : 'No Title',
1935 'description' => isset($item->description) ? $item->description : '',
1936 'start' => $ev_start_date,
1937 'end' => $ev_end_date,
1938 'borderColor' => !empty($settings_eael_event_global_popup_ribbon_color) ? $settings_eael_event_global_popup_ribbon_color : '#10ecab',
1939 'textColor' => $settings_eael_event_global_text_color,
1940 'color' => $settings_eael_event_global_bg_color,
1941 'url' => ($settings['eael_event_details_link_hide'] !== 'yes') ? $item->htmlLink : '',
1942 'allDay' => $all_day,
1943 'external' => 'on',
1944 'nofollow' => 'on',
1945 ];
1946 }
1947
1948 }
1949
1950 return $calendar_data;
1951 }
1952
1953 /**
1954 * @param $settings
1955 *
1956 * @return array
1957 * @since 3.8.2
1958 */
1959 public function get_the_events_calendar_events($settings)
1960 {
1961
1962 if (!function_exists('tribe_get_events')) {
1963 return [];
1964 }
1965 $arg = [
1966 'posts_per_page' => $settings['eael_the_events_calendar_max_result'],
1967 ];
1968 if ($settings['eael_the_events_calendar_fetch'] == 'date_range') {
1969 $arg['start_date'] = $settings['eael_the_events_calendar_start_date'];
1970 $arg['end_date'] = $settings['eael_the_events_calendar_end_date'];
1971 }
1972 if (!empty($settings['eael_the_events_calendar_category'])) {
1973 $arg['tax_query'] = [
1974 [
1975 'taxonomy' => 'tribe_events_cat', 'field' => 'id',
1976 'terms' => $settings['eael_the_events_calendar_category'],
1977 ],
1978 ];
1979 }
1980 $events = tribe_get_events($arg);
1981 if (empty($events)) {
1982 return [];
1983 }
1984
1985 $calendar_data = [];
1986 foreach ($events as $key => $event) {
1987 $date_format = 'Y-m-d';
1988 $all_day = 'yes';
1989 if (!tribe_event_is_all_day($event->ID)) {
1990 $date_format .= ' H:i';
1991 $all_day = '';
1992 }
1993
1994
1995 if (tribe_event_is_all_day($event->ID)) {
1996 $end = date('Y-m-d', strtotime("+1 days", strtotime(tribe_get_end_date($event->ID, true, $date_format))));
1997 } else {
1998 $end = date('Y-m-d H:i', strtotime(tribe_get_end_date($event->ID, true, $date_format))) . ":01";
1999 }
2000
2001 $settings_eael_event_global_bg_color = $this->fetch_color_or_global_color($settings, 'eael_event_global_bg_color');
2002 $settings_eael_event_global_text_color = $this->fetch_color_or_global_color($settings, 'eael_event_global_text_color');
2003 $settings_eael_event_global_popup_ribbon_color = $this->fetch_color_or_global_color($settings, 'eael_event_global_popup_ribbon_color');
2004
2005 $calendar_data[] = [
2006 'id' => ++$key,
2007 'title' => !empty($event->post_title) ? $event->post_title : __('No Title',
2008 'essential-addons-for-elementor-lite'),
2009 'description' => do_shortcode($event->post_content),
2010 'start' => tribe_get_start_date($event->ID, true, $date_format),
2011 'end' => $end,
2012 'borderColor' => !empty($settings_eael_event_global_popup_ribbon_color) ? $settings_eael_event_global_popup_ribbon_color : '#10ecab',
2013 'textColor' => $settings_eael_event_global_text_color,
2014 'color' => $settings_eael_event_global_bg_color,
2015 'url' => ($settings['eael_event_details_link_hide'] !== 'yes') ? get_the_permalink($event->ID) : '',
2016 'allDay' => $all_day,
2017 'external' => 'on',
2018 'nofollow' => 'on',
2019 ];
2020 }
2021 return $calendar_data;
2022 }
2023
2024 public function fetch_color_or_global_color($settings, $control_name=''){
2025 if( !isset($settings[$control_name])) {
2026 return '';
2027 }
2028
2029 $color = $settings[$control_name];
2030
2031 if(!empty($settings['__globals__']) && !empty($settings['__globals__'][$control_name])){
2032 $color = $settings['__globals__'][$control_name];
2033 $color_arr = explode('?id=', $color); //E.x. 'globals/colors/?id=primary'
2034
2035 $color_name = count($color_arr) > 1 ? $color_arr[1] : '';
2036 if( !empty($color_name) ) {
2037 $color = "var( --e-global-color-$color_name )";
2038 }
2039 }
2040
2041 return $color;
2042 }
2043 }
2044