PluginProbe
Elementor Website Builder – more than just a page builder / 3.21.3
Elementor Website Builder – more than just a page builder v3.21.3
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/counter.php +20 -56 4.2.0-dev23.21.3 View file →
@@ -86,31 +86,9 @@
86 86 public function get_keywords() {
87 87 return [ 'counter' ];
88 88 }
89 89
90 - protected function is_dynamic_content(): bool {
91 - return false;
92 - }
93 -
94 90 /**
95 - * Get style dependencies.
96 - *
97 - * Retrieve the list of style dependencies the widget requires.
98 - *
99 - * @since 3.24.0
100 - * @access public
101 - *
102 - * @return array Widget style dependencies.
103 - */
104 - public function get_style_depends(): array {
105 - return [ 'widget-counter' ];
106 - }
107 -
108 - public function has_widget_inner_wrapper(): bool {
109 - return ! Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
110 - }
111 -
112 - /**
113 91 * Register counter widget controls.
114 92 *
115 93 * Adds different input fields to allow the user to change and customize the widget settings.
116 94 *
@@ -117,8 +95,11 @@
117 95 * @since 3.1.0
118 96 * @access protected
119 97 */
120 98 protected function register_controls() {
99 + $start = is_rtl() ? 'right' : 'left';
100 + $end = ! is_rtl() ? 'right' : 'left';
101 +
121 102 $this->start_controls_section(
122 103 'section_counter',
123 104 [
124 105 'label' => esc_html__( 'Counter', 'elementor' ),
@@ -279,15 +260,16 @@
279 260 'after' => [
280 261 'title' => esc_html__( 'After', 'elementor' ),
281 262 'icon' => 'eicon-v-align-bottom',
282 263 ],
264 +
283 265 'start' => [
284 266 'title' => esc_html__( 'Start', 'elementor' ),
285 - 'icon' => 'eicon-h-align-left',
267 + 'icon' => "eicon-h-align-$start",
286 268 ],
287 269 'end' => [
288 270 'title' => esc_html__( 'End', 'elementor' ),
289 - 'icon' => 'eicon-h-align-right',
271 + 'icon' => "eicon-h-align-$end",
290 272 ],
291 273 ],
292 274 'selectors_dictionary' => [
293 275 'before' => 'flex-direction: column;',
@@ -297,9 +279,8 @@
297 279 ],
298 280 'selectors' => [
299 281 '{{WRAPPER}} .elementor-counter' => '{{VALUE}}',
300 282 ],
301 - 'classes' => 'elementor-control-start-end',
302 283 'condition' => [
303 284 'title!' => '',
304 285 ],
305 286 ]
@@ -312,9 +293,9 @@
312 293 'type' => Controls_Manager::CHOOSE,
313 294 'options' => [
314 295 'start' => [
315 296 'title' => esc_html__( 'Start', 'elementor' ),
316 - 'icon' => 'eicon-h-align-left',
297 + 'icon' => "eicon-h-align-$start",
317 298 ],
318 299 'center' => [
319 300 'title' => esc_html__( 'Center', 'elementor' ),
320 301 'icon' => 'eicon-h-align-center',
@@ -320,13 +301,12 @@
320 301 'icon' => 'eicon-h-align-center',
321 302 ],
322 303 'end' => [
323 304 'title' => esc_html__( 'End', 'elementor' ),
324 - 'icon' => 'eicon-h-align-right',
305 + 'icon' => "eicon-h-align-$end",
325 306 ],
326 307 ],
327 308 'separator' => 'before',
328 - 'classes' => 'elementor-control-start-end',
329 309 'selectors' => [
330 310 '{{WRAPPER}} .elementor-counter-title' => 'justify-content: {{VALUE}};',
331 311 ],
332 312 'condition' => [
@@ -387,9 +367,9 @@
387 367 'type' => Controls_Manager::CHOOSE,
388 368 'options' => [
389 369 'start' => [
390 370 'title' => esc_html__( 'Start', 'elementor' ),
391 - 'icon' => 'eicon-h-align-left',
371 + 'icon' => "eicon-h-align-$start",
392 372 ],
393 373 'center' => [
394 374 'title' => esc_html__( 'Center', 'elementor' ),
395 375 'icon' => 'eicon-h-align-center',
@@ -395,9 +375,9 @@
395 375 'icon' => 'eicon-h-align-center',
396 376 ],
397 377 'end' => [
398 378 'title' => esc_html__( 'End', 'elementor' ),
399 - 'icon' => 'eicon-h-align-right',
379 + 'icon' => "eicon-h-align-$end",
400 380 ],
401 381 'stretch' => [
402 382 'title' => esc_html__( 'Stretch', 'elementor' ),
403 383 'icon' => 'eicon-grow',
@@ -402,9 +382,8 @@
402 382 'title' => esc_html__( 'Stretch', 'elementor' ),
403 383 'icon' => 'eicon-grow',
404 384 ],
405 385 ],
406 - 'classes' => 'elementor-control-start-end',
407 386 'selectors_dictionary' => [
408 387 'start' => 'text-align: {{VALUE}}; --counter-prefix-grow: 0; --counter-suffix-grow: 1; --counter-number-grow: 0;',
409 388 'center' => 'text-align: {{VALUE}}; --counter-prefix-grow: 1; --counter-suffix-grow: 1; --counter-number-grow: 0;',
410 389 'end' => 'text-align: {{VALUE}}; --counter-prefix-grow: 1; --counter-suffix-grow: 0; --counter-number-grow: 0;',
@@ -424,9 +403,9 @@
424 403 'type' => Controls_Manager::CHOOSE,
425 404 'options' => [
426 405 'start' => [
427 406 'title' => esc_html__( 'Start', 'elementor' ),
428 - 'icon' => 'eicon-text-align-left',
407 + 'icon' => "eicon-text-align-$start",
429 408 ],
430 409 'center' => [
431 410 'title' => esc_html__( 'Center', 'elementor' ),
432 411 'icon' => 'eicon-text-align-center',
@@ -432,12 +411,11 @@
432 411 'icon' => 'eicon-text-align-center',
433 412 ],
434 413 'end' => [
435 414 'title' => esc_html__( 'End', 'elementor' ),
436 - 'icon' => 'eicon-text-align-right',
415 + 'icon' => "eicon-text-align-$end",
437 416 ],
438 417 ],
439 - 'classes' => 'elementor-control-start-end',
440 418 'selectors' => [
441 419 '{{WRAPPER}} .elementor-counter-number' => 'text-align: {{VALUE}};',
442 420 ],
443 421 'condition' => [
@@ -644,14 +622,14 @@
644 622 const titleTag = elementor.helpers.validateHTMLTag( settings.title_tag );
645 623 #>
646 624 <div {{{ view.getRenderAttributeString( 'elementor-counter' ) }}}>
647 625 <# if ( settings.title ) {
648 - #><{{ titleTag }} {{{ view.getRenderAttributeString( 'counter-title' ) }}}>{{{ elementor.helpers.sanitize( settings.title, { ALLOW_DATA_ATTR: false } ) }}}</{{ titleTag }}><#
626 + #><{{ titleTag }} {{{ view.getRenderAttributeString( 'counter-title' ) }}}>{{{ settings.title }}}</{{ titleTag }}><#
649 627 } #>
650 628 <div {{{ view.getRenderAttributeString( 'counter-number' ) }}}>
651 - <span {{{ view.getRenderAttributeString( 'prefix' ) }}}>{{ settings.prefix }}</span>
652 - <span {{{ view.getRenderAttributeString( 'counter' ) }}}>{{ settings.starting_number }}</span>
653 - <span {{{ view.getRenderAttributeString( 'suffix' ) }}}>{{ settings.suffix }}</span>
629 + <span {{{ view.getRenderAttributeString( 'prefix' ) }}}>{{{ settings.prefix }}}</span>
630 + <span {{{ view.getRenderAttributeString( 'counter' ) }}}>{{{ settings.starting_number }}}</span>
631 + <span {{{ view.getRenderAttributeString( 'suffix' ) }}}>{{{ settings.suffix }}}</span>
654 632 </div>
655 633 </div>
656 634 <?php
657 635 }
@@ -698,30 +676,16 @@
698 676 ?>
699 677 <div <?php $this->print_render_attribute_string( 'elementor-counter' ); ?>>
700 678 <?php
701 679 if ( $settings['title'] ) :
702 - ?><<?php Utils::print_validated_html_tag( $title_tag ); ?> <?php $this->print_render_attribute_string( 'counter-title' ); ?>><?php echo wp_kses_post( $this->get_settings_for_display( 'title' ) ); ?></<?php Utils::print_validated_html_tag( $title_tag ); ?>><?php
680 + ?><<?php Utils::print_validated_html_tag( $title_tag ); ?> <?php $this->print_render_attribute_string( 'counter-title' ); ?>><?php $this->print_unescaped_setting( 'title' ); ?></<?php Utils::print_validated_html_tag( $title_tag ); ?>><?php
703 681 endif;
704 682 ?>
705 683 <div <?php $this->print_render_attribute_string( 'counter-number' ); ?>>
706 - <span <?php $this->print_render_attribute_string( 'prefix' ); ?>><?php echo wp_kses_post( $settings['prefix'] ); ?></span>
707 - <span <?php $this->print_render_attribute_string( 'counter' ); ?>><?php echo wp_kses_post( $settings['starting_number'] ); ?></span>
708 - <span <?php $this->print_render_attribute_string( 'suffix' ); ?>><?php echo wp_kses_post( $settings['suffix'] ); ?></span>
684 + <span <?php $this->print_render_attribute_string( 'prefix' ); ?>><?php $this->print_unescaped_setting( 'prefix' ); ?></span>
685 + <span <?php $this->print_render_attribute_string( 'counter' ); ?>><?php $this->print_unescaped_setting( 'starting_number' ); ?></span>
686 + <span <?php $this->print_render_attribute_string( 'suffix' ); ?>><?php $this->print_unescaped_setting( 'suffix' ); ?></span>
709 687 </div>
710 688 </div>
711 689 <?php
712 - }
713 -
714 - public function render_markdown(): string {
715 - $settings = $this->get_settings_for_display();
716 - $number = $settings['ending_number'] ?? '';
717 - $prefix = $settings['prefix'] ?? '';
718 - $suffix = $settings['suffix'] ?? '';
719 - $title = Utils::html_to_plain_text( $settings['title'] ?? '' );
720 - $value = $prefix . $number . $suffix;
721 - if ( empty( $value ) && empty( $title ) ) {
722 - return '';
723 - }
724 - $parts = array_filter( [ $value, $title ] );
725 - return implode( ' - ', $parts );
726 690 }
727 691 }