PluginProbe
Elementor Website Builder – more than just a page builder / 3.19.0-beta1
Elementor Website Builder – more than just a page builder v3.19.0-beta1
4.3.3 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 All 456 releases
← All changes | includes/widgets/testimonial.php +32 -81 4.0.9 → 3.19.0-beta1 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>
@@ -570,12 +530,8 @@
570 530 */
571 531 protected function content_template() {
572 532 ?>
573 533 <#
574 - if ( '' === settings.testimonial_content && '' === settings.testimonial_image.url && '' === settings.testimonial_name && '' === settings.testimonial_job ) {
575 - return;
576 - }
577 -
578 534 var image = {
579 535 id: settings.testimonial_image.id,
580 536 url: settings.testimonial_image.url,
581 537 size: settings.testimonial_image_size,
@@ -588,10 +544,10 @@
588 544 imageUrl = elementor.imagesManager.getImageUrl( image );
589 545 hasImage = ' elementor-has-image';
590 546
591 547 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>';
548 + if ( settings.link.url ) {
549 + imageHtml = '<a href="' + _.escape( settings.link.url ) + '">' + imageHtml + '</a>';
594 550 }
595 551 }
596 552
597 553 var testimonial_image_position = settings.testimonial_image_position ? ' elementor-testimonial-image-position-' + settings.testimonial_image_position : '';
@@ -600,19 +556,14 @@
600 556 <# if ( '' !== settings.testimonial_content ) {
601 557 view.addRenderAttribute( 'testimonial_content', {
602 558 'data-binding-type': 'content',
603 559 'data-binding-setting': 'testimonial_content',
604 - 'data-binding-config': JSON.stringify({
605 - 'testimonial_content': {
606 - editType: "text"
607 - }
608 - })
609 560 } );
610 561 view.addRenderAttribute( 'testimonial_content', 'class', 'elementor-testimonial-content' );
611 562
612 563 view.addInlineEditingAttributes( 'testimonial_content' );
613 564 #>
614 - <div {{{ view.getRenderAttributeString( 'testimonial_content' ) }}}>{{ settings.testimonial_content }}</div>
565 + <div {{{ view.getRenderAttributeString( 'testimonial_content' ) }}}>{{{ settings.testimonial_content }}}</div>
615 566 <# } #>
616 567 <div class="elementor-testimonial-meta{{ hasImage }}{{ testimonial_image_position }}">
617 568 <div class="elementor-testimonial-meta-inner">
618 569 <# if ( imageUrl ) { #>
@@ -634,15 +585,15 @@
634 585 view.addRenderAttribute( 'testimonial_name', 'class', 'elementor-testimonial-name' );
635 586
636 587 view.addInlineEditingAttributes( 'testimonial_name', 'none' );
637 588
638 - if ( settings.link?.url ) {
589 + if ( settings.link.url ) {
639 590 #>
640 - <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>
641 592 <#
642 593 } else {
643 594 #>
644 - <div {{{ view.getRenderAttributeString( 'testimonial_name' ) }}}>{{ settings.testimonial_name }}</div>
595 + <div {{{ view.getRenderAttributeString( 'testimonial_name' ) }}}>{{{ settings.testimonial_name }}}</div>
645 596 <#
646 597 }
647 598 }
648 599
@@ -650,15 +601,15 @@
650 601 view.addRenderAttribute( 'testimonial_job', 'class', 'elementor-testimonial-job' );
651 602
652 603 view.addInlineEditingAttributes( 'testimonial_job', 'none' );
653 604
654 - if ( settings.link?.url ) {
605 + if ( settings.link.url ) {
655 606 #>
656 - <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>
657 608 <#
658 609 } else {
659 610 #>
660 - <div {{{ view.getRenderAttributeString( 'testimonial_job' ) }}}>{{ settings.testimonial_job }}</div>
611 + <div {{{ view.getRenderAttributeString( 'testimonial_job' ) }}}>{{{ settings.testimonial_job }}}</div>
661 612 <#
662 613 }
663 614 }
664 615 #>