| @@ -96,29 +96,8 @@ | ||
| 96 | 96 | return ! Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' ); |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | /** |
| 100 | - * Get widget upsale data. | |
| 101 | - * | |
| 102 | - * Retrieve the widget promotion data. | |
| 103 | - * | |
| 104 | - * @since 3.18.0 | |
| 105 | - * @access protected | |
| 106 | - * | |
| 107 | - * @return array Widget promotion data. | |
| 108 | - */ | |
| 109 | - protected function get_upsale_data() { | |
| 110 | - return [ | |
| 111 | - 'condition' => ! Utils::has_pro(), | |
| 112 | - 'image' => esc_url( ELEMENTOR_ASSETS_URL . 'images/go-pro.svg' ), | |
| 113 | - 'image_alt' => esc_attr__( 'Upgrade', 'elementor' ), | |
| 114 | - 'description' => esc_html__( 'Use interesting masonry layouts and other overlay features with Elementor\'s Pro Gallery widget.', 'elementor' ), | |
| 115 | - 'upgrade_url' => esc_url( 'https://go.elementor.com/go-pro-testimonial-widget/' ), | |
| 116 | - 'upgrade_text' => esc_html__( 'Upgrade Now', 'elementor' ), | |
| 117 | - ]; | |
| 118 | - } | |
| 119 | - | |
| 120 | - /** | |
| 121 | 100 | * Register testimonial widget controls. |
| 122 | 101 | * |
| 123 | 102 | * Adds different input fields to allow the user to change and customize the widget settings. |
| 124 | 103 | * |
| @@ -208,8 +187,10 @@ | ||
| 208 | 187 | ], |
| 209 | 188 | ] |
| 210 | 189 | ); |
| 211 | 190 | |
| 191 | + $aside = is_rtl() ? 'right' : 'left'; | |
| 192 | + | |
| 212 | 193 | $this->add_control( |
| 213 | 194 | 'testimonial_image_position', |
| 214 | 195 | [ |
| 215 | 196 | 'label' => esc_html__( 'Image Position', 'elementor' ), |
| @@ -217,9 +198,9 @@ | ||
| 217 | 198 | 'default' => 'aside', |
| 218 | 199 | 'options' => [ |
| 219 | 200 | 'aside' => [ |
| 220 | 201 | 'title' => esc_html__( 'Aside', 'elementor' ), |
| 221 | - 'icon' => 'eicon-h-align-left', | |
| 202 | + 'icon' => 'eicon-h-align-' . $aside, | |
| 222 | 203 | ], |
| 223 | 204 | 'top' => [ |
| 224 | 205 | 'title' => esc_html__( 'Top', 'elementor' ), |
| 225 | 206 | 'icon' => 'eicon-v-align-top', |
| @@ -229,9 +210,8 @@ | ||
| 229 | 210 | 'condition' => [ |
| 230 | 211 | 'testimonial_image[url]!' => '', |
| 231 | 212 | ], |
| 232 | 213 | 'separator' => 'before', |
| 233 | - 'classes' => 'elementor-control-start-end', | |
| 234 | 214 | 'style_transfer' => true, |
| 235 | 215 | ] |
| 236 | 216 | ); |
| 237 | 217 | |
| @@ -241,10 +221,10 @@ | ||
| 241 | 221 | 'label' => esc_html__( 'Alignment', 'elementor' ), |
| 242 | 222 | 'type' => Controls_Manager::CHOOSE, |
| 243 | 223 | 'default' => 'center', |
| 244 | 224 | 'options' => [ |
| 245 | - 'start' => [ | |
| 246 | - 'title' => esc_html__( 'Start', 'elementor' ), | |
| 225 | + 'left' => [ | |
| 226 | + 'title' => esc_html__( 'Left', 'elementor' ), | |
| 247 | 227 | 'icon' => 'eicon-text-align-left', |
| 248 | 228 | ], |
| 249 | 229 | 'center' => [ |
| 250 | 230 | 'title' => esc_html__( 'Center', 'elementor' ), |
| @@ -249,18 +229,13 @@ | ||
| 249 | 229 | 'center' => [ |
| 250 | 230 | 'title' => esc_html__( 'Center', 'elementor' ), |
| 251 | 231 | 'icon' => 'eicon-text-align-center', |
| 252 | 232 | ], |
| 253 | - 'end' => [ | |
| 254 | - 'title' => esc_html__( 'End', 'elementor' ), | |
| 233 | + 'right' => [ | |
| 234 | + 'title' => esc_html__( 'Right', 'elementor' ), | |
| 255 | 235 | 'icon' => 'eicon-text-align-right', |
| 256 | 236 | ], |
| 257 | 237 | ], |
| 258 | - 'classes' => 'elementor-control-start-end', | |
| 259 | - 'selectors_dictionary' => [ | |
| 260 | - 'left' => is_rtl() ? 'end' : 'start', | |
| 261 | - 'right' => is_rtl() ? 'start' : 'end', | |
| 262 | - ], | |
| 263 | 238 | 'selectors' => [ |
| 264 | 239 | '{{WRAPPER}} .elementor-testimonial-wrapper' => 'text-align: {{VALUE}}', |
| 265 | 240 | ], |
| 266 | 241 | 'style_transfer' => true, |
| @@ -266,8 +241,18 @@ | ||
| 266 | 241 | 'style_transfer' => true, |
| 267 | 242 | ] |
| 268 | 243 | ); |
| 269 | 244 | |
| 245 | + if ( ! Utils::has_pro() ) { | |
| 246 | + $this->add_control( | |
| 247 | + Utils::TESTIMONIAL_WIDGET . '_promotion', | |
| 248 | + [ | |
| 249 | + 'label' => esc_html__( 'Loop Carousel widget', 'elementor' ), | |
| 250 | + 'type' => Promotion_Control::TYPE, | |
| 251 | + ] | |
| 252 | + ); | |
| 253 | + } | |
| 254 | + | |
| 270 | 255 | $this->end_controls_section(); |
| 271 | 256 | |
| 272 | 257 | // Content. |
| 273 | 258 | $this->start_controls_section( |
| @@ -499,9 +484,9 @@ | ||
| 499 | 484 | if ( $has_content ) : |
| 500 | 485 | $this->add_render_attribute( 'testimonial_content', 'class', 'elementor-testimonial-content' ); |
| 501 | 486 | $this->add_inline_editing_attributes( 'testimonial_content' ); |
| 502 | 487 | ?> |
| 503 | - <div <?php $this->print_render_attribute_string( 'testimonial_content' ); ?>><?php echo wp_kses_post( $settings['testimonial_content'] ); ?></div> | |
| 488 | + <div <?php $this->print_render_attribute_string( 'testimonial_content' ); ?>><?php $this->print_unescaped_setting( 'testimonial_content' ); ?></div> | |
| 504 | 489 | <?php endif; ?> |
| 505 | 490 | |
| 506 | 491 | <?php if ( $has_image || $has_name || $has_job ) : ?> |
| 507 | 492 | <div <?php $this->print_render_attribute_string( 'meta' ); ?>> |
| @@ -526,13 +511,13 @@ | ||
| 526 | 511 | $this->add_inline_editing_attributes( 'testimonial_name', 'none' ); |
| 527 | 512 | |
| 528 | 513 | if ( ! empty( $settings['link']['url'] ) ) : |
| 529 | 514 | ?> |
| 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> | |
| 515 | + <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 | 516 | <?php |
| 532 | 517 | else : |
| 533 | 518 | ?> |
| 534 | - <div <?php $this->print_render_attribute_string( 'testimonial_name' ); ?>><?php echo wp_kses_post( $settings['testimonial_name'] ); ?></div> | |
| 519 | + <div <?php $this->print_render_attribute_string( 'testimonial_name' ); ?>><?php $this->print_unescaped_setting( 'testimonial_name' ); ?></div> | |
| 535 | 520 | <?php |
| 536 | 521 | endif; |
| 537 | 522 | endif; ?> |
| 538 | 523 | <?php |
| @@ -542,13 +527,13 @@ | ||
| 542 | 527 | $this->add_inline_editing_attributes( 'testimonial_job', 'none' ); |
| 543 | 528 | |
| 544 | 529 | if ( ! empty( $settings['link']['url'] ) ) : |
| 545 | 530 | ?> |
| 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> | |
| 531 | + <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 | 532 | <?php |
| 548 | 533 | else : |
| 549 | 534 | ?> |
| 550 | - <div <?php $this->print_render_attribute_string( 'testimonial_job' ); ?>><?php echo wp_kses_post( $settings['testimonial_job'] ); ?></div> | |
| 535 | + <div <?php $this->print_render_attribute_string( 'testimonial_job' ); ?>><?php $this->print_unescaped_setting( 'testimonial_job' ); ?></div> | |
| 551 | 536 | <?php |
| 552 | 537 | endif; |
| 553 | 538 | endif; ?> |
| 554 | 539 | </div> |
| @@ -567,34 +552,8 @@ | ||
| 567 | 552 | * |
| 568 | 553 | * @since 2.9.0 |
| 569 | 554 | * @access protected |
| 570 | 555 | */ |
| 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 | 556 | protected function content_template() { |
| 598 | 557 | ?> |
| 599 | 558 | <# |
| 600 | 559 | if ( '' === settings.testimonial_content && '' === settings.testimonial_image.url && '' === settings.testimonial_name && '' === settings.testimonial_job ) { |
| @@ -614,10 +573,10 @@ | ||
| 614 | 573 | imageUrl = elementor.imagesManager.getImageUrl( image ); |
| 615 | 574 | hasImage = ' elementor-has-image'; |
| 616 | 575 | |
| 617 | 576 | 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>'; | |
| 577 | + if ( settings.link.url ) { | |
| 578 | + imageHtml = '<a href="' + elementor.helpers.sanitizeUrl( settings.link.url ) + '">' + imageHtml + '</a>'; | |
| 620 | 579 | } |
| 621 | 580 | } |
| 622 | 581 | |
| 623 | 582 | var testimonial_image_position = settings.testimonial_image_position ? ' elementor-testimonial-image-position-' + settings.testimonial_image_position : ''; |
| @@ -636,9 +595,9 @@ | ||
| 636 | 595 | view.addRenderAttribute( 'testimonial_content', 'class', 'elementor-testimonial-content' ); |
| 637 | 596 | |
| 638 | 597 | view.addInlineEditingAttributes( 'testimonial_content' ); |
| 639 | 598 | #> |
| 640 | - <div {{{ view.getRenderAttributeString( 'testimonial_content' ) }}}>{{ settings.testimonial_content }}</div> | |
| 599 | + <div {{{ view.getRenderAttributeString( 'testimonial_content' ) }}}>{{{ settings.testimonial_content }}}</div> | |
| 641 | 600 | <# } #> |
| 642 | 601 | <div class="elementor-testimonial-meta{{ hasImage }}{{ testimonial_image_position }}"> |
| 643 | 602 | <div class="elementor-testimonial-meta-inner"> |
| 644 | 603 | <# if ( imageUrl ) { #> |
| @@ -660,15 +619,15 @@ | ||
| 660 | 619 | view.addRenderAttribute( 'testimonial_name', 'class', 'elementor-testimonial-name' ); |
| 661 | 620 | |
| 662 | 621 | view.addInlineEditingAttributes( 'testimonial_name', 'none' ); |
| 663 | 622 | |
| 664 | - if ( settings.link?.url ) { | |
| 623 | + if ( settings.link.url ) { | |
| 665 | 624 | #> |
| 666 | - <a href="{{ elementor.helpers.sanitizeUrl( settings.link?.url ) }}" {{{ view.getRenderAttributeString( 'testimonial_name' ) }}}>{{ settings.testimonial_name }}</a> | |
| 625 | + <a href="{{ elementor.helpers.sanitizeUrl( settings.link.url ) }}" {{{ view.getRenderAttributeString( 'testimonial_name' ) }}}>{{{ settings.testimonial_name }}}</a> | |
| 667 | 626 | <# |
| 668 | 627 | } else { |
| 669 | 628 | #> |
| 670 | - <div {{{ view.getRenderAttributeString( 'testimonial_name' ) }}}>{{ settings.testimonial_name }}</div> | |
| 629 | + <div {{{ view.getRenderAttributeString( 'testimonial_name' ) }}}>{{{ settings.testimonial_name }}}</div> | |
| 671 | 630 | <# |
| 672 | 631 | } |
| 673 | 632 | } |
| 674 | 633 | |
| @@ -676,15 +635,15 @@ | ||
| 676 | 635 | view.addRenderAttribute( 'testimonial_job', 'class', 'elementor-testimonial-job' ); |
| 677 | 636 | |
| 678 | 637 | view.addInlineEditingAttributes( 'testimonial_job', 'none' ); |
| 679 | 638 | |
| 680 | - if ( settings.link?.url ) { | |
| 639 | + if ( settings.link.url ) { | |
| 681 | 640 | #> |
| 682 | - <a href="{{ elementor.helpers.sanitizeUrl( settings.link?.url ) }}" {{{ view.getRenderAttributeString( 'testimonial_job' ) }}}>{{ settings.testimonial_job }}</a> | |
| 641 | + <a href="{{ elementor.helpers.sanitizeUrl( settings.link.url ) }}" {{{ view.getRenderAttributeString( 'testimonial_job' ) }}}>{{{ settings.testimonial_job }}}</a> | |
| 683 | 642 | <# |
| 684 | 643 | } else { |
| 685 | 644 | #> |
| 686 | - <div {{{ view.getRenderAttributeString( 'testimonial_job' ) }}}>{{ settings.testimonial_job }}</div> | |
| 645 | + <div {{{ view.getRenderAttributeString( 'testimonial_job' ) }}}>{{{ settings.testimonial_job }}}</div> | |
| 687 | 646 | <# |
| 688 | 647 | } |
| 689 | 648 | } |
| 690 | 649 | #> |