| @@ -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', |
| @@ -669,8 +631,9 @@ | ||
| 669 | 631 | Group_Control_Image_Size::get_type(), |
| 670 | 632 | [ |
| 671 | 633 | 'name' => 'image_overlay', // Usage: `{name}_size` and `{name}_custom_dimension`, in this case `image_overlay_size` and `image_overlay_custom_dimension`. |
| 672 | 634 | 'default' => 'full', |
| 635 | + 'separator' => 'none', | |
| 673 | 636 | 'condition' => [ |
| 674 | 637 | 'show_image_overlay' => 'yes', |
| 675 | 638 | ], |
| 676 | 639 | ] |
| @@ -935,11 +898,11 @@ | ||
| 935 | 898 | |
| 936 | 899 | $this->add_control( |
| 937 | 900 | 'deprecation_warning', |
| 938 | 901 | [ |
| 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' ), | |
| 902 | + 'type' => Controls_Manager::RAW_HTML, | |
| 903 | + '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' ), | |
| 904 | + 'content_classes' => 'elementor-panel-alert elementor-panel-alert-danger', | |
| 942 | 905 | 'separator' => 'before', |
| 943 | 906 | 'condition' => [ |
| 944 | 907 | 'lightbox_video_width!' => '', |
| 945 | 908 | 'lightbox_content_position!' => '', |
| @@ -957,9 +920,9 @@ | ||
| 957 | 920 | 'default' => [ |
| 958 | 921 | 'unit' => '%', |
| 959 | 922 | ], |
| 960 | 923 | // 'selectors' => [ |
| 961 | - // '(desktop+)#elementor-lightbox-{{ID}} .elementor-video-container' => 'width: {{SIZE}}{{UNIT}};', | |
| 924 | + // '(desktop+)#elementor-lightbox-{{ID}} .elementor-video-container' => 'width: {{SIZE}}{{UNIT}};', | |
| 962 | 925 | // ], |
| 963 | 926 | 'condition' => [ |
| 964 | 927 | 'lightbox_video_width!' => '', |
| 965 | 928 | 'lightbox_content_position!' => '', |
| @@ -978,9 +941,9 @@ | ||
| 978 | 941 | '' => esc_html__( 'Center', 'elementor' ), |
| 979 | 942 | 'top' => esc_html__( 'Top', 'elementor' ), |
| 980 | 943 | ], |
| 981 | 944 | // 'selectors' => [ |
| 982 | - // '#elementor-lightbox-{{ID}} .elementor-video-container' => '{{VALUE}}; transform: translateX(-50%);', | |
| 945 | + // '#elementor-lightbox-{{ID}} .elementor-video-container' => '{{VALUE}}; transform: translateX(-50%);', | |
| 983 | 946 | // ], |
| 984 | 947 | 'selectors_dictionary' => [ |
| 985 | 948 | 'top' => 'top: 60px', |
| 986 | 949 | ], |
| @@ -1048,9 +1011,9 @@ | ||
| 1048 | 1011 | |
| 1049 | 1012 | if ( $is_static_render_mode ) { |
| 1050 | 1013 | $video_html = Embed::get_embed_thumbnail_html( $video_url, $post_id ); |
| 1051 | 1014 | // YouTube API requires a different markup which was set above. |
| 1052 | - } elseif ( 'youtube' !== $settings['video_type'] ) { | |
| 1015 | + } else if ( 'youtube' !== $settings['video_type'] ) { | |
| 1053 | 1016 | $video_html = Embed::get_embed_html( $video_url, $embed_params, $embed_options ); |
| 1054 | 1017 | } |
| 1055 | 1018 | } |
| 1056 | 1019 | |
| @@ -1083,15 +1046,14 @@ | ||
| 1083 | 1046 | $lightbox_options = [ |
| 1084 | 1047 | 'type' => 'video', |
| 1085 | 1048 | 'videoType' => $settings['video_type'], |
| 1086 | 1049 | 'url' => $lightbox_url, |
| 1087 | - 'autoplay' => $settings['autoplay'], | |
| 1088 | 1050 | 'modalOptions' => [ |
| 1089 | 1051 | 'id' => 'elementor-lightbox-' . $this->get_id(), |
| 1090 | 1052 | 'entranceAnimation' => $settings['lightbox_content_animation'], |
| 1091 | 1053 | 'entranceAnimation_tablet' => $settings['lightbox_content_animation_tablet'], |
| 1092 | 1054 | 'entranceAnimation_mobile' => $settings['lightbox_content_animation_mobile'], |
| 1093 | - 'videoAspectRatio' => $settings['aspect_ratio'] ?? '169', | |
| 1055 | + 'videoAspectRatio' => $settings['aspect_ratio'], | |
| 1094 | 1056 | ], |
| 1095 | 1057 | ]; |
| 1096 | 1058 | |
| 1097 | 1059 | if ( 'hosted' === $settings['video_type'] ) { |
| @@ -1134,8 +1096,9 @@ | ||
| 1134 | 1096 | ]; |
| 1135 | 1097 | } |
| 1136 | 1098 | Icons_Manager::render_icon( $settings['play_icon'], [ 'aria-hidden' => 'true' ] ); |
| 1137 | 1099 | ?> |
| 1100 | + <span class="elementor-screen-only"><?php $this->print_a11y_text( $settings['image_overlay'] ); ?></span> | |
| 1138 | 1101 | </div> |
| 1139 | 1102 | <?php endif; ?> |
| 1140 | 1103 | </div> |
| 1141 | 1104 | <?php } ?> |
| @@ -1145,9 +1108,9 @@ | ||
| 1145 | 1108 | |
| 1146 | 1109 | /** |
| 1147 | 1110 | * Render video widget as plain content. |
| 1148 | 1111 | * |
| 1149 | - * Override the default behavior, by printing the video URL instead of rendering it. | |
| 1112 | + * Override the default behavior, by printing the video URL insted of rendering it. | |
| 1150 | 1113 | * |
| 1151 | 1114 | * @since 1.4.5 |
| 1152 | 1115 | * @access public |
| 1153 | 1116 | */ |
| @@ -1193,9 +1156,9 @@ | ||
| 1193 | 1156 | 'loop', |
| 1194 | 1157 | 'controls', |
| 1195 | 1158 | 'mute', |
| 1196 | 1159 | 'rel', |
| 1197 | - 'cc_load_policy', | |
| 1160 | + 'modestbranding', | |
| 1198 | 1161 | ]; |
| 1199 | 1162 | |
| 1200 | 1163 | if ( $settings['loop'] ) { |
| 1201 | 1164 | $video_properties = Embed::get_video_properties( $settings['youtube_url'] ); |
| @@ -1332,8 +1295,9 @@ | ||
| 1332 | 1295 | return $video_params; |
| 1333 | 1296 | } |
| 1334 | 1297 | |
| 1335 | 1298 | /** |
| 1299 | + * @param bool $from_media | |
| 1336 | 1300 | * |
| 1337 | 1301 | * @return string |
| 1338 | 1302 | * @since 2.1.0 |
| 1339 | 1303 | * @access private |
| @@ -1413,26 +1377,12 @@ | ||
| 1413 | 1377 | <video class="elementor-video" src="<?php echo esc_attr( $video_url ); ?>" <?php Utils::print_html_attributes( $video_params ); ?>></video> |
| 1414 | 1378 | <?php |
| 1415 | 1379 | } |
| 1416 | 1380 | |
| 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 ) . ')'; | |
| 1381 | + protected function get_upsale_data() { | |
| 1382 | + return [ | |
| 1383 | + 'title' => __( 'Grab your visitors\' attention', 'elementor' ), | |
| 1384 | + 'description' => esc_html__( 'Get the Video Playlist widget and grow your toolbox with Elementor Pro.', 'elementor' ), | |
| 1385 | + 'upgrade_url' => esc_url( 'https://go.elementor.com/go-pro-video-widget/', 'elementor' ), | |
| 1386 | + ]; | |
| 1437 | 1387 | } |
| 1438 | 1388 | } |