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/truelysell-wp/wp-content/plugins/truelysell-elementor/widgets/class-testimonialsmain.php
<?php
/**
 * truelysell class.
 *
 * @category   Class
 * @package    Elementortruelysell
 * @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 ElementorTruelysell\Widgets;
if ( ! defined( 'ABSPATH' ) ) {
	// Exit if accessed directly.
	exit;
}
use Elementor\Widget_Base;
use Elementor\Controls_Manager;
use Elementor\Utils;
 
/**
 * truelysell widget class.
 *
 * @since 1.0.0
 */
class Widget_Truelusell_TestimonialsMain extends Widget_Base {

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

	/**
	 * Retrieve the widget title.
	 *
	 * @since 1.0.0
	 *
	 * @access public
	 *
	 * @return string Widget title.
	 */
	public function get_title() {
		return __( 'Truelysell Genuine Reviews', 'truelysell_elementor' );
	}

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

	public function get_keywords() {
		return [ 'tabs', 'accordion', 'toggle' ];
	}
	/**
	 * 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( 'truelysell' );
	}

	/**
	 * 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_query',
			array(
				'label' => __( 'Query Settings', 'truelysell_elementor' ),
			)
		);

		 

		$this->add_control(
			'title',
			array(
				'label'   => __( 'Title', 'truelysell_elementor' ),
				'type'    => Controls_Manager::TEXT,
				'default' => __( 'Genuine reviews from', 'truelysell_elementor' ),
			)
		);	

		$this->add_control(
			'ttitle',
			array(
				'label'   => __( 'Highlight Title', 'truelysell_elementor' ),
				'type'    => Controls_Manager::TEXT,
				'default' => __( 'Customers', 'truelysell_elementor' ),
			)
		);	
		
		
		$this->add_control(
			'subtitle',
			array(
				'label'   => __( 'Sub-Title', 'truelysell_elementor' ),
				'type'    => Controls_Manager::TEXT,
				'default' => __( 'Each listing is designed to be clear and concise, providing customers', 'truelysell_elementor' ),
			)
		);


		$this->add_control(
			'bottomtitle',
			array(
				'label'   => __( 'Bottom Title', 'truelysell_elementor' ),
				'type'    => Controls_Manager::TEXT,
				'default' => __( 'Each listing is designed to be clear and concise, providing customers', 'truelysell_elementor' ),
			)
		);

		$this->add_control(
			'bottomstitle',
			array(
				'label'   => __( 'Bottom Sub-Title', 'truelysell_elementor' ),
				'type'    => Controls_Manager::TEXT,
				'default' => __( 'Excellent', 'truelysell_elementor' ),
			)
		);

		$this->add_control(
			'bottomoverall',
			array(
				'label'   => __( 'Bottom Based on', 'truelysell_elementor' ),
				'type'    => Controls_Manager::TEXT,
				'default' => __( 'Based on 456 reviews', 'truelysell_elementor' ),
			)
		);

	 
	  

		$this->end_controls_section();

		$this->start_controls_section(
			'section_toggle',
			[
				'label' => esc_html__( 'Testimonials', 'truelysell_elementor' ),
			]
		);
 		$repeater = new \Elementor\Repeater();
		$repeater->add_control(
			'tab_title',
			[
				'label' => esc_html__( 'Title', 'truelysell_elementor' ),
				'type' => \Elementor\Controls_Manager::TEXT,
				'default' => esc_html__( 'It was a very good experience', 'truelysell_elementor' ),
				'label_block' => true,
				 
			]
		);

		$repeater->add_control(
			'tab_name',
			[
				'label' => esc_html__( 'Name', 'truelysell_elementor' ),
				'type' => \Elementor\Controls_Manager::TEXT,
				'default' => esc_html__( 'Name', 'truelysell_elementor' ),
				'label_block' => true,
				 
			]
		);
		

		$repeater->add_control(
			'client_designation',
			[
				'label'   => __( 'Designation', 'truelysell_elementor' ),
				'type'    => \Elementor\Controls_Manager::TEXT,
				'label_block' => true,
				'default' => __('Managing Director','truelysell_elementor'),
			]
		);

		$repeater->add_control(
			'srating',
			[
				'label' => __( 'Style', 'plugin-domain' ),
				'type' => \Elementor\Controls_Manager::SELECT,
				'default' => '1',
				'options' => [
					'1' =>  __( '1 Star', 'truelysell_elementor' ),
					'2' =>  __( '2 Star', 'truelysell_elementor' ),
					'3' =>  __( '3 Star', 'truelysell_elementor' ),
					'4' =>  __( '4 Star', 'truelysell_elementor' ),
					'5' =>  __( '5 Star', 'truelysell_elementor' ),
				],
			]
		);

		 
		$repeater->add_control(
			'days_ago',
			[
				'label'   => __( 'Days ago', 'truelysell_elementor' ),
				'type'    => \Elementor\Controls_Manager::TEXT,
				'label_block' => true,
				'default' => __('5 Days Ago','truelysell_elementor'),
			]
		);

		$repeater->add_control(
			'client_image',
			[
				'label' => __( 'Image', 'truelysell_elementor' ),
				'type' => \Elementor\Controls_Manager::MEDIA,
				'default' => [
					'url' => Utils::get_placeholder_image_src(),
				]
			]
		);

	 


		$repeater->add_control(
			'tab_content',
			[
				'label' => esc_html__( 'Content', 'truelysell_elementor' ),
				'type' => \Elementor\Controls_Manager::TEXTAREA,
				'default' => esc_html__( 'Testimonial Content', 'truelysell_elementor' ),
				'show_label' => true,
			]
		);


		$this->add_control(
			'tabs',
			[
				'label' => esc_html__( 'Testimonial Items', 'truelysell_elementor' ),
				'type' => \Elementor\Controls_Manager::REPEATER,
				'fields' => $repeater->get_controls(),
				'default' => [
					[
						'tab_title' => esc_html__( 'Testimonial #1', 'truelysell_elementor' ),
						'tab_name' => esc_html__( 'Name #1', 'truelysell_elementor' ),
						'srating' => esc_html__( '5', 'truelysell_elementor' ),
						'tab_content' => esc_html__( 'I had a great experience with ABC Electrical on the Services. The electrician arrived on time!!!', 'truelysell_elementor' ),
						'days_ago' => esc_html__( 'Days ago #1', 'truelysell_elementor' ),
					],
					[
						'tab_title' => esc_html__( 'Testimonial #2', 'truelysell_elementor' ),
						'tab_name' => esc_html__( 'Name #2', 'truelysell_elementor' ),
						'srating' => esc_html__( '5', 'truelysell_elementor' ),
						'tab_content' => esc_html__( 'I had a great experience with ABC Electrical on the Services. The electrician arrived on time!!!', 'truelysell_elementor' ),
						'days_ago' => esc_html__( 'Days ago #1', 'truelysell_elementor' ),
					],
				],
				'title_field' => '{{{ tab_title }}}',
			]
		);
		

		$this->add_control(
			'view',
			[
				'label' => esc_html__( 'View', 'truelysell_elementor' ),
				'type' => \Elementor\Controls_Manager::HIDDEN,
				'default' => 'traditional',
			]
		);
		
		$this->end_controls_section();
 		/* Add the options you'd like to show in this tab here */
 	}

	/**
	 * 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 );
		$migrated = isset( $settings['__fa4_migrated']['selected_icon'] );

		if ( ! isset( $settings['icon'] ) && ! \Elementor\Icons_Manager::is_migration_allowed() ) {
			// @todo: remove when deprecated
			// added as bc in 2.6
			// add old default
			$settings['icon'] = 'fa fa-caret' . ( is_rtl() ? '-left' : '-right' );
			$settings['icon_active'] = 'fa fa-caret-up';
			$settings['icon_align'] = $this->get_settings( 'icon_align' );
		}

		$is_new = empty( $settings['icon'] ) && \Elementor\Icons_Manager::is_migration_allowed();
		$has_icon = ( ! $is_new || ! empty( $settings['selected_icon']['value'] ) );

		?>




	<!-- Testimonial Section -->
	<section class="section testimonial-section">
		<div class="container">
			<div class="row justify-content-center">
				<div class="col-lg-6 text-center wow fadeInUp" data-wow-delay="0.2s">
					<div class="section-header text-center">
						<h2 class="mb-1"><?php echo $settings['title']; ?> <span class="text-linear-primary"><?php echo $settings['ttitle']; ?></span></h2>
						<p class="sub-title"><?php echo $settings['subtitle']; ?></p>
					</div>
				</div>
			</div>
			<div class="testimonial-slider main_tesimonial owl-carousel nav-center">
			<?php foreach ( $settings['tabs'] as $testimonial ) : ?>
			 
 				<div class="testimonial-item wow fadeInUp" data-wow-delay="0.2s">
					<div class="d-flex align-items-center mb-3">

					<?php  if( !empty($testimonial['srating']) ){
                             echo truelysell_display_course_rating_new($testimonial['srating']); 
						 }
					 ?>
 
					</div>
					<h5 class="mb-2"><?php echo $testimonial['tab_title']; ?></h5>
					<p class="mb-4">“<?php echo $testimonial['tab_content']; ?>“</p>
					<div class="d-flex align-items-center justify-content-between">
						<div class="d-flex align-items-center overflow-hidden">
							<span class="avatar avatar-lg flex-shrink-0">
								<!-- <img src="assets/img/profiles/avatar-12.jpg" class="img-fluid rounded-circle" alt="img"> -->

								<img src="<?php Utils::print_unescaped_internal_string( $this->parse_text_editor( $testimonial['client_image']['url']) ); ?>" class="img-fluid rounded-circle" alt="img"> 
 								
 							</span>
							<h6 class="text-truncate ms-2">Daniel Davis</h6>
						</div>
						<p>7 Days Ago</p>
					</div>
				</div>
				<?php endforeach; ?>	 

			</div>
			<div class="text-center wow fadeInUp" data-wow-delay="0.2s">
				<h6 class="mb-2"><?php echo $settings['bottomtitle']; ?></h6>
				<p>
					<span class="text-dark fw-medium"><?php echo $settings['bottomstitle']; ?></span>
					<img src="<?php echo get_template_directory_uri(); ?>/assets/images/icon/star-01.svg" class="img-fluid" alt="img">
					<img src="<?php echo get_template_directory_uri(); ?>/assets/images/icon/star-01.svg" class="img-fluid" alt="img">
					<img src="<?php echo get_template_directory_uri(); ?>/assets/images/icon/star-01.svg" class="img-fluid" alt="img">
					<img src="<?php echo get_template_directory_uri(); ?>/assets/images/icon/star-01.svg" class="img-fluid" alt="img">
					<img src="<?php echo get_template_directory_uri(); ?>/assets/images/icon/star-01.svg" class="img-fluid" alt="img">
					<span class="fs-14"><?php echo $settings['bottomoverall']; ?></span>
				</p>
			</div>
		</div>
	</section>
	<!--/Testimonial Section --> 
		<?php
	}

	
	/**
	 * Render toggle widget output in the editor.
	 *
	 * Written as a Backbone JavaScript template and used to generate the live preview.
	 *
	 * @since 2.9.0
	 * @access protected
	 */
 }