𝗖𝗨𝗥𝗥𝗘𝗡𝗧 𝗙𝗜𝗟𝗘 : /home/builxejc/public_html/wp-content/plugins/kinsley-plugin/elementor/widgets//testimonials-2.php
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
* Kinsley Testimonials Two Widget.
*
* @since 1.0
*/
class Kinsley_Testimonials_Two_Widget extends Widget_Base {
public function get_name() {
return 'kinsley-testimonials-two';
}
public function get_title() {
return esc_html__( 'Testimonials (Style-2)', 'kinsley-plugin' );
}
public function get_icon() {
return 'eicon-parallax';
}
public function get_categories() {
return [ 'kinsley-category' ];
}
/**
* Register widget controls.
*
* @since 1.0
*/
protected function register_controls() {
$this->start_controls_section(
'items_tab',
[
'label' => esc_html__( 'Items', 'kinsley-plugin' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$this->add_responsive_control(
'align',
[
'label' => __( 'Alignment', 'kinsley-plugin' ),
'type' => Controls_Manager::CHOOSE,
'options' => [
'left' => [
'title' => __( 'Left', 'kinsley-plugin' ),
'icon' => 'eicon-text-align-left',
],
'center' => [
'title' => __( 'Center', 'kinsley-plugin' ),
'icon' => 'eicon-text-align-center',
],
'right' => [
'title' => __( 'Right', 'kinsley-plugin' ),
'icon' => 'eicon-text-align-right',
],
],
'selectors' => [
'{{WRAPPER}}' => 'text-align: {{VALUE}};',
],
'default' => 'center',
]
);
$repeater = new \Elementor\Repeater();
$repeater->add_control(
'title', [
'label' => esc_html__( 'Title', 'kinsley-plugin' ),
'type' => Controls_Manager::TEXTAREA,
'placeholder' => esc_html__( 'Enter Title', 'kinsley-plugin' ),
'default' => esc_html__( 'Title', 'kinsley-plugin' ),
]
);
$repeater->add_control(
'text', [
'label' => esc_html__( 'Text', 'kinsley-plugin' ),
'type' => Controls_Manager::WYSIWYG,
'placeholder' => esc_html__( 'Enter text', 'kinsley-plugin' ),
'default' => esc_html__( 'Text', 'kinsley-plugin' ),
]
);
$repeater->add_control(
'image', [
'label' => esc_html__( 'Image', 'kinsley-plugin' ),
'type' => Controls_Manager::MEDIA,
'default' => [
'url' => \Elementor\Utils::get_placeholder_image_src(),
],
]
);
$repeater->add_control(
'subtitle', [
'label' => esc_html__( 'Name', 'kinsley-plugin' ),
'type' => Controls_Manager::TEXTAREA,
'placeholder' => esc_html__( 'Enter Name', 'kinsley-plugin' ),
'default' => esc_html__( 'Name', 'kinsley-plugin' ),
]
);
$repeater->add_control(
'role', [
'label' => esc_html__( 'Role', 'kinsley-plugin' ),
'type' => Controls_Manager::TEXTAREA,
'placeholder' => esc_html__( 'Enter role', 'kinsley-plugin' ),
'default' => esc_html__( 'Role', 'kinsley-plugin' ),
]
);
$repeater->add_control(
'rating', [
'label' => esc_html__( 'Rating', 'kinsley-plugin' ),
'type' => Controls_Manager::NUMBER,
'min' => 0,
'max' => 5,
'step' => 1,
'default' => 5,
]
);
$this->add_control(
'items',
[
'label' => esc_html__( 'Testimonials Items', 'kinsley-plugin' ),
'type' => Controls_Manager::REPEATER,
'prevent_empty' => false,
'fields' => $repeater->get_controls(),
'title_field' => '{{{ title }}}',
]
);
$this->end_controls_section();
$this->start_controls_section(
'item_settings_tab',
[
'label' => esc_html__( 'Item Settings', 'kinsley-plugin' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'item_show_image',
[
'label' => esc_html__( 'Show Image', 'kinsley-plugin' ),
'type' => Controls_Manager::SELECT,
'default' => 'yes',
'options' => [
'yes' => __( 'Yes', 'kinsley-plugin' ),
'no' => __( 'No', 'kinsley-plugin' ),
],
]
);
$this->add_control(
'item_show_name',
[
'label' => esc_html__( 'Show Title', 'kinsley-plugin' ),
'type' => Controls_Manager::SELECT,
'default' => 'yes',
'options' => [
'yes' => __( 'Yes', 'kinsley-plugin' ),
'no' => __( 'No', 'kinsley-plugin' ),
],
]
);
$this->add_control(
'item_show_subtitle',
[
'label' => esc_html__( 'Show Name', 'kinsley-plugin' ),
'type' => Controls_Manager::SELECT,
'default' => 'yes',
'options' => [
'yes' => __( 'Yes', 'kinsley-plugin' ),
'no' => __( 'No', 'kinsley-plugin' ),
],
]
);
$this->add_control(
'item_show_role',
[
'label' => esc_html__( 'Show Role', 'kinsley-plugin' ),
'type' => Controls_Manager::SELECT,
'default' => 'yes',
'options' => [
'yes' => __( 'Yes', 'kinsley-plugin' ),
'no' => __( 'No', 'kinsley-plugin' ),
],
]
);
$this->add_control(
'item_show_text',
[
'label' => esc_html__( 'Show Text', 'kinsley-plugin' ),
'type' => Controls_Manager::SELECT,
'default' => 'yes',
'options' => [
'yes' => __( 'Yes', 'kinsley-plugin' ),
'no' => __( 'No', 'kinsley-plugin' ),
],
]
);
$this->add_control(
'item_show_rating',
[
'label' => esc_html__( 'Show Rating', 'kinsley-plugin' ),
'type' => Controls_Manager::SELECT,
'default' => 'yes',
'options' => [
'yes' => __( 'Yes', 'kinsley-plugin' ),
'no' => __( 'No', 'kinsley-plugin' ),
],
]
);
$this->end_controls_section();
$this->start_controls_section(
'items_styling',
[
'label' => esc_html__( 'Items', 'kinsley-plugin' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'item_title_color',
[
'label' => esc_html__( 'Title Color', 'kinsley-plugin' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .knsl-testimonial-two-card .knsl-tt-title' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'item_title_typography',
'label' => esc_html__( 'Title Typography', 'kinsley-plugin' ),
'selector' => '{{WRAPPER}} .knsl-testimonial-two-card .knsl-tt-title',
]
);
$this->add_control(
'item_text_color',
[
'label' => esc_html__( 'Text Color', 'kinsley-plugin' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .knsl-testimonial-two-card .knsl-tt-text' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'item_text_typography',
'label' => esc_html__( 'Text Typography', 'kinsley-plugin' ),
'selector' => '{{WRAPPER}} .knsl-testimonial-two-card .knsl-tt-text',
]
);
$this->add_control(
'item_subtitle_color',
[
'label' => esc_html__( 'Name Color', 'kinsley-plugin' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .knsl-testimonial-two-card .knsl-tt-subtitle' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'item_subtitle_typography',
'label' => esc_html__( 'Name Typography', 'kinsley-plugin' ),
'selector' => '{{WRAPPER}} .knsl-testimonial-two-card .knsl-tt-subtitle',
]
);
$this->add_control(
'item_role_color',
[
'label' => esc_html__( 'Role Color', 'kinsley-plugin' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .knsl-testimonial-two-card .knsl-tt-role' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'item_role_typography',
'label' => esc_html__( 'Role Typography', 'kinsley-plugin' ),
'selector' => '{{WRAPPER}} .knsl-testimonial-two-card .knsl-tt-role',
]
);
$this->add_control(
'item_rating_color',
[
'label' => esc_html__( 'Rating Color', 'kinsley-plugin' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .knsl-testimonial-two-card .knsl-stars' => 'color: {{VALUE}};',
],
]
);
$this->end_controls_section();
}
/**
* Render widget output on the frontend.
*
* @since 1.0
*/
protected function render() {
$settings = $this->get_settings_for_display();
?>
<!-- testimonials -->
<div class="swiper-slider knsl-testimonials-two-slider">
<div class="swiper-wrapper">
<?php foreach ( $settings['items'] as $index => $item ) :
$item_title = $this->get_repeater_setting_key( 'title', 'items', $index );
$this->add_inline_editing_attributes( $item_title, 'basic' );
$item_subtitle = $this->get_repeater_setting_key( 'subtitle', 'items', $index );
$this->add_inline_editing_attributes( $item_subtitle, 'basic' );
$item_role = $this->get_repeater_setting_key( 'role', 'items', $index );
$this->add_inline_editing_attributes( $item_role, 'basic' );
$item_text = $this->get_repeater_setting_key( 'text', 'items', $index );
$this->add_inline_editing_attributes( $item_text, 'advanced' );
?>
<div class="swiper-slide">
<div class="knsl-testimonial-two-card knsl-mb-30">
<?php if ( $item['title'] && $settings['item_show_name'] == 'yes' ) : ?>
<h4 class="knsl-tt-title knsl-mb-30">
<span <?php echo $this->get_render_attribute_string( $item_title ); ?>>
<?php echo wp_kses_post( $item['title'] ); ?>
</span>
</h4>
<?php endif; ?>
<?php if ( $item['text'] && $settings['item_show_text'] == 'yes' ) : ?>
<div class="knsl-tt-text knsl-mb-30">
<div <?php echo $this->get_render_attribute_string( $item_text ); ?>>
<?php echo wp_kses_post( $item['text'] ); ?>
</div>
</div>
<?php endif; ?>
<?php if ( $item['image'] && $settings['item_show_image'] == 'yes' ) : $image = wp_get_attachment_image_url( $item['image']['id'], 'kinsley_140x140' ); ?>
<div class="knsl-tt-avatar knsl-mb-20">
<img src="<?php echo esc_url( $image ); ?>" alt="<?php echo esc_attr( $item['title'] ); ?>" />
</div>
<?php endif; ?>
<?php if ( $item['subtitle'] && $settings['item_show_subtitle'] == 'yes' ) : ?>
<h5 class="knsl-tt-subtitle">
<span <?php echo $this->get_render_attribute_string( $item_subtitle ); ?>>
<?php echo wp_kses_post( $item['subtitle'] ); ?>
</span>
</h5>
<?php endif; ?>
<?php if ( $item['role'] && $settings['item_show_role'] == 'yes' ) : ?>
<div class="knsl-tt-role knsl-mb-10">
<div <?php echo $this->get_render_attribute_string( $item_role ); ?>>
<?php echo wp_kses_post( $item['role'] ); ?>
</div>
</div>
<?php endif; ?>
<?php if ( $item['rating'] && $settings['item_show_rating'] == 'yes' ) : ?>
<ul class="knsl-stars">
<?php for ( $i = 1; $i <= 5; $i++ ) : ?>
<?php if ( $item['rating'] >= $i ) : ?>
<li><i class="fas fa-star"></i></li>
<?php else : ?>
<li class="knsl-empty"><i class="fas fa-star"></i></li>
<?php endif; ?>
<?php endfor; ?>
</ul>
<?php endif; ?>
</div>
</div>
<?php endforeach; ?>
</div>
<div class="knsl-two-slider-nav">
<div class="knsl-two-slider-prev knsl-two-slider-tt-prev"></div>
<div class="knsl-two-slider-next knsl-two-slider-tt-next"></div>
</div>
</div>
<!-- testimonials end -->
<?php
}
}
Plugin::instance()->widgets_manager->register( new Kinsley_Testimonials_Two_Widget() );