| @@ -6,9 +6,8 @@ | ||
| 6 | 6 | } |
| 7 | 7 | |
| 8 | 8 | use Elementor\Core\Kits\Documents\Tabs\Global_Colors; |
| 9 | 9 | use Elementor\Core\Kits\Documents\Tabs\Global_Typography; |
| 10 | -use Elementor\Modules\Promotions\Controls\Promotion_Control; | |
| 11 | 10 | |
| 12 | 11 | /** |
| 13 | 12 | * Elementor testimonial widget. |
| 14 | 13 | * |
| @@ -91,12 +90,8 @@ | ||
| 91 | 90 | public function get_style_depends(): array { |
| 92 | 91 | return [ 'widget-testimonial' ]; |
| 93 | 92 | } |
| 94 | 93 | |
| 95 | - public function has_widget_inner_wrapper(): bool { | |
| 96 | - return ! Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' ); | |
| 97 | - } | |
| 98 | - | |
| 99 | 94 | /** |
| 100 | 95 | * Get widget upsale data. |
| 101 | 96 | * |
| 102 | 97 | * Retrieve the widget promotion data. |
| @@ -208,8 +203,10 @@ | ||
| 208 | 203 | ], |
| 209 | 204 | ] |
| 210 | 205 | ); |
| 211 | 206 | |
| 207 | + $aside = is_rtl() ? 'right' : 'left'; | |
| 208 | + | |
| 212 | 209 | $this->add_control( |
| 213 | 210 | 'testimonial_image_position', |
| 214 | 211 | [ |
| 215 | 212 | 'label' => esc_html__( 'Image Position', 'elementor' ), |
| @@ -217,9 +214,9 @@ | ||
| 217 | 214 | 'default' => 'aside', |
| 218 | 215 | 'options' => [ |
| 219 | 216 | 'aside' => [ |
| 220 | 217 | 'title' => esc_html__( 'Aside', 'elementor' ), |
| 221 | - 'icon' => 'eicon-h-align-left', | |
| 218 | + 'icon' => 'eicon-h-align-' . $aside, | |
| 222 | 219 | ], |
| 223 | 220 | 'top' => [ |
| 224 | 221 | 'title' => esc_html__( 'Top', 'elementor' ), |
| 225 | 222 | 'icon' => 'eicon-v-align-top', |
| @@ -229,9 +226,8 @@ | ||
| 229 | 226 | 'condition' => [ |
| 230 | 227 | 'testimonial_image[url]!' => '', |
| 231 | 228 | ], |
| 232 | 229 | 'separator' => 'before', |
| 233 | - 'classes' => 'elementor-control-start-end', | |
| 234 | 230 | 'style_transfer' => true, |
| 235 | 231 | ] |
| 236 | 232 | ); |
| 237 | 233 | |
| @@ -241,10 +237,10 @@ | ||
| 241 | 237 | 'label' => esc_html__( 'Alignment', 'elementor' ), |
| 242 | 238 | 'type' => Controls_Manager::CHOOSE, |
| 243 | 239 | 'default' => 'center', |
| 244 | 240 | 'options' => [ |
| 245 | - 'start' => [ | |
| 246 | - 'title' => esc_html__( 'Start', 'elementor' ), | |
| 241 | + 'left' => [ | |
| 242 | + 'title' => esc_html__( 'Left', 'elementor' ), | |
| 247 | 243 | 'icon' => 'eicon-text-align-left', |
| 248 | 244 | ], |
| 249 | 245 | 'center' => [ |
| 250 | 246 | 'title' => esc_html__( 'Center', 'elementor' ), |
| @@ -249,18 +245,13 @@ | ||
| 249 | 245 | 'center' => [ |
| 250 | 246 | 'title' => esc_html__( 'Center', 'elementor' ), |
| 251 | 247 | 'icon' => 'eicon-text-align-center', |
| 252 | 248 | ], |
| 253 | - 'end' => [ | |
| 254 | - 'title' => esc_html__( 'End', 'elementor' ), | |
| 249 | + 'right' => [ | |
| 250 | + 'title' => esc_html__( 'Right', 'elementor' ), | |
| 255 | 251 | 'icon' => 'eicon-text-align-right', |
| 256 | 252 | ], |
| 257 | 253 | ], |
| 258 | - 'classes' => 'elementor-control-start-end', | |
| 259 | - 'selectors_dictionary' => [ | |
| 260 | - 'left' => is_rtl() ? 'end' : 'start', | |
| 261 | - 'right' => is_rtl() ? 'start' : 'end', | |
| 262 | - ], | |
| 263 | 254 | 'selectors' => [ |
| 264 | 255 | '{{WRAPPER}} .elementor-testimonial-wrapper' => 'text-align: {{VALUE}}', |
| 265 | 256 | ], |
| 266 | 257 | 'style_transfer' => true, |
| @@ -499,9 +490,9 @@ | ||
| 499 | 490 | if ( $has_content ) : |
| 500 | 491 | $this->add_render_attribute( 'testimonial_content', 'class', 'elementor-testimonial-content' ); |
| 501 | 492 | $this->add_inline_editing_attributes( 'testimonial_content' ); |
| 502 | 493 | ?> |
| 503 | - <div <?php $this->print_render_attribute_string( 'testimonial_content' ); ?>><?php echo wp_kses_post( $settings['testimonial_content'] ); ?></div> | |
| 494 | + <div <?php $this->print_render_attribute_string( 'testimonial_content' ); ?>><?php $this->print_unescaped_setting( 'testimonial_content' ); ?></div> | |
| 504 | 495 | <?php endif; ?> |
| 505 | 496 | |
| 506 | 497 | <?php if ( $has_image || $has_name || $has_job ) : ?> |
| 507 | 498 | <div <?php $this->print_render_attribute_string( 'meta' ); ?>> |
| @@ -526,13 +517,13 @@ | ||
| 526 | 517 | $this->add_inline_editing_attributes( 'testimonial_name', 'none' ); |
| 527 | 518 | |
| 528 | 519 | if ( ! empty( $settings['link']['url'] ) ) : |
| 529 | 520 | ?> |
| 530 | - <a <?php $this->print_render_attribute_string( 'testimonial_name' ); ?> <?php $this->print_render_attribute_string( 'link' ); ?>><?php echo wp_kses_post( $settings['testimonial_name'] ); ?></a> | |
| 521 | + <a <?php $this->print_render_attribute_string( 'testimonial_name' ); ?> <?php $this->print_render_attribute_string( 'link' ); ?>><?php $this->print_unescaped_setting( 'testimonial_name' ); ?></a> | |
| 531 | 522 | <?php |
| 532 | 523 | else : |
| 533 | 524 | ?> |
| 534 | - <div <?php $this->print_render_attribute_string( 'testimonial_name' ); ?>><?php echo wp_kses_post( $settings['testimonial_name'] ); ?></div> | |
| 525 | + <div <?php $this->print_render_attribute_string( 'testimonial_name' ); ?>><?php $this->print_unescaped_setting( 'testimonial_name' ); ?></div> | |
| 535 | 526 | <?php |
| 536 | 527 | endif; |
| 537 | 528 | endif; ?> |
| 538 | 529 | <?php |
| @@ -542,13 +533,13 @@ | ||
| 542 | 533 | $this->add_inline_editing_attributes( 'testimonial_job', 'none' ); |
| 543 | 534 | |
| 544 | 535 | if ( ! empty( $settings['link']['url'] ) ) : |
| 545 | 536 | ?> |
| 546 | - <a <?php $this->print_render_attribute_string( 'testimonial_job' ); ?> <?php $this->print_render_attribute_string( 'link' ); ?>><?php echo wp_kses_post( $settings['testimonial_job'] ); ?></a> | |
| 537 | + <a <?php $this->print_render_attribute_string( 'testimonial_job' ); ?> <?php $this->print_render_attribute_string( 'link' ); ?>><?php $this->print_unescaped_setting( 'testimonial_job' ); ?></a> | |
| 547 | 538 | <?php |
| 548 | 539 | else : |
| 549 | 540 | ?> |
| 550 | - <div <?php $this->print_render_attribute_string( 'testimonial_job' ); ?>><?php echo wp_kses_post( $settings['testimonial_job'] ); ?></div> | |
| 541 | + <div <?php $this->print_render_attribute_string( 'testimonial_job' ); ?>><?php $this->print_unescaped_setting( 'testimonial_job' ); ?></div> | |
| 551 | 542 | <?php |
| 552 | 543 | endif; |
| 553 | 544 | endif; ?> |
| 554 | 545 | </div> |
| @@ -567,34 +558,8 @@ | ||
| 567 | 558 | * |
| 568 | 559 | * @since 2.9.0 |
| 569 | 560 | * @access protected |
| 570 | 561 | */ |
| 571 | - public function render_markdown(): string { | |
| 572 | - $settings = $this->get_settings_for_display(); | |
| 573 | - | |
| 574 | - $content = Utils::html_to_plain_text( $settings['testimonial_content'] ?? '' ); | |
| 575 | - $name = Utils::html_to_plain_text( $settings['testimonial_name'] ?? '' ); | |
| 576 | - $job = Utils::html_to_plain_text( $settings['testimonial_job'] ?? '' ); | |
| 577 | - | |
| 578 | - if ( empty( $content ) && empty( $name ) ) { | |
| 579 | - return ''; | |
| 580 | - } | |
| 581 | - | |
| 582 | - $md = ''; | |
| 583 | - | |
| 584 | - if ( ! empty( $content ) ) { | |
| 585 | - $md = '> "' . $content . '"'; | |
| 586 | - } | |
| 587 | - | |
| 588 | - $attribution = array_filter( [ $name, $job ] ); | |
| 589 | - | |
| 590 | - if ( ! empty( $attribution ) ) { | |
| 591 | - $md .= "\n>\n> -- " . implode( ', ', $attribution ); | |
| 592 | - } | |
| 593 | - | |
| 594 | - return $md; | |
| 595 | - } | |
| 596 | - | |
| 597 | 562 | protected function content_template() { |
| 598 | 563 | ?> |
| 599 | 564 | <# |
| 600 | 565 | if ( '' === settings.testimonial_content && '' === settings.testimonial_image.url && '' === settings.testimonial_name && '' === settings.testimonial_job ) { |
| @@ -614,10 +579,10 @@ | ||
| 614 | 579 | imageUrl = elementor.imagesManager.getImageUrl( image ); |
| 615 | 580 | hasImage = ' elementor-has-image'; |
| 616 | 581 | |
| 617 | 582 | var imageHtml = '<img src="' + _.escape( imageUrl ) + '" alt="testimonial" />'; |
| 618 | - if ( settings.link?.url ) { | |
| 619 | - imageHtml = '<a href="' + elementor.helpers.sanitizeUrl( settings.link?.url ) + '">' + imageHtml + '</a>'; | |
| 583 | + if ( settings.link.url ) { | |
| 584 | + imageHtml = '<a href="' + elementor.helpers.sanitizeUrl( settings.link.url ) + '">' + imageHtml + '</a>'; | |
| 620 | 585 | } |
| 621 | 586 | } |
| 622 | 587 | |
| 623 | 588 | var testimonial_image_position = settings.testimonial_image_position ? ' elementor-testimonial-image-position-' + settings.testimonial_image_position : ''; |
| @@ -626,19 +591,14 @@ | ||
| 626 | 591 | <# if ( '' !== settings.testimonial_content ) { |
| 627 | 592 | view.addRenderAttribute( 'testimonial_content', { |
| 628 | 593 | 'data-binding-type': 'content', |
| 629 | 594 | 'data-binding-setting': 'testimonial_content', |
| 630 | - 'data-binding-config': JSON.stringify({ | |
| 631 | - 'testimonial_content': { | |
| 632 | - editType: "text" | |
| 633 | - } | |
| 634 | - }) | |
| 635 | 595 | } ); |
| 636 | 596 | view.addRenderAttribute( 'testimonial_content', 'class', 'elementor-testimonial-content' ); |
| 637 | 597 | |
| 638 | 598 | view.addInlineEditingAttributes( 'testimonial_content' ); |
| 639 | 599 | #> |
| 640 | - <div {{{ view.getRenderAttributeString( 'testimonial_content' ) }}}>{{ settings.testimonial_content }}</div> | |
| 600 | + <div {{{ view.getRenderAttributeString( 'testimonial_content' ) }}}>{{{ settings.testimonial_content }}}</div> | |
| 641 | 601 | <# } #> |
| 642 | 602 | <div class="elementor-testimonial-meta{{ hasImage }}{{ testimonial_image_position }}"> |
| 643 | 603 | <div class="elementor-testimonial-meta-inner"> |
| 644 | 604 | <# if ( imageUrl ) { #> |
| @@ -660,15 +620,15 @@ | ||
| 660 | 620 | view.addRenderAttribute( 'testimonial_name', 'class', 'elementor-testimonial-name' ); |
| 661 | 621 | |
| 662 | 622 | view.addInlineEditingAttributes( 'testimonial_name', 'none' ); |
| 663 | 623 | |
| 664 | - if ( settings.link?.url ) { | |
| 624 | + if ( settings.link.url ) { | |
| 665 | 625 | #> |
| 666 | - <a href="{{ elementor.helpers.sanitizeUrl( settings.link?.url ) }}" {{{ view.getRenderAttributeString( 'testimonial_name' ) }}}>{{ settings.testimonial_name }}</a> | |
| 626 | + <a href="{{ elementor.helpers.sanitizeUrl( settings.link.url ) }}" {{{ view.getRenderAttributeString( 'testimonial_name' ) }}}>{{{ settings.testimonial_name }}}</a> | |
| 667 | 627 | <# |
| 668 | 628 | } else { |
| 669 | 629 | #> |
| 670 | - <div {{{ view.getRenderAttributeString( 'testimonial_name' ) }}}>{{ settings.testimonial_name }}</div> | |
| 630 | + <div {{{ view.getRenderAttributeString( 'testimonial_name' ) }}}>{{{ settings.testimonial_name }}}</div> | |
| 671 | 631 | <# |
| 672 | 632 | } |
| 673 | 633 | } |
| 674 | 634 | |
| @@ -676,15 +636,15 @@ | ||
| 676 | 636 | view.addRenderAttribute( 'testimonial_job', 'class', 'elementor-testimonial-job' ); |
| 677 | 637 | |
| 678 | 638 | view.addInlineEditingAttributes( 'testimonial_job', 'none' ); |
| 679 | 639 | |
| 680 | - if ( settings.link?.url ) { | |
| 640 | + if ( settings.link.url ) { | |
| 681 | 641 | #> |
| 682 | - <a href="{{ elementor.helpers.sanitizeUrl( settings.link?.url ) }}" {{{ view.getRenderAttributeString( 'testimonial_job' ) }}}>{{ settings.testimonial_job }}</a> | |
| 642 | + <a href="{{ elementor.helpers.sanitizeUrl( settings.link.url ) }}" {{{ view.getRenderAttributeString( 'testimonial_job' ) }}}>{{{ settings.testimonial_job }}}</a> | |
| 683 | 643 | <# |
| 684 | 644 | } else { |
| 685 | 645 | #> |
| 686 | - <div {{{ view.getRenderAttributeString( 'testimonial_job' ) }}}>{{ settings.testimonial_job }}</div> | |
| 646 | + <div {{{ view.getRenderAttributeString( 'testimonial_job' ) }}}>{{{ settings.testimonial_job }}}</div> | |
| 687 | 647 | <# |
| 688 | 648 | } |
| 689 | 649 | } |
| 690 | 650 | #> |