| @@ -5,9 +5,8 @@ | ||
| 5 | 5 | exit; // Exit if accessed directly. |
| 6 | 6 | } |
| 7 | 7 | |
| 8 | 8 | use Elementor\Core\Kits\Documents\Tabs\Global_Colors; |
| 9 | -use Elementor\Modules\Promotions\Controls\Promotion_Control; | |
| 10 | 9 | |
| 11 | 10 | /** |
| 12 | 11 | * Elementor image carousel widget. |
| 13 | 12 | * |
| @@ -78,40 +77,8 @@ | ||
| 78 | 77 | return false; |
| 79 | 78 | } |
| 80 | 79 | |
| 81 | 80 | /** |
| 82 | - * Get style dependencies. | |
| 83 | - * | |
| 84 | - * Retrieve the list of style dependencies the widget requires. | |
| 85 | - * | |
| 86 | - * @since 3.24.0 | |
| 87 | - * @access public | |
| 88 | - * | |
| 89 | - * @return array Widget style dependencies. | |
| 90 | - */ | |
| 91 | - public function get_style_depends(): array { | |
| 92 | - return [ 'e-swiper', 'widget-image-carousel' ]; | |
| 93 | - } | |
| 94 | - | |
| 95 | - /** | |
| 96 | - * Get script dependencies. | |
| 97 | - * | |
| 98 | - * Retrieve the list of script dependencies the widget requires. | |
| 99 | - * | |
| 100 | - * @since 3.27.0 | |
| 101 | - * @access public | |
| 102 | - * | |
| 103 | - * @return array Widget script dependencies. | |
| 104 | - */ | |
| 105 | - public function get_script_depends(): array { | |
| 106 | - return [ 'swiper' ]; | |
| 107 | - } | |
| 108 | - | |
| 109 | - public function has_widget_inner_wrapper(): bool { | |
| 110 | - return ! Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' ); | |
| 111 | - } | |
| 112 | - | |
| 113 | - /** | |
| 114 | 81 | * Get widget upsale data. |
| 115 | 82 | * |
| 116 | 83 | * Retrieve the widget promotion data. |
| 117 | 84 | * |
| @@ -147,17 +114,8 @@ | ||
| 147 | 114 | ] |
| 148 | 115 | ); |
| 149 | 116 | |
| 150 | 117 | $this->add_control( |
| 151 | - 'carousel_name', | |
| 152 | - [ | |
| 153 | - 'label' => esc_html__( 'Carousel Name', 'elementor' ), | |
| 154 | - 'type' => Controls_Manager::TEXT, | |
| 155 | - 'default' => esc_html__( 'Image Carousel', 'elementor' ), | |
| 156 | - ] | |
| 157 | - ); | |
| 158 | - | |
| 159 | - $this->add_control( | |
| 160 | 118 | 'carousel', |
| 161 | 119 | [ |
| 162 | 120 | 'label' => esc_html__( 'Add Images', 'elementor' ), |
| 163 | 121 | 'type' => Controls_Manager::GALLERY, |
| @@ -658,28 +616,8 @@ | ||
| 658 | 616 | ] |
| 659 | 617 | ); |
| 660 | 618 | |
| 661 | 619 | $this->add_responsive_control( |
| 662 | - 'dots_gap', | |
| 663 | - [ | |
| 664 | - 'label' => esc_html__( 'Space Between Dots', 'elementor' ), | |
| 665 | - 'type' => Controls_Manager::SLIDER, | |
| 666 | - 'size_units' => [ 'px', 'em', 'rem', 'custom' ], | |
| 667 | - 'range' => [ | |
| 668 | - 'px' => [ | |
| 669 | - 'max' => 20, | |
| 670 | - ], | |
| 671 | - ], | |
| 672 | - 'selectors' => [ | |
| 673 | - '{{WRAPPER}} .swiper-pagination-bullet' => '--swiper-pagination-bullet-horizontal-gap: {{SIZE}}{{UNIT}}; --swiper-pagination-bullet-vertical-gap: {{SIZE}}{{UNIT}};', | |
| 674 | - ], | |
| 675 | - 'condition' => [ | |
| 676 | - 'navigation' => [ 'dots', 'both' ], | |
| 677 | - ], | |
| 678 | - ] | |
| 679 | - ); | |
| 680 | - | |
| 681 | - $this->add_responsive_control( | |
| 682 | 620 | 'dots_size', |
| 683 | 621 | [ |
| 684 | 622 | 'label' => esc_html__( 'Size', 'elementor' ), |
| 685 | 623 | 'type' => Controls_Manager::SLIDER, |
| @@ -785,9 +723,9 @@ | ||
| 785 | 723 | 'image_spacing_custom', |
| 786 | 724 | [ |
| 787 | 725 | 'label' => esc_html__( 'Image Spacing', 'elementor' ), |
| 788 | 726 | 'type' => Controls_Manager::SLIDER, |
| 789 | - 'size_units' => [ 'px' ], | |
| 727 | + 'size_units' => [ 'px', 'em', 'rem', 'custom' ], | |
| 790 | 728 | 'range' => [ |
| 791 | 729 | 'px' => [ |
| 792 | 730 | 'max' => 100, |
| 793 | 731 | ], |
| @@ -843,10 +781,10 @@ | ||
| 843 | 781 | [ |
| 844 | 782 | 'label' => esc_html__( 'Alignment', 'elementor' ), |
| 845 | 783 | 'type' => Controls_Manager::CHOOSE, |
| 846 | 784 | 'options' => [ |
| 847 | - 'start' => [ | |
| 848 | - 'title' => esc_html__( 'Start', 'elementor' ), | |
| 785 | + 'left' => [ | |
| 786 | + 'title' => esc_html__( 'Left', 'elementor' ), | |
| 849 | 787 | 'icon' => 'eicon-text-align-left', |
| 850 | 788 | ], |
| 851 | 789 | 'center' => [ |
| 852 | 790 | 'title' => esc_html__( 'Center', 'elementor' ), |
| @@ -851,10 +789,10 @@ | ||
| 851 | 789 | 'center' => [ |
| 852 | 790 | 'title' => esc_html__( 'Center', 'elementor' ), |
| 853 | 791 | 'icon' => 'eicon-text-align-center', |
| 854 | 792 | ], |
| 855 | - 'end' => [ | |
| 856 | - 'title' => esc_html__( 'End', 'elementor' ), | |
| 793 | + 'right' => [ | |
| 794 | + 'title' => esc_html__( 'Right', 'elementor' ), | |
| 857 | 795 | 'icon' => 'eicon-text-align-right', |
| 858 | 796 | ], |
| 859 | 797 | 'justify' => [ |
| 860 | 798 | 'title' => esc_html__( 'Justified', 'elementor' ), |
| @@ -860,13 +798,8 @@ | ||
| 860 | 798 | 'title' => esc_html__( 'Justified', 'elementor' ), |
| 861 | 799 | 'icon' => 'eicon-text-align-justify', |
| 862 | 800 | ], |
| 863 | 801 | ], |
| 864 | - 'classes' => 'elementor-control-start-end', | |
| 865 | - 'selectors_dictionary' => [ | |
| 866 | - 'left' => is_rtl() ? 'end' : 'start', | |
| 867 | - 'right' => is_rtl() ? 'start' : 'end', | |
| 868 | - ], | |
| 869 | 802 | 'default' => 'center', |
| 870 | 803 | 'selectors' => [ |
| 871 | 804 | '{{WRAPPER}} .elementor-image-carousel-caption' => 'text-align: {{VALUE}};', |
| 872 | 805 | ], |
| @@ -1013,9 +946,9 @@ | ||
| 1013 | 946 | if ( empty( $slides ) ) { |
| 1014 | 947 | return; |
| 1015 | 948 | } |
| 1016 | 949 | |
| 1017 | - $swiper_class = 'swiper'; | |
| 950 | + $swiper_class = Plugin::$instance->experiments->is_feature_active( 'e_swiper_latest' ) ? 'swiper' : 'swiper-container'; | |
| 1018 | 951 | $has_autoplay_enabled = 'yes' === $this->get_settings_for_display( 'autoplay' ); |
| 1019 | 952 | |
| 1020 | 953 | $this->add_render_attribute( [ |
| 1021 | 954 | 'carousel' => [ |
| @@ -1023,11 +956,8 @@ | ||
| 1023 | 956 | 'aria-live' => $has_autoplay_enabled ? 'off' : 'polite', |
| 1024 | 957 | ], |
| 1025 | 958 | 'carousel-wrapper' => [ |
| 1026 | 959 | 'class' => 'elementor-image-carousel-wrapper ' . $swiper_class, |
| 1027 | - 'role' => 'region', | |
| 1028 | - 'aria-roledescription' => 'carousel', | |
| 1029 | - 'aria-label' => $settings['carousel_name'], | |
| 1030 | 960 | 'dir' => $settings['direction'], |
| 1031 | 961 | ], |
| 1032 | 962 | ] ); |
| 1033 | 963 | |
| @@ -1041,9 +971,9 @@ | ||
| 1041 | 971 | $slides_count = count( $settings['carousel'] ); |
| 1042 | 972 | ?> |
| 1043 | 973 | <div <?php $this->print_render_attribute_string( 'carousel-wrapper' ); ?>> |
| 1044 | 974 | <div <?php $this->print_render_attribute_string( 'carousel' ); ?>> |
| 1045 | - <?php // PHPCS - $slides contains the slides content, all the relevant content is escaped above. ?> | |
| 975 | + <?php // PHPCS - $slides contains the slides content, all the relevent content is escaped above. ?> | |
| 1046 | 976 | <?php echo implode( '', $slides ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> |
| 1047 | 977 | </div> |
| 1048 | 978 | <?php if ( 1 < $slides_count ) : ?> |
| 1049 | 979 | <?php if ( $show_arrows ) : ?> |
| @@ -1068,9 +998,9 @@ | ||
| 1068 | 998 | * |
| 1069 | 999 | * @since 1.0.0 |
| 1070 | 1000 | * @access private |
| 1071 | 1001 | * |
| 1072 | - * @param array $attachment | |
| 1002 | + * @param array $attachment | |
| 1073 | 1003 | * @param object $instance |
| 1074 | 1004 | * |
| 1075 | 1005 | * @return array|string|false An array/string containing the attachment URL, or false if no link. |
| 1076 | 1006 | */ |
| @@ -1110,12 +1040,8 @@ | ||
| 1110 | 1040 | } |
| 1111 | 1041 | |
| 1112 | 1042 | $attachment_post = get_post( $attachment['id'] ); |
| 1113 | 1043 | |
| 1114 | - if ( Utils::has_invalid_post_permissions( $attachment_post ) ) { | |
| 1115 | - return ''; | |
| 1116 | - } | |
| 1117 | - | |
| 1118 | 1044 | if ( 'caption' === $caption_type ) { |
| 1119 | 1045 | return $attachment_post->post_excerpt; |
| 1120 | 1046 | } |
| 1121 | 1047 | |
| @@ -1141,26 +1067,6 @@ | ||
| 1141 | 1067 | ]; |
| 1142 | 1068 | } |
| 1143 | 1069 | |
| 1144 | 1070 | Icons_Manager::render_icon( $icon_settings, [ 'aria-hidden' => 'true' ] ); |
| 1145 | - } | |
| 1146 | - | |
| 1147 | - public function render_markdown(): string { | |
| 1148 | - $settings = $this->get_settings_for_display(); | |
| 1149 | - if ( empty( $settings['carousel'] ) ) { | |
| 1150 | - return ''; | |
| 1151 | - } | |
| 1152 | - $images = []; | |
| 1153 | - foreach ( $settings['carousel'] as $item ) { | |
| 1154 | - $url = $item['url'] ?? ''; | |
| 1155 | - if ( empty( $url ) ) { | |
| 1156 | - continue; | |
| 1157 | - } | |
| 1158 | - $alt = ''; | |
| 1159 | - if ( ! empty( $item['id'] ) ) { | |
| 1160 | - $alt = get_post_meta( $item['id'], '_wp_attachment_image_alt', true ); | |
| 1161 | - } | |
| 1162 | - $images[] = ' . ')'; | |
| 1163 | - } | |
| 1164 | - return implode( "\n\n", $images ); | |
| 1165 | 1071 | } |
| 1166 | 1072 | } |