PluginProbe
Elementor Website Builder – more than just a page builder / 3.19.2
Elementor Website Builder – more than just a page builder v3.19.2
4.3.1 4.3.0 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 All 454 releases
← All changes | includes/widgets/testimonial.php +32 -107 4.3.03.19.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,48 +72,12 @@
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 - /**
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 - * 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 76 protected function get_upsale_data() {
110 77 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 78 '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' ),
79 + 'upgrade_url' => 'https://go.elementor.com/go-pro-testimonial-widget/',
117 80 ];
118 81 }
119 82
120 83 /**
@@ -164,8 +127,9 @@
164 127 Group_Control_Image_Size::get_type(),
165 128 [
166 129 'name' => 'testimonial_image', // Usage: `{name}_size` and `{name}_custom_dimension`, in this case `testimonial_image_size` and `testimonial_image_custom_dimension`.
167 130 'default' => 'full',
131 + 'separator' => 'none',
168 132 ]
169 133 );
170 134
171 135 $this->add_control(
@@ -208,8 +172,10 @@
208 172 ],
209 173 ]
210 174 );
211 175
176 + $aside = is_rtl() ? 'right' : 'left';
177 +
212 178 $this->add_control(
213 179 'testimonial_image_position',
214 180 [
215 181 'label' => esc_html__( 'Image Position', 'elementor' ),
@@ -217,9 +183,9 @@
217 183 'default' => 'aside',
218 184 'options' => [
219 185 'aside' => [
220 186 'title' => esc_html__( 'Aside', 'elementor' ),
221 - 'icon' => 'eicon-h-align-left',
187 + 'icon' => 'eicon-h-align-' . $aside,
222 188 ],
223 189 'top' => [
224 190 'title' => esc_html__( 'Top', 'elementor' ),
225 191 'icon' => 'eicon-v-align-top',
@@ -229,9 +195,8 @@
229 195 'condition' => [
230 196 'testimonial_image[url]!' => '',
231 197 ],
232 198 'separator' => 'before',
233 - 'classes' => 'elementor-control-start-end',
234 199 'style_transfer' => true,
235 200 ]
236 201 );
237 202
@@ -241,10 +206,10 @@
241 206 'label' => esc_html__( 'Alignment', 'elementor' ),
242 207 'type' => Controls_Manager::CHOOSE,
243 208 'default' => 'center',
244 209 'options' => [
245 - 'start' => [
246 - 'title' => esc_html__( 'Start', 'elementor' ),
210 + 'left' => [
211 + 'title' => esc_html__( 'Left', 'elementor' ),
247 212 'icon' => 'eicon-text-align-left',
248 213 ],
249 214 'center' => [
250 215 'title' => esc_html__( 'Center', 'elementor' ),
@@ -249,18 +214,13 @@
249 214 'center' => [
250 215 'title' => esc_html__( 'Center', 'elementor' ),
251 216 'icon' => 'eicon-text-align-center',
252 217 ],
253 - 'end' => [
254 - 'title' => esc_html__( 'End', 'elementor' ),
218 + 'right' => [
219 + 'title' => esc_html__( 'Right', 'elementor' ),
255 220 'icon' => 'eicon-text-align-right',
256 221 ],
257 222 ],
258 - 'classes' => 'elementor-control-start-end',
259 - 'selectors_dictionary' => [
260 - 'left' => is_rtl() ? 'end' : 'start',
261 - 'right' => is_rtl() ? 'start' : 'end',
262 - ],
263 223 'selectors' => [
264 224 '{{WRAPPER}} .elementor-testimonial-wrapper' => 'text-align: {{VALUE}}',
265 225 ],
266 226 'style_transfer' => true,
@@ -468,17 +428,8 @@
468 428 */
469 429 protected function render() {
470 430 $settings = $this->get_settings_for_display();
471 431
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 432 $this->add_render_attribute( 'wrapper', 'class', 'elementor-testimonial-wrapper' );
482 433
483 434 $this->add_render_attribute( 'meta', 'class', 'elementor-testimonial-meta' );
484 435
@@ -489,8 +440,17 @@
489 440 if ( $settings['testimonial_image_position'] ) {
490 441 $this->add_render_attribute( 'meta', 'class', 'elementor-testimonial-image-position-' . $settings['testimonial_image_position'] );
491 442 }
492 443
444 + $has_content = ! ! $settings['testimonial_content'];
445 + $has_image = ! ! $settings['testimonial_image']['url'];
446 + $has_name = ! ! $settings['testimonial_name'];
447 + $has_job = ! ! $settings['testimonial_job'];
448 +
449 + if ( ! $has_content && ! $has_image && ! $has_name && ! $has_job ) {
450 + return;
451 + }
452 +
493 453 if ( ! empty( $settings['link']['url'] ) ) {
494 454 $this->add_link_attributes( 'link', $settings['link'] );
495 455 }
496 456 ?>
@@ -499,9 +459,9 @@
499 459 if ( $has_content ) :
500 460 $this->add_render_attribute( 'testimonial_content', 'class', 'elementor-testimonial-content' );
501 461 $this->add_inline_editing_attributes( 'testimonial_content' );
502 462 ?>
503 - <div <?php $this->print_render_attribute_string( 'testimonial_content' ); ?>><?php echo wp_kses_post( $settings['testimonial_content'] ); ?></div>
463 + <div <?php $this->print_render_attribute_string( 'testimonial_content' ); ?>><?php $this->print_unescaped_setting( 'testimonial_content' ); ?></div>
504 464 <?php endif; ?>
505 465
506 466 <?php if ( $has_image || $has_name || $has_job ) : ?>
507 467 <div <?php $this->print_render_attribute_string( 'meta' ); ?>>
@@ -526,13 +486,13 @@
526 486 $this->add_inline_editing_attributes( 'testimonial_name', 'none' );
527 487
528 488 if ( ! empty( $settings['link']['url'] ) ) :
529 489 ?>
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>
490 + <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 491 <?php
532 492 else :
533 493 ?>
534 - <div <?php $this->print_render_attribute_string( 'testimonial_name' ); ?>><?php echo wp_kses_post( $settings['testimonial_name'] ); ?></div>
494 + <div <?php $this->print_render_attribute_string( 'testimonial_name' ); ?>><?php $this->print_unescaped_setting( 'testimonial_name' ); ?></div>
535 495 <?php
536 496 endif;
537 497 endif; ?>
538 498 <?php
@@ -542,13 +502,13 @@
542 502 $this->add_inline_editing_attributes( 'testimonial_job', 'none' );
543 503
544 504 if ( ! empty( $settings['link']['url'] ) ) :
545 505 ?>
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>
506 + <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 507 <?php
548 508 else :
549 509 ?>
550 - <div <?php $this->print_render_attribute_string( 'testimonial_job' ); ?>><?php echo wp_kses_post( $settings['testimonial_job'] ); ?></div>
510 + <div <?php $this->print_render_attribute_string( 'testimonial_job' ); ?>><?php $this->print_unescaped_setting( 'testimonial_job' ); ?></div>
551 511 <?php
552 512 endif;
553 513 endif; ?>
554 514 </div>
@@ -567,41 +527,11 @@
567 527 *
568 528 * @since 2.9.0
569 529 * @access protected
570 530 */
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 531 protected function content_template() {
598 532 ?>
599 533 <#
600 - if ( '' === settings.testimonial_content && '' === settings.testimonial_image.url && '' === settings.testimonial_name && '' === settings.testimonial_job ) {
601 - return;
602 - }
603 -
604 534 var image = {
605 535 id: settings.testimonial_image.id,
606 536 url: settings.testimonial_image.url,
607 537 size: settings.testimonial_image_size,
@@ -614,10 +544,10 @@
614 544 imageUrl = elementor.imagesManager.getImageUrl( image );
615 545 hasImage = ' elementor-has-image';
616 546
617 547 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>';
548 + if ( settings.link.url ) {
549 + imageHtml = '<a href="' + _.escape( settings.link.url ) + '">' + imageHtml + '</a>';
620 550 }
621 551 }
622 552
623 553 var testimonial_image_position = settings.testimonial_image_position ? ' elementor-testimonial-image-position-' + settings.testimonial_image_position : '';
@@ -626,19 +556,14 @@
626 556 <# if ( '' !== settings.testimonial_content ) {
627 557 view.addRenderAttribute( 'testimonial_content', {
628 558 'data-binding-type': 'content',
629 559 'data-binding-setting': 'testimonial_content',
630 - 'data-binding-config': JSON.stringify({
631 - 'testimonial_content': {
632 - editType: "text"
633 - }
634 - })
635 560 } );
636 561 view.addRenderAttribute( 'testimonial_content', 'class', 'elementor-testimonial-content' );
637 562
638 563 view.addInlineEditingAttributes( 'testimonial_content' );
639 564 #>
640 - <div {{{ view.getRenderAttributeString( 'testimonial_content' ) }}}>{{ settings.testimonial_content }}</div>
565 + <div {{{ view.getRenderAttributeString( 'testimonial_content' ) }}}>{{{ settings.testimonial_content }}}</div>
641 566 <# } #>
642 567 <div class="elementor-testimonial-meta{{ hasImage }}{{ testimonial_image_position }}">
643 568 <div class="elementor-testimonial-meta-inner">
644 569 <# if ( imageUrl ) { #>
@@ -660,15 +585,15 @@
660 585 view.addRenderAttribute( 'testimonial_name', 'class', 'elementor-testimonial-name' );
661 586
662 587 view.addInlineEditingAttributes( 'testimonial_name', 'none' );
663 588
664 - if ( settings.link?.url ) {
589 + if ( settings.link.url ) {
665 590 #>
666 - <a href="{{ elementor.helpers.sanitizeUrl( settings.link?.url ) }}" {{{ view.getRenderAttributeString( 'testimonial_name' ) }}}>{{ settings.testimonial_name }}</a>
591 + <a href="{{ settings.link.url }}" {{{ view.getRenderAttributeString( 'testimonial_name' ) }}}>{{{ settings.testimonial_name }}}</a>
667 592 <#
668 593 } else {
669 594 #>
670 - <div {{{ view.getRenderAttributeString( 'testimonial_name' ) }}}>{{ settings.testimonial_name }}</div>
595 + <div {{{ view.getRenderAttributeString( 'testimonial_name' ) }}}>{{{ settings.testimonial_name }}}</div>
671 596 <#
672 597 }
673 598 }
674 599
@@ -676,15 +601,15 @@
676 601 view.addRenderAttribute( 'testimonial_job', 'class', 'elementor-testimonial-job' );
677 602
678 603 view.addInlineEditingAttributes( 'testimonial_job', 'none' );
679 604
680 - if ( settings.link?.url ) {
605 + if ( settings.link.url ) {
681 606 #>
682 - <a href="{{ elementor.helpers.sanitizeUrl( settings.link?.url ) }}" {{{ view.getRenderAttributeString( 'testimonial_job' ) }}}>{{ settings.testimonial_job }}</a>
607 + <a href="{{ settings.link.url }}" {{{ view.getRenderAttributeString( 'testimonial_job' ) }}}>{{{ settings.testimonial_job }}}</a>
683 608 <#
684 609 } else {
685 610 #>
686 - <div {{{ view.getRenderAttributeString( 'testimonial_job' ) }}}>{{ settings.testimonial_job }}</div>
611 + <div {{{ view.getRenderAttributeString( 'testimonial_job' ) }}}>{{{ settings.testimonial_job }}}</div>
687 612 <#
688 613 }
689 614 }
690 615 #>