| @@ -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 | } |
| @@ -85,60 +84,16 @@ | ||
| 85 | 84 | * |
| 86 | 85 | * @return array Widget keywords. |
| 87 | 86 | */ |
| 88 | 87 | public function get_keywords() { |
| 89 | - return [ 'video', 'player', 'embed', 'youtube', 'vimeo', 'dailymotion', 'videopress' ]; | |
| 88 | + return [ 'video', 'player', 'embed', 'youtube', 'vimeo', 'dailymotion' ]; | |
| 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() { |
| @@ -158,9 +113,8 @@ | ||
| 158 | 113 | 'options' => [ |
| 159 | 114 | 'youtube' => esc_html__( 'YouTube', 'elementor' ), |
| 160 | 115 | 'vimeo' => esc_html__( 'Vimeo', 'elementor' ), |
| 161 | 116 | 'dailymotion' => esc_html__( 'Dailymotion', 'elementor' ), |
| 162 | - 'videopress' => esc_html__( 'VideoPress', 'elementor' ), | |
| 163 | 117 | 'hosted' => esc_html__( 'Self Hosted', 'elementor' ), |
| 164 | 118 | ], |
| 165 | 119 | 'frontend_available' => true, |
| 166 | 120 | ] |
| @@ -244,9 +198,9 @@ | ||
| 244 | 198 | [ |
| 245 | 199 | 'label' => esc_html__( 'External URL', 'elementor' ), |
| 246 | 200 | 'type' => Controls_Manager::SWITCHER, |
| 247 | 201 | 'condition' => [ |
| 248 | - 'video_type' => [ 'hosted', 'videopress' ], | |
| 202 | + 'video_type' => 'hosted', | |
| 249 | 203 | ], |
| 250 | 204 | ] |
| 251 | 205 | ); |
| 252 | 206 | |
| @@ -264,9 +218,9 @@ | ||
| 264 | 218 | 'media_types' => [ |
| 265 | 219 | 'video', |
| 266 | 220 | ], |
| 267 | 221 | 'condition' => [ |
| 268 | - 'video_type' => [ 'hosted', 'videopress' ], | |
| 222 | + 'video_type' => 'hosted', | |
| 269 | 223 | 'insert_url' => '', |
| 270 | 224 | ], |
| 271 | 225 | ] |
| 272 | 226 | ); |
| @@ -295,35 +249,8 @@ | ||
| 295 | 249 | ] |
| 296 | 250 | ); |
| 297 | 251 | |
| 298 | 252 | $this->add_control( |
| 299 | - 'videopress_url', | |
| 300 | - [ | |
| 301 | - 'label' => esc_html__( 'URL', 'elementor' ), | |
| 302 | - 'type' => Controls_Manager::TEXT, | |
| 303 | - 'label_block' => true, | |
| 304 | - 'show_label' => false, | |
| 305 | - 'default' => 'https://videopress.com/v/ZCAOzTNk', | |
| 306 | - 'dynamic' => [ | |
| 307 | - 'active' => true, | |
| 308 | - 'categories' => [ | |
| 309 | - TagsModule::POST_META_CATEGORY, | |
| 310 | - TagsModule::URL_CATEGORY, | |
| 311 | - ], | |
| 312 | - ], | |
| 313 | - 'placeholder' => esc_html__( 'VideoPress URL', 'elementor' ), | |
| 314 | - 'ai' => [ | |
| 315 | - 'active' => false, | |
| 316 | - ], | |
| 317 | - 'condition' => [ | |
| 318 | - 'video_type' => 'videopress', | |
| 319 | - 'insert_url' => 'yes', | |
| 320 | - ], | |
| 321 | - | |
| 322 | - ] | |
| 323 | - ); | |
| 324 | - | |
| 325 | - $this->add_control( | |
| 326 | 253 | 'start', |
| 327 | 254 | [ |
| 328 | 255 | 'label' => esc_html__( 'Start Time', 'elementor' ), |
| 329 | 256 | 'type' => Controls_Manager::NUMBER, |
| @@ -358,16 +285,23 @@ | ||
| 358 | 285 | $this->add_control( |
| 359 | 286 | 'autoplay', |
| 360 | 287 | [ |
| 361 | 288 | '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 | 289 | 'type' => Controls_Manager::SWITCHER, |
| 369 | 290 | 'frontend_available' => true, |
| 291 | + 'conditions' => [ | |
| 292 | + 'relation' => 'or', | |
| 293 | + 'terms' => [ | |
| 294 | + [ | |
| 295 | + 'name' => 'show_image_overlay', | |
| 296 | + 'value' => '', | |
| 297 | + ], | |
| 298 | + [ | |
| 299 | + 'name' => 'image_overlay[url]', | |
| 300 | + 'value' => '', | |
| 301 | + ], | |
| 302 | + ], | |
| 303 | + ], | |
| 370 | 304 | ] |
| 371 | 305 | ); |
| 372 | 306 | |
| 373 | 307 | $this->add_control( |
| @@ -432,11 +366,11 @@ | ||
| 432 | 366 | ] |
| 433 | 367 | ); |
| 434 | 368 | |
| 435 | 369 | $this->add_control( |
| 436 | - 'cc_load_policy', | |
| 370 | + 'modestbranding', | |
| 437 | 371 | [ |
| 438 | - 'label' => esc_html__( 'Captions', 'elementor' ), | |
| 372 | + 'label' => esc_html__( 'Modest Branding', 'elementor' ), | |
| 439 | 373 | 'type' => Controls_Manager::SWITCHER, |
| 440 | 374 | 'condition' => [ |
| 441 | 375 | 'video_type' => [ 'youtube' ], |
| 442 | 376 | 'controls' => 'yes', |
| @@ -600,11 +534,11 @@ | ||
| 600 | 534 | 'auto' => esc_html__( 'Auto', 'elementor' ), |
| 601 | 535 | 'none' => esc_html__( 'None', 'elementor' ), |
| 602 | 536 | ], |
| 603 | 537 | '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' ), | |
| 538 | + esc_html__( 'Preload attribute lets you specify how the video should be loaded when the page loads. %1$sLearn More%2$s', 'elementor' ), | |
| 539 | + '<a target="_blank" href="https://go.elementor.com/preload-video/">', | |
| 540 | + '</a>' | |
| 607 | 541 | ), |
| 608 | 542 | 'default' => 'metadata', |
| 609 | 543 | 'condition' => [ |
| 610 | 544 | 'video_type' => 'hosted', |
| @@ -626,8 +560,17 @@ | ||
| 626 | 560 | ], |
| 627 | 561 | ] |
| 628 | 562 | ); |
| 629 | 563 | |
| 564 | + $this->add_control( | |
| 565 | + 'view', | |
| 566 | + [ | |
| 567 | + 'label' => esc_html__( 'View', 'elementor' ), | |
| 568 | + 'type' => Controls_Manager::HIDDEN, | |
| 569 | + 'default' => 'youtube', | |
| 570 | + ] | |
| 571 | + ); | |
| 572 | + | |
| 630 | 573 | $this->end_controls_section(); |
| 631 | 574 | |
| 632 | 575 | $this->start_controls_section( |
| 633 | 576 | 'section_image_overlay', |
| @@ -669,8 +612,9 @@ | ||
| 669 | 612 | Group_Control_Image_Size::get_type(), |
| 670 | 613 | [ |
| 671 | 614 | 'name' => 'image_overlay', // Usage: `{name}_size` and `{name}_custom_dimension`, in this case `image_overlay_size` and `image_overlay_custom_dimension`. |
| 672 | 615 | 'default' => 'full', |
| 616 | + 'separator' => 'none', | |
| 673 | 617 | 'condition' => [ |
| 674 | 618 | 'show_image_overlay' => 'yes', |
| 675 | 619 | ], |
| 676 | 620 | ] |
| @@ -861,9 +805,9 @@ | ||
| 861 | 805 | 'name' => 'play_icon_text_shadow', |
| 862 | 806 | 'selector' => '{{WRAPPER}} .elementor-custom-embed-play i', |
| 863 | 807 | 'fields_options' => [ |
| 864 | 808 | 'text_shadow_type' => [ |
| 865 | - 'label' => esc_html__( 'Shadow', 'elementor' ), | |
| 809 | + 'label' => esc_html_x( 'Shadow', 'Text Shadow Control', 'elementor' ), | |
| 866 | 810 | ], |
| 867 | 811 | ], |
| 868 | 812 | 'condition' => [ |
| 869 | 813 | 'show_image_overlay' => 'yes', |
| @@ -935,11 +879,11 @@ | ||
| 935 | 879 | |
| 936 | 880 | $this->add_control( |
| 937 | 881 | 'deprecation_warning', |
| 938 | 882 | [ |
| 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' ), | |
| 883 | + 'type' => Controls_Manager::RAW_HTML, | |
| 884 | + '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' ), | |
| 885 | + 'content_classes' => 'elementor-panel-alert elementor-panel-alert-danger', | |
| 942 | 886 | 'separator' => 'before', |
| 943 | 887 | 'condition' => [ |
| 944 | 888 | 'lightbox_video_width!' => '', |
| 945 | 889 | 'lightbox_content_position!' => '', |
| @@ -957,9 +901,9 @@ | ||
| 957 | 901 | 'default' => [ |
| 958 | 902 | 'unit' => '%', |
| 959 | 903 | ], |
| 960 | 904 | // 'selectors' => [ |
| 961 | - // '(desktop+)#elementor-lightbox-{{ID}} .elementor-video-container' => 'width: {{SIZE}}{{UNIT}};', | |
| 905 | + // '(desktop+)#elementor-lightbox-{{ID}} .elementor-video-container' => 'width: {{SIZE}}{{UNIT}};', | |
| 962 | 906 | // ], |
| 963 | 907 | 'condition' => [ |
| 964 | 908 | 'lightbox_video_width!' => '', |
| 965 | 909 | 'lightbox_content_position!' => '', |
| @@ -978,9 +922,9 @@ | ||
| 978 | 922 | '' => esc_html__( 'Center', 'elementor' ), |
| 979 | 923 | 'top' => esc_html__( 'Top', 'elementor' ), |
| 980 | 924 | ], |
| 981 | 925 | // 'selectors' => [ |
| 982 | - // '#elementor-lightbox-{{ID}} .elementor-video-container' => '{{VALUE}}; transform: translateX(-50%);', | |
| 926 | + // '#elementor-lightbox-{{ID}} .elementor-video-container' => '{{VALUE}}; transform: translateX(-50%);', | |
| 983 | 927 | // ], |
| 984 | 928 | 'selectors_dictionary' => [ |
| 985 | 929 | 'top' => 'top: 60px', |
| 986 | 930 | ], |
| @@ -1017,12 +961,8 @@ | ||
| 1017 | 961 | |
| 1018 | 962 | if ( 'hosted' === $settings['video_type'] ) { |
| 1019 | 963 | $video_url = $this->get_hosted_video_url(); |
| 1020 | 964 | } else { |
| 1021 | - if ( 'videopress' === $settings['video_type'] ) { | |
| 1022 | - $video_url = $this->get_videopress_video_url(); | |
| 1023 | - } | |
| 1024 | - | |
| 1025 | 965 | $embed_params = $this->get_embed_params(); |
| 1026 | 966 | $embed_options = $this->get_embed_options(); |
| 1027 | 967 | } |
| 1028 | 968 | |
| @@ -1048,9 +988,9 @@ | ||
| 1048 | 988 | |
| 1049 | 989 | if ( $is_static_render_mode ) { |
| 1050 | 990 | $video_html = Embed::get_embed_thumbnail_html( $video_url, $post_id ); |
| 1051 | 991 | // YouTube API requires a different markup which was set above. |
| 1052 | - } elseif ( 'youtube' !== $settings['video_type'] ) { | |
| 992 | + } else if ( 'youtube' !== $settings['video_type'] ) { | |
| 1053 | 993 | $video_html = Embed::get_embed_html( $video_url, $embed_params, $embed_options ); |
| 1054 | 994 | } |
| 1055 | 995 | } |
| 1056 | 996 | |
| @@ -1083,15 +1023,14 @@ | ||
| 1083 | 1023 | $lightbox_options = [ |
| 1084 | 1024 | 'type' => 'video', |
| 1085 | 1025 | 'videoType' => $settings['video_type'], |
| 1086 | 1026 | 'url' => $lightbox_url, |
| 1087 | - 'autoplay' => $settings['autoplay'], | |
| 1088 | 1027 | 'modalOptions' => [ |
| 1089 | 1028 | 'id' => 'elementor-lightbox-' . $this->get_id(), |
| 1090 | 1029 | 'entranceAnimation' => $settings['lightbox_content_animation'], |
| 1091 | 1030 | 'entranceAnimation_tablet' => $settings['lightbox_content_animation_tablet'], |
| 1092 | 1031 | 'entranceAnimation_mobile' => $settings['lightbox_content_animation_mobile'], |
| 1093 | - 'videoAspectRatio' => $settings['aspect_ratio'] ?? '169', | |
| 1032 | + 'videoAspectRatio' => $settings['aspect_ratio'], | |
| 1094 | 1033 | ], |
| 1095 | 1034 | ]; |
| 1096 | 1035 | |
| 1097 | 1036 | if ( 'hosted' === $settings['video_type'] ) { |
| @@ -1134,8 +1073,9 @@ | ||
| 1134 | 1073 | ]; |
| 1135 | 1074 | } |
| 1136 | 1075 | Icons_Manager::render_icon( $settings['play_icon'], [ 'aria-hidden' => 'true' ] ); |
| 1137 | 1076 | ?> |
| 1077 | + <span class="elementor-screen-only"><?php $this->print_a11y_text( $settings['image_overlay'] ); ?></span> | |
| 1138 | 1078 | </div> |
| 1139 | 1079 | <?php endif; ?> |
| 1140 | 1080 | </div> |
| 1141 | 1081 | <?php } ?> |
| @@ -1145,9 +1085,9 @@ | ||
| 1145 | 1085 | |
| 1146 | 1086 | /** |
| 1147 | 1087 | * Render video widget as plain content. |
| 1148 | 1088 | * |
| 1149 | - * Override the default behavior, by printing the video URL instead of rendering it. | |
| 1089 | + * Override the default behavior, by printing the video URL insted of rendering it. | |
| 1150 | 1090 | * |
| 1151 | 1091 | * @since 1.4.5 |
| 1152 | 1092 | * @access public |
| 1153 | 1093 | */ |
| @@ -1193,9 +1133,9 @@ | ||
| 1193 | 1133 | 'loop', |
| 1194 | 1134 | 'controls', |
| 1195 | 1135 | 'mute', |
| 1196 | 1136 | 'rel', |
| 1197 | - 'cc_load_policy', | |
| 1137 | + 'modestbranding', | |
| 1198 | 1138 | ]; |
| 1199 | 1139 | |
| 1200 | 1140 | if ( $settings['loop'] ) { |
| 1201 | 1141 | $video_properties = Embed::get_video_properties( $settings['youtube_url'] ); |
| @@ -1236,12 +1176,8 @@ | ||
| 1236 | 1176 | |
| 1237 | 1177 | $params['start'] = $settings['start']; |
| 1238 | 1178 | |
| 1239 | 1179 | $params['endscreen-enable'] = '0'; |
| 1240 | - } elseif ( 'videopress' === $settings['video_type'] ) { | |
| 1241 | - $params_dictionary = $this->get_params_dictionary_for_videopress(); | |
| 1242 | - | |
| 1243 | - $params['at'] = $settings['start']; | |
| 1244 | 1180 | } |
| 1245 | 1181 | |
| 1246 | 1182 | foreach ( $params_dictionary as $key => $param_name ) { |
| 1247 | 1183 | $setting_name = $param_name; |
| @@ -1332,8 +1268,9 @@ | ||
| 1332 | 1268 | return $video_params; |
| 1333 | 1269 | } |
| 1334 | 1270 | |
| 1335 | 1271 | /** |
| 1272 | + * @param bool $from_media | |
| 1336 | 1273 | * |
| 1337 | 1274 | * @return string |
| 1338 | 1275 | * @since 2.1.0 |
| 1339 | 1276 | * @access private |
| @@ -1363,38 +1300,8 @@ | ||
| 1363 | 1300 | $video_url .= ',' . $settings['end']; |
| 1364 | 1301 | } |
| 1365 | 1302 | |
| 1366 | 1303 | return $video_url; |
| 1367 | - } | |
| 1368 | - | |
| 1369 | - /** | |
| 1370 | - * Get the VideoPress video URL from the current selected settings. | |
| 1371 | - * | |
| 1372 | - * @return string | |
| 1373 | - */ | |
| 1374 | - private function get_videopress_video_url() { | |
| 1375 | - $settings = $this->get_settings_for_display(); | |
| 1376 | - | |
| 1377 | - if ( ! empty( $settings['insert_url'] ) ) { | |
| 1378 | - return $settings['videopress_url']; | |
| 1379 | - } | |
| 1380 | - | |
| 1381 | - return $settings['hosted_url']['url']; | |
| 1382 | - } | |
| 1383 | - | |
| 1384 | - /** | |
| 1385 | - * Get the params dictionary for VideoPress videos. | |
| 1386 | - * | |
| 1387 | - * @return array | |
| 1388 | - */ | |
| 1389 | - private function get_params_dictionary_for_videopress() { | |
| 1390 | - return [ | |
| 1391 | - 'controls', | |
| 1392 | - 'autoplay' => 'autoPlay', | |
| 1393 | - 'mute' => 'muted', | |
| 1394 | - 'loop', | |
| 1395 | - 'play_on_mobile' => 'playsinline', | |
| 1396 | - ]; | |
| 1397 | 1304 | } |
| 1398 | 1305 | |
| 1399 | 1306 | /** |
| 1400 | 1307 | * |