PluginProbe
Elementor Website Builder – more than just a page builder / 3.20.2
Elementor Website Builder – more than just a page builder v3.20.2
4.3.0-beta3 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 All 452 releases
← All changes | includes/widgets/testimonial.php +30 -92 4.1.43.20.2 View file →
@@ -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,
@@ -468,17 +441,8 @@
468 441 */
469 442 protected function render() {
470 443 $settings = $this->get_settings_for_display();
471 444
472 - $has_content = ! empty( $settings['testimonial_content'] );
473 - $has_image = ! empty( $settings['testimonial_image']['url'] );
474 - $has_name = ! empty( $settings['testimonial_name'] );
475 - $has_job = ! empty( $settings['testimonial_job'] );
476 -
477 - if ( ! $has_content && ! $has_image && ! $has_name && ! $has_job ) {
478 - return;
479 - }
480 -
481 445 $this->add_render_attribute( 'wrapper', 'class', 'elementor-testimonial-wrapper' );
482 446
483 447 $this->add_render_attribute( 'meta', 'class', 'elementor-testimonial-meta' );
484 448
@@ -489,8 +453,17 @@
489 453 if ( $settings['testimonial_image_position'] ) {
490 454 $this->add_render_attribute( 'meta', 'class', 'elementor-testimonial-image-position-' . $settings['testimonial_image_position'] );
491 455 }
492 456
457 + $has_content = ! ! $settings['testimonial_content'];
458 + $has_image = ! ! $settings['testimonial_image']['url'];
459 + $has_name = ! ! $settings['testimonial_name'];
460 + $has_job = ! ! $settings['testimonial_job'];
461 +
462 + if ( ! $has_content && ! $has_image && ! $has_name && ! $has_job ) {
463 + return;
464 + }
465 +
493 466 if ( ! empty( $settings['link']['url'] ) ) {
494 467 $this->add_link_attributes( 'link', $settings['link'] );
495 468 }
496 469 ?>
@@ -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,41 +540,11 @@
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 - if ( '' === settings.testimonial_content && '' === settings.testimonial_image.url && '' === settings.testimonial_name && '' === settings.testimonial_job ) {
601 - return;
602 - }
603 -
604 547 var image = {
605 548 id: settings.testimonial_image.id,
606 549 url: settings.testimonial_image.url,
607 550 size: settings.testimonial_image_size,
@@ -614,10 +557,10 @@
614 557 imageUrl = elementor.imagesManager.getImageUrl( image );
615 558 hasImage = ' elementor-has-image';
616 559
617 560 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>';
561 + if ( settings.link.url ) {
562 + imageHtml = '<a href="' + _.escape( settings.link.url ) + '">' + imageHtml + '</a>';
620 563 }
621 564 }
622 565
623 566 var testimonial_image_position = settings.testimonial_image_position ? ' elementor-testimonial-image-position-' + settings.testimonial_image_position : '';
@@ -626,19 +569,14 @@
626 569 <# if ( '' !== settings.testimonial_content ) {
627 570 view.addRenderAttribute( 'testimonial_content', {
628 571 'data-binding-type': 'content',
629 572 'data-binding-setting': 'testimonial_content',
630 - 'data-binding-config': JSON.stringify({
631 - 'testimonial_content': {
632 - editType: "text"
633 - }
634 - })
635 573 } );
636 574 view.addRenderAttribute( 'testimonial_content', 'class', 'elementor-testimonial-content' );
637 575
638 576 view.addInlineEditingAttributes( 'testimonial_content' );
639 577 #>
640 - <div {{{ view.getRenderAttributeString( 'testimonial_content' ) }}}>{{ settings.testimonial_content }}</div>
578 + <div {{{ view.getRenderAttributeString( 'testimonial_content' ) }}}>{{{ settings.testimonial_content }}}</div>
641 579 <# } #>
642 580 <div class="elementor-testimonial-meta{{ hasImage }}{{ testimonial_image_position }}">
643 581 <div class="elementor-testimonial-meta-inner">
644 582 <# if ( imageUrl ) { #>
@@ -660,15 +598,15 @@
660 598 view.addRenderAttribute( 'testimonial_name', 'class', 'elementor-testimonial-name' );
661 599
662 600 view.addInlineEditingAttributes( 'testimonial_name', 'none' );
663 601
664 - if ( settings.link?.url ) {
602 + if ( settings.link.url ) {
665 603 #>
666 - <a href="{{ elementor.helpers.sanitizeUrl( settings.link?.url ) }}" {{{ view.getRenderAttributeString( 'testimonial_name' ) }}}>{{ settings.testimonial_name }}</a>
604 + <a href="{{ settings.link.url }}" {{{ view.getRenderAttributeString( 'testimonial_name' ) }}}>{{{ settings.testimonial_name }}}</a>
667 605 <#
668 606 } else {
669 607 #>
670 - <div {{{ view.getRenderAttributeString( 'testimonial_name' ) }}}>{{ settings.testimonial_name }}</div>
608 + <div {{{ view.getRenderAttributeString( 'testimonial_name' ) }}}>{{{ settings.testimonial_name }}}</div>
671 609 <#
672 610 }
673 611 }
674 612
@@ -676,15 +614,15 @@
676 614 view.addRenderAttribute( 'testimonial_job', 'class', 'elementor-testimonial-job' );
677 615
678 616 view.addInlineEditingAttributes( 'testimonial_job', 'none' );
679 617
680 - if ( settings.link?.url ) {
618 + if ( settings.link.url ) {
681 619 #>
682 - <a href="{{ elementor.helpers.sanitizeUrl( settings.link?.url ) }}" {{{ view.getRenderAttributeString( 'testimonial_job' ) }}}>{{ settings.testimonial_job }}</a>
620 + <a href="{{ settings.link.url }}" {{{ view.getRenderAttributeString( 'testimonial_job' ) }}}>{{{ settings.testimonial_job }}}</a>
683 621 <#
684 622 } else {
685 623 #>
686 - <div {{{ view.getRenderAttributeString( 'testimonial_job' ) }}}>{{ settings.testimonial_job }}</div>
624 + <div {{{ view.getRenderAttributeString( 'testimonial_job' ) }}}>{{{ settings.testimonial_job }}}</div>
687 625 <#
688 626 }
689 627 }
690 628 #>