PluginProbe
Easy Elements for Elementor – Addons & Website Templates / 1.0.7
Easy Elements for Elementor – Addons & Website Templates v1.0.7
1.5.3 1.5.2 1.5.1 1.5.0 1.4.9 1.4.6 1.4.7 1.4.8 1.4.5 1.4.4 1.4.3 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 All 47 releases
← All changes | widgets/video/video.php +209 -548 1.2.9 → 1.0.7 View file →
@@ -1,6 +1,5 @@
1 1 <?php
2 -namespace Easyel\EasyElements\Widgets;
3 2 use Elementor\Controls_Manager;
4 3 use Elementor\Utils;
5 4 use Elementor\Widget_Base;
6 5 use \Elementor\Group_Control_Border;
@@ -10,14 +9,24 @@
10 9 }
11 10
12 11 class Easyel_Video_Popup_Widget extends \Elementor\Widget_Base {
13 12
13 + public function get_style_depends() {
14 + $handle = 'eel-video-popup-style';
15 + $css_path = plugin_dir_path( __FILE__ ) . 'css/video.css';
16 +
17 + if ( ! wp_style_is( $handle, 'registered' ) && file_exists( $css_path ) ) {
18 + wp_register_style( $handle, plugins_url( 'css/video.css', __FILE__ ), [], defined( 'WP_DEBUG' ) && WP_DEBUG ? filemtime( $css_path ) : '1.0.0' );
19 + }
20 + return [ $handle ];
21 + }
22 +
14 23 public function get_name() {
15 24 return 'eel-video-popup';
16 25 }
17 26
18 27 public function get_title() {
19 - return __( 'Video', 'easy-elements' );
28 + return __( 'Video Popup', 'easy-elements' );
20 29 }
21 30
22 31 public function get_icon() {
23 32 return 'easyicon easyelIcon-video';
@@ -29,20 +38,13 @@
29 38
30 39 public function get_keywords() {
31 40 return [ 'video', 'popup', 'link', 'click' ];
32 41 }
33 -
34 - public function get_style_depends() {
35 - return [
36 - 'eel-video-popup',
37 - ];
38 - }
39 -
40 42 protected function register_controls() {
41 43 $this->start_controls_section(
42 44 'section_video',
43 45 [
44 - 'label' => __( 'Video Settings', 'easy-elements' ),
46 + 'label' => __( 'Video Popup Settings', 'easy-elements' ),
45 47 ]
46 48 );
47 49
48 50 $this->add_control(
@@ -80,28 +82,13 @@
80 82 'default' => 'https://www.youtube.com/watch?v=hDABYoas7SY',
81 83 'placeholder' => __( 'https://www.youtube.com/watch?v=hDABYoas7SY', 'easy-elements' ),
82 84 'condition' => [
83 85 'video_type!' => 'self_hosted',
84 - 'video_type' => 'youtube',
85 86 ],
86 87 ]
87 88 );
88 89
89 90 $this->add_control(
90 - 'video_url_vimeo',
91 - [
92 - 'label' => __( 'Video URL', 'easy-elements' ),
93 - 'type' => Controls_Manager::TEXT,
94 - 'default' => 'https://vimeo.com/347119375',
95 - 'placeholder' => __( 'https://vimeo.com/347119375', 'easy-elements' ),
96 - 'condition' => [
97 - 'video_type!' => 'self_hosted',
98 - 'video_type' => 'vimeo',
99 - ],
100 - ]
101 - );
102 -
103 - $this->add_control(
104 91 'self_hosted_video',
105 92 [
106 93 'label' => __( 'Self Hosted Video', 'easy-elements' ),
107 94 'type' => Controls_Manager::MEDIA,
@@ -111,9 +98,74 @@
111 98 ],
112 99 ]
113 100 );
114 101
115 - $this->add_responsive_control(
102 + $this->add_control(
103 + 'self_hosted_autoplay',
104 + [
105 + 'label' => __( 'Autoplay', 'easy-elements' ),
106 + 'type' => Controls_Manager::SWITCHER,
107 + 'label_on' => __( 'Yes', 'easy-elements' ),
108 + 'label_off' => __( 'No', 'easy-elements' ),
109 + 'return_value' => 'yes',
110 + 'default' => '',
111 + 'condition' => [
112 + 'display_type' => 'normal',
113 + 'video_type' => 'self_hosted',
114 + ],
115 + ]
116 + );
117 +
118 + $this->add_control(
119 + 'self_hosted_loop',
120 + [
121 + 'label' => __( 'Loop', 'easy-elements' ),
122 + 'type' => Controls_Manager::SWITCHER,
123 + 'label_on' => __( 'Yes', 'easy-elements' ),
124 + 'label_off' => __( 'No', 'easy-elements' ),
125 + 'return_value' => 'yes',
126 + 'default' => '',
127 + 'condition' => [
128 + 'display_type' => 'normal',
129 + 'video_type' => 'self_hosted',
130 + ],
131 + ]
132 + );
133 +
134 + $this->add_control(
135 + 'self_hosted_muted',
136 + [
137 + 'label' => __( 'Muted', 'easy-elements' ),
138 + 'type' => Controls_Manager::SWITCHER,
139 + 'label_on' => __( 'Yes', 'easy-elements' ),
140 + 'label_off' => __( 'No', 'easy-elements' ),
141 + 'return_value' => 'yes',
142 + 'default' => '',
143 + 'condition' => [
144 + 'display_type' => 'normal',
145 + 'video_type' => 'self_hosted',
146 + ],
147 + ]
148 + );
149 +
150 + $this->add_control(
151 + 'self_hosted_controls',
152 + [
153 + 'label' => __( 'Show Controls', 'easy-elements' ),
154 + 'type' => Controls_Manager::SWITCHER,
155 + 'label_on' => __( 'Yes', 'easy-elements' ),
156 + 'label_off' => __( 'No', 'easy-elements' ),
157 + 'return_value' => 'yes',
158 + 'default' => 'yes',
159 + 'condition' => [
160 + 'display_type' => 'normal',
161 + 'video_type' => 'self_hosted',
162 + ],
163 + ]
164 + );
165 +
166 +
167 + $this->add_control(
116 168 'video_height',
117 169 [
118 170 'label' => __( 'Video Height', 'easy-elements' ),
119 171 'type' => \Elementor\Controls_Manager::SLIDER,
@@ -128,9 +180,9 @@
128 180 'max' => 100,
129 181 ],
130 182 ],
131 183 'default' => [
132 - 'size' => 700,
184 + 'size' => 400,
133 185 'unit' => 'px',
134 186 ],
135 187 'selectors' => [
136 188 '{{WRAPPER}} .eel-video-popup-wrapper iframe' => 'height: {{SIZE}}{{UNIT}};',
@@ -141,19 +193,9 @@
141 193 ],
142 194 ]
143 195 );
144 196
145 - $this->add_group_control(
146 - \Elementor\Group_Control_Css_Filter::get_type(),
147 - [
148 - 'name' => 'video_filters',
149 - 'label' => __( 'CSS Filters', 'easy-elements' ),
150 - 'selector' => '{{WRAPPER}} .eel-video-popup-wrapper iframe, {{WRAPPER}} .eel-video-popup-wrapper video',
151 - ]
152 - );
153 197
154 -
155 -
156 198 $this->add_control(
157 199 'popup_trigger_text',
158 200 [
159 201 'label' => __( 'Trigger Text', 'easy-elements' ),
@@ -165,33 +207,29 @@
165 207 ]
166 208 );
167 209
168 210 $this->add_responsive_control(
169 - 'popup_icon_spacing',
170 - [
171 - 'label' => __( 'Text Spacing', 'easy-elements' ),
172 - 'type' => \Elementor\Controls_Manager::SLIDER,
173 - 'size_units' => [ 'px' ],
174 - 'default' => [
175 - 'size' => 8,
176 - 'unit' => 'px',
177 - ],
178 - 'range' => [
179 - 'px' => [
180 - 'min' => 0,
181 - 'max' => 100,
182 - ],
183 - ],
184 - 'selectors' => [
185 - '{{WRAPPER}} .eel-video-popup-btn .eel-icon-wrap + .eel-trigger-text' => 'margin-left: {{SIZE}}{{UNIT}};',
186 - '{{WRAPPER}} .eel-video-popup-btn .eel-trigger-text + .eel-icon-wrap' => 'margin-left: {{SIZE}}{{UNIT}};',
187 - ],
188 - 'condition' => [
189 - 'display_type' => 'popup',
190 - ],
191 - ]
211 + 'popup_icon_spacing',
212 + [
213 + 'label' => __( 'Text Spacing', 'easy-elements' ),
214 + 'type' => \Elementor\Controls_Manager::SLIDER,
215 + 'range' => [
216 + 'px' => [
217 + 'min' => 0,
218 + 'max' => 100,
219 + ],
220 + ],
221 + 'selectors' => [
222 + '{{WRAPPER}} .eel-video-popup-btn .eel-icon-wrap + .eel-trigger-text' => 'margin-left: {{SIZE}}{{UNIT}};',
223 + '{{WRAPPER}} .eel-video-popup-btn .eel-trigger-text + .eel-icon-wrap' => 'margin-left: {{SIZE}}{{UNIT}};',
224 + ],
225 + 'condition' => [
226 + 'display_type' => 'popup',
227 + ],
228 + ]
192 229 );
193 230
231 +
194 232 $this->add_control(
195 233 'popup_text_color',
196 234 [
197 235 'label' => __( 'Text Color', 'easy-elements' ),
@@ -479,264 +517,11 @@
479 517 );
480 518 $this->end_controls_section();
481 519
482 520 $this->start_controls_section(
483 - 'section_video_self_options',
484 - [
485 - 'label' => __( 'Video Settings', 'easy-elements' ),
486 - 'condition' => [
487 - 'display_type' => 'normal',
488 - 'video_type' => 'self_hosted',
489 - ],
490 - ]
491 - );
492 -
493 - $this->add_control(
494 - 'self_hosted_autoplay',
495 - [
496 - 'label' => __( 'Autoplay', 'easy-elements' ),
497 - 'type' => Controls_Manager::SWITCHER,
498 - 'label_on' => __( 'Yes', 'easy-elements' ),
499 - 'label_off' => __( 'No', 'easy-elements' ),
500 - 'return_value' => 'yes',
501 - 'default' => '',
502 - 'condition' => [
503 - 'display_type' => 'normal',
504 - 'video_type' => 'self_hosted',
505 - ],
506 - ]
507 - );
508 -
509 - $this->add_control(
510 - 'self_hosted_loop',
511 - [
512 - 'label' => __( 'Loop', 'easy-elements' ),
513 - 'type' => Controls_Manager::SWITCHER,
514 - 'label_on' => __( 'Yes', 'easy-elements' ),
515 - 'label_off' => __( 'No', 'easy-elements' ),
516 - 'return_value' => 'yes',
517 - 'default' => '',
518 - 'condition' => [
519 - 'display_type' => 'normal',
520 - 'video_type' => 'self_hosted',
521 - ],
522 - ]
523 - );
524 -
525 - $this->add_control(
526 - 'self_hosted_muted',
527 - [
528 - 'label' => __( 'Muted', 'easy-elements' ),
529 - 'type' => Controls_Manager::SWITCHER,
530 - 'label_on' => __( 'Yes', 'easy-elements' ),
531 - 'label_off' => __( 'No', 'easy-elements' ),
532 - 'return_value' => 'yes',
533 - 'default' => '',
534 - 'condition' => [
535 - 'display_type' => 'normal',
536 - 'video_type' => 'self_hosted',
537 - ],
538 - ]
539 - );
540 -
541 - $this->add_control(
542 - 'self_hosted_controls',
543 - [
544 - 'label' => __( 'Show Controls', 'easy-elements' ),
545 - 'type' => Controls_Manager::SWITCHER,
546 - 'label_on' => __( 'Yes', 'easy-elements' ),
547 - 'label_off' => __( 'No', 'easy-elements' ),
548 - 'return_value' => 'yes',
549 - 'default' => 'yes',
550 - 'condition' => [
551 - 'display_type' => 'normal',
552 - 'video_type' => 'self_hosted',
553 - ],
554 - ]
555 - );
556 - $this->end_controls_section();
557 -
558 - $this->start_controls_section(
559 - 'section_video_options',
560 - [
561 - 'label' => __( 'Video Settings', 'easy-elements' ),
562 - 'condition' => [
563 - 'display_type' => 'normal',
564 - 'video_type!' => 'self_hosted',
565 - ],
566 - ]
567 - );
568 -
569 - $this->add_control(
570 - 'autoplay',
571 - [
572 - 'label' => __( 'Autoplay', 'easy-elements' ),
573 - 'type' => Controls_Manager::SWITCHER,
574 - 'label_on' => __( 'Yes', 'easy-elements' ),
575 - 'label_off'=> __( 'No', 'easy-elements' ),
576 - 'return_value' => 'yes',
577 - 'default' => '',
578 - ]
579 - );
580 -
581 - $this->add_control(
582 - 'mute',
583 - [
584 - 'label' => __( 'Mute', 'easy-elements' ),
585 - 'type' => Controls_Manager::SWITCHER,
586 - 'label_on' => __( 'Yes', 'easy-elements' ),
587 - 'label_off'=> __( 'No', 'easy-elements' ),
588 - 'return_value' => 'yes',
589 - 'default' => '',
590 - ]
591 - );
592 -
593 - $this->add_control(
594 - 'loop',
595 - [
596 - 'label' => __( 'Loop', 'easy-elements' ),
597 - 'type' => Controls_Manager::SWITCHER,
598 - 'label_on' => __( 'Yes', 'easy-elements' ),
599 - 'label_off'=> __( 'No', 'easy-elements' ),
600 - 'return_value' => 'yes',
601 - 'default' => '',
602 - ]
603 - );
604 -
605 - $this->add_control(
606 - 'controls',
607 - [
608 - 'label' => __( 'Player Controls', 'easy-elements' ),
609 - 'type' => Controls_Manager::SWITCHER,
610 - 'label_on' => __( 'Yes', 'easy-elements' ),
611 - 'label_off'=> __( 'No', 'easy-elements' ),
612 - 'return_value' => 'yes',
613 - 'default' => 'yes',
614 - ]
615 - );
616 -
617 - $this->add_control(
618 - 'privacy_mode',
619 - [
620 - 'label' => __( 'Privacy Mode', 'easy-elements' ),
621 - 'type' => Controls_Manager::SWITCHER,
622 - 'label_on' => __( 'On', 'easy-elements' ),
623 - 'label_off'=> __( 'Off', 'easy-elements' ),
624 - 'return_value' => 'yes',
625 - 'description' => __( 'YouTube nocookie / Vimeo DNT', 'easy-elements' ),
626 - ]
627 - );
628 -
629 - $this->end_controls_section();
630 -
631 -
632 - $this->start_controls_section(
633 - 'section_image_overlay',
634 - [
635 - 'label' => __( 'Video Overlay', 'easy-elements' ),
636 - 'condition' => [
637 - 'display_type' => 'normal',
638 - ],
639 - ]
640 - );
641 -
642 - $this->add_control(
643 - 'show_image_overlay',
644 - [
645 - 'label' => __( 'Image Overlay', 'easy-elements' ),
646 - 'type' => \Elementor\Controls_Manager::SWITCHER,
647 - 'label_on' => __( 'On', 'easy-elements' ),
648 - 'label_off'=> __( 'Off', 'easy-elements' ),
649 - 'return_value' => 'yes',
650 - 'default' => '',
651 - ]
652 - );
653 -
654 - $this->add_control(
655 - 'overlay_image',
656 - [
657 - 'label' => __( 'Choose Image', 'easy-elements' ),
658 - 'type' => \Elementor\Controls_Manager::MEDIA,
659 - 'condition' => [
660 - 'show_image_overlay' => 'yes',
661 - ],
662 - ]
663 - );
664 -
665 - $this->add_control(
666 - 'overlay_image_size',
667 - [
668 - 'label' => __( 'Image Resolution', 'easy-elements' ),
669 - 'type' => \Elementor\Controls_Manager::SELECT,
670 - 'default' => 'full',
671 - 'options' => [
672 - 'thumbnail' => __( 'Thumbnail', 'easy-elements' ),
673 - 'medium' => __( 'Medium', 'easy-elements' ),
674 - 'large' => __( 'Large', 'easy-elements' ),
675 - 'full' => __( 'Full', 'easy-elements' ),
676 - ],
677 - 'condition' => [
678 - 'show_image_overlay' => 'yes',
679 - ],
680 - ]
681 - );
682 -
683 - $this->add_control(
684 - 'overlay_play_icon',
685 - [
686 - 'label' => __( 'Play Icon', 'easy-elements' ),
687 - 'type' => \Elementor\Controls_Manager::SWITCHER,
688 - 'default' => 'yes',
689 - 'condition' => [
690 - 'show_image_overlay' => 'yes',
691 - ],
692 - ]
693 - );
694 -
695 - $this->add_control(
696 - 'overlay_icon',
697 - [
698 - 'label' => __( 'Icon', 'easy-elements' ),
699 - 'type' => \Elementor\Controls_Manager::ICONS,
700 - 'condition' => [
701 - 'show_image_overlay' => 'yes',
702 - 'overlay_play_icon' => 'yes',
703 - ],
704 - ]
705 - );
706 -
707 - $this->add_control(
708 - 'overlay_lightbox',
709 - [
710 - 'label' => __( 'Lightbox', 'easy-elements' ),
711 - 'type' => \Elementor\Controls_Manager::SWITCHER,
712 - 'return_value' => 'yes',
713 - 'default' => '',
714 - 'condition' => [
715 - 'show_image_overlay' => 'yes',
716 - ],
717 - ]
718 - );
719 -
720 - $this->add_control(
721 - 'lightbox_animation',
722 - [
723 - 'label' => __( 'Animation', 'easy-elements' ),
724 - 'type' => \Elementor\Controls_Manager::ANIMATION,
725 - 'default' => '',
726 - 'condition' => [
727 - 'overlay_lightbox' => 'yes',
728 - 'show_image_overlay' => 'yes',
729 - ],
730 - ]
731 - );
732 -
733 - $this->end_controls_section();
734 -
735 - $this->start_controls_section(
736 521 'section_video_popup_overlay_settings',
737 522 [
738 - 'label' => __( 'Play Button Overlay Settings', 'easy-elements' ),
523 + 'label' => __( 'Play Overlay Settings', 'easy-elements' ),
739 524 'condition' => [
740 525 'display_type' => 'popup',
741 526 ],
742 527 ]
@@ -778,114 +563,8 @@
778 563 ]
779 564 );
780 565
781 566 $this->end_controls_section();
782 -
783 - $this->start_controls_section(
784 - 'video_icon_settings_style',
785 - [
786 - 'label' => __( 'Video Overlay Style', 'easy-elements' ),
787 - 'tab' => Controls_Manager::TAB_STYLE,
788 - 'condition' => [
789 - 'display_type' => 'normal',
790 - ],
791 - ]
792 - );
793 -
794 - $this->add_control(
795 - 'icon_color',
796 - [
797 - 'label' => esc_html__('Icon Color', 'easy-elements'),
798 - 'type' => Controls_Manager::COLOR,
799 - 'selectors' => [
800 - '{{WRAPPER}} .eel-overlay-play-icon' => 'color: {{VALUE}};',
801 - '{{WRAPPER}} .eel-overlay-play-icon svg path' => 'fill: {{VALUE}};',
802 - ],
803 - ]
804 - );
805 -
806 - $this->add_responsive_control(
807 - 'video_icon_size',
808 - [
809 - 'label' => esc_html__('Icon Size', 'easy-elements'),
810 - 'type' => \Elementor\Controls_Manager::SLIDER,
811 - 'size_units' => ['px', 'em', '%'],
812 - 'range' => [
813 - 'px' => [
814 - 'min' => 10,
815 - 'max' => 200,
816 - ],
817 - 'em' => [
818 - 'min' => 0.5,
819 - 'max' => 10,
820 - ],
821 - '%' => [
822 - 'min' => 10,
823 - 'max' => 200,
824 - ],
825 - ],
826 - 'selectors' => [
827 - '{{WRAPPER}} .eel-overlay-play-icon i' => 'font-size: {{SIZE}}{{UNIT}};',
828 - '{{WRAPPER}} .eel-overlay-play-icon svg' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};',
829 - ],
830 - ]
831 - );
832 -
833 - $this->add_group_control(
834 - \Elementor\Group_Control_Border::get_type(),
835 - [
836 - 'name' => 'video_border',
837 - 'selector' => '{{WRAPPER}} .eel-overlay-play-icon',
838 - ]
839 - );
840 -
841 - $this->add_group_control(
842 - \Elementor\Group_Control_Background::get_type(),
843 - [
844 - 'name' => 'video_background',
845 - 'types' => [ 'classic', 'gradient' ],
846 - 'selector' => '{{WRAPPER}} .eel-overlay-play-icon',
847 - ]
848 - );
849 - $this->add_responsive_control(
850 - 'video_border_radius',
851 - [
852 - 'label' => esc_html__('Border Radius', 'easy-elements'),
853 - 'type' => Controls_Manager::DIMENSIONS,
854 - 'size_units' => [ 'px', '%', 'em' ],
855 - 'selectors' => [
856 - '{{WRAPPER}} .eel-overlay-play-icon' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
857 - ],
858 - ]
859 - );
860 -
861 - $this->add_responsive_control(
862 - 'custom_circle_normal_size',
863 - [
864 - 'label' => esc_html__('Circle Size', 'easy-elements'),
865 - 'type' => Controls_Manager::SLIDER,
866 - 'size_units' => [ 'px', 'em', '%' ],
867 - 'range' => [
868 - 'px' => [
869 - 'min' => 10,
870 - 'max' => 300,
871 - ],
872 - 'em' => [
873 - 'min' => 0.5,
874 - 'max' => 20,
875 - ],
876 - '%' => [
877 - 'min' => 5,
878 - 'max' => 100,
879 - ],
880 - ],
881 - 'selectors' => [
882 - '{{WRAPPER}} .eel-overlay-play-icon' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};',
883 - ],
884 - ]
885 - );
886 -
887 - $this->end_controls_section();
888 567 }
889 568
890 569 private function get_youtube_id( $url ) {
891 570 preg_match('/(?:v=|\/)([0-9A-Za-z_-]{11}).*/', $url, $matches);
@@ -897,141 +576,118 @@
897 576 return $matches[1] ?? '';
898 577 }
899 578
900 579 protected function render() {
901 - $settings = $this->get_settings_for_display();
902 - $embed_type = $settings['video_type'];
903 - $display_type = $settings['display_type'];
904 - $video_url = '';
580 + $settings = $this->get_settings_for_display();
581 + $video_url = '';
582 + $embed_type = $settings['video_type'];
583 + $display_type = $settings['display_type'];
905 584
906 - /* -----------------------------------------
907 - * Get Video URL
908 - * ----------------------------------------- */
909 - if ( $embed_type === 'self_hosted' && ! empty( $settings['self_hosted_video']['url'] ) ) {
910 - $video_url = esc_url( $settings['self_hosted_video']['url'] );
911 - } elseif ( ! empty( $settings['video_url'] ) ) {
912 - $video_url = esc_url( $settings['video_url'] );
913 - } elseif ( ! empty( $settings['video_url_vimeo'] ) ) {
914 - $video_url = esc_url( $settings['video_url_vimeo'] );
915 - }
585 + if ( $embed_type === 'self_hosted' && ! empty( $settings['self_hosted_video']['url'] ) ) {
586 + $video_url = esc_url( $settings['self_hosted_video']['url'] );
587 + } elseif ( ! empty( $settings['video_url'] ) ) {
588 + $video_url = esc_url( $settings['video_url'] );
589 + }
916 590
917 - if ( empty( $video_url ) ) {
918 - return;
919 - }
591 + if ( empty( $video_url ) ) {
592 + return;
593 + }
920 594
921 - $video_id = uniqid( 'eel_video_' );
922 - $circle_glow = ( ! empty( $settings['circle_glow'] ) && $settings['circle_glow'] === 'yes' ) ? 'eel-glow-active' : '';
923 - $icon_hide_h_show = ( ! empty( $settings['popup_icon_hover_show'] ) && $settings['popup_icon_hover_show'] === 'yes' ) ? 'eel-vicon-hide-show' : '';
595 + $video_id = uniqid('eel_video_');
596 + $circle_glow = ! empty( $settings['circle_glow'] ) && $settings['circle_glow'] === 'yes' ? 'eel-glow-active' : '';
924 597
925 - echo '<div class="eel-video-popup-wrapper ' . esc_attr( $icon_hide_h_show ) . '">';
598 + $icon_hide_h_show = ( isset( $settings['popup_icon_hover_show'] ) && $settings['popup_icon_hover_show'] === 'yes' ) ? 'eel-vicon-hide-show' : '';
926 599
927 - /* =====================================================================
928 - * NORMAL VIDEO
929 - * ===================================================================== */
930 - if ( $display_type === 'normal' ) {
600 + echo '<div class="eel-video-popup-wrapper ' . esc_attr( $icon_hide_h_show ?? '' ) . '">';
931 601
932 - // Image Overlay
933 - if ( ! empty( $settings['show_image_overlay'] ) && $settings['show_image_overlay'] === 'yes' && ! empty( $settings['overlay_image']['url'] ) ) {
934 - $overlay_url = esc_url( $settings['overlay_image']['url'] );
935 - $overlay_size = ! empty( $settings['overlay_image_size'] ) ? $settings['overlay_image_size'] : 'full';
936 - $bg_style = "background-image: url('{$overlay_url}'); background-size: cover; background-position: center;";
937 - $overlay_lightbox = ! empty( $settings['overlay_lightbox'] ) && $settings['overlay_lightbox'] === 'yes' ? 'yes' : 'no';
938 - $lightbox_animation = ! empty( $settings['lightbox_animation'] ) ? esc_attr( $settings['lightbox_animation'] ) : '';
939 - echo '<div class="eel-video-overlay"
940 - style="' . esc_attr($bg_style) . '"
941 - data-lightbox="' . esc_attr( $overlay_lightbox ) . '"
942 - data-video-type="' . esc_attr( $embed_type ) . '"
943 - data-video-url="' . esc_url( $video_url ) . '"
944 - data-popup-id="' . esc_attr( $video_id ) . '"
945 - data-animation="' . esc_attr( $lightbox_animation ) . '">';
946 - if ( ! empty( $settings['overlay_play_icon'] ) && $settings['overlay_play_icon'] === 'yes' ) {
947 - $icon_html = '';
948 - if ( ! empty( $settings['overlay_icon']['value'] ) ) {
949 - $icon_html = '<i class="' . esc_attr( $settings['overlay_icon']['value'] ) . '"></i>';
950 - } else {
951 - $icon_html = '<i class="unicon-play"></i>';
952 - }
953 - // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
954 - echo '<span class="eel-overlay-play-icon">' . $icon_html . '</span>';
955 - }
602 + if ( $display_type === 'normal' ) {
603 + if ( $embed_type === 'self_hosted' && !empty( $settings['self_hosted_video']['url'] ) ) {
604 + $attrs = [];
956 605
957 - echo '</div>';
958 -
959 - // Create lightbox overlay structure if lightbox is enabled
960 - if ( $overlay_lightbox === 'yes' ) {
961 - $animation_class = ! empty( $lightbox_animation ) ? ' animated ' . $lightbox_animation : '';
962 - echo '<div id="' . esc_attr( $video_id ) . '" class="eel-video-popup-overlay" data-animation="' . esc_attr( $lightbox_animation ) . '">';
963 - echo '<div class="eel-video-popup-content ' . esc_attr( $animation_class ) . '">';
964 - echo '<span class="eel-video-popup-close">&times;</span>';
965 - echo '<div class="eel-video-popup-iframe-wrapper"></div>';
966 - echo '</div>';
967 - echo '</div>';
968 - }
969 - }
606 + if ( ! empty( $settings['self_hosted_autoplay'] ) ) {
607 + $attrs[] = 'autoplay';
608 + }
609 + if ( ! empty( $settings['self_hosted_loop'] ) ) {
610 + $attrs[] = 'loop';
611 + }
612 + if ( ! empty( $settings['self_hosted_muted'] ) ) {
613 + $attrs[] = 'muted';
614 + }
615 + if ( ! empty( $settings['self_hosted_controls'] ) ) {
616 + $attrs[] = 'controls';
617 + }
970 618
619 + $attrs[] = 'playsinline';
971 620
972 - // Self Hosted Video
973 - if ( $embed_type === 'self_hosted' ) {
974 - $attrs = [];
975 - if ( ! empty( $settings['self_hosted_autoplay'] ) ) {
976 - $attrs[] = 'autoplay';
977 - $attrs[] = 'muted';
978 - }
979 - if ( ! empty( $settings['self_hosted_loop'] ) ) $attrs[] = 'loop';
980 - if ( ! empty( $settings['self_hosted_muted'] ) ) $attrs[] = 'muted';
981 - if ( ! empty( $settings['self_hosted_controls'] ) ) $attrs[] = 'controls';
982 - $attrs[] = 'playsinline';
983 - $attrs[] = 'preload="none"';
984 - // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
985 - echo '<video class="eel-normal-video" src="' . esc_url( $video_url ) . '" ' . implode( ' ', $attrs ) . '></video>';
986 - } else {
987 - // YouTube/Vimeo
988 - $params = [
989 - 'autoplay' => ! empty( $settings['autoplay'] ) ? '1' : '0',
990 - 'loop' => ! empty( $settings['loop'] ) ? '1' : '0',
991 - 'controls' => ! empty( $settings['controls'] ) ? '1' : '0',
992 - ];
993 - if ( ! empty( $settings['mute'] ) ) $params['mute'] = '1';
621 + echo '<video src="' . esc_url($video_url) . '" ' . esc_attr(implode( ' ', $attrs )) . ' class="eel-normal-video"></video>';
622 + } else {
623 + $embed_url = '';
624 + if ( $embed_type === 'youtube' ) {
625 + $yt_id = $this->get_youtube_id($video_url);
626 + if ($yt_id) {
627 + $embed_url = 'https://www.youtube.com/embed/' . $yt_id;
628 + }
629 + } elseif ( $embed_type === 'vimeo' ) {
630 + $vimeo_id = $this->get_vimeo_id($video_url);
631 + if ($vimeo_id) {
632 + $embed_url = 'https://player.vimeo.com/video/' . $vimeo_id;
633 + }
634 + }
994 635
995 - if ( $embed_type === 'youtube' ) {
996 - $yt_id = $this->get_youtube_id( $video_url );
997 - if ( ! $yt_id ) { echo '</div>'; return; }
998 - $embed_url = 'https://www.youtube.com/embed/' . $yt_id . '?' . http_build_query( $params );
999 - } elseif ( $embed_type === 'vimeo' ) {
1000 - $vimeo_id = $this->get_vimeo_id( $video_url );
1001 - if ( ! $vimeo_id ) { echo '</div>'; return; }
1002 - $embed_url = 'https://player.vimeo.com/video/' . $vimeo_id . '?' . http_build_query( $params );
1003 - }
1004 - echo '<iframe class="eel-normal-video" src="' . esc_url( $embed_url ) . '" loading="lazy" frameborder="0" allow="autoplay; fullscreen" allowfullscreen></iframe>';
1005 - }
1006 - }
636 + if ( $embed_url ) {
637 + echo '<iframe class="eel-normal-video" src="' . esc_url($embed_url) . '" frameborder="0" allowfullscreen></iframe>';
638 + }
639 + }
640 + }
1007 641
1008 - if ( $display_type === 'popup' ) {
642 + if ( $display_type === 'popup' ) {
643 + $icon_html = '';
644 + $icon_setting = $settings['popup_trigger_icon'];
645 + // Handle custom SVG upload (Elementor 3.18+)
646 + if (
647 + isset($icon_setting['library']) &&
648 + $icon_setting['library'] === 'svg' &&
649 + isset($icon_setting['value']['url'])
650 + ) {
651 + $svg_url = $icon_setting['value']['url'];
652 + if (strtolower(pathinfo($svg_url, PATHINFO_EXTENSION)) === 'svg') {
653 + $response = wp_remote_get($svg_url);
654 + if (!is_wp_error($response) && isset($response['body'])) {
655 + $icon_html = $response['body'];
656 + }
657 + }
658 + } elseif (
659 + isset($icon_setting['library']) &&
660 + $icon_setting['library'] === 'image' &&
661 + isset($icon_setting['value']['url'])
662 + ) {
663 + $img_url = esc_url($icon_setting['value']['url']);
664 + $attachment_id = attachment_url_to_postid($img_url);
665 + if ($attachment_id) {
666 + $icon_html = wp_get_attachment_image($attachment_id, 'full', false, [
667 + 'style' => 'max-width:100%;max-height:100%;',
668 + 'alt' => '',
669 + ]);
670 + } else {
671 + // Do not output the image if not an attachment
672 + $icon_html = '';
673 + }
674 + } elseif (!empty($icon_setting['value']) && is_string($icon_setting['value'])) {
675 + $icon_class = esc_attr($icon_setting['value']);
676 + $icon_html = '<i class="' . $icon_class . '" aria-hidden="true"></i>';
677 + } else {
678 + $icon_html = '<i class="unicon-play" aria-hidden="true"></i>';
679 + }
1009 680
1010 - $icon_html = '';
1011 - $icon_setting = $settings['popup_trigger_icon'];
681 + $button_label = ! empty( $settings['popup_trigger_text'] ) ? wp_strip_all_tags( $settings['popup_trigger_text'] ) : 'Play Video';
682 + ?>
1012 683
1013 - if ( isset( $icon_setting['library'] ) && $icon_setting['library'] === 'svg' && ! empty( $icon_setting['value']['url'] ) ) {
1014 - $response = wp_remote_get( $icon_setting['value']['url'] );
1015 - if ( ! is_wp_error( $response ) && ! empty( $response['body'] ) ) {
1016 - $icon_html = $response['body'];
1017 - }
1018 - } elseif ( isset( $icon_setting['library'] ) && $icon_setting['library'] === 'image' && ! empty( $icon_setting['value']['url'] ) ) {
1019 - $icon_html = wp_get_attachment_image( attachment_url_to_postid( $icon_setting['value']['url'] ), 'full' );
1020 - } elseif ( ! empty( $icon_setting['value'] ) ) {
1021 - $icon_html = '<i class="' . esc_attr( $icon_setting['value'] ) . '"></i>';
1022 - } else {
1023 - $icon_html = '<i class="unicon-play"></i>';
1024 - }
1025 -
1026 - $label = ! empty( $settings['popup_trigger_text'] ) ? wp_strip_all_tags( $settings['popup_trigger_text'] ) : 'Play Video';
1027 - ?>
1028 -
1029 - <div class="eel-video-popup-btn entro-all-video-popup <?php echo esc_attr($circle_glow); ?>"
684 + <button class="eel-video-popup-btn entro-all-video-popup <?php echo esc_attr($circle_glow); ?>"
1030 685 data-video-type="<?php echo esc_attr( $embed_type ); ?>"
1031 686 data-video-src="<?php echo esc_url( $video_url ); ?>"
1032 687 data-popup-id="<?php echo esc_attr( $video_id ); ?>"
1033 - aria-label="<?php echo esc_attr( $label ); ?>">
688 + aria-label="<?php echo esc_attr( $button_label ); ?>">
689 +
1034 690 <?php if ( $settings['popup_icon_show'] === 'yes' && $settings['popup_icon_position'] === 'before' ) : ?>
1035 691 <span class="eel-icon-wrap"><?php echo wp_kses_post($icon_html); ?>
1036 692 <?php if(!empty($settings['popup_play_overlay'])): ?>
1037 693 <span class="eel-overlay-play"><?php echo esc_html( $settings['popup_play_overlay'] ); ?> </span>
@@ -1037,9 +693,11 @@
1037 693 <span class="eel-overlay-play"><?php echo esc_html( $settings['popup_play_overlay'] ); ?> </span>
1038 694 <?php endif; ?>
1039 695 </span>
1040 696 <?php endif; ?>
697 +
1041 698 <span class="eel-trigger-text"><?php echo esc_html( $settings['popup_trigger_text'] ); ?></span>
699 +
1042 700 <?php if ( $settings['popup_icon_show'] === 'yes' && $settings['popup_icon_position'] === 'after' ) : ?>
1043 701 <span class="eel-icon-wrap"><?php echo wp_kses_post($icon_html); ?>
1044 702 <?php if(!empty($settings['popup_play_overlay'])): ?>
1045 703 <span class="eel-overlay-play"><?php echo esc_html( $settings['popup_play_overlay'] ); ?> </span>
@@ -1045,16 +703,19 @@
1045 703 <span class="eel-overlay-play"><?php echo esc_html( $settings['popup_play_overlay'] ); ?> </span>
1046 704 <?php endif; ?>
1047 705 </span>
1048 706 <?php endif; ?>
1049 - </div>
1050 - <div id="<?php echo esc_attr( $video_id ); ?>" class="eel-video-popup-overlay">
1051 - <div class="eel-video-popup-content">
1052 - <span class="eel-video-popup-close">&times;</span>
1053 - <div class="eel-video-popup-iframe-wrapper"></div>
1054 - </div>
1055 - </div>
1056 - <?php
1057 - }
1058 - echo '</div>';
707 +
708 + </button>
709 +
710 + <div id="<?php echo esc_attr($video_id); ?>" class="eel-video-popup-overlay">
711 + <div class="eel-video-popup-content">
712 + <span class="eel-video-popup-close">&times;</span>
713 + <div class="eel-video-popup-iframe-wrapper"></div>
714 + </div>
715 + </div>
716 + <?php
717 + }
718 +
719 + echo '</div>';
1059 720 }
1060 -}
721 +}?>