HEX
Server: nginx/1.24.0
System: Linux DGT-WORDPRESS-VM-SERVER 6.14.0-1014-azure #14~24.04.1-Ubuntu SMP Fri Oct 3 20:52:11 UTC 2025 x86_64
User: ubuntu (1000)
PHP: 8.4.12
Disabled: NONE
Upload Files
File: /mnt/data/doccure-wp/wp-content/plugins/doccure-elementor/widgets/class-counters.php
<?php
/**
 * Awesomesauce class.
 *
 * @category   Class
 * @package    ElementorAwesomesauce
 * @subpackage WordPress
 * @author     Ben Marshall <[email protected]>
 * @copyright  2020 Ben Marshall
 * @license    https://opensource.org/licenses/GPL-3.0 GPL-3.0-only
 * @link       link(https://www.benmarshall.me/build-custom-elementor-widgets/,
 *             Build Custom Elementor Widgets)
 * @since      1.0.0
 * php version 7.3.9
 */

namespace ElementorDoccure\Widgets;

use Elementor\Widget_Base;
use Elementor\Controls_Manager;
use Elementor\Utils;
use Elementor\Scheme_Color;

if ( ! defined( 'ABSPATH' ) ) {
	// Exit if accessed directly.
	exit;
}

/**
 * Awesomesauce widget class.
 *
 * @since 1.0.0
 */
class Doccure_counters extends Widget_Base {

	/**
	 * Retrieve the widget name.
	 *
	 * @since 1.0.0
	 *
	 * @access public
	 *
	 * @return string Widget name.
	 */
	public function get_name() {
		return 'doccure-Doccurecounters';
	}

	/**
	 * Retrieve the widget title.
	 *
	 * @since 1.0.0
	 *
	 * @access public
	 *
	 * @return string Widget title.
	 */
	public function get_title() {
		return __( 'Doccure Counters', 'doccure_elementor' );
	}

	/**
	 * Retrieve the widget icon.
	 *
	 * @since 1.0.0
	 *
	 * @access public
	 *
	 * @return string Widget icon.
	 */
	public function get_icon() {
		return 'eicon-slides';
	}

	/**
	 * Retrieve the list of categories the widget belongs to.
	 *
	 * Used to determine where to display the widget in the editor.
	 *
	 * Note that currently Elementor supports only one category.
	 * When multiple categories passed, Elementor uses the first one.
	 *
	 * @since 1.0.0
	 *
	 * @access public
	 *
	 * @return array Widget categories.
	 */
	public function get_categories() {
		return array( 'doccure' );
	}

	/**
	 * Register the widget controls.
	 *
	 * Adds different input fields to allow the user to change and customize the widget settings.
	 *
	 * @since 1.0.0
	 *
	 * @access protected
	 */
	protected function register_controls() {
   
		 
		$this->start_controls_section(
			'section_toggle',
			[
				'label' => esc_html__( 'Toggle', 'doccure_elementor' ),
			]
		);
 		$repeater = new \Elementor\Repeater();
 

		 $repeater->add_control(
			'tab_title',
			[
				'label' => esc_html__( 'Title', 'doccure_elementor' ),
				'type' => \Elementor\Controls_Manager::TEXT,
				'default' => esc_html__( 'Doctors Available', 'doccure_elementor' ),
				'label_block' => true,
				 
			]
		);

        $repeater->add_control(
			'tab_number',
			array(
				'label'   => __( 'Starting Number', 'doccure_elementor' ),
				'type'    => Controls_Manager::TEXT,
				'default' => __( '0', 'doccure_elementor' ),
			)
		);	

	 
 		
		$repeater->add_control(
			'tab_numbersuff',
			array(
				'label'   => __( 'Number Suffix', 'doccure_elementor' ),
				'type'    => Controls_Manager::TEXT,
				'default' => __( '+', 'doccure_elementor' ),
			)
		);	

		$repeater->add_control(
			'tab_style',
			array(
				'label'   => __( 'Style', 'doccure_elementor' ),
				'type'    => Controls_Manager::SELECT,
				'default' => 'primary-count',
				'options' => array(
					'primary-count'  => __('Primary Count', 'doccure_elementor'),
					'secondary-count' => __('Secondary Count', 'doccure_elementor'),
					'purple-count'  => __('Purple Count', 'doccure_elementor'),
					'pink-count'  => __('Pink Count', 'doccure_elementor'),
					'warning-count' => __('Warning Count', 'doccure_elementor'),
				),
			)
		);
		

 		$this->add_control(
			'tabs',
			[
				'label' => esc_html__( 'Toggle Items', 'doccure_elementor' ),
				'type' => \Elementor\Controls_Manager::REPEATER,
				'fields' => $repeater->get_controls(),
				'default' => 	[
 					'tab_title' => esc_html__( 'Multi Speciality Treatments & Doctors', 'doccure_elementor' ),
				   ],
 				'title_field' => '{{{ tab_title }}}',
			]
		);
		

	 
		
		$this->end_controls_section();
	}

	/**
	 * Render the widget output on the frontend.
	 *
	 * Written in PHP and used to generate the final HTML.
	 *
	 * @since 1.0.0
	 *
	 * @access protected
	 */
	protected function render() {
		$settings = $this->get_settings_for_display();
		$id_int = substr( $this->get_id_int(), 0, 3 );
		$this->add_inline_editing_attributes( 'title', 'none' );
		$this->add_inline_editing_attributes( 'subtitle', 'none' );
  		?>
 <div class="testimonial-counter">
			<div class="row row-cols-1 row-cols-sm-2 row-cols-md-3 row-cols-lg-5 row-gap-4">	 
			<?php
			foreach ( $settings['tabs'] as $index => $item ) :
				$tab_count = $index + 1;
				$tab_title_setting_key = $this->get_repeater_setting_key( 'tab_title', 'tabs', $index );
				$tab_content_setting_key = $this->get_repeater_setting_key( 'tab_content', 'tabs', $index );
  				?>

							<div class="counter-item text-center aos" data-aos="fade-up">
								<h6 class="display-6 mb-0 <?php echo $item['tab_style']; ?>"><span class="count-digit"><?php echo $item['tab_number']; ?></span><?php echo $item['tab_numbersuff']; ?></h6>
								<p><?php echo $item['tab_title']; ?></p>
							</div>
 <?php endforeach; ?>
						</div>
					</div>
 		<?php
	}
}