| @@ -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,31 +87,9 @@ | ||
| 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 | * |
| @@ -358,16 +335,23 @@ | ||
| 358 | 335 | $this->add_control( |
| 359 | 336 | 'autoplay', |
| 360 | 337 | [ |
| 361 | 338 | '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 | 339 | 'type' => Controls_Manager::SWITCHER, |
| 369 | 340 | 'frontend_available' => true, |
| 341 | + 'conditions' => [ | |
| 342 | + 'relation' => 'or', | |
| 343 | + 'terms' => [ | |
| 344 | + [ | |
| 345 | + 'name' => 'show_image_overlay', | |
| 346 | + 'value' => '', | |
| 347 | + ], | |
| 348 | + [ | |
| 349 | + 'name' => 'image_overlay[url]', | |
| 350 | + 'value' => '', | |
| 351 | + ], | |
| 352 | + ], | |
| 353 | + ], | |
| 370 | 354 | ] |
| 371 | 355 | ); |
| 372 | 356 | |
| 373 | 357 | $this->add_control( |
| @@ -432,11 +416,11 @@ | ||
| 432 | 416 | ] |
| 433 | 417 | ); |
| 434 | 418 | |
| 435 | 419 | $this->add_control( |
| 436 | - 'cc_load_policy', | |
| 420 | + 'modestbranding', | |
| 437 | 421 | [ |
| 438 | - 'label' => esc_html__( 'Captions', 'elementor' ), | |
| 422 | + 'label' => esc_html__( 'Modest Branding', 'elementor' ), | |
| 439 | 423 | 'type' => Controls_Manager::SWITCHER, |
| 440 | 424 | 'condition' => [ |
| 441 | 425 | 'video_type' => [ 'youtube' ], |
| 442 | 426 | 'controls' => 'yes', |
| @@ -957,9 +941,9 @@ | ||
| 957 | 941 | 'default' => [ |
| 958 | 942 | 'unit' => '%', |
| 959 | 943 | ], |
| 960 | 944 | // 'selectors' => [ |
| 961 | - // '(desktop+)#elementor-lightbox-{{ID}} .elementor-video-container' => 'width: {{SIZE}}{{UNIT}};', | |
| 945 | + // '(desktop+)#elementor-lightbox-{{ID}} .elementor-video-container' => 'width: {{SIZE}}{{UNIT}};', | |
| 962 | 946 | // ], |
| 963 | 947 | 'condition' => [ |
| 964 | 948 | 'lightbox_video_width!' => '', |
| 965 | 949 | 'lightbox_content_position!' => '', |
| @@ -978,9 +962,9 @@ | ||
| 978 | 962 | '' => esc_html__( 'Center', 'elementor' ), |
| 979 | 963 | 'top' => esc_html__( 'Top', 'elementor' ), |
| 980 | 964 | ], |
| 981 | 965 | // 'selectors' => [ |
| 982 | - // '#elementor-lightbox-{{ID}} .elementor-video-container' => '{{VALUE}}; transform: translateX(-50%);', | |
| 966 | + // '#elementor-lightbox-{{ID}} .elementor-video-container' => '{{VALUE}}; transform: translateX(-50%);', | |
| 983 | 967 | // ], |
| 984 | 968 | 'selectors_dictionary' => [ |
| 985 | 969 | 'top' => 'top: 60px', |
| 986 | 970 | ], |
| @@ -1048,9 +1032,9 @@ | ||
| 1048 | 1032 | |
| 1049 | 1033 | if ( $is_static_render_mode ) { |
| 1050 | 1034 | $video_html = Embed::get_embed_thumbnail_html( $video_url, $post_id ); |
| 1051 | 1035 | // YouTube API requires a different markup which was set above. |
| 1052 | - } elseif ( 'youtube' !== $settings['video_type'] ) { | |
| 1036 | + } else if ( 'youtube' !== $settings['video_type'] ) { | |
| 1053 | 1037 | $video_html = Embed::get_embed_html( $video_url, $embed_params, $embed_options ); |
| 1054 | 1038 | } |
| 1055 | 1039 | } |
| 1056 | 1040 | |
| @@ -1083,15 +1067,14 @@ | ||
| 1083 | 1067 | $lightbox_options = [ |
| 1084 | 1068 | 'type' => 'video', |
| 1085 | 1069 | 'videoType' => $settings['video_type'], |
| 1086 | 1070 | 'url' => $lightbox_url, |
| 1087 | - 'autoplay' => $settings['autoplay'], | |
| 1088 | 1071 | 'modalOptions' => [ |
| 1089 | 1072 | 'id' => 'elementor-lightbox-' . $this->get_id(), |
| 1090 | 1073 | 'entranceAnimation' => $settings['lightbox_content_animation'], |
| 1091 | 1074 | 'entranceAnimation_tablet' => $settings['lightbox_content_animation_tablet'], |
| 1092 | 1075 | 'entranceAnimation_mobile' => $settings['lightbox_content_animation_mobile'], |
| 1093 | - 'videoAspectRatio' => $settings['aspect_ratio'] ?? '169', | |
| 1076 | + 'videoAspectRatio' => $settings['aspect_ratio'], | |
| 1094 | 1077 | ], |
| 1095 | 1078 | ]; |
| 1096 | 1079 | |
| 1097 | 1080 | if ( 'hosted' === $settings['video_type'] ) { |
| @@ -1134,8 +1117,9 @@ | ||
| 1134 | 1117 | ]; |
| 1135 | 1118 | } |
| 1136 | 1119 | Icons_Manager::render_icon( $settings['play_icon'], [ 'aria-hidden' => 'true' ] ); |
| 1137 | 1120 | ?> |
| 1121 | + <span class="elementor-screen-only"><?php $this->print_a11y_text( $settings['image_overlay'] ); ?></span> | |
| 1138 | 1122 | </div> |
| 1139 | 1123 | <?php endif; ?> |
| 1140 | 1124 | </div> |
| 1141 | 1125 | <?php } ?> |
| @@ -1145,9 +1129,9 @@ | ||
| 1145 | 1129 | |
| 1146 | 1130 | /** |
| 1147 | 1131 | * Render video widget as plain content. |
| 1148 | 1132 | * |
| 1149 | - * Override the default behavior, by printing the video URL instead of rendering it. | |
| 1133 | + * Override the default behavior, by printing the video URL insted of rendering it. | |
| 1150 | 1134 | * |
| 1151 | 1135 | * @since 1.4.5 |
| 1152 | 1136 | * @access public |
| 1153 | 1137 | */ |
| @@ -1193,9 +1177,9 @@ | ||
| 1193 | 1177 | 'loop', |
| 1194 | 1178 | 'controls', |
| 1195 | 1179 | 'mute', |
| 1196 | 1180 | 'rel', |
| 1197 | - 'cc_load_policy', | |
| 1181 | + 'modestbranding', | |
| 1198 | 1182 | ]; |
| 1199 | 1183 | |
| 1200 | 1184 | if ( $settings['loop'] ) { |
| 1201 | 1185 | $video_properties = Embed::get_video_properties( $settings['youtube_url'] ); |
| @@ -1332,8 +1316,9 @@ | ||
| 1332 | 1316 | return $video_params; |
| 1333 | 1317 | } |
| 1334 | 1318 | |
| 1335 | 1319 | /** |
| 1320 | + * @param bool $from_media | |
| 1336 | 1321 | * |
| 1337 | 1322 | * @return string |
| 1338 | 1323 | * @since 2.1.0 |
| 1339 | 1324 | * @access private |
| @@ -1411,28 +1396,6 @@ | ||
| 1411 | 1396 | /* Sometimes the video url is base64, therefore we use `esc_attr` in `src`. */ |
| 1412 | 1397 | ?> |
| 1413 | 1398 | <video class="elementor-video" src="<?php echo esc_attr( $video_url ); ?>" <?php Utils::print_html_attributes( $video_params ); ?>></video> |
| 1414 | 1399 | <?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 | 1400 | } |
| 1438 | 1401 | } |