PluginProbe
Elementor Website Builder – more than just a page builder / 3.17.2
Elementor Website Builder – more than just a page builder v3.17.2
4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 4.0.7 All 451 releases
← All changes | includes/widgets/video.php +39 -88 4.2.23.17.2 View file →
@@ -1,9 +1,8 @@
1 1 <?php
2 2 namespace Elementor;
3 3
4 4 use Elementor\Modules\DynamicTags\Module as TagsModule;
5 -use Elementor\Modules\Promotions\Controls\Promotion_Control;
6 5
7 6 if ( ! defined( 'ABSPATH' ) ) {
8 7 exit; // Exit if accessed directly.
9 8 }
@@ -88,57 +87,13 @@
88 87 public function get_keywords() {
89 88 return [ 'video', 'player', 'embed', 'youtube', 'vimeo', 'dailymotion', 'videopress' ];
90 89 }
91 90
92 - protected function is_dynamic_content(): bool {
93 - return false;
94 - }
95 -
96 91 /**
97 - * Get style dependencies.
98 - *
99 - * Retrieve the list of style dependencies the widget requires.
100 - *
101 - * @since 3.24.0
102 - * @access public
103 - *
104 - * @return array Widget style dependencies.
105 - */
106 - public function get_style_depends(): array {
107 - return [ 'widget-video' ];
108 - }
109 -
110 - public function has_widget_inner_wrapper(): bool {
111 - return ! Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
112 - }
113 -
114 - /**
115 92 * Register video widget controls.
116 93 *
117 94 * Adds different input fields to allow the user to change and customize the widget settings.
118 95 *
119 - * @since 3.19.0
120 - * @access protected
121 - *
122 - * @return array Widget promotion data.
123 - */
124 - protected function get_upsale_data() {
125 - return [
126 - 'condition' => ! Utils::has_pro(),
127 - 'image' => esc_url( ELEMENTOR_ASSETS_URL . 'images/go-pro.svg' ),
128 - 'image_alt' => esc_attr__( 'Upgrade', 'elementor' ),
129 - 'title' => esc_html__( "Grab your visitors' attention", 'elementor' ),
130 - 'description' => esc_html__( 'Get the Video Playlist widget and grow your toolbox with Elementor Pro.', 'elementor' ),
131 - 'upgrade_url' => esc_url( 'https://go.elementor.com/go-pro-video-widget/' ),
132 - 'upgrade_text' => esc_html__( 'Upgrade Now', 'elementor' ),
133 - ];
134 - }
135 -
136 - /**
137 - * Register video widget controls.
138 - *
139 - * Adds different input fields to allow the user to change and customize the widget settings.
140 - *
141 96 * @since 3.1.0
142 97 * @access protected
143 98 */
144 99 protected function register_controls() {
@@ -358,16 +313,23 @@
358 313 $this->add_control(
359 314 'autoplay',
360 315 [
361 316 'label' => esc_html__( 'Autoplay', 'elementor' ),
362 - 'description' => sprintf(
363 - /* translators: 1: `<a>` opening tag, 2: `</a>` closing tag. */
364 - esc_html__( 'Note: Autoplay is affected by %1$s Google’s Autoplay policy %2$s on Chrome browsers.', 'elementor' ),
365 - '<a href="https://developers.google.com/web/updates/2017/09/autoplay-policy-changes" target="_blank">',
366 - '</a>'
367 - ),
368 317 'type' => Controls_Manager::SWITCHER,
369 318 'frontend_available' => true,
319 + 'conditions' => [
320 + 'relation' => 'or',
321 + 'terms' => [
322 + [
323 + 'name' => 'show_image_overlay',
324 + 'value' => '',
325 + ],
326 + [
327 + 'name' => 'image_overlay[url]',
328 + 'value' => '',
329 + ],
330 + ],
331 + ],
370 332 ]
371 333 );
372 334
373 335 $this->add_control(
@@ -432,11 +394,11 @@
432 394 ]
433 395 );
434 396
435 397 $this->add_control(
436 - 'cc_load_policy',
398 + 'modestbranding',
437 399 [
438 - 'label' => esc_html__( 'Captions', 'elementor' ),
400 + 'label' => esc_html__( 'Modest Branding', 'elementor' ),
439 401 'type' => Controls_Manager::SWITCHER,
440 402 'condition' => [
441 403 'video_type' => [ 'youtube' ],
442 404 'controls' => 'yes',
@@ -600,11 +562,11 @@
600 562 'auto' => esc_html__( 'Auto', 'elementor' ),
601 563 'none' => esc_html__( 'None', 'elementor' ),
602 564 ],
603 565 'description' => sprintf(
604 - '%1$s <a target="_blank" href="https://go.elementor.com/preload-video/">%2$s</a>',
605 - esc_html__( 'Preload attribute lets you specify how the video should be loaded when the page loads.', 'elementor' ),
606 - esc_html__( 'Learn more', 'elementor' ),
566 + esc_html__( 'Preload attribute lets you specify how the video should be loaded when the page loads. %1$sLearn More%2$s', 'elementor' ),
567 + '<a target="_blank" href="https://go.elementor.com/preload-video/">',
568 + '</a>'
607 569 ),
608 570 'default' => 'metadata',
609 571 'condition' => [
610 572 'video_type' => 'hosted',
@@ -626,8 +588,17 @@
626 588 ],
627 589 ]
628 590 );
629 591
592 + $this->add_control(
593 + 'view',
594 + [
595 + 'label' => esc_html__( 'View', 'elementor' ),
596 + 'type' => Controls_Manager::HIDDEN,
597 + 'default' => 'youtube',
598 + ]
599 + );
600 +
630 601 $this->end_controls_section();
631 602
632 603 $this->start_controls_section(
633 604 'section_image_overlay',
@@ -669,8 +640,9 @@
669 640 Group_Control_Image_Size::get_type(),
670 641 [
671 642 'name' => 'image_overlay', // Usage: `{name}_size` and `{name}_custom_dimension`, in this case `image_overlay_size` and `image_overlay_custom_dimension`.
672 643 'default' => 'full',
644 + 'separator' => 'none',
673 645 'condition' => [
674 646 'show_image_overlay' => 'yes',
675 647 ],
676 648 ]
@@ -935,11 +907,11 @@
935 907
936 908 $this->add_control(
937 909 'deprecation_warning',
938 910 [
939 - 'type' => Controls_Manager::ALERT,
940 - 'alert_type' => 'danger',
941 - 'content' => esc_html__( 'Note: These controls have been deprecated and are only visible if they were previously in use. The video’s width and position are now set based on its aspect ratio.', 'elementor' ),
911 + 'type' => Controls_Manager::RAW_HTML,
912 + 'raw' => esc_html__( 'Note: These controls have been deprecated and are only visible if they were previously in use. The video’s width and position are now set based on its aspect ratio.', 'elementor' ),
913 + 'content_classes' => 'elementor-panel-alert elementor-panel-alert-danger',
942 914 'separator' => 'before',
943 915 'condition' => [
944 916 'lightbox_video_width!' => '',
945 917 'lightbox_content_position!' => '',
@@ -957,9 +929,9 @@
957 929 'default' => [
958 930 'unit' => '%',
959 931 ],
960 932 // 'selectors' => [
961 - // '(desktop+)#elementor-lightbox-{{ID}} .elementor-video-container' => 'width: {{SIZE}}{{UNIT}};',
933 + // '(desktop+)#elementor-lightbox-{{ID}} .elementor-video-container' => 'width: {{SIZE}}{{UNIT}};',
962 934 // ],
963 935 'condition' => [
964 936 'lightbox_video_width!' => '',
965 937 'lightbox_content_position!' => '',
@@ -978,9 +950,9 @@
978 950 '' => esc_html__( 'Center', 'elementor' ),
979 951 'top' => esc_html__( 'Top', 'elementor' ),
980 952 ],
981 953 // 'selectors' => [
982 - // '#elementor-lightbox-{{ID}} .elementor-video-container' => '{{VALUE}}; transform: translateX(-50%);',
954 + // '#elementor-lightbox-{{ID}} .elementor-video-container' => '{{VALUE}}; transform: translateX(-50%);',
983 955 // ],
984 956 'selectors_dictionary' => [
985 957 'top' => 'top: 60px',
986 958 ],
@@ -1048,9 +1020,9 @@
1048 1020
1049 1021 if ( $is_static_render_mode ) {
1050 1022 $video_html = Embed::get_embed_thumbnail_html( $video_url, $post_id );
1051 1023 // YouTube API requires a different markup which was set above.
1052 - } elseif ( 'youtube' !== $settings['video_type'] ) {
1024 + } else if ( 'youtube' !== $settings['video_type'] ) {
1053 1025 $video_html = Embed::get_embed_html( $video_url, $embed_params, $embed_options );
1054 1026 }
1055 1027 }
1056 1028
@@ -1083,15 +1055,14 @@
1083 1055 $lightbox_options = [
1084 1056 'type' => 'video',
1085 1057 'videoType' => $settings['video_type'],
1086 1058 'url' => $lightbox_url,
1087 - 'autoplay' => $settings['autoplay'],
1088 1059 'modalOptions' => [
1089 1060 'id' => 'elementor-lightbox-' . $this->get_id(),
1090 1061 'entranceAnimation' => $settings['lightbox_content_animation'],
1091 1062 'entranceAnimation_tablet' => $settings['lightbox_content_animation_tablet'],
1092 1063 'entranceAnimation_mobile' => $settings['lightbox_content_animation_mobile'],
1093 - 'videoAspectRatio' => $settings['aspect_ratio'] ?? '169',
1064 + 'videoAspectRatio' => $settings['aspect_ratio'],
1094 1065 ],
1095 1066 ];
1096 1067
1097 1068 if ( 'hosted' === $settings['video_type'] ) {
@@ -1134,8 +1105,9 @@
1134 1105 ];
1135 1106 }
1136 1107 Icons_Manager::render_icon( $settings['play_icon'], [ 'aria-hidden' => 'true' ] );
1137 1108 ?>
1109 + <span class="elementor-screen-only"><?php $this->print_a11y_text( $settings['image_overlay'] ); ?></span>
1138 1110 </div>
1139 1111 <?php endif; ?>
1140 1112 </div>
1141 1113 <?php } ?>
@@ -1145,9 +1117,9 @@
1145 1117
1146 1118 /**
1147 1119 * Render video widget as plain content.
1148 1120 *
1149 - * Override the default behavior, by printing the video URL instead of rendering it.
1121 + * Override the default behavior, by printing the video URL insted of rendering it.
1150 1122 *
1151 1123 * @since 1.4.5
1152 1124 * @access public
1153 1125 */
@@ -1193,9 +1165,9 @@
1193 1165 'loop',
1194 1166 'controls',
1195 1167 'mute',
1196 1168 'rel',
1197 - 'cc_load_policy',
1169 + 'modestbranding',
1198 1170 ];
1199 1171
1200 1172 if ( $settings['loop'] ) {
1201 1173 $video_properties = Embed::get_video_properties( $settings['youtube_url'] );
@@ -1332,8 +1304,9 @@
1332 1304 return $video_params;
1333 1305 }
1334 1306
1335 1307 /**
1308 + * @param bool $from_media
1336 1309 *
1337 1310 * @return string
1338 1311 * @since 2.1.0
1339 1312 * @access private
@@ -1411,28 +1384,6 @@
1411 1384 /* Sometimes the video url is base64, therefore we use `esc_attr` in `src`. */
1412 1385 ?>
1413 1386 <video class="elementor-video" src="<?php echo esc_attr( $video_url ); ?>" <?php Utils::print_html_attributes( $video_params ); ?>></video>
1414 1387 <?php
1415 - }
1416 -
1417 - public function render_markdown(): string {
1418 - $settings = $this->get_settings_for_display();
1419 - $video_type = $settings['video_type'] ?? 'youtube';
1420 - $url = '';
1421 -
1422 - if ( 'hosted' === $video_type ) {
1423 - if ( ! empty( $settings['insert_url'] ) ) {
1424 - $url = $settings['external_url']['url'] ?? '';
1425 - } else {
1426 - $url = $settings['hosted_url']['url'] ?? '';
1427 - }
1428 - } else {
1429 - $url = $settings[ $video_type . '_url' ] ?? '';
1430 - }
1431 -
1432 - if ( empty( $url ) ) {
1433 - return '';
1434 - }
1435 -
1436 - return '[Video](' . esc_url( $url ) . ')';
1437 1388 }
1438 1389 }