PluginProbe
Elementor Website Builder – more than just a page builder / 3.22.2
Elementor Website Builder – more than just a page builder v3.22.2
4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 4.0.7 All 451 releases
← All changes | includes/widgets/image.php +13 -98 4.2.23.22.2 View file →
@@ -93,26 +93,8 @@
93 93 return false;
94 94 }
95 95
96 96 /**
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-image' ];
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 97 * Register image widget controls.
116 98 *
117 99 * Adds different input fields to allow the user to change and customize the widget settings.
118 100 *
@@ -258,10 +240,10 @@
258 240 [
259 241 'label' => esc_html__( 'Alignment', 'elementor' ),
260 242 'type' => Controls_Manager::CHOOSE,
261 243 'options' => [
262 - 'start' => [
263 - 'title' => esc_html__( 'Start', 'elementor' ),
244 + 'left' => [
245 + 'title' => esc_html__( 'Left', 'elementor' ),
264 246 'icon' => 'eicon-text-align-left',
265 247 ],
266 248 'center' => [
267 249 'title' => esc_html__( 'Center', 'elementor' ),
@@ -266,18 +248,13 @@
266 248 'center' => [
267 249 'title' => esc_html__( 'Center', 'elementor' ),
268 250 'icon' => 'eicon-text-align-center',
269 251 ],
270 - 'end' => [
271 - 'title' => esc_html__( 'End', 'elementor' ),
252 + 'right' => [
253 + 'title' => esc_html__( 'Right', 'elementor' ),
272 254 'icon' => 'eicon-text-align-right',
273 255 ],
274 256 ],
275 - 'classes' => 'elementor-control-start-end',
276 - 'selectors_dictionary' => [
277 - 'left' => is_rtl() ? 'end' : 'start',
278 - 'right' => is_rtl() ? 'start' : 'end',
279 - ],
280 257 'selectors' => [
281 258 '{{WRAPPER}}' => 'text-align: {{VALUE}};',
282 259 ],
283 260 ]
@@ -387,9 +364,8 @@
387 364 '' => esc_html__( 'Default', 'elementor' ),
388 365 'fill' => esc_html__( 'Fill', 'elementor' ),
389 366 'cover' => esc_html__( 'Cover', 'elementor' ),
390 367 'contain' => esc_html__( 'Contain', 'elementor' ),
391 - 'scale-down' => esc_html__( 'Scale Down', 'elementor' ),
392 368 ],
393 369 'default' => '',
394 370 'selectors' => [
395 371 '{{WRAPPER}} img' => 'object-fit: {{VALUE}};',
@@ -418,9 +394,9 @@
418 394 '{{WRAPPER}} img' => 'object-position: {{VALUE}};',
419 395 ],
420 396 'condition' => [
421 397 'height[size]!' => '',
422 - 'object-fit' => [ 'cover', 'contain', 'scale-down' ],
398 + 'object-fit' => 'cover',
423 399 ],
424 400 ]
425 401 );
426 402
@@ -581,10 +557,10 @@
581 557 [
582 558 'label' => esc_html__( 'Alignment', 'elementor' ),
583 559 'type' => Controls_Manager::CHOOSE,
584 560 'options' => [
585 - 'start' => [
586 - 'title' => esc_html__( 'Start', 'elementor' ),
561 + 'left' => [
562 + 'title' => esc_html__( 'Left', 'elementor' ),
587 563 'icon' => 'eicon-text-align-left',
588 564 ],
589 565 'center' => [
590 566 'title' => esc_html__( 'Center', 'elementor' ),
@@ -589,10 +565,10 @@
589 565 'center' => [
590 566 'title' => esc_html__( 'Center', 'elementor' ),
591 567 'icon' => 'eicon-text-align-center',
592 568 ],
593 - 'end' => [
594 - 'title' => esc_html__( 'End', 'elementor' ),
569 + 'right' => [
570 + 'title' => esc_html__( 'Right', 'elementor' ),
595 571 'icon' => 'eicon-text-align-right',
596 572 ],
597 573 'justify' => [
598 574 'title' => esc_html__( 'Justified', 'elementor' ),
@@ -598,13 +574,8 @@
598 574 'title' => esc_html__( 'Justified', 'elementor' ),
599 575 'icon' => 'eicon-text-align-justify',
600 576 ],
601 577 ],
602 - 'classes' => 'elementor-control-start-end',
603 - 'selectors_dictionary' => [
604 - 'left' => is_rtl() ? 'end' : 'start',
605 - 'right' => is_rtl() ? 'start' : 'end',
606 - ],
607 578 'default' => '',
608 579 'selectors' => [
609 580 '{{WRAPPER}} .widget-image-caption' => 'text-align: {{VALUE}};',
610 581 ],
@@ -675,9 +646,9 @@
675 646 'max' => 10,
676 647 ],
677 648 ],
678 649 'selectors' => [
679 - '{{WRAPPER}} .widget-image-caption' => 'margin-block-start: {{SIZE}}{{UNIT}};',
650 + '{{WRAPPER}} .widget-image-caption' => 'margin-top: {{SIZE}}{{UNIT}};',
680 651 ],
681 652 ]
682 653 );
683 654
@@ -702,9 +673,9 @@
702 673 * Get the caption for current widget.
703 674 *
704 675 * @access private
705 676 * @since 2.3.0
706 - * @param array $settings
677 + * @param $settings
707 678 *
708 679 * @return string
709 680 */
710 681 private function get_caption( $settings ) {
@@ -773,64 +744,8 @@
773 744 <?php endif; ?>
774 745 <?php
775 746 }
776 747
777 - public function render_markdown(): string {
778 - $settings = $this->get_settings_for_display();
779 -
780 - if ( empty( $settings['image']['url'] ) ) {
781 - return '';
782 - }
783 -
784 - $url = esc_url( $settings['image']['url'] );
785 - $alt = $this->get_image_alt_text( $settings );
786 - $image_md = '![' . $alt . '](' . $url . ')';
787 -
788 - $link = $this->get_link_url( $settings );
789 -
790 - if ( ! empty( $link['url'] ) && $link['url'] !== $url ) {
791 - $image_md = '[' . $image_md . '](' . esc_url( $link['url'] ) . ')';
792 - }
793 -
794 - $caption = $this->get_visible_caption( $settings );
795 -
796 - if ( ! empty( $caption ) ) {
797 - $image_md .= "\n" . $caption;
798 - }
799 -
800 - return $image_md;
801 - }
802 -
803 - private function get_image_alt_text( array $settings ): string {
804 - if ( empty( $settings['image']['id'] ) ) {
805 - return '';
806 - }
807 -
808 - $attachment_id = $settings['image']['id'];
809 -
810 - $alt = get_post_meta( $attachment_id, '_wp_attachment_image_alt', true );
811 -
812 - if ( ! empty( $alt ) ) {
813 - return $alt;
814 - }
815 -
816 - $attachment = get_post( $attachment_id );
817 -
818 - if ( ! $attachment ) {
819 - return '';
820 - }
821 -
822 - return $attachment->post_title ?? '';
823 - }
824 -
825 - private function get_visible_caption( array $settings ): string {
826 - if ( ! $this->has_caption( $settings ) ) {
827 - return '';
828 - }
829 -
830 - return Utils::html_to_plain_text( $this->get_caption( $settings ) );
831 - }
832 -
833 748 /**
834 749 * Render image widget output in the editor.
835 750 *
836 751 * Written as a Backbone JavaScript template and used to generate the live preview.
@@ -887,9 +802,9 @@
887 802
888 803 var link_url;
889 804
890 805 if ( 'custom' === settings.link_to ) {
891 - link_url = settings.link?.url;
806 + link_url = settings.link.url;
892 807 }
893 808
894 809 if ( 'file' === settings.link_to ) {
895 810 link_url = settings.image.url;
@@ -905,9 +820,9 @@
905 820 #><figure class="wp-caption"><#
906 821 }
907 822
908 823 if ( link_url ) {
909 - #><a class="elementor-clickable" data-elementor-open-lightbox="{{ settings.open_lightbox }}" href="{{ elementor.helpers.sanitizeUrl( link_url ) }}"><#
824 + #><a class="elementor-clickable" data-elementor-open-lightbox="{{ settings.open_lightbox }}" href="{{ link_url }}"><#
910 825 }
911 826 #><img src="{{ image_url }}" class="{{ imgClass }}" /><#
912 827
913 828 if ( link_url ) {