PluginProbe ʕ •ᴥ•ʔ
ElementsKit Elementor Addons – Advanced Widgets & Templates Addons for Elementor / 3.5.0
ElementsKit Elementor Addons – Advanced Widgets & Templates Addons for Elementor v3.5.0
3.9.5 3.9.6 3.9.3 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.3.0 2.3.1 2.3.1.1 2.3.2 2.3.3 2.3.4 2.3.5 2.3.6 2.3.7 2.4.0 2.5.0 2.5.1 2.5.10 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.7 2.5.8 2.5.9 2.6.0 2.6.1 2.6.2 2.6.3 2.7.0 2.7.2 2.7.3 2.7.4 2.7.5 2.8.0 2.8.1 2.8.5 2.8.6 2.8.7 2.8.8 2.9.0 2.9.1 2.9.2 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6 3.4.7 3.4.8 3.4.9 3.5.0 3.5.1 3.5.2 3.5.3 3.5.4 3.5.5 3.5.6 3.6.0 3.6.1 3.7.0 3.7.1 3.7.2 3.7.3 3.7.4 3.7.5 3.7.6 3.7.7 3.7.8 3.7.9 3.8.0 3.8.1 3.8.2 3.9.0 3.9.1 3.9.2 trunk 1.2.6 1.2.7 1.2.9 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.7 1.4.8 1.4.9 1.5.0 1.5.1 1.5.10 1.5.11 1.5.12 1.5.2 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 2.0.0 2.0.1 2.0.10 2.0.11 2.0.12 2.0.13 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.0.9.1 2.0.9.2 2.0.9.3
elementskit-lite / widgets / video / video.php
elementskit-lite / widgets / video Last commit date
parts 2 years ago video-handler.php 3 years ago video.php 1 year ago
video.php
1162 lines
1 <?php
2 namespace Elementor;
3
4 use Elementor\Modules\DynamicTags\Module as TagsModule;
5 use \Elementor\ElementsKit_Widget_Video_Handler as Handler;
6
7 if ( ! defined( 'ABSPATH' ) ) exit;
8
9 class ElementsKit_Widget_Video extends Widget_Base {
10 use \ElementsKit_Lite\Widgets\Widget_Notice;
11
12 public $base;
13
14 public function get_style_depends() {
15 return ['wp-mediaelement'];
16 }
17
18 public function get_script_depends() {
19 return ['wp-mediaelement'];
20 }
21
22 public function get_name() {
23 return Handler::get_name();
24 }
25
26 public function get_title() {
27 return Handler::get_title();
28 }
29
30 public function get_icon() {
31 return Handler::get_icon();
32 }
33
34 public function get_categories() {
35 return Handler::get_categories();
36 }
37
38 public function get_keywords() {
39 return Handler::get_keywords();
40 }
41 protected function is_dynamic_content(): bool {
42 return false;
43 }
44 public function get_help_url() {
45 return 'https://wpmet.com/doc/video/';
46 }
47
48 protected function register_controls() {
49
50 $this->start_controls_section(
51 'ekit_video_popup_content_section',
52 [
53 'label' => esc_html__( 'Video', 'elementskit-lite' ),
54 'tab' => Controls_Manager::TAB_CONTENT,
55 ]
56 );
57
58 $this->add_control(
59 'ekit_video_popup_button_style',
60 [
61 'label' => esc_html__( 'Button Style', 'elementskit-lite' ),
62 'type' => Controls_Manager::SELECT,
63 'default' => 'icon',
64 'options' => [
65 'text' => esc_html__( 'Text', 'elementskit-lite' ),
66 'icon' => esc_html__( 'Icon', 'elementskit-lite' ),
67 'both' => esc_html__( 'Both', 'elementskit-lite' ),
68 ],
69 ]
70 );
71
72 $this->add_control(
73 'ekit_video_popup_button_title',
74 [
75 'label' =>esc_html__( 'Button Title', 'elementskit-lite' ),
76 'type' => Controls_Manager::TEXT,
77 'label_block' => true,
78 'placeholder' =>esc_html__( 'Play Video', 'elementskit-lite' ),
79 'default' =>esc_html__( 'Play Video', 'elementskit-lite' ),
80 'condition' => [
81 'ekit_video_popup_button_style' => ['text', 'both'],
82 ],
83 'dynamic' => [
84 'active' => true,
85 ],
86 ]
87 );
88
89 $this->add_control(
90 'ekit_video_popup_button_icons__switch',
91 [
92 'label' => esc_html__('Add icon? ', 'elementskit-lite'),
93 'type' => Controls_Manager::SWITCHER,
94 'default' => 'yes',
95 'label_on' => esc_html__( 'Yes', 'elementskit-lite' ),
96 'label_off' => esc_html__( 'No', 'elementskit-lite' ),
97 'condition' => [
98 'ekit_video_popup_button_style' => ['icon', 'both'],
99 ]
100 ]
101 );
102
103 $this->add_control(
104 'ekit_video_popup_button_icons',
105 [
106 'label' =>esc_html__( 'Button Icon', 'elementskit-lite' ),
107 'type' => Controls_Manager::ICONS,
108 'fa4compatibility' => 'ekit_video_popup_button_icon',
109 'default' => [
110 'value' => 'icon icon-play',
111 'library' => 'ekiticons',
112 ],
113 'label_block' => true,
114 'condition' => [
115 'ekit_video_popup_button_style' => ['icon', 'both'],
116 'ekit_video_popup_button_icons__switch' => 'yes',
117 ]
118 ]
119 );
120 $this->add_control(
121 'ekit_video_popup_icon_align',
122 [
123 'label' =>esc_html__( 'Icon Position', 'elementskit-lite' ),
124 'type' => Controls_Manager::SELECT,
125 'default' => 'before',
126 'options' => [
127 'before' =>esc_html__( 'Before', 'elementskit-lite' ),
128 'after' =>esc_html__( 'After', 'elementskit-lite' ),
129 ],
130 'condition' => [
131 'ekit_video_popup_button_style' => 'both',
132 'ekit_video_popup_button_icons__switch' => 'yes',
133 ]
134 ]
135 );
136
137 $this->add_control(
138 'ekit_video_popup_video_glow',
139 [
140 'label' =>esc_html__( 'Active Glow', 'elementskit-lite' ),
141 'type' => Controls_Manager::SWITCHER,
142 'label_on' => esc_html__( 'Yes', 'elementskit-lite' ),
143 'label_off' => esc_html__( 'No', 'elementskit-lite' ),
144 'return_value' => 'yes',
145 'default' => 'yes',
146 ]
147 );
148
149
150 $this->add_control(
151 'ekit_video_popup_video_type',
152 [
153 'label' => esc_html__( 'Video Type', 'elementskit-lite' ),
154 'type' => Controls_Manager::SELECT,
155 'default' => 'youtube',
156 'options' => [
157 'youtube'=> esc_html__( 'Youtube', 'elementskit-lite' ),
158 'vimeo'=> esc_html__( 'Vimeo', 'elementskit-lite' ),
159 'self'=> esc_html__( 'Self Hosted', 'elementskit-lite' ),
160 ]
161 ]
162 );
163
164 $this->add_control(
165 'ekit_video_popup_url',
166 [
167 'label' => esc_html__( 'URL to Embed', 'elementskit-lite' ),
168 'type' => Controls_Manager::TEXT,
169 'input_type' => 'url',
170 'placeholder' => esc_url( 'https://www.youtube.com/watch?v=VhBl3dHT5SY' ),
171 'default' => esc_url( 'https://www.youtube.com/watch?v=VhBl3dHT5SY' ),
172 'dynamic' => [
173 'active' => true,
174 ],
175 'condition' => [
176 'ekit_video_popup_video_type!' => 'self',
177 ],
178 ]
179 );
180
181 //video option
182 $this->add_control(
183 'ekit_video_popup_start_time',
184 [
185 'label' => esc_html__( 'Start Time', 'elementskit-lite' ),
186 'type' => Controls_Manager::NUMBER,
187 'dynamic' => [
188 'active' => true,
189 ],
190 'input_type' => 'number',
191 'placeholder' => '',
192 'default' => '0',
193 'condition' => ['ekit_video_popup_video_type' => 'youtube' ]
194 ]
195 );
196
197 $this->add_control(
198 'ekit_video_popup_end_time',
199 [
200 'label' => esc_html__( 'End Time', 'elementskit-lite' ),
201 'type' => Controls_Manager::NUMBER,
202 'dynamic' => [
203 'active' => true,
204 ],
205 'input_type' => 'number',
206 'placeholder' => '',
207 'default' => '',
208 'condition' => ['ekit_video_popup_video_type' => 'youtube']
209 ]
210 );
211
212 // video Options
213 $this->add_control(
214 'ekit_video_player_options_heading',
215 [
216 'label' => esc_html__('video Options', 'elementskit-lite'),
217 'type' => Controls_Manager::HEADING,
218 'separator' => 'before',
219 'condition' => [
220 'ekit_video_popup_video_type' => 'self',
221 ],
222 ]
223 );
224
225 // Self hosted
226 $this->add_control(
227 'ekit_video_self_url',
228 [
229 'label' => esc_html__('Custom Url', 'elementskit-lite'),
230 'type' => Controls_Manager::SWITCHER,
231 'default' => 'yes',
232 'label_on' => esc_html__('Yes', 'elementskit-lite'),
233 'label_off' => esc_html__('No', 'elementskit-lite'),
234 'condition' => [
235 'ekit_video_popup_video_type' => 'self',
236 ],
237 ]
238 );
239
240 $this->add_control(
241 'ekit_video_self_external_url',
242 [
243 'label' => esc_html__( 'URL', 'elementskit-lite' ),
244 'type' => Controls_Manager::TEXT,
245 'label_block' => true,
246 'placeholder' => esc_html__('Enter video URL', 'elementskit-lite'),
247 'description' => esc_html__('Input a valid video url', 'elementskit-lite'),
248 'dynamic' => [
249 'active' => true,
250 ],
251 'condition' => [
252 'ekit_video_self_url' => 'yes',
253 'ekit_video_popup_video_type' => 'self',
254 ],
255 ]
256 );
257
258 $this->add_control(
259 'ekit_video_player_self_hosted',
260 [
261 'label' => esc_html__( 'Choose Video', 'elementskit-lite' ),
262 'type' => Controls_Manager::MEDIA,
263 'dynamic' => [
264 'active' => true,
265 'categories' => [
266 TagsModule::MEDIA_CATEGORY,
267 ],
268 ],
269 'media_type' => 'video',
270 'condition' => [
271 'ekit_video_self_url!' => 'yes',
272 'ekit_video_popup_video_type' => 'self',
273 ],
274 ]
275 );
276
277 $this->add_control(
278 'ekit_video_popup_auto_play',
279 [
280 'label' => esc_html__( 'Auto Play', 'elementskit-lite' ),
281 'description' => esc_html__( 'Unmuted videos will not auto play in some browsers.', 'elementskit-lite'),
282 'type' => Controls_Manager::SWITCHER,
283 'label_on' => esc_html__( 'Yes', 'elementskit-lite' ),
284 'label_off' => esc_html__( 'No', 'elementskit-lite' ),
285 'default' => 'no',
286 'return_value' => '1',
287 ]
288 );
289
290 $this->add_control(
291 'ekit_video_popup_video_mute',
292 [
293 'label' => esc_html__( 'Mute', 'elementskit-lite' ),
294 'type' => Controls_Manager::SWITCHER,
295 'label_on' => esc_html__( 'Yes', 'elementskit-lite' ),
296 'label_off' => esc_html__( 'No', 'elementskit-lite' ),
297 'return_value' => '1',
298 'default' => 'no',
299 ]
300 );
301
302 $this->add_control(
303 'ekit_video_popup_video_loop',
304 [
305 'label' => esc_html__( 'Loop', 'elementskit-lite' ),
306 'type' => Controls_Manager::SWITCHER,
307 'label_on' => esc_html__( 'Yes', 'elementskit-lite' ),
308 'label_off' => esc_html__( 'No', 'elementskit-lite' ),
309 'return_value' => '1',
310 'default' => 'no',
311 ]
312 );
313
314 $this->add_control(
315 'ekit_video_popup_video_player_control',
316 [
317 'label' => esc_html__( 'Player Control', 'elementskit-lite' ),
318 'type' => Controls_Manager::SWITCHER,
319 'label_on' => esc_html__( 'Yes', 'elementskit-lite' ),
320 'label_off' => esc_html__( 'No', 'elementskit-lite' ),
321 'return_value' => '1',
322 'default' => 'no',
323 'condition' => ['ekit_video_popup_video_type!' => 'self']
324 ]
325 );
326
327 $this->add_control(
328 'ekit_video_popup_video_intro_title',
329 [
330 'label' => esc_html__( 'Intro Title', 'elementskit-lite' ),
331 'type' => Controls_Manager::SWITCHER,
332 'label_on' => esc_html__( 'Yes', 'elementskit-lite' ),
333 'label_off' =>esc_html__( 'No', 'elementskit-lite' ),
334 'return_value' => '1',
335 'default' => 'no',
336 'condition' => ['ekit_video_popup_video_type' => 'vimeo']
337 ]
338 );
339
340 $this->add_control(
341 'ekit_video_popup_video_intro_portrait',
342 [
343 'label' => esc_html__( 'Intro Portrait', 'elementskit-lite' ),
344 'type' => Controls_Manager::SWITCHER,
345 'label_on' => esc_html__( 'Yes', 'elementskit-lite' ),
346 'label_off' => esc_html__( 'No', 'elementskit-lite' ),
347 'return_value' => '1',
348 'default' => 'no',
349 'condition' => ['ekit_video_popup_video_type' => 'vimeo']
350 ]
351 );
352
353 $this->add_control(
354 'ekit_video_popup_video_intro_byline',
355 [
356 'label' => esc_html__( 'Intro Byline', 'elementskit-lite' ),
357 'type' => Controls_Manager::SWITCHER,
358 'label_on' => esc_html__( 'Yes', 'elementskit-lite' ),
359 'label_off' => esc_html__( 'No', 'elementskit-lite' ),
360 'return_value' => '1',
361 'default' => 'no',
362 'condition' => ['ekit_video_popup_video_type' => 'vimeo']
363 ]
364 );
365 //video option
366 $this->add_control(
367 'self_poster_image',
368 [
369 'label' => esc_html__( 'Poster Image', 'elementskit-lite' ),
370 'type' => Controls_Manager::MEDIA,
371 'dynamic' => [
372 'active' => true,
373 ],
374 'separator' => 'before',
375 'condition' => [
376 'ekit_video_popup_video_type' => 'self',
377 ],
378 ]
379 );
380
381 // Control Options
382 $this->add_control(
383 'ekit_video_player_control_options_heading',
384 [
385 'label' => esc_html__('Control Options', 'elementskit-lite'),
386 'type' => Controls_Manager::HEADING,
387 'separator' => 'before',
388 'condition' => [
389 'ekit_video_popup_video_type' => 'self',
390 ],
391 ]
392 );
393
394 $this->add_control(
395 'ekit_video_player_playpause',
396 [
397 'label' => esc_html__('Play Pause', 'elementskit-lite'),
398 'type' => Controls_Manager::SWITCHER,
399 'default' => 'yes',
400 'label_on' => esc_html__('Yes', 'elementskit-lite'),
401 'label_off' => esc_html__('No', 'elementskit-lite'),
402 'condition' => [
403 'ekit_video_popup_video_type' => 'self',
404 ],
405 ]
406 );
407
408 $this->add_control(
409 'ekit_video_player_progress',
410 [
411 'label' => esc_html__('Progress Bar', 'elementskit-lite'),
412 'type' => Controls_Manager::SWITCHER,
413 'default' => 'yes',
414 'label_on' => esc_html__('Yes', 'elementskit-lite'),
415 'label_off' => esc_html__('No', 'elementskit-lite'),
416 'condition' => [
417 'ekit_video_popup_video_type' => 'self',
418 ],
419 ]
420 );
421
422 $this->add_control(
423 'ekit_video_player_current',
424 [
425 'label' => esc_html__('Current Time', 'elementskit-lite'),
426 'type' => Controls_Manager::SWITCHER,
427 'default' => 'yes',
428 'label_on' => esc_html__('Yes', 'elementskit-lite'),
429 'label_off' => esc_html__('No', 'elementskit-lite'),
430 'condition' => [
431 'ekit_video_popup_video_type' => 'self',
432 ],
433 ]
434 );
435
436 $this->add_control(
437 'ekit_video_player_duration',
438 [
439 'label' => esc_html__('Total Duration', 'elementskit-lite'),
440 'type' => Controls_Manager::SWITCHER,
441 'default' => 'yes',
442 'label_on' => esc_html__('Yes', 'elementskit-lite'),
443 'label_off' => esc_html__('No', 'elementskit-lite'),
444 'condition' => [
445 'ekit_video_player_current' => 'yes',
446 'ekit_video_popup_video_type' => 'self',
447 ],
448 ]
449 );
450
451 $this->add_control(
452 'ekit_video_player_volume',
453 [
454 'label' => esc_html__('Volume Bar', 'elementskit-lite'),
455 'type' => Controls_Manager::SWITCHER,
456 'default' => 'yes',
457 'label_on' => esc_html__('Yes', 'elementskit-lite'),
458 'label_off' => esc_html__('No', 'elementskit-lite'),
459 'condition' => [
460 'ekit_video_popup_video_type' => 'self',
461 ],
462 ]
463 );
464
465 $this->add_control(
466 'ekit_video_player_volume_slider_layout',
467 [
468 'label' => esc_html__('Volume Slider Layout', 'elementskit-lite'),
469 'type' => Controls_Manager::SELECT,
470 'default' => 'horizontal',
471 'options' => [
472 'vertical' => esc_html__('Vertical', 'elementskit-lite'),
473 'horizontal' => esc_html__('Horizontal', 'elementskit-lite'),
474 ],
475 'condition' => [
476 'ekit_video_player_volume' => ['yes'],
477 'ekit_video_popup_video_type' => 'self',
478 ],
479 ]
480 );
481
482 $this->add_control(
483 'ekit_video_player_start_volume',
484 [
485 'label' => esc_html__('Start Volume', 'elementskit-lite'),
486 'description' => esc_html__('Initial volume when the player starts.', 'elementskit-lite'),
487 'type' => Controls_Manager::SLIDER,
488 'size_units' => ['px'],
489 'range' => [
490 'px' => [
491 'min' => 0,
492 'max' => 1,
493 'step' => 0.1,
494 ],
495 ],
496 'default' => [
497 'unit' => 'px',
498 'size' => 0.8,
499 ],
500 'condition' => [
501 'ekit_video_popup_video_type' => 'self',
502 ],
503 ]
504 );
505
506 $this->end_controls_section();
507
508 $this->start_controls_section(
509 'ekit_video_popup_style_section',
510 [
511 'label' => esc_html__( 'Wrapper Style', 'elementskit-lite' ),
512 'tab' => Controls_Manager::TAB_STYLE,
513 ]
514 );
515
516 $this->add_responsive_control(
517 'ekit_video_popup_title_align', [
518 'label' =>esc_html__( 'Alignment', 'elementskit-lite' ),
519 'type' => Controls_Manager::CHOOSE,
520 'options' => [
521
522 'left' => [
523 'title' =>esc_html__( 'Left', 'elementskit-lite' ),
524 'icon' => 'eicon-text-align-left',
525 ],
526 'center' => [
527 'title' =>esc_html__( 'Center', 'elementskit-lite' ),
528 'icon' => 'eicon-text-align-center',
529 ],
530 'right' => [
531 'title' =>esc_html__( 'Right', 'elementskit-lite' ),
532 'icon' => 'eicon-text-align-right',
533 ],
534 'justify' => [
535 'title' =>esc_html__( 'Justified', 'elementskit-lite' ),
536 'icon' => 'eicon-text-align-justify',
537 ],
538 ],
539 'default' => 'center',
540 'selectors' => [
541 '{{WRAPPER}} .video-content' => 'text-align: {{VALUE}};',
542 ],
543 ]
544 );
545
546 $this->add_responsive_control(
547 'ekit_video_wrap_padding',
548 [
549 'label' => esc_html__( 'Padding', 'elementskit-lite' ),
550 'type' => Controls_Manager::DIMENSIONS,
551 'size_units' => [ 'px' ],
552 'selectors' => [
553 '{{WRAPPER}} .video-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
554 ],
555 ]
556 );
557
558 $this->add_group_control(
559 Group_Control_Border::get_type(),
560 [
561 'name' => 'ekit_video_wrap_border',
562 'label' => esc_html__( 'Border', 'elementskit-lite' ),
563 'selector' => '{{WRAPPER}} .video-content',
564 ]
565 );
566
567 $this->add_control(
568 'ekit_video_wrap_border_radius',
569 [
570 'label' => esc_html__( 'Border Radius', 'elementskit-lite' ),
571 'type' => Controls_Manager::DIMENSIONS,
572 'size_units' => [ 'px', '%', 'em' ],
573 'selectors' => [
574 '{{WRAPPER}} .video-content' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
575 ],
576 ]
577 );
578
579 $this->end_controls_section();
580
581 $this->start_controls_section(
582 'ekit_video_popup_section_style',
583 [
584 'label' =>esc_html__( 'Button Style', 'elementskit-lite' ),
585 'tab' => Controls_Manager::TAB_STYLE,
586 ]
587 );
588
589 $this->add_responsive_control(
590 'ekit_video_popup_text_padding',
591 [
592 'label' =>esc_html__( 'Padding', 'elementskit-lite' ),
593 'type' => Controls_Manager::DIMENSIONS,
594 'size_units' => [ 'px', 'em', '%' ],
595 'selectors' => [
596 '{{WRAPPER}} .ekit-video-popup-btn' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
597 ],
598 ]
599 );
600
601 $this->add_responsive_control(
602 'ekit_video_popup_icon_size',
603 [
604 'label' => esc_html__( 'Icon Size', 'elementskit-lite' ),
605 'type' => Controls_Manager::SLIDER,
606 'size_units' => [ 'px', '%' ],
607 'range' => [
608 'px' => [
609 'min' => 1,
610 'max' => 100,
611 'step' => 5,
612 ],
613 '%' => [
614 'min' => 1,
615 'max' => 100,
616 ],
617 ],
618 'selectors' => [
619 '{{WRAPPER}} .ekit-video-popup-btn i' => 'font-size: {{SIZE}}{{UNIT}};',
620 '{{WRAPPER}} .ekit-video-popup-btn svg' => 'max-width: {{SIZE}}{{UNIT}};',
621 ],
622 ]
623 );
624
625 $this->add_group_control(
626 Group_Control_Typography::get_type(),
627 [
628 'name' => 'ekit_video_popup_btn_typography',
629 'label' =>esc_html__( 'Typography', 'elementskit-lite' ),
630 'selector' => '{{WRAPPER}} .ekit-video-popup-btn',
631 ]
632 );
633
634
635 $this->add_control(
636 'ekit_video_popup_btn_use_height_and_width',
637 [
638 'label' => esc_html__( 'Use height width', 'elementskit-lite' ),
639 'type' => Controls_Manager::SWITCHER,
640 'label_on' => esc_html__( 'Show', 'elementskit-lite' ),
641 'label_off' => esc_html__( 'Hide', 'elementskit-lite' ),
642 'return_value' => 'yes',
643 'default' => 'yes',
644 ]
645 );
646
647 $this->add_responsive_control(
648 'ekit_video_popup_btn_width',
649 [
650 'label' => esc_html__( 'Width', 'elementskit-lite' ),
651 'type' => Controls_Manager::SLIDER,
652 'size_units' => [ 'px', '%' ],
653 'range' => [
654 'px' => [
655 'min' => 30,
656 'max' => 200,
657 'step' => 1,
658 ],
659 '%' => [
660 'min' => 10,
661 'max' => 100,
662 ],
663 ],
664 'default' => [
665 'unit' => 'px',
666 'size' => 60,
667 ],
668 'selectors' => [
669 '{{WRAPPER}} .ekit-video-popup-btn' => 'width: {{SIZE}}{{UNIT}};',
670 ],
671 'condition' => [
672 'ekit_video_popup_btn_use_height_and_width' => 'yes'
673 ]
674 ]
675 );
676
677 $this->add_responsive_control(
678 'ekit_video_popup_btn_height',
679 [
680 'label' => esc_html__( 'Height', 'elementskit-lite' ),
681 'type' => Controls_Manager::SLIDER,
682 'size_units' => [ 'px', '%' ],
683 'range' => [
684 'px' => [
685 'min' => 30,
686 'max' => 200,
687 'step' => 1,
688 ],
689 '%' => [
690 'min' => 10,
691 'max' => 100,
692 ],
693 ],
694 'default' => [
695 'unit' => 'px',
696 'size' => 60,
697 ],
698 'selectors' => [
699 '{{WRAPPER}} .ekit-video-popup-btn' => 'height: {{SIZE}}{{UNIT}};',
700 ],
701 'condition' => [
702 'ekit_video_popup_btn_use_height_and_width' => 'yes'
703 ]
704 ]
705 );
706
707 $this->add_responsive_control(
708 'ekit_video_popup_btn_line_height',
709 [
710 'label' => esc_html__( 'Line height', 'elementskit-lite' ),
711 'type' => Controls_Manager::SLIDER,
712 'size_units' => [ 'px', '%' ],
713 'range' => [
714 'px' => [
715 'min' => 30,
716 'max' => 200,
717 'step' => 1,
718 ],
719 '%' => [
720 'min' => 10,
721 'max' => 100,
722 ],
723 ],
724 'selectors' => [
725 '{{WRAPPER}} .ekit-video-popup-btn' => 'line-height: {{SIZE}}{{UNIT}};',
726 ],
727 'condition' => [
728 'ekit_video_popup_btn_use_height_and_width' => 'yes'
729 ]
730 ]
731 );
732
733 $this->add_control(
734 'ekit_video_popup_btn_glow_color',
735 [
736 'label' => esc_html__( 'Glow Color', 'elementskit-lite' ),
737 'type' => Controls_Manager::COLOR,
738 'selectors' => [
739 '{{WRAPPER}} .ekit-video-popup-btn.glow-btn:before' => 'color: {{VALUE}}',
740 '{{WRAPPER}} .ekit-video-popup-btn.glow-btn:after' => 'color: {{VALUE}}',
741 '{{WRAPPER}} .ekit-video-popup-btn.glow-btn > i:after' => 'color: {{VALUE}}',
742 ],
743 'default' => '#255cff',
744 'separator' => 'before',
745 'condition' => [
746 'ekit_video_popup_video_glow' => 'yes'
747 ]
748 ]
749 );
750
751 $this->add_responsive_control(
752 'ekit_video_popup_btn_glow_size',
753 [
754 'label' => esc_html__( 'Glow Size (px)', 'elementskit-lite' ),
755 'type' => Controls_Manager::SLIDER,
756 'size_units' => [ 'px'],
757 'range' => [
758 'px' => [
759 'min' => 30,
760 'max' => 200,
761 'step' => 1,
762 ],
763 ],
764 'selectors' => [
765 '{{WRAPPER}} .ekit-video-popup-btn' => '--glow-size: {{SIZE}}{{UNIT}};',
766 ],
767 'condition' => [
768 'ekit_video_popup_video_glow' => 'yes'
769 ]
770 ]
771 );
772
773 $this->start_controls_tabs( 'ekit_video_popup_button_style_tabs' );
774
775 $this->start_controls_tab(
776 'ekit_video_popup_button_normal',
777 [
778 'label' =>esc_html__( 'Normal', 'elementskit-lite' ),
779 ]
780 );
781
782 $this->add_control(
783 'ekit_video_popup_btn_text_color',
784 [
785 'label' =>esc_html__( 'Text Color', 'elementskit-lite' ),
786 'type' => Controls_Manager::COLOR,
787 'default' => '#ffffff',
788 'selectors' => [
789 '{{WRAPPER}} .ekit-video-popup-btn' => 'color: {{VALUE}};',
790 '{{WRAPPER}} .ekit-video-popup-btn svg path' => 'stroke: {{VALUE}}; fill: {{VALUE}};',
791 ],
792 ]
793 );
794 $this->add_group_control(
795 Group_Control_Background::get_type(),
796 array(
797 'name' => 'ekit_video_popup_btn_bg_color',
798 'selector' => '{{WRAPPER}} .ekit-video-popup-btn',
799 )
800 );
801
802 $this->end_controls_tab();
803
804 $this->start_controls_tab(
805 'ekit_video_popup_btn_tab_button_hover',
806 [
807 'label' =>esc_html__( 'Hover', 'elementskit-lite' ),
808 ]
809 );
810
811 $this->add_control(
812 'ekit_video_popup_btn_hover_color',
813 [
814 'label' =>esc_html__( 'Text Color', 'elementskit-lite' ),
815 'type' => Controls_Manager::COLOR,
816 'default' => '#ffffff',
817 'selectors' => [
818 '{{WRAPPER}} .ekit-video-popup-btn:hover' => 'color: {{VALUE}};',
819 '{{WRAPPER}} .ekit-video-popup-btn:hover svg path' => 'stroke: {{VALUE}}; fill: {{VALUE}};',
820 ],
821 ]
822 );
823
824 $this->add_group_control(
825 Group_Control_Background::get_type(),
826 array(
827 'name' => 'ekit_video_popup_btn_bg_hover_color',
828 'selector' => '{{WRAPPER}} .ekit-video-popup-btn:hover',
829 )
830 );
831
832 $this->end_controls_tab();
833 $this->end_controls_tabs();
834 $this->end_controls_section();
835
836 $this->start_controls_section(
837 'ekit_video_popup_border_style',
838 [
839 'label' =>esc_html__( 'Border Style', 'elementskit-lite' ),
840 'tab' => Controls_Manager::TAB_STYLE,
841 ]
842 );
843
844 $this->add_control(
845 'ekit_video_popup_btn_border_style',
846 [
847 'label' => esc_html_x( 'Border Type', 'Border Control', 'elementskit-lite' ),
848 'type' => Controls_Manager::SELECT,
849 'options' => [
850 '' => esc_html__( 'None', 'elementskit-lite' ),
851 'solid' => esc_html_x( 'Solid', 'Border Control', 'elementskit-lite' ),
852 'double' => esc_html_x( 'Double', 'Border Control', 'elementskit-lite' ),
853 'dotted' => esc_html_x( 'Dotted', 'Border Control', 'elementskit-lite' ),
854 'dashed' => esc_html_x( 'Dashed', 'Border Control', 'elementskit-lite' ),
855 'groove' => esc_html_x( 'Groove', 'Border Control', 'elementskit-lite' ),
856 ],
857 'selectors' => [
858 '{{WRAPPER}} .ekit-video-popup-btn' => 'border-style: {{VALUE}};',
859 ],
860 ]
861 );
862 $this->add_control(
863 'ekit_video_popup_btn_border_dimensions',
864 [
865 'label' => esc_html_x( 'Width', 'Border Control', 'elementskit-lite' ),
866 'type' => Controls_Manager::DIMENSIONS,
867 'selectors' => [
868 '{{WRAPPER}} .ekit-video-popup-btn' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
869 ],
870 ]
871 );
872 $this->start_controls_tabs( 'ekit_video_popup__button_border_style' );
873 $this->start_controls_tab(
874 'ekit_video_popup__button_border_normal',
875 [
876 'label' =>esc_html__( 'Normal', 'elementskit-lite' ),
877 ]
878 );
879
880 $this->add_control(
881 'ekit_video_popup_btn_border_color',
882 [
883 'label' => esc_html_x( 'Color', 'Border Control', 'elementskit-lite' ),
884 'type' => Controls_Manager::COLOR,
885 'default' => '',
886 'selectors' => [
887 '{{WRAPPER}} .ekit-video-popup-btn' => 'border-color: {{VALUE}};',
888 ],
889 ]
890 );
891 $this->end_controls_tab();
892
893 $this->start_controls_tab(
894 'ekit_video_popup_btn_tab_button_border_hover',
895 [
896 'label' =>esc_html__( 'Hover', 'elementskit-lite' ),
897 ]
898 );
899 $this->add_control(
900 'ekit_video_popup_btn_hover_border_color',
901 [
902 'label' => esc_html_x( 'Color', 'Border Control', 'elementskit-lite' ),
903 'type' => Controls_Manager::COLOR,
904 'default' => '',
905 'selectors' => [
906 '{{WRAPPER}} .ekit-video-popup-btn:hover' => 'border-color: {{VALUE}};',
907 ],
908 ]
909 );
910 $this->end_controls_tab();
911 $this->end_controls_tabs();
912 $this->add_responsive_control(
913 'ekit_video_popup_btn_border_radius',
914 [
915 'label' =>esc_html__( 'Border Radius', 'elementskit-lite' ),
916 'type' => Controls_Manager::DIMENSIONS,
917 'size_units' => [ 'px'],
918 'default' => [
919 'top' => '',
920 'right' => '',
921 'bottom' => '' ,
922 'left' => '',
923 ],
924 'selectors' => [
925 '{{WRAPPER}} .ekit-video-popup-btn, {{WRAPPER}} .ekit-video-popup-btn:before' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
926 ],
927 ]
928 );
929 $this->end_controls_section();
930
931 $this->start_controls_section(
932 'ekit_video_popup_box_shadow_style',
933 [
934 'label' =>esc_html__( 'Shadow Style', 'elementskit-lite' ),
935 'tab' => Controls_Manager::TAB_STYLE,
936 ]
937 );
938
939 $this->add_group_control(
940 Group_Control_Box_Shadow::get_type(),
941 [
942 'name' => 'ekit_video_popup_btn_box_shadow',
943 'label' => esc_html__( 'Box Shadow', 'elementskit-lite' ),
944 'selector' => '{{WRAPPER}} .ekit-video-popup-btn',
945 ]
946 );
947
948 $this->add_group_control(
949 Group_Control_Text_Shadow::get_type(),
950 [
951 'name' => 'ekit_video_popup_btn_text_shadow',
952 'label' => esc_html__( 'Text Shadow', 'elementskit-lite' ),
953 'selector' => '{{WRAPPER}} .ekit-video-popup-btn',
954 ]
955 );
956
957 $this->end_controls_section();
958
959 $this->start_controls_section(
960 'ekit_video_popup_icon_style',
961 [
962 'label' => esc_html__( 'Icon', 'elementskit-lite' ),
963 'tab' => Controls_Manager::TAB_STYLE,
964 'condition' => [
965 'ekit_video_popup_button_icons__switch' => 'yes',
966 'ekit_video_popup_button_style' => ['both']
967 ]
968 ]
969 );
970
971 $this->add_responsive_control(
972 'ekit_video_popup_icon_padding_right',
973 [
974 'label' => esc_html__( 'Padding Right', 'elementskit-lite' ),
975 'type' => Controls_Manager::SLIDER,
976 'size_units' => [ 'px', '%' ],
977 'range' => [
978 'px' => [
979 'min' => 0,
980 'max' => 200,
981 'step' => 1,
982 ],
983 '%' => [
984 'min' => 0,
985 'max' => 100,
986 ],
987 ],
988 'default' => [
989 'unit' => 'px',
990 'size' => 5,
991 ],
992 'selectors' => [
993 '{{WRAPPER}} .ekit-video-popup-btn > i' => 'padding-right: {{SIZE}}{{UNIT}};',
994 ],
995 'condition' => [
996 'ekit_video_popup_button_style' => 'both',
997 'ekit_video_popup_icon_align' => 'before'
998 ]
999 ]
1000 );
1001
1002 $this->add_responsive_control(
1003 'ekit_video_popup_icon_padding_left',
1004 [
1005 'label' => esc_html__( 'Padding Left', 'elementskit-lite' ),
1006 'type' => Controls_Manager::SLIDER,
1007 'size_units' => [ 'px', '%' ],
1008 'range' => [
1009 'px' => [
1010 'min' => 0,
1011 'max' => 200,
1012 'step' => 1,
1013 ],
1014 '%' => [
1015 'min' => 0,
1016 'max' => 100,
1017 ],
1018 ],
1019 'default' => [
1020 'unit' => 'px',
1021 'size' => 5,
1022 ],
1023 'selectors' => [
1024 '{{WRAPPER}} .ekit-video-popup-btn > i' => 'padding-left: {{SIZE}}{{UNIT}};',
1025 ],
1026 'condition' => [
1027 'ekit_video_popup_button_style' => 'both',
1028 'ekit_video_popup_icon_align' => 'after'
1029 ]
1030 ]
1031 );
1032
1033 $this->end_controls_section();
1034
1035 $this->insert_pro_message();
1036 }
1037
1038 /**
1039 * Video Icon
1040 */
1041 private function video_icon() {
1042 $settings = $this->get_settings_for_display();
1043
1044 // new icon
1045 $migrated = isset( $settings['__fa4_migrated']['ekit_video_popup_button_icons'] );
1046 // Check if its a new widget without previously selected icon using the old Icon control
1047 $is_new = empty( $settings['ekit_video_popup_button_icon'] );
1048 if ( $is_new || $migrated ) {
1049 // new icon
1050 Icons_Manager::render_icon( $settings['ekit_video_popup_button_icons'], [ 'aria-hidden' => 'true' ] );
1051 } else {
1052 ?>
1053 <i class="<?php echo esc_attr($settings['ekit_video_popup_button_icons']); ?>" aria-hidden="true"></i>
1054 <?php
1055 }
1056 }
1057
1058 protected function render( ) {
1059 echo '<div class="ekit-wid-con" >';
1060 $this->render_raw();
1061 echo '</div>';
1062 }
1063
1064 protected function render_raw( ) {
1065 $settings = $this->get_settings_for_display();
1066 extract($settings);
1067
1068 $player_control = isset( $ekit_video_popup_video_player_control ) && $ekit_video_popup_video_player_control == '1' ? 1 : 0;
1069
1070 // Fallback Video URL for YouTube
1071 if ( empty($ekit_video_popup_url) ) {
1072 $ekit_video_popup_url = 'https://www.youtube.com/watch?v=VhBl3dHT5SY';
1073 }
1074
1075 $ekit_video_popup_url = Embed::get_embed_url( $ekit_video_popup_url ); // Support for short links like: https://youtu.be/VhBl3dHT5SY
1076 $video_properties = Embed::get_video_properties( $ekit_video_popup_url ); // Get only the video id.
1077
1078 $video_id = '';
1079 if( !empty($video_properties['video_id']) ) {
1080 $video_id = $video_properties['video_id'];
1081 }
1082
1083 $is_autoplay = (int) $ekit_video_popup_auto_play;
1084 $is_muted = (int) $ekit_video_popup_video_mute;
1085
1086 if($ekit_video_popup_video_type == "vimeo"){
1087 $url = explode('#', $ekit_video_popup_url, 2);
1088 $ekit_video_popup_url = $url[0];
1089 $ekit_video_popup_url = $ekit_video_popup_url."?playlist={$video_id}&muted={$is_muted}&autoplay={$is_autoplay}&loop={$ekit_video_popup_video_loop}&controls={$player_control}&start={$ekit_video_popup_start_time}&end={$ekit_video_popup_end_time}";
1090 }
1091 else{
1092 $ekit_video_popup_url = $ekit_video_popup_url."?playlist={$video_id}&mute={$is_muted}&autoplay={$is_autoplay}&loop={$ekit_video_popup_video_loop}&controls={$player_control}&start={$ekit_video_popup_start_time}&end={$ekit_video_popup_end_time}";
1093 };
1094
1095 // set player features playpause, current, progress, duration, volume
1096 $features = [];
1097 ($ekit_video_player_playpause === 'yes') && array_push($features, 'playpause');
1098 ($ekit_video_player_current === 'yes') && array_push($features, 'current');
1099 ($ekit_video_player_progress === 'yes') && array_push($features, 'progress');
1100 ($ekit_video_player_duration === 'yes') && array_push($features, 'duration');
1101 ($ekit_video_player_volume === 'yes') && array_push($features, 'volume');
1102
1103
1104 // set settings data attributes
1105 $video_settings['videoVolume'] = (!empty($ekit_video_player_volume_slider_layout)) ? $ekit_video_player_volume_slider_layout: 'horizontal';
1106 $video_settings['startVolume'] = (!empty($ekit_video_player_start_volume['size'])) ? $ekit_video_player_start_volume['size']: 0.8;
1107 $video_settings['videoType'] = (!empty($ekit_video_popup_video_type === 'vimeo' || $ekit_video_popup_video_type === 'youtube')) ? 'iframe': 'inline';
1108 $video_settings['videoClass'] = (!empty($ekit_video_popup_video_type === 'vimeo' || $ekit_video_popup_video_type === 'youtube')) ? 'mfp-fade': 'ekit_self_video_wrap_content';
1109 $poster_image = !empty($self_poster_image['url']) ? esc_url($self_poster_image['url']) : '';
1110
1111 //generate id
1112 $generate_id = "test-popup-link".$this->get_id();
1113
1114 // registering video player default attributes.
1115 $this->add_render_attribute(
1116 'player',
1117 [
1118 'preload' => 'none',
1119 'controls' => '',
1120 'poster' => $poster_image,
1121 ]
1122 );
1123
1124 // video options
1125 if (!empty($ekit_video_popup_auto_play) && $ekit_video_popup_auto_play === '1') {
1126 $this->add_render_attribute('player', 'autoplay', '');
1127 }
1128
1129 if (!empty($ekit_video_popup_video_loop) && $ekit_video_popup_video_loop === '1') {
1130 $this->add_render_attribute('player', 'loop', '');
1131 }
1132
1133 if (!empty($ekit_video_popup_video_mute) && $ekit_video_popup_video_mute === '1') {
1134 $this->add_render_attribute('player', 'muted', '');
1135 }
1136
1137 $clean_url = "#";
1138 if (isset($ekit_video_self_external_url) && filter_var($ekit_video_self_external_url, FILTER_VALIDATE_URL)) {
1139 $clean_url = $ekit_video_self_external_url;
1140 }
1141
1142 $clean_url = ($ekit_video_self_url === 'yes' && $clean_url !== '')
1143 ? $clean_url
1144 : (isset($ekit_video_player_self_hosted['url']) ? esc_url($ekit_video_player_self_hosted['url']) : '#');
1145
1146 ?>
1147 <div class="video-content" data-video-player="<?php echo esc_attr(wp_json_encode($features)); ?>" data-video-setting="<?php echo esc_attr(wp_json_encode($video_settings)); ?>">
1148 <?php if($ekit_video_popup_video_type === 'vimeo' || $ekit_video_popup_video_type === 'youtube') :
1149 include Handler::get_dir() . 'parts/video-button.php'; ?>
1150 <?php else :
1151 include Handler::get_dir() . 'parts/video-button.php'; ?>
1152 <div id="<?php echo esc_attr($generate_id); ?>" class="mfp-hide ekit_self_video_wrap">
1153 <video class="video_class" <?php $this->print_render_attribute_string('player'); ?> >
1154 <source type="video/mp4" src="<?php echo esc_url($clean_url); ?>" />
1155 </video>
1156 </div>
1157 <?php endif;?>
1158 </div>
1159 <?php
1160 }
1161 }
1162