| @@ -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 | * |
| @@ -73,31 +72,9 @@ | ||
| 73 | 72 | public function get_keywords() { |
| 74 | 73 | return [ 'testimonial', 'blockquote' ]; |
| 75 | 74 | } |
| 76 | 75 | |
| 77 | - protected function is_dynamic_content(): bool { | |
| 78 | - return false; | |
| 79 | - } | |
| 80 | - | |
| 81 | 76 | /** |
| 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 [ 'widget-testimonial' ]; | |
| 93 | - } | |
| 94 | - | |
| 95 | - public function has_widget_inner_wrapper(): bool { | |
| 96 | - return ! Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' ); | |
| 97 | - } | |
| 98 | - | |
| 99 | - /** | |
| 100 | 77 | * Get widget upsale data. |
| 101 | 78 | * |
| 102 | 79 | * Retrieve the widget promotion data. |
| 103 | 80 | * |
| @@ -208,8 +185,10 @@ | ||
| 208 | 185 | ], |
| 209 | 186 | ] |
| 210 | 187 | ); |
| 211 | 188 | |
| 189 | + $aside = is_rtl() ? 'right' : 'left'; | |
| 190 | + | |
| 212 | 191 | $this->add_control( |
| 213 | 192 | 'testimonial_image_position', |
| 214 | 193 | [ |
| 215 | 194 | 'label' => esc_html__( 'Image Position', 'elementor' ), |
| @@ -217,9 +196,9 @@ | ||
| 217 | 196 | 'default' => 'aside', |
| 218 | 197 | 'options' => [ |
| 219 | 198 | 'aside' => [ |
| 220 | 199 | 'title' => esc_html__( 'Aside', 'elementor' ), |
| 221 | - 'icon' => 'eicon-h-align-left', | |
| 200 | + 'icon' => 'eicon-h-align-' . $aside, | |
| 222 | 201 | ], |
| 223 | 202 | 'top' => [ |
| 224 | 203 | 'title' => esc_html__( 'Top', 'elementor' ), |
| 225 | 204 | 'icon' => 'eicon-v-align-top', |
| @@ -229,9 +208,8 @@ | ||
| 229 | 208 | 'condition' => [ |
| 230 | 209 | 'testimonial_image[url]!' => '', |
| 231 | 210 | ], |
| 232 | 211 | 'separator' => 'before', |
| 233 | - 'classes' => 'elementor-control-start-end', | |
| 234 | 212 | 'style_transfer' => true, |
| 235 | 213 | ] |
| 236 | 214 | ); |
| 237 | 215 | |
| @@ -241,10 +219,10 @@ | ||
| 241 | 219 | 'label' => esc_html__( 'Alignment', 'elementor' ), |
| 242 | 220 | 'type' => Controls_Manager::CHOOSE, |
| 243 | 221 | 'default' => 'center', |
| 244 | 222 | 'options' => [ |
| 245 | - 'start' => [ | |
| 246 | - 'title' => esc_html__( 'Start', 'elementor' ), | |
| 223 | + 'left' => [ | |
| 224 | + 'title' => esc_html__( 'Left', 'elementor' ), | |
| 247 | 225 | 'icon' => 'eicon-text-align-left', |
| 248 | 226 | ], |
| 249 | 227 | 'center' => [ |
| 250 | 228 | 'title' => esc_html__( 'Center', 'elementor' ), |
| @@ -249,18 +227,13 @@ | ||
| 249 | 227 | 'center' => [ |
| 250 | 228 | 'title' => esc_html__( 'Center', 'elementor' ), |
| 251 | 229 | 'icon' => 'eicon-text-align-center', |
| 252 | 230 | ], |
| 253 | - 'end' => [ | |
| 254 | - 'title' => esc_html__( 'End', 'elementor' ), | |
| 231 | + 'right' => [ | |
| 232 | + 'title' => esc_html__( 'Right', 'elementor' ), | |
| 255 | 233 | 'icon' => 'eicon-text-align-right', |
| 256 | 234 | ], |
| 257 | 235 | ], |
| 258 | - 'classes' => 'elementor-control-start-end', | |
| 259 | - 'selectors_dictionary' => [ | |
| 260 | - 'left' => is_rtl() ? 'end' : 'start', | |
| 261 | - 'right' => is_rtl() ? 'start' : 'end', | |
| 262 | - ], | |
| 263 | 236 | 'selectors' => [ |
| 264 | 237 | '{{WRAPPER}} .elementor-testimonial-wrapper' => 'text-align: {{VALUE}}', |
| 265 | 238 | ], |
| 266 | 239 | 'style_transfer' => true, |
| @@ -499,9 +472,9 @@ | ||
| 499 | 472 | if ( $has_content ) : |
| 500 | 473 | $this->add_render_attribute( 'testimonial_content', 'class', 'elementor-testimonial-content' ); |
| 501 | 474 | $this->add_inline_editing_attributes( 'testimonial_content' ); |
| 502 | 475 | ?> |
| 503 | - <div <?php $this->print_render_attribute_string( 'testimonial_content' ); ?>><?php echo wp_kses_post( $settings['testimonial_content'] ); ?></div> | |
| 476 | + <div <?php $this->print_render_attribute_string( 'testimonial_content' ); ?>><?php $this->print_unescaped_setting( 'testimonial_content' ); ?></div> | |
| 504 | 477 | <?php endif; ?> |
| 505 | 478 | |
| 506 | 479 | <?php if ( $has_image || $has_name || $has_job ) : ?> |
| 507 | 480 | <div <?php $this->print_render_attribute_string( 'meta' ); ?>> |
| @@ -526,13 +499,13 @@ | ||
| 526 | 499 | $this->add_inline_editing_attributes( 'testimonial_name', 'none' ); |
| 527 | 500 | |
| 528 | 501 | if ( ! empty( $settings['link']['url'] ) ) : |
| 529 | 502 | ?> |
| 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> | |
| 503 | + <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 | 504 | <?php |
| 532 | 505 | else : |
| 533 | 506 | ?> |
| 534 | - <div <?php $this->print_render_attribute_string( 'testimonial_name' ); ?>><?php echo wp_kses_post( $settings['testimonial_name'] ); ?></div> | |
| 507 | + <div <?php $this->print_render_attribute_string( 'testimonial_name' ); ?>><?php $this->print_unescaped_setting( 'testimonial_name' ); ?></div> | |
| 535 | 508 | <?php |
| 536 | 509 | endif; |
| 537 | 510 | endif; ?> |
| 538 | 511 | <?php |
| @@ -542,13 +515,13 @@ | ||
| 542 | 515 | $this->add_inline_editing_attributes( 'testimonial_job', 'none' ); |
| 543 | 516 | |
| 544 | 517 | if ( ! empty( $settings['link']['url'] ) ) : |
| 545 | 518 | ?> |
| 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> | |
| 519 | + <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 | 520 | <?php |
| 548 | 521 | else : |
| 549 | 522 | ?> |
| 550 | - <div <?php $this->print_render_attribute_string( 'testimonial_job' ); ?>><?php echo wp_kses_post( $settings['testimonial_job'] ); ?></div> | |
| 523 | + <div <?php $this->print_render_attribute_string( 'testimonial_job' ); ?>><?php $this->print_unescaped_setting( 'testimonial_job' ); ?></div> | |
| 551 | 524 | <?php |
| 552 | 525 | endif; |
| 553 | 526 | endif; ?> |
| 554 | 527 | </div> |
| @@ -567,34 +540,8 @@ | ||
| 567 | 540 | * |
| 568 | 541 | * @since 2.9.0 |
| 569 | 542 | * @access protected |
| 570 | 543 | */ |
| 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 | 544 | protected function content_template() { |
| 598 | 545 | ?> |
| 599 | 546 | <# |
| 600 | 547 | if ( '' === settings.testimonial_content && '' === settings.testimonial_image.url && '' === settings.testimonial_name && '' === settings.testimonial_job ) { |
| @@ -614,10 +561,10 @@ | ||
| 614 | 561 | imageUrl = elementor.imagesManager.getImageUrl( image ); |
| 615 | 562 | hasImage = ' elementor-has-image'; |
| 616 | 563 | |
| 617 | 564 | 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>'; | |
| 565 | + if ( settings.link.url ) { | |
| 566 | + imageHtml = '<a href="' + _.escape( settings.link.url ) + '">' + imageHtml + '</a>'; | |
| 620 | 567 | } |
| 621 | 568 | } |
| 622 | 569 | |
| 623 | 570 | var testimonial_image_position = settings.testimonial_image_position ? ' elementor-testimonial-image-position-' + settings.testimonial_image_position : ''; |
| @@ -626,19 +573,14 @@ | ||
| 626 | 573 | <# if ( '' !== settings.testimonial_content ) { |
| 627 | 574 | view.addRenderAttribute( 'testimonial_content', { |
| 628 | 575 | 'data-binding-type': 'content', |
| 629 | 576 | 'data-binding-setting': 'testimonial_content', |
| 630 | - 'data-binding-config': JSON.stringify({ | |
| 631 | - 'testimonial_content': { | |
| 632 | - editType: "text" | |
| 633 | - } | |
| 634 | - }) | |
| 635 | 577 | } ); |
| 636 | 578 | view.addRenderAttribute( 'testimonial_content', 'class', 'elementor-testimonial-content' ); |
| 637 | 579 | |
| 638 | 580 | view.addInlineEditingAttributes( 'testimonial_content' ); |
| 639 | 581 | #> |
| 640 | - <div {{{ view.getRenderAttributeString( 'testimonial_content' ) }}}>{{ settings.testimonial_content }}</div> | |
| 582 | + <div {{{ view.getRenderAttributeString( 'testimonial_content' ) }}}>{{{ settings.testimonial_content }}}</div> | |
| 641 | 583 | <# } #> |
| 642 | 584 | <div class="elementor-testimonial-meta{{ hasImage }}{{ testimonial_image_position }}"> |
| 643 | 585 | <div class="elementor-testimonial-meta-inner"> |
| 644 | 586 | <# if ( imageUrl ) { #> |
| @@ -660,15 +602,15 @@ | ||
| 660 | 602 | view.addRenderAttribute( 'testimonial_name', 'class', 'elementor-testimonial-name' ); |
| 661 | 603 | |
| 662 | 604 | view.addInlineEditingAttributes( 'testimonial_name', 'none' ); |
| 663 | 605 | |
| 664 | - if ( settings.link?.url ) { | |
| 606 | + if ( settings.link.url ) { | |
| 665 | 607 | #> |
| 666 | - <a href="{{ elementor.helpers.sanitizeUrl( settings.link?.url ) }}" {{{ view.getRenderAttributeString( 'testimonial_name' ) }}}>{{ settings.testimonial_name }}</a> | |
| 608 | + <a href="{{ settings.link.url }}" {{{ view.getRenderAttributeString( 'testimonial_name' ) }}}>{{{ settings.testimonial_name }}}</a> | |
| 667 | 609 | <# |
| 668 | 610 | } else { |
| 669 | 611 | #> |
| 670 | - <div {{{ view.getRenderAttributeString( 'testimonial_name' ) }}}>{{ settings.testimonial_name }}</div> | |
| 612 | + <div {{{ view.getRenderAttributeString( 'testimonial_name' ) }}}>{{{ settings.testimonial_name }}}</div> | |
| 671 | 613 | <# |
| 672 | 614 | } |
| 673 | 615 | } |
| 674 | 616 | |
| @@ -676,15 +618,15 @@ | ||
| 676 | 618 | view.addRenderAttribute( 'testimonial_job', 'class', 'elementor-testimonial-job' ); |
| 677 | 619 | |
| 678 | 620 | view.addInlineEditingAttributes( 'testimonial_job', 'none' ); |
| 679 | 621 | |
| 680 | - if ( settings.link?.url ) { | |
| 622 | + if ( settings.link.url ) { | |
| 681 | 623 | #> |
| 682 | - <a href="{{ elementor.helpers.sanitizeUrl( settings.link?.url ) }}" {{{ view.getRenderAttributeString( 'testimonial_job' ) }}}>{{ settings.testimonial_job }}</a> | |
| 624 | + <a href="{{ settings.link.url }}" {{{ view.getRenderAttributeString( 'testimonial_job' ) }}}>{{{ settings.testimonial_job }}}</a> | |
| 683 | 625 | <# |
| 684 | 626 | } else { |
| 685 | 627 | #> |
| 686 | - <div {{{ view.getRenderAttributeString( 'testimonial_job' ) }}}>{{ settings.testimonial_job }}</div> | |
| 628 | + <div {{{ view.getRenderAttributeString( 'testimonial_job' ) }}}>{{{ settings.testimonial_job }}}</div> | |
| 687 | 629 | <# |
| 688 | 630 | } |
| 689 | 631 | } |
| 690 | 632 | #> |