PluginProbe
Elementor Website Builder – more than just a page builder / 3.20.0-dev2
Elementor Website Builder – more than just a page builder v3.20.0-dev2
4.3.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 All 455 releases
← All changes | includes/widgets/testimonial.php +30 -66 4.0.8 → 3.20.0-dev2 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>
@@ -570,12 +543,8 @@
570 543 */
571 544 protected function content_template() {
572 545 ?>
573 546 <#
574 - if ( '' === settings.testimonial_content && '' === settings.testimonial_image.url && '' === settings.testimonial_name && '' === settings.testimonial_job ) {
575 - return;
576 - }
577 -
578 547 var image = {
579 548 id: settings.testimonial_image.id,
580 549 url: settings.testimonial_image.url,
581 550 size: settings.testimonial_image_size,
@@ -588,10 +557,10 @@
588 557 imageUrl = elementor.imagesManager.getImageUrl( image );
589 558 hasImage = ' elementor-has-image';
590 559
591 560 var imageHtml = '<img src="' + _.escape( imageUrl ) + '" alt="testimonial" />';
592 - if ( settings.link?.url ) {
593 - 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>';
594 563 }
595 564 }
596 565
597 566 var testimonial_image_position = settings.testimonial_image_position ? ' elementor-testimonial-image-position-' + settings.testimonial_image_position : '';
@@ -600,19 +569,14 @@
600 569 <# if ( '' !== settings.testimonial_content ) {
601 570 view.addRenderAttribute( 'testimonial_content', {
602 571 'data-binding-type': 'content',
603 572 'data-binding-setting': 'testimonial_content',
604 - 'data-binding-config': JSON.stringify({
605 - 'testimonial_content': {
606 - editType: "text"
607 - }
608 - })
609 573 } );
610 574 view.addRenderAttribute( 'testimonial_content', 'class', 'elementor-testimonial-content' );
611 575
612 576 view.addInlineEditingAttributes( 'testimonial_content' );
613 577 #>
614 - <div {{{ view.getRenderAttributeString( 'testimonial_content' ) }}}>{{ settings.testimonial_content }}</div>
578 + <div {{{ view.getRenderAttributeString( 'testimonial_content' ) }}}>{{{ settings.testimonial_content }}}</div>
615 579 <# } #>
616 580 <div class="elementor-testimonial-meta{{ hasImage }}{{ testimonial_image_position }}">
617 581 <div class="elementor-testimonial-meta-inner">
618 582 <# if ( imageUrl ) { #>
@@ -634,15 +598,15 @@
634 598 view.addRenderAttribute( 'testimonial_name', 'class', 'elementor-testimonial-name' );
635 599
636 600 view.addInlineEditingAttributes( 'testimonial_name', 'none' );
637 601
638 - if ( settings.link?.url ) {
602 + if ( settings.link.url ) {
639 603 #>
640 - <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>
641 605 <#
642 606 } else {
643 607 #>
644 - <div {{{ view.getRenderAttributeString( 'testimonial_name' ) }}}>{{ settings.testimonial_name }}</div>
608 + <div {{{ view.getRenderAttributeString( 'testimonial_name' ) }}}>{{{ settings.testimonial_name }}}</div>
645 609 <#
646 610 }
647 611 }
648 612
@@ -650,15 +614,15 @@
650 614 view.addRenderAttribute( 'testimonial_job', 'class', 'elementor-testimonial-job' );
651 615
652 616 view.addInlineEditingAttributes( 'testimonial_job', 'none' );
653 617
654 - if ( settings.link?.url ) {
618 + if ( settings.link.url ) {
655 619 #>
656 - <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>
657 621 <#
658 622 } else {
659 623 #>
660 - <div {{{ view.getRenderAttributeString( 'testimonial_job' ) }}}>{{ settings.testimonial_job }}</div>
624 + <div {{{ view.getRenderAttributeString( 'testimonial_job' ) }}}>{{{ settings.testimonial_job }}}</div>
661 625 <#
662 626 }
663 627 }
664 628 #>