HEX
Server: Apache
System: Linux webm005.cluster121.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64
User: adventp (418412)
PHP: 7.4.33
Disabled: _dyuweyrj4,_dyuweyrj4r,dl
Upload Files
File: /home/a/d/v/adventp/www/wp-content/plugins/ut-shortcodes/shortcodes/count-up.php
<?php

if ( ! defined( 'ABSPATH' ) ) exit;

if( !class_exists( 'UT_Count_Up' ) ) {
	
    class UT_Count_Up {
        
        private $shortcode;
            
        function __construct() {
			
            /* shortcode base */
            $this->shortcode = 'ut_count_up';
            
            add_action( 'vc_before_init', array( $this, 'ut_map_shortcode' ) );
            add_shortcode( $this->shortcode, array( $this, 'ut_create_shortcode' ) );	
            
		}
        
        function ut_map_shortcode() {

            vc_map(
                array(
                    'name'            => esc_html__( 'Count Up Box', 'ut_shortcodes' ),
                    'description'     => esc_html__( 'Count up to any value.', 'ut_shortcodes' ),
                    'base'            => $this->shortcode,
                    // 'icon'         => 'fa fa-sort-numeric-asc ut-vc-module-icon',
                    'icon'            => UT_SHORTCODES_URL . '/admin/img/vc_icons/number-counter.png',
                    'category'        => 'Information',
                    'class'           => 'ut-vc-icon-module ut-information-module',
                    'content_element' => true,
                    'deprecated'      => true,
                    'params'          => array(

                        array(
                            'type'              => 'iconpicker',
                            'heading'           => esc_html__( 'Choose Icon', 'ut_shortcodes' ),
                            'param_name'        => 'icon',
                            'group'             => 'General',
                        ),
                        array(
                            'type'              => 'attach_image',
                            'heading'           => esc_html__( 'or upload an own Icon', 'ut_shortcodes' ),
                            'description'       => esc_html__( 'recommended size 32x32', 'ut_shortcodes' ),
                            'param_name'        => 'imageicon',
                            'group'             => 'General',
                        ),
                        array(
                            'type'              => 'colorpicker',
                            'heading'           => esc_html__( 'Icon Color', 'ut_shortcodes' ),
                            'param_name'        => 'color',
                            'group'             => 'Colors'
                        ),
                        array(
                            'type'              => 'colorpicker',
                            'heading'           => esc_html__( 'Counter Color', 'ut_shortcodes' ),
                            'param_name'        => 'counter_color',
                            'group'             => 'Colors'
                        ),
                        array(
                            'type'              => 'colorpicker',
                            'heading'           => esc_html__( 'Caption Color', 'ut_shortcodes' ),
                            'param_name'        => 'desccolor',
                            'group'             => 'Colors'
                        ),
                        array(
                            'type'              => 'css_editor',
                            'param_name'        => 'css',
                            'group'             => esc_html__( 'Design Options', 'ut_shortcodes' ),
                        ),
                        array(
                            'type'              => 'textfield',
                            'heading'           => esc_html__( 'Count Up to', 'ut_shortcodes' ),
                            'admin_label'       => true,
                            'param_name'        => 'to',
                            'group'             => 'General'
                        ),
                        array(
                            'type'              => 'textfield',
                            'heading'           => esc_html__( 'Counter Caption', 'ut_shortcodes' ),
                            'admin_label'       => true,
                            'param_name'        => 'content',
                            'group'             => 'General'
                        ),
                        array(
                            'type'              => 'dropdown',
                            'heading'           => esc_html__( 'Counter Caption Text Transform', 'unitedthemes' ),
                            'param_name'        => 'caption_text_transform',
                            'group'             => 'General',
                            'value'             => array(
                                esc_html__( 'None' , 'ut_shortcodes' )        => 'none',
                                esc_html__( 'Capitalize' , 'ut_shortcodes' )  => 'capitalize',
                                esc_html__( 'Inherit' , 'ut_shortcodes' )     => 'inherit',
                                esc_html__( 'Lowercase' , 'ut_shortcodes' )   => 'lowercase',
                                esc_html__( 'Uppercase' , 'ut_shortcodes' )   => 'uppercase'
                            ),

                        ),
                        array(
                            'type'              => 'textfield',
                            'heading'           => esc_html__( 'Counter Caption Font Size', 'ut_shortcodes' ),
                            'param_name'        => 'caption_font_size',
                            'group'             => 'General'
                        ),
                        array(
                            'type'              => 'textfield',
                            'heading'           => esc_html__( 'CSS Class', 'ut_shortcodes' ),
                            'param_name'        => 'class',
                            'group'             => 'General'
                        )

                    )

                )

            ); /* end mapping */
        
        }
        
        function ut_create_shortcode( $atts, $content = NULL ) {
            
            extract( shortcode_atts( array (
                'icon'                   => '',
                'imageicon'              => '',
                'color'                  => '',
                'counter_color'          => '',
                'desccolor'              => '',
                'caption_text_transform' => '',
                'caption_font_size'      => '',
                'to'                     => '1250',
                'opacity'                => '0.8',      /* deprecated */
                'width'                  => '',         /* deprecated */
                'last'                   => 'false',    /* deprecated */
                'animate_once'           => 'no',       /* deprecated */
                'background'             => '',         /* deprecated */
                'css'                    => '',
                'class'                  => ''
            ), $atts ) ); 
            
            
            /* deprecated - will be removed one day - start block */
            
                $grid = array( 
                    'third'   => 'ut-one-third',
                    'fourth'  => 'ut-one-fourth',
                    'half'    => 'ut-one-half'
                );  
                
                $classes[] = ( $last == 'true' ) ? 'ut-column-last' : '';
                $classes[] = !empty( $grid[$width] ) ? $grid[$width] : 'clearfix';
                $classes[] = $class;                             
                    
            /* deprecated - will be removed one day - end block */
            
            
            /* icon setting */
            if( !empty( $imageicon ) && is_numeric( $imageicon ) ) {
                $imageicon = wp_get_attachment_url( $imageicon );        
            }            
            
            /* overwrite default icon */
            $icon = empty( $imageicon ) ? $icon : $imageicon;
            
            /* check if icon is an image */
            $image_icon = strpos( $icon, '.png' ) !== false || strpos( $icon, '.jpg' ) !== false || strpos( $icon, '.gif' ) !== false || strpos( $icon, '.ico' ) !== false || strpos( $icon, '.svg' ) !== false ? true : false;
            
            /* font awesome icon */
            if( !$image_icon ) {
                
                /* fallback */
                $icon = str_replace('fa fa-', 'fa-', $icon );                
                
            }            
            
            /* inline css */
            $id = uniqid("ut_sc_");
            
            $css_style = '<style type="text/css">';
                    
                if( $color ) {
                    $css_style .= '#' . $id . ' .fa { color: ' . $color . '; }';  
                }
                
                if( $counter_color ) {
                    $css_style .= '#' . $id . ' .ut-count { color: ' . $counter_color . '; }';  
                }
                
                if( $desccolor ) {
                    $css_style .= '#' . $id . ' h3.ut-counter-details { color: ' . $desccolor . '; }';     
                }
                
                if( $caption_text_transform ) {
                    $css_style .= '#' . $id . ' h3.ut-counter-details { text-transform: ' . $caption_text_transform . '; }';     
                }
                
                if( $caption_font_size ) {
                    $css_style .= '#' . $id . ' h3.ut-counter-details { font-size: ' . $caption_font_size . '; }';     
                }
                
                if( $background ) {
                    $css_style .= '#' . $id . ' .ut-counter-box { background: rgba(' .  ut_hex_to_rgb( $background )  . ',' . $opacity . '); }';     
                }
                
                
            $css_style .= '</style>';                        
            
            /* start output */
            $output = '';
            
            /* add css */ 
            $output .= ut_minify_inline_css( $css_style );
            
            $output .= '<div id="' . $id . '" class="' . implode( ' ', $classes ) . '">';
                
                $output .= '<div data-animateonce="' . $animate_once . '" data-effecttype="counter" class="ut-counter-box ut-counter" data-suffix="" data-prefix="" data-sep-sign="" data-counter="' . $to . '">';
                    
                    if( !empty( $icon ) ) {
                        
                        if( $image_icon ) {
                            
                            $output .= '<figure class="ut-custom-icon"><img alt="' . esc_html__( 'Count Up to', 'ut_shortcodes' ) . ' ' . $to . '" src="' . $icon . '"></figure>';
                            
                        } else {
                            
                            $output .= '<i class="fa ' . $icon . ' fa-4x"></i>';
                            
                        }
                        
                    }
                    
                    $output .= '<span id="' . uniqid("ut_sc_count_") . '" class="ut-count">' . $to . '</span>';
                    
                    $output .= '<h3 class="ut-counter-details">' . $content . '</h3>';
                    
                $output .= '</div>';
                
            $output .= '</div>';
            
            if( defined( 'WPB_VC_VERSION' ) ) { 
                
                return '<div class="wpb_content_element ' . apply_filters( VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, vc_shortcode_custom_css_class( $css, ' ' ), $this->shortcode, $atts ) . '">' . $output . '</div>'; 
            
            }
            
            return $output;
        
        }
            
    }

}

new UT_Count_Up;