| @@ -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 | ] |
| @@ -183,11 +137,8 @@ | ||
| 183 | 137 | 'label_block' => true, |
| 184 | 138 | 'condition' => [ |
| 185 | 139 | 'video_type' => 'youtube', |
| 186 | 140 | ], |
| 187 | - 'ai' => [ | |
| 188 | - 'active' => false, | |
| 189 | - ], | |
| 190 | 141 | 'frontend_available' => true, |
| 191 | 142 | ] |
| 192 | 143 | ); |
| 193 | 144 | |
| @@ -208,11 +159,8 @@ | ||
| 208 | 159 | 'label_block' => true, |
| 209 | 160 | 'condition' => [ |
| 210 | 161 | 'video_type' => 'vimeo', |
| 211 | 162 | ], |
| 212 | - 'ai' => [ | |
| 213 | - 'active' => false, | |
| 214 | - ], | |
| 215 | 163 | ] |
| 216 | 164 | ); |
| 217 | 165 | |
| 218 | 166 | $this->add_control( |
| @@ -232,11 +180,8 @@ | ||
| 232 | 180 | 'label_block' => true, |
| 233 | 181 | 'condition' => [ |
| 234 | 182 | 'video_type' => 'dailymotion', |
| 235 | 183 | ], |
| 236 | - 'ai' => [ | |
| 237 | - 'active' => false, | |
| 238 | - ], | |
| 239 | 184 | ] |
| 240 | 185 | ); |
| 241 | 186 | |
| 242 | 187 | $this->add_control( |
| @@ -244,9 +189,9 @@ | ||
| 244 | 189 | [ |
| 245 | 190 | 'label' => esc_html__( 'External URL', 'elementor' ), |
| 246 | 191 | 'type' => Controls_Manager::SWITCHER, |
| 247 | 192 | 'condition' => [ |
| 248 | - 'video_type' => [ 'hosted', 'videopress' ], | |
| 193 | + 'video_type' => 'hosted', | |
| 249 | 194 | ], |
| 250 | 195 | ] |
| 251 | 196 | ); |
| 252 | 197 | |
| @@ -252,9 +197,9 @@ | ||
| 252 | 197 | |
| 253 | 198 | $this->add_control( |
| 254 | 199 | 'hosted_url', |
| 255 | 200 | [ |
| 256 | - 'label' => esc_html__( 'Choose Video File', 'elementor' ), | |
| 201 | + 'label' => esc_html__( 'Choose File', 'elementor' ), | |
| 257 | 202 | 'type' => Controls_Manager::MEDIA, |
| 258 | 203 | 'dynamic' => [ |
| 259 | 204 | 'active' => true, |
| 260 | 205 | 'categories' => [ |
| @@ -260,13 +205,11 @@ | ||
| 260 | 205 | 'categories' => [ |
| 261 | 206 | TagsModule::MEDIA_CATEGORY, |
| 262 | 207 | ], |
| 263 | 208 | ], |
| 264 | - 'media_types' => [ | |
| 265 | - 'video', | |
| 266 | - ], | |
| 209 | + 'media_type' => 'video', | |
| 267 | 210 | 'condition' => [ |
| 268 | - 'video_type' => [ 'hosted', 'videopress' ], | |
| 211 | + 'video_type' => 'hosted', | |
| 269 | 212 | 'insert_url' => '', |
| 270 | 213 | ], |
| 271 | 214 | ] |
| 272 | 215 | ); |
| @@ -286,8 +229,9 @@ | ||
| 286 | 229 | TagsModule::POST_META_CATEGORY, |
| 287 | 230 | TagsModule::URL_CATEGORY, |
| 288 | 231 | ], |
| 289 | 232 | ], |
| 233 | + 'media_type' => 'video', | |
| 290 | 234 | 'placeholder' => esc_html__( 'Enter your URL', 'elementor' ), |
| 291 | 235 | 'condition' => [ |
| 292 | 236 | 'video_type' => 'hosted', |
| 293 | 237 | 'insert_url' => 'yes', |
| @@ -295,35 +239,8 @@ | ||
| 295 | 239 | ] |
| 296 | 240 | ); |
| 297 | 241 | |
| 298 | 242 | $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 | 243 | 'start', |
| 327 | 244 | [ |
| 328 | 245 | 'label' => esc_html__( 'Start Time', 'elementor' ), |
| 329 | 246 | 'type' => Controls_Manager::NUMBER, |
| @@ -328,9 +245,8 @@ | ||
| 328 | 245 | 'label' => esc_html__( 'Start Time', 'elementor' ), |
| 329 | 246 | 'type' => Controls_Manager::NUMBER, |
| 330 | 247 | 'description' => esc_html__( 'Specify a start time (in seconds)', 'elementor' ), |
| 331 | 248 | 'frontend_available' => true, |
| 332 | - 'separator' => 'before', | |
| 333 | 249 | ] |
| 334 | 250 | ); |
| 335 | 251 | |
| 336 | 252 | $this->add_control( |
| @@ -358,16 +274,23 @@ | ||
| 358 | 274 | $this->add_control( |
| 359 | 275 | 'autoplay', |
| 360 | 276 | [ |
| 361 | 277 | '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 | 278 | 'type' => Controls_Manager::SWITCHER, |
| 369 | 279 | 'frontend_available' => true, |
| 280 | + 'conditions' => [ | |
| 281 | + 'relation' => 'or', | |
| 282 | + 'terms' => [ | |
| 283 | + [ | |
| 284 | + 'name' => 'show_image_overlay', | |
| 285 | + 'value' => '', | |
| 286 | + ], | |
| 287 | + [ | |
| 288 | + 'name' => 'image_overlay[url]', | |
| 289 | + 'value' => '', | |
| 290 | + ], | |
| 291 | + ], | |
| 292 | + ], | |
| 370 | 293 | ] |
| 371 | 294 | ); |
| 372 | 295 | |
| 373 | 296 | $this->add_control( |
| @@ -432,11 +355,11 @@ | ||
| 432 | 355 | ] |
| 433 | 356 | ); |
| 434 | 357 | |
| 435 | 358 | $this->add_control( |
| 436 | - 'cc_load_policy', | |
| 359 | + 'modestbranding', | |
| 437 | 360 | [ |
| 438 | - 'label' => esc_html__( 'Captions', 'elementor' ), | |
| 361 | + 'label' => esc_html__( 'Modest Branding', 'elementor' ), | |
| 439 | 362 | 'type' => Controls_Manager::SWITCHER, |
| 440 | 363 | 'condition' => [ |
| 441 | 364 | 'video_type' => [ 'youtube' ], |
| 442 | 365 | 'controls' => 'yes', |
| @@ -464,11 +387,11 @@ | ||
| 464 | 387 | 'yt_privacy', |
| 465 | 388 | [ |
| 466 | 389 | 'label' => esc_html__( 'Privacy Mode', 'elementor' ), |
| 467 | 390 | 'type' => Controls_Manager::SWITCHER, |
| 468 | - 'description' => esc_html__( 'When you turn on privacy mode, YouTube/Vimeo won\'t store information about visitors on your website unless they play the video.', 'elementor' ), | |
| 391 | + 'description' => esc_html__( 'When you turn on privacy mode, YouTube won\'t store information about visitors on your website unless they play the video.', 'elementor' ), | |
| 469 | 392 | 'condition' => [ |
| 470 | - 'video_type' => [ 'youtube', 'vimeo' ], | |
| 393 | + 'video_type' => 'youtube', | |
| 471 | 394 | ], |
| 472 | 395 | 'frontend_available' => true, |
| 473 | 396 | ] |
| 474 | 397 | ); |
| @@ -590,41 +513,27 @@ | ||
| 590 | 513 | ] |
| 591 | 514 | ); |
| 592 | 515 | |
| 593 | 516 | $this->add_control( |
| 594 | - 'preload', | |
| 517 | + 'poster', | |
| 595 | 518 | [ |
| 596 | - 'label' => esc_html__( 'Preload', 'elementor' ), | |
| 597 | - 'type' => Controls_Manager::SELECT, | |
| 598 | - 'options' => [ | |
| 599 | - 'metadata' => esc_html__( 'Metadata', 'elementor' ), | |
| 600 | - 'auto' => esc_html__( 'Auto', 'elementor' ), | |
| 601 | - 'none' => esc_html__( 'None', 'elementor' ), | |
| 519 | + 'label' => esc_html__( 'Poster', 'elementor' ), | |
| 520 | + 'type' => Controls_Manager::MEDIA, | |
| 521 | + 'dynamic' => [ | |
| 522 | + 'active' => true, | |
| 602 | 523 | ], |
| 603 | - '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' ), | |
| 607 | - ), | |
| 608 | - 'default' => 'metadata', | |
| 609 | 524 | 'condition' => [ |
| 610 | 525 | 'video_type' => 'hosted', |
| 611 | - 'autoplay' => '', | |
| 612 | 526 | ], |
| 613 | 527 | ] |
| 614 | 528 | ); |
| 615 | 529 | |
| 616 | 530 | $this->add_control( |
| 617 | - 'poster', | |
| 531 | + 'view', | |
| 618 | 532 | [ |
| 619 | - 'label' => esc_html__( 'Poster', 'elementor' ), | |
| 620 | - 'type' => Controls_Manager::MEDIA, | |
| 621 | - 'dynamic' => [ | |
| 622 | - 'active' => true, | |
| 623 | - ], | |
| 624 | - 'condition' => [ | |
| 625 | - 'video_type' => 'hosted', | |
| 626 | - ], | |
| 533 | + 'label' => esc_html__( 'View', 'elementor' ), | |
| 534 | + 'type' => Controls_Manager::HIDDEN, | |
| 535 | + 'default' => 'youtube', | |
| 627 | 536 | ] |
| 628 | 537 | ); |
| 629 | 538 | |
| 630 | 539 | $this->end_controls_section(); |
| @@ -669,8 +578,9 @@ | ||
| 669 | 578 | Group_Control_Image_Size::get_type(), |
| 670 | 579 | [ |
| 671 | 580 | 'name' => 'image_overlay', // Usage: `{name}_size` and `{name}_custom_dimension`, in this case `image_overlay_size` and `image_overlay_custom_dimension`. |
| 672 | 581 | 'default' => 'full', |
| 582 | + 'separator' => 'none', | |
| 673 | 583 | 'condition' => [ |
| 674 | 584 | 'show_image_overlay' => 'yes', |
| 675 | 585 | ], |
| 676 | 586 | ] |
| @@ -681,11 +591,8 @@ | ||
| 681 | 591 | [ |
| 682 | 592 | 'label' => esc_html__( 'Play Icon', 'elementor' ), |
| 683 | 593 | 'type' => Controls_Manager::SWITCHER, |
| 684 | 594 | 'default' => 'yes', |
| 685 | - 'label_off' => esc_html__( 'Hide', 'elementor' ), | |
| 686 | - 'label_on' => esc_html__( 'Show', 'elementor' ), | |
| 687 | - 'separator' => 'before', | |
| 688 | 595 | 'condition' => [ |
| 689 | 596 | 'show_image_overlay' => 'yes', |
| 690 | 597 | 'image_overlay[url]!' => '', |
| 691 | 598 | ], |
| @@ -765,20 +672,11 @@ | ||
| 765 | 672 | '32' => '3:2', |
| 766 | 673 | '11' => '1:1', |
| 767 | 674 | '916' => '9:16', |
| 768 | 675 | ], |
| 769 | - 'selectors_dictionary' => [ | |
| 770 | - '169' => '1.77777', // 16 / 9 | |
| 771 | - '219' => '2.33333', // 21 / 9 | |
| 772 | - '43' => '1.33333', // 4 / 3 | |
| 773 | - '32' => '1.5', // 3 / 2 | |
| 774 | - '11' => '1', // 1 / 1 | |
| 775 | - '916' => '0.5625', // 9 / 16 | |
| 776 | - ], | |
| 777 | 676 | 'default' => '169', |
| 778 | - 'selectors' => [ | |
| 779 | - '{{WRAPPER}} .elementor-wrapper' => '--video-aspect-ratio: {{VALUE}}', | |
| 780 | - ], | |
| 677 | + 'prefix_class' => 'elementor-aspect-ratio-', | |
| 678 | + 'frontend_available' => true, | |
| 781 | 679 | ] |
| 782 | 680 | ); |
| 783 | 681 | |
| 784 | 682 | $this->add_group_control( |
| @@ -788,22 +686,8 @@ | ||
| 788 | 686 | 'selector' => '{{WRAPPER}} .elementor-wrapper', |
| 789 | 687 | ] |
| 790 | 688 | ); |
| 791 | 689 | |
| 792 | - $this->end_controls_section(); | |
| 793 | - | |
| 794 | - $this->start_controls_section( | |
| 795 | - 'section_image_overlay_style', | |
| 796 | - [ | |
| 797 | - 'label' => esc_html__( 'Image Overlay', 'elementor' ), | |
| 798 | - 'tab' => Controls_Manager::TAB_STYLE, | |
| 799 | - 'condition' => [ | |
| 800 | - 'show_image_overlay' => 'yes', | |
| 801 | - 'show_play_icon' => 'yes', | |
| 802 | - ], | |
| 803 | - ] | |
| 804 | - ); | |
| 805 | - | |
| 806 | 690 | $this->add_control( |
| 807 | 691 | 'play_icon_title', |
| 808 | 692 | [ |
| 809 | 693 | 'label' => esc_html__( 'Play Icon', 'elementor' ), |
| @@ -811,8 +695,9 @@ | ||
| 811 | 695 | 'condition' => [ |
| 812 | 696 | 'show_image_overlay' => 'yes', |
| 813 | 697 | 'show_play_icon' => 'yes', |
| 814 | 698 | ], |
| 699 | + 'separator' => 'before', | |
| 815 | 700 | ] |
| 816 | 701 | ); |
| 817 | 702 | |
| 818 | 703 | $this->add_control( |
| @@ -835,9 +720,8 @@ | ||
| 835 | 720 | 'play_icon_size', |
| 836 | 721 | [ |
| 837 | 722 | 'label' => esc_html__( 'Size', 'elementor' ), |
| 838 | 723 | 'type' => Controls_Manager::SLIDER, |
| 839 | - 'size_units' => [ 'px', 'em', 'rem', 'custom' ], | |
| 840 | 724 | 'range' => [ |
| 841 | 725 | 'px' => [ |
| 842 | 726 | 'min' => 10, |
| 843 | 727 | 'max' => 300, |
| @@ -861,9 +745,9 @@ | ||
| 861 | 745 | 'name' => 'play_icon_text_shadow', |
| 862 | 746 | 'selector' => '{{WRAPPER}} .elementor-custom-embed-play i', |
| 863 | 747 | 'fields_options' => [ |
| 864 | 748 | 'text_shadow_type' => [ |
| 865 | - 'label' => esc_html__( 'Shadow', 'elementor' ), | |
| 749 | + 'label' => _x( 'Shadow', 'Text Shadow Control', 'elementor' ), | |
| 866 | 750 | ], |
| 867 | 751 | ], |
| 868 | 752 | 'condition' => [ |
| 869 | 753 | 'show_image_overlay' => 'yes', |
| @@ -919,56 +803,31 @@ | ||
| 919 | 803 | 'selectors' => [ |
| 920 | 804 | '#elementor-lightbox-{{ID}} .dialog-lightbox-close-button:hover' => 'color: {{VALUE}}', |
| 921 | 805 | '#elementor-lightbox-{{ID}} .dialog-lightbox-close-button:hover svg' => 'fill: {{VALUE}}', |
| 922 | 806 | ], |
| 807 | + 'separator' => 'after', | |
| 923 | 808 | ] |
| 924 | 809 | ); |
| 925 | 810 | |
| 926 | - $this->add_responsive_control( | |
| 927 | - 'lightbox_content_animation', | |
| 928 | - [ | |
| 929 | - 'label' => esc_html__( 'Entrance Animation', 'elementor' ), | |
| 930 | - 'type' => Controls_Manager::ANIMATION, | |
| 931 | - 'frontend_available' => true, | |
| 932 | - 'separator' => 'before', | |
| 933 | - ] | |
| 934 | - ); | |
| 935 | - | |
| 936 | 811 | $this->add_control( |
| 937 | - 'deprecation_warning', | |
| 938 | - [ | |
| 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' ), | |
| 942 | - 'separator' => 'before', | |
| 943 | - 'condition' => [ | |
| 944 | - 'lightbox_video_width!' => '', | |
| 945 | - 'lightbox_content_position!' => '', | |
| 946 | - ], | |
| 947 | - ] | |
| 948 | - ); | |
| 949 | - | |
| 950 | - // Deprecated control. Visible only if it was previously in use. | |
| 951 | - $this->add_control( | |
| 952 | 812 | 'lightbox_video_width', |
| 953 | 813 | [ |
| 954 | 814 | 'label' => esc_html__( 'Content Width', 'elementor' ), |
| 955 | 815 | 'type' => Controls_Manager::SLIDER, |
| 956 | - 'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ], | |
| 957 | 816 | 'default' => [ |
| 958 | 817 | 'unit' => '%', |
| 959 | 818 | ], |
| 960 | - // 'selectors' => [ | |
| 961 | - // '(desktop+)#elementor-lightbox-{{ID}} .elementor-video-container' => 'width: {{SIZE}}{{UNIT}};', | |
| 962 | - // ], | |
| 963 | - 'condition' => [ | |
| 964 | - 'lightbox_video_width!' => '', | |
| 965 | - 'lightbox_content_position!' => '', | |
| 819 | + 'range' => [ | |
| 820 | + '%' => [ | |
| 821 | + 'min' => 30, | |
| 822 | + ], | |
| 966 | 823 | ], |
| 824 | + 'selectors' => [ | |
| 825 | + '(desktop+)#elementor-lightbox-{{ID}} .elementor-video-container' => 'width: {{SIZE}}{{UNIT}};', | |
| 826 | + ], | |
| 967 | 827 | ] |
| 968 | 828 | ); |
| 969 | 829 | |
| 970 | - // Deprecated control. Visible only if it was previously in use. | |
| 971 | 830 | $this->add_control( |
| 972 | 831 | 'lightbox_content_position', |
| 973 | 832 | [ |
| 974 | 833 | 'label' => esc_html__( 'Content Position', 'elementor' ), |
| @@ -977,21 +836,26 @@ | ||
| 977 | 836 | 'options' => [ |
| 978 | 837 | '' => esc_html__( 'Center', 'elementor' ), |
| 979 | 838 | 'top' => esc_html__( 'Top', 'elementor' ), |
| 980 | 839 | ], |
| 981 | - // 'selectors' => [ | |
| 982 | - // '#elementor-lightbox-{{ID}} .elementor-video-container' => '{{VALUE}}; transform: translateX(-50%);', | |
| 983 | - // ], | |
| 840 | + 'selectors' => [ | |
| 841 | + '#elementor-lightbox-{{ID}} .elementor-video-container' => '{{VALUE}}; transform: translateX(-50%);', | |
| 842 | + ], | |
| 984 | 843 | 'selectors_dictionary' => [ |
| 985 | 844 | 'top' => 'top: 60px', |
| 986 | 845 | ], |
| 987 | - 'condition' => [ | |
| 988 | - 'lightbox_video_width!' => '', | |
| 989 | - 'lightbox_content_position!' => '', | |
| 990 | - ], | |
| 991 | 846 | ] |
| 992 | 847 | ); |
| 993 | 848 | |
| 849 | + $this->add_responsive_control( | |
| 850 | + 'lightbox_content_animation', | |
| 851 | + [ | |
| 852 | + 'label' => esc_html__( 'Entrance Animation', 'elementor' ), | |
| 853 | + 'type' => Controls_Manager::ANIMATION, | |
| 854 | + 'frontend_available' => true, | |
| 855 | + ] | |
| 856 | + ); | |
| 857 | + | |
| 994 | 858 | $this->end_controls_section(); |
| 995 | 859 | } |
| 996 | 860 | |
| 997 | 861 | public function print_a11y_text( $image_overlay ) { |
| @@ -1017,12 +881,8 @@ | ||
| 1017 | 881 | |
| 1018 | 882 | if ( 'hosted' === $settings['video_type'] ) { |
| 1019 | 883 | $video_url = $this->get_hosted_video_url(); |
| 1020 | 884 | } else { |
| 1021 | - if ( 'videopress' === $settings['video_type'] ) { | |
| 1022 | - $video_url = $this->get_videopress_video_url(); | |
| 1023 | - } | |
| 1024 | - | |
| 1025 | 885 | $embed_params = $this->get_embed_params(); |
| 1026 | 886 | $embed_options = $this->get_embed_options(); |
| 1027 | 887 | } |
| 1028 | 888 | |
| @@ -1048,9 +908,9 @@ | ||
| 1048 | 908 | |
| 1049 | 909 | if ( $is_static_render_mode ) { |
| 1050 | 910 | $video_html = Embed::get_embed_thumbnail_html( $video_url, $post_id ); |
| 1051 | 911 | // YouTube API requires a different markup which was set above. |
| 1052 | - } elseif ( 'youtube' !== $settings['video_type'] ) { | |
| 912 | + } else if ( 'youtube' !== $settings['video_type'] ) { | |
| 1053 | 913 | $video_html = Embed::get_embed_html( $video_url, $embed_params, $embed_options ); |
| 1054 | 914 | } |
| 1055 | 915 | } |
| 1056 | 916 | |
| @@ -1061,8 +921,12 @@ | ||
| 1061 | 921 | } |
| 1062 | 922 | |
| 1063 | 923 | $this->add_render_attribute( 'video-wrapper', 'class', 'elementor-wrapper' ); |
| 1064 | 924 | |
| 925 | + if ( ! $settings['lightbox'] ) { | |
| 926 | + $this->add_render_attribute( 'video-wrapper', 'class', 'elementor-fit-aspect-ratio' ); | |
| 927 | + } | |
| 928 | + | |
| 1065 | 929 | $this->add_render_attribute( 'video-wrapper', 'class', 'elementor-open-' . ( $settings['lightbox'] ? 'lightbox' : 'inline' ) ); |
| 1066 | 930 | ?> |
| 1067 | 931 | <div <?php $this->print_render_attribute_string( 'video-wrapper' ); ?>> |
| 1068 | 932 | <?php |
| @@ -1083,15 +947,14 @@ | ||
| 1083 | 947 | $lightbox_options = [ |
| 1084 | 948 | 'type' => 'video', |
| 1085 | 949 | 'videoType' => $settings['video_type'], |
| 1086 | 950 | 'url' => $lightbox_url, |
| 1087 | - 'autoplay' => $settings['autoplay'], | |
| 1088 | 951 | 'modalOptions' => [ |
| 1089 | 952 | 'id' => 'elementor-lightbox-' . $this->get_id(), |
| 1090 | 953 | 'entranceAnimation' => $settings['lightbox_content_animation'], |
| 1091 | 954 | 'entranceAnimation_tablet' => $settings['lightbox_content_animation_tablet'], |
| 1092 | 955 | 'entranceAnimation_mobile' => $settings['lightbox_content_animation_mobile'], |
| 1093 | - 'videoAspectRatio' => $settings['aspect_ratio'] ?? '169', | |
| 956 | + 'videoAspectRatio' => $settings['aspect_ratio'], | |
| 1094 | 957 | ], |
| 1095 | 958 | ]; |
| 1096 | 959 | |
| 1097 | 960 | if ( 'hosted' === $settings['video_type'] ) { |
| @@ -1100,9 +963,9 @@ | ||
| 1100 | 963 | |
| 1101 | 964 | $this->add_render_attribute( 'image-overlay', [ |
| 1102 | 965 | 'data-elementor-open-lightbox' => 'yes', |
| 1103 | 966 | 'data-elementor-lightbox' => wp_json_encode( $lightbox_options ), |
| 1104 | - 'data-e-action-hash' => Plugin::instance()->frontend->create_action_hash( 'lightbox', $lightbox_options ), | |
| 967 | + 'e-action-hash' => Plugin::instance()->frontend->create_action_hash( 'lightbox', $lightbox_options ), | |
| 1105 | 968 | ] ); |
| 1106 | 969 | |
| 1107 | 970 | if ( Plugin::$instance->editor->is_edit_mode() ) { |
| 1108 | 971 | $this->add_render_attribute( 'image-overlay', [ |
| @@ -1134,8 +997,9 @@ | ||
| 1134 | 997 | ]; |
| 1135 | 998 | } |
| 1136 | 999 | Icons_Manager::render_icon( $settings['play_icon'], [ 'aria-hidden' => 'true' ] ); |
| 1137 | 1000 | ?> |
| 1001 | + <span class="elementor-screen-only"><?php $this->print_a11y_text( $settings['image_overlay'] ); ?></span> | |
| 1138 | 1002 | </div> |
| 1139 | 1003 | <?php endif; ?> |
| 1140 | 1004 | </div> |
| 1141 | 1005 | <?php } ?> |
| @@ -1145,9 +1009,9 @@ | ||
| 1145 | 1009 | |
| 1146 | 1010 | /** |
| 1147 | 1011 | * Render video widget as plain content. |
| 1148 | 1012 | * |
| 1149 | - * Override the default behavior, by printing the video URL instead of rendering it. | |
| 1013 | + * Override the default behavior, by printing the video URL insted of rendering it. | |
| 1150 | 1014 | * |
| 1151 | 1015 | * @since 1.4.5 |
| 1152 | 1016 | * @access public |
| 1153 | 1017 | */ |
| @@ -1193,9 +1057,9 @@ | ||
| 1193 | 1057 | 'loop', |
| 1194 | 1058 | 'controls', |
| 1195 | 1059 | 'mute', |
| 1196 | 1060 | 'rel', |
| 1197 | - 'cc_load_policy', | |
| 1061 | + 'modestbranding', | |
| 1198 | 1062 | ]; |
| 1199 | 1063 | |
| 1200 | 1064 | if ( $settings['loop'] ) { |
| 1201 | 1065 | $video_properties = Embed::get_video_properties( $settings['youtube_url'] ); |
| @@ -1219,12 +1083,8 @@ | ||
| 1219 | 1083 | |
| 1220 | 1084 | $params['color'] = str_replace( '#', '', $settings['color'] ); |
| 1221 | 1085 | |
| 1222 | 1086 | $params['autopause'] = '0'; |
| 1223 | - | |
| 1224 | - if ( ! empty( $settings['yt_privacy'] ) ) { | |
| 1225 | - $params['dnt'] = 'true'; | |
| 1226 | - } | |
| 1227 | 1087 | } elseif ( 'dailymotion' === $settings['video_type'] ) { |
| 1228 | 1088 | $params_dictionary = [ |
| 1229 | 1089 | 'controls', |
| 1230 | 1090 | 'mute', |
| @@ -1236,12 +1096,8 @@ | ||
| 1236 | 1096 | |
| 1237 | 1097 | $params['start'] = $settings['start']; |
| 1238 | 1098 | |
| 1239 | 1099 | $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 | 1100 | } |
| 1245 | 1101 | |
| 1246 | 1102 | foreach ( $params_dictionary as $key => $param_name ) { |
| 1247 | 1103 | $setting_name = $param_name; |
| @@ -1308,12 +1164,8 @@ | ||
| 1308 | 1164 | $video_params[ $option_name ] = ''; |
| 1309 | 1165 | } |
| 1310 | 1166 | } |
| 1311 | 1167 | |
| 1312 | - if ( $settings['preload'] ) { | |
| 1313 | - $video_params['preload'] = $settings['preload']; | |
| 1314 | - } | |
| 1315 | - | |
| 1316 | 1168 | if ( $settings['mute'] ) { |
| 1317 | 1169 | $video_params['muted'] = 'muted'; |
| 1318 | 1170 | } |
| 1319 | 1171 | |
| @@ -1332,8 +1184,9 @@ | ||
| 1332 | 1184 | return $video_params; |
| 1333 | 1185 | } |
| 1334 | 1186 | |
| 1335 | 1187 | /** |
| 1188 | + * @param bool $from_media | |
| 1336 | 1189 | * |
| 1337 | 1190 | * @return string |
| 1338 | 1191 | * @since 2.1.0 |
| 1339 | 1192 | * @access private |
| @@ -1366,39 +1219,9 @@ | ||
| 1366 | 1219 | return $video_url; |
| 1367 | 1220 | } |
| 1368 | 1221 | |
| 1369 | 1222 | /** |
| 1370 | - * Get the VideoPress video URL from the current selected settings. | |
| 1371 | 1223 | * |
| 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 | - } | |
| 1398 | - | |
| 1399 | - /** | |
| 1400 | - * | |
| 1401 | 1224 | * @since 2.1.0 |
| 1402 | 1225 | * @access private |
| 1403 | 1226 | */ |
| 1404 | 1227 | private function render_hosted_video() { |
| @@ -1411,28 +1234,6 @@ | ||
| 1411 | 1234 | /* Sometimes the video url is base64, therefore we use `esc_attr` in `src`. */ |
| 1412 | 1235 | ?> |
| 1413 | 1236 | <video class="elementor-video" src="<?php echo esc_attr( $video_url ); ?>" <?php Utils::print_html_attributes( $video_params ); ?>></video> |
| 1414 | 1237 | <?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 | 1238 | } |
| 1438 | 1239 | } |