PluginProbe
Elementor Website Builder – more than just a page builder / 3.25.2
Elementor Website Builder – more than just a page builder v3.25.2
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 4.0.7 All 451 releases
← All changes | includes/widgets/counter.php +18 -36 4.2.23.25.2 View file →
@@ -104,12 +104,8 @@
104 104 public function get_style_depends(): array {
105 105 return [ 'widget-counter' ];
106 106 }
107 107
108 - public function has_widget_inner_wrapper(): bool {
109 - return ! Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
110 - }
111 -
112 108 /**
113 109 * Register counter widget controls.
114 110 *
115 111 * Adds different input fields to allow the user to change and customize the widget settings.
@@ -117,8 +113,11 @@
117 113 * @since 3.1.0
118 114 * @access protected
119 115 */
120 116 protected function register_controls() {
117 + $start = is_rtl() ? 'right' : 'left';
118 + $end = ! is_rtl() ? 'right' : 'left';
119 +
121 120 $this->start_controls_section(
122 121 'section_counter',
123 122 [
124 123 'label' => esc_html__( 'Counter', 'elementor' ),
@@ -279,15 +278,16 @@
279 278 'after' => [
280 279 'title' => esc_html__( 'After', 'elementor' ),
281 280 'icon' => 'eicon-v-align-bottom',
282 281 ],
282 +
283 283 'start' => [
284 284 'title' => esc_html__( 'Start', 'elementor' ),
285 - 'icon' => 'eicon-h-align-left',
285 + 'icon' => "eicon-h-align-$start",
286 286 ],
287 287 'end' => [
288 288 'title' => esc_html__( 'End', 'elementor' ),
289 - 'icon' => 'eicon-h-align-right',
289 + 'icon' => "eicon-h-align-$end",
290 290 ],
291 291 ],
292 292 'selectors_dictionary' => [
293 293 'before' => 'flex-direction: column;',
@@ -297,9 +297,8 @@
297 297 ],
298 298 'selectors' => [
299 299 '{{WRAPPER}} .elementor-counter' => '{{VALUE}}',
300 300 ],
301 - 'classes' => 'elementor-control-start-end',
302 301 'condition' => [
303 302 'title!' => '',
304 303 ],
305 304 ]
@@ -312,9 +311,9 @@
312 311 'type' => Controls_Manager::CHOOSE,
313 312 'options' => [
314 313 'start' => [
315 314 'title' => esc_html__( 'Start', 'elementor' ),
316 - 'icon' => 'eicon-h-align-left',
315 + 'icon' => "eicon-h-align-$start",
317 316 ],
318 317 'center' => [
319 318 'title' => esc_html__( 'Center', 'elementor' ),
320 319 'icon' => 'eicon-h-align-center',
@@ -320,13 +319,12 @@
320 319 'icon' => 'eicon-h-align-center',
321 320 ],
322 321 'end' => [
323 322 'title' => esc_html__( 'End', 'elementor' ),
324 - 'icon' => 'eicon-h-align-right',
323 + 'icon' => "eicon-h-align-$end",
325 324 ],
326 325 ],
327 326 'separator' => 'before',
328 - 'classes' => 'elementor-control-start-end',
329 327 'selectors' => [
330 328 '{{WRAPPER}} .elementor-counter-title' => 'justify-content: {{VALUE}};',
331 329 ],
332 330 'condition' => [
@@ -387,9 +385,9 @@
387 385 'type' => Controls_Manager::CHOOSE,
388 386 'options' => [
389 387 'start' => [
390 388 'title' => esc_html__( 'Start', 'elementor' ),
391 - 'icon' => 'eicon-h-align-left',
389 + 'icon' => "eicon-h-align-$start",
392 390 ],
393 391 'center' => [
394 392 'title' => esc_html__( 'Center', 'elementor' ),
395 393 'icon' => 'eicon-h-align-center',
@@ -395,9 +393,9 @@
395 393 'icon' => 'eicon-h-align-center',
396 394 ],
397 395 'end' => [
398 396 'title' => esc_html__( 'End', 'elementor' ),
399 - 'icon' => 'eicon-h-align-right',
397 + 'icon' => "eicon-h-align-$end",
400 398 ],
401 399 'stretch' => [
402 400 'title' => esc_html__( 'Stretch', 'elementor' ),
403 401 'icon' => 'eicon-grow',
@@ -402,9 +400,8 @@
402 400 'title' => esc_html__( 'Stretch', 'elementor' ),
403 401 'icon' => 'eicon-grow',
404 402 ],
405 403 ],
406 - 'classes' => 'elementor-control-start-end',
407 404 'selectors_dictionary' => [
408 405 'start' => 'text-align: {{VALUE}}; --counter-prefix-grow: 0; --counter-suffix-grow: 1; --counter-number-grow: 0;',
409 406 'center' => 'text-align: {{VALUE}}; --counter-prefix-grow: 1; --counter-suffix-grow: 1; --counter-number-grow: 0;',
410 407 'end' => 'text-align: {{VALUE}}; --counter-prefix-grow: 1; --counter-suffix-grow: 0; --counter-number-grow: 0;',
@@ -424,9 +421,9 @@
424 421 'type' => Controls_Manager::CHOOSE,
425 422 'options' => [
426 423 'start' => [
427 424 'title' => esc_html__( 'Start', 'elementor' ),
428 - 'icon' => 'eicon-text-align-left',
425 + 'icon' => "eicon-text-align-$start",
429 426 ],
430 427 'center' => [
431 428 'title' => esc_html__( 'Center', 'elementor' ),
432 429 'icon' => 'eicon-text-align-center',
@@ -432,12 +429,11 @@
432 429 'icon' => 'eicon-text-align-center',
433 430 ],
434 431 'end' => [
435 432 'title' => esc_html__( 'End', 'elementor' ),
436 - 'icon' => 'eicon-text-align-right',
433 + 'icon' => "eicon-text-align-$end",
437 434 ],
438 435 ],
439 - 'classes' => 'elementor-control-start-end',
440 436 'selectors' => [
441 437 '{{WRAPPER}} .elementor-counter-number' => 'text-align: {{VALUE}};',
442 438 ],
443 439 'condition' => [
@@ -647,11 +643,11 @@
647 643 <# if ( settings.title ) {
648 644 #><{{ titleTag }} {{{ view.getRenderAttributeString( 'counter-title' ) }}}>{{{ elementor.helpers.sanitize( settings.title, { ALLOW_DATA_ATTR: false } ) }}}</{{ titleTag }}><#
649 645 } #>
650 646 <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>
647 + <span {{{ view.getRenderAttributeString( 'prefix' ) }}}>{{{ settings.prefix }}}</span>
648 + <span {{{ view.getRenderAttributeString( 'counter' ) }}}>{{{ settings.starting_number }}}</span>
649 + <span {{{ view.getRenderAttributeString( 'suffix' ) }}}>{{{ settings.suffix }}}</span>
654 650 </div>
655 651 </div>
656 652 <?php
657 653 }
@@ -702,26 +698,12 @@
702 698 ?><<?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
703 699 endif;
704 700 ?>
705 701 <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>
702 + <span <?php $this->print_render_attribute_string( 'prefix' ); ?>><?php $this->print_unescaped_setting( 'prefix' ); ?></span>
703 + <span <?php $this->print_render_attribute_string( 'counter' ); ?>><?php $this->print_unescaped_setting( 'starting_number' ); ?></span>
704 + <span <?php $this->print_render_attribute_string( 'suffix' ); ?>><?php $this->print_unescaped_setting( 'suffix' ); ?></span>
709 705 </div>
710 706 </div>
711 707 <?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 708 }
727 709 }