File: /home/h278792/public_html/wp-content/plugins/ecademy-toolkit/widgets/feedback.php
<?php
/**
* Feedback Widget
*/
namespace Elementor;
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class eCademy_Feedback extends Widget_Base {
public function get_name() {
return 'Feedback';
}
public function get_title() {
return __( 'بازخورد', 'ecademy-toolkit' );
}
public function get_icon() {
return 'eicon-testimonial';
}
public function get_categories() {
return [ 'ecademy-elements' ];
}
protected function register_controls() {
$this->start_controls_section(
'content_section',
[
'label' => __( 'محتوا', 'ecademy-toolkit' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'feedback_style',
[
'label' => __( 'سبک بازخورد', 'ecademy-toolkit' ),
'type' => Controls_Manager::SELECT,
'options' => [
'1' => __( 'سبک 1', 'ecademy-toolkit' ),
'2' => __( 'سبک', 'ecademy-toolkit' ),
],
'default' => '1',
]
);
$this->add_control(
'top_title',
[
'label' => __( 'عنوان بالا', 'ecademy-toolkit' ),
'type' => Controls_Manager::TEXT,
'default' => __('Distance learning', 'ecademy-toolkit'),
]
);
$this->add_control(
'title',
[
'label' => __( 'عنوان', 'ecademy-toolkit' ),
'type' => Controls_Manager::TEXT,
'default' => __('مطالعه انعطاف پذیر با سرعت خود، مطابق با نیازهای خود', 'ecademy-toolkit'),
]
);
$this->add_control(
'title_tag',
[
'label' => __( 'عنوان برچسب', 'ecademy-toolkit' ),
'type' => Controls_Manager::SELECT,
'options' => [
'h1' => __( 'h1', 'ecademy-toolkit' ),
'h2' => __( 'h2', 'ecademy-toolkit' ),
'h3' => __( 'h3', 'ecademy-toolkit' ),
'h4' => __( 'h4', 'ecademy-toolkit' ),
'h5' => __( 'h5', 'ecademy-toolkit' ),
'h6' => __( 'h6', 'ecademy-toolkit' ),
],
'default' => 'h2',
]
);
$this->add_control(
'content',
[
'label' => __( 'محتوا', 'ecademy-toolkit' ),
'type' => Controls_Manager::TEXTAREA,
'default' => __('با دانشگاه آزاد می توانید در هر زمان و مکانی که بخواهید تحصیل کنید. ما در بیش از 128 کشور دانشآموز داریم و به عنوان پیشگام در زمینه یادگیری انعطافپذیر شهرت جهانی داریم. آموزش انعطافپذیر ما همچنین به این معنی است که اگر اغلب سفر میکنید یا نیاز به جابهجایی دارید، میتوانید هر کجا که میروید به مطالعه ادامه دهید..', 'ecademy-toolkit'),
]
);
$repeater = new Repeater();
$repeater->add_control(
'image', [
'label' => __( 'تصویر', 'ecademy-toolkit' ),
'type' => Controls_Manager::MEDIA,
]
);
$repeater->add_control(
'name', [
'label' => esc_html__('نام', 'ecademy-toolkit'),
'type' => Controls_Manager::TEXT,
'default' => esc_html__('اولیور روسی', 'ecademy-toolkit'),
'label_block' => true,
]
);
$repeater->add_control(
'designation', [
'label' => esc_html__(' تعیین', 'ecademy-toolkit'),
'type' => Controls_Manager::TEXT,
'default' => esc_html__('طراح', 'ecademy-toolkit'),
'label_block' => true,
]
);
$repeater->add_control(
'feedback', [
'label' => esc_html__('محتوای بازخورد', 'ecademy-toolkit'),
'type' => Controls_Manager::TEXTAREA,
'default' => esc_html__('لورم ایپسوم متن ساختگی با تولید سادگی نامفهوم از صنعت چاپ و با استفاده از طراحان گرافیک است.. لورم ایپسوم متن ساختگی با تولید سادگی نامفهوم از صنعت چاپ و با استفاده از طراحان گرافیک است..', 'ecademy-toolkit'),
'label_block' => true,
]
);
$this->add_control(
'ecademy_feedback_items',
[
'label' => esc_html__('اسلایدر آیتم', 'ecademy-toolkit'),
'type' => Controls_Manager::REPEATER,
'default' => [
[ 'name' => esc_html__(' آیتم #1', 'ecademy-toolkit') ],
],
'fields' => $repeater->get_controls(),
]
);
$this->add_control(
'bottom_title',
[
'label' => __( 'متن دکمه', 'ecademy-toolkit' ),
'type' => Controls_Manager::TEXT,
'default' => __('آیا هنوز عضو نشده؟', 'ecademy-toolkit'),
'condition' => [
'feedback_style' => '1',
]
]
);
$this->add_control(
'bottom_link_title',
[
'label' => __( 'عنوان لینک پایین', 'ecademy-toolkit' ),
'type' => Controls_Manager::TEXT,
'default' => __('ثبت نام کنید', 'ecademy-toolkit'),
'condition' => [
'feedback_style' => '1',
]
]
);
$this->add_control(
'link_type',
[
'label' => esc_html__( ' نوع پیوند ', 'ecademy-toolkit' ),
'type' => Controls_Manager::SELECT,
'label_block' => true,
'options' => [
'1' => esc_html__( 'پیوند به صفحه', 'ecademy-toolkit' ),
'2' => esc_html__( 'لینک خارجی', 'ecademy-toolkit' ),
],
'condition' => [
'feedback_style' => '1',
]
]
);
$this->add_control(
'link_to_page',
[
'label' => esc_html__( 'پیوند صفحه ', 'ecademy-toolkit' ),
'type' => Controls_Manager::SELECT,
'label_block' => true,
'options' => ecademy_toolkit_get_page_as_list(),
'condition' => [
'link_type' => '1',
]
]
);
$this->add_control(
'ex_link',
[
'label' => esc_html__('لینک خارجی', 'ecademy-toolkit'),
'type' => Controls_Manager:: TEXT,
'condition' => [
'link_type' => '2',
]
]
);
$this->add_control(
'shape1',
[
'label' => esc_html__('شکل تصویر یک', 'ecademy-toolkit'),
'type' => Controls_Manager:: MEDIA,
'condition' => [
'feedback_style' => '2',
]
]
);
$this->add_control(
'shape2',
[
'label' => esc_html__('شکل تصویر دو', 'ecademy-toolkit'),
'type' => Controls_Manager:: MEDIA,
'condition' => [
'feedback_style' => '2',
]
]
);
$this->add_control(
'shape3',
[
'label' => esc_html__('شکل تصویر سه ', 'ecademy-toolkit'),
'type' => Controls_Manager:: MEDIA,
'condition' => [
'feedback_style' => '2',
]
]
);
$this->end_controls_section();
$this->start_controls_section(
'style',
[
'label' => __( 'سبک', 'ecademy-toolkit' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'top_title_color',
[
'label' => __( 'رنگ عنوان بالا', 'ecademy-toolkit' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .feedback-content .sub-title, .section-title .sub-title' => 'color: {{VALUE}}',
],
]
);
$this->add_responsive_control(
'top_title_size',
[
'label' => __( 'اندازه قلم عنوان بالا', 'ecademy-toolkit' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px' ],
'range' => [
'px' => [
'min' => 1,
'max' => 60,
'step' => 1,
],
],
'devices' => [ 'desktop', 'tablet', 'mobile' ],
'selectors' => [
'{{WRAPPER}} .feedback-content .sub-title, .section-title .sub-title' => 'font-size: {{SIZE}}px;',
],
]
);
$this->add_control(
'title_color',
[
'label' => __( 'عنوان رنگ', 'ecademy-toolkit' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .feedback-content h2, .feedback-content h3, .feedback-content h4, .feedback-content h5, .feedback-content h5, .feedback-content h6, .feedback-content h1, .section-title h1, .section-title h2, .section-title h3, .section-title h4, .section-title h5, .section-title h6' => 'color: {{VALUE}}',
],
]
);
$this->add_responsive_control(
'title_size',
[
'label' => __( 'اندازه قلم عنوان', 'ecademy-toolkit' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px' ],
'range' => [
'px' => [
'min' => 1,
'max' => 60,
'step' => 1,
],
],
'devices' => [ 'desktop', 'tablet', 'mobile' ],
'selectors' => [
'{{WRAPPER}} .feedback-content h2, .feedback-content h3, .feedback-content h4, .feedback-content h5, .feedback-content h5, .feedback-content h6, .feedback-content h1, .section-title h1, .section-title h2, .section-title h3, .section-title h4, .section-title h5, .section-title h6' => 'font-size: {{SIZE}}px;',
],
]
);
$this->add_control(
'feedback_color',
[
'label' => __( ' رنگ بازخورد', 'ecademy-toolkit' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .feedback-content p, .single-testimonials-item p, .section-title p' => 'color: {{VALUE}}',
],
]
);
$this->add_responsive_control(
'feedback_size',
[
'label' => __( 'بازخورد اندازه قلم', 'ecademy-toolkit' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px' ],
'range' => [
'px' => [
'min' => 1,
'max' => 100,
'step' => 1,
],
],
'devices' => [ 'desktop', 'tablet', 'mobile' ],
'selectors' => [
'{{WRAPPER}} .feedback-content p, .single-testimonials-item p, .section-title p' => 'font-size: {{SIZE}}px;',
],
]
);
$this->add_control(
'name_color',
[
'label' => __( 'رنگ نام', 'ecademy-toolkit' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .single-feedback-item .client-info .title h3, .single-testimonials-item h3' => 'color: {{VALUE}}',
],
]
);
$this->add_responsive_control(
'name_size',
[
'label' => __( 'اندازه قلم نام', 'ecademy-toolkit' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px' ],
'range' => [
'px' => [
'min' => 1,
'max' => 100,
'step' => 1,
],
],
'devices' => [ 'desktop', 'tablet', 'mobile' ],
'selectors' => [
'{{WRAPPER}} .single-feedback-item .client-info .title h3, .single-testimonials-item h3' => 'font-size: {{SIZE}}px;',
],
]
);
$this->add_control(
'designation_color',
[
'label' => __( ' رنگ تعیین ', 'ecademy-toolkit' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .single-feedback-item .client-info .title span, .single-testimonials-item span' => 'color: {{VALUE}}',
],
]
);
$this->add_responsive_control(
'designation_size',
[
'label' => __( 'تعیین اندازه قلم', 'ecademy-toolkit' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px' ],
'range' => [
'px' => [
'min' => 1,
'max' => 100,
'step' => 1,
],
],
'devices' => [ 'desktop', 'tablet', 'mobile' ],
'selectors' => [
'{{WRAPPER}} .single-feedback-item .client-info .title span, .single-testimonials-item span' => 'font-size: {{SIZE}}px;',
],
]
);
$this->end_controls_section();
}
protected function render() {
$settings = $this->get_settings_for_display();
global $ecademy_opt;
if( isset( $ecademy_opt['enable_lazyloader'] ) ):
$is_lazyloader = $ecademy_opt['enable_lazyloader'];
else:
$is_lazyloader = true;
endif;
$slider = $settings['ecademy_feedback_items'];
// Inline Editing
$this-> add_inline_editing_attributes('title','none');
// Get Button Link
if($settings['link_type'] == 1){
$link = get_page_link( $settings['link_to_page'] );
} else {
$link = $settings['ex_link'];
}
$count = 0;
foreach ($slider as $items => $counts):
$count++;
endforeach;
?>
<?php if( $settings['feedback_style'] == '1' ): ?>
<div class="feedback-content">
<span class="sub-title"><?php echo esc_html( $settings['top_title'] ); ?></span>
<<?php echo esc_attr( $settings['title_tag'] ); ?> <?php echo $this-> get_render_attribute_string('title'); ?>><?php echo esc_html( $settings['title'] ); ?></<?php echo esc_attr( $settings['title_tag'] ); ?>>
<p <?php echo $this-> get_render_attribute_string('content'); ?>><?php echo wp_kses_post( $settings['content'] ); ?></p>
<?php if( $count == 1 ): ?>
<div class="col-lg-12">
<?php else: ?>
<div class="feedback-slides owl-carousel owl-theme">
<?php endif; ?>
<?php foreach ($slider as $key => $value): ?>
<div class="single-feedback-item">
<p><?php echo esc_html( $value['feedback'] ); ?></p>
<div class="client-info d-flex align-items-center">
<?php if( $value['image']['url'] != '' ): ?>
<?php if( $is_lazyloader == true ): ?>
<img class="shadow rounded-circle" sm-src="<?php echo esc_url( $value['image']['url'] ); ?>" alt="<?php echo esc_attr( $value['name'] ) ?>">
<?php else: ?>
<img class="shadow rounded-circle" src="<?php echo esc_url( $value['image']['url'] ); ?>" alt="<?php echo esc_attr( $value['name'] ) ?>">
<?php endif; ?>
<?php endif; ?>
<div class="title">
<h3><?php echo esc_html( $value['name'] ); ?></h3>
<span><?php echo esc_html( $value['designation'] ); ?></span>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
<?php if( !is_user_logged_in() ): ?>
<div class="feedback-info">
<p><?php echo esc_html( $settings['bottom_title'] ); ?> <a href="<?php echo esc_url( $link ); ?>"><?php echo esc_html( $settings['bottom_link_title'] ); ?></a></p>
</div>
<?php endif; ?>
</div>
<?php elseif( $settings['feedback_style'] == '2' ): ?>
<div class="testimonials-area ptb-100">
<div class="container">
<div class="section-title">
<span class="sub-title"><?php echo esc_html( $settings['top_title'] ); ?></span>
<<?php echo esc_attr( $settings['title_tag'] ); ?> <?php echo $this-> get_render_attribute_string('title'); ?>><?php echo esc_html( $settings['title'] ); ?></<?php echo esc_attr( $settings['title_tag'] ); ?>>
<p <?php echo $this-> get_render_attribute_string('content'); ?>><?php echo wp_kses_post( $settings['content'] ); ?></p>
</div>
<?php if( $count == 1 ): ?>
<div class="col-lg-12">
<?php else: ?>
<div class="testimonials-slides owl-carousel owl-theme">
<?php endif; ?>
<?php foreach ($slider as $key => $value): ?>
<div class="single-testimonials-item">
<?php if( $value['image']['url'] != '' ): ?>
<?php if( $is_lazyloader == true ): ?>
<img class="client-img" sm-src="<?php echo esc_url( $value['image']['url'] ); ?>" alt="<?php echo esc_attr( $value['name'] ) ?>">
<?php else: ?>
<img class="client-img" src="<?php echo esc_url( $value['image']['url'] ); ?>" alt="<?php echo esc_attr( $value['name'] ) ?>">
<?php endif; ?>
<?php endif; ?>
<p><?php echo esc_html( $value['feedback'] ); ?></p>
<h3><?php echo esc_html( $value['name'] ); ?></h3>
<span><?php echo esc_html( $value['designation'] ); ?></span>
<div class="shape-img">
<?php if( $settings['shape1']['url'] != '' ): ?>
<?php if( $is_lazyloader == true ): ?>
<img sm-src="<?php echo esc_url( $settings['shape1']['url'] ); ?>" class="shape-1" alt="<?php echo esc_attr__( 'شکل تصویر', 'ecademy-toolkit' ); ?>">
<?php else: ?>
<img src="<?php echo esc_url( $settings['shape1']['url'] ); ?>" class="shape-1" alt="<?php echo esc_attr__( 'شکل تصویر', 'ecademy-toolkit' ); ?>">
<?php endif; ?>
<?php endif; ?>
<?php if( $settings['shape2']['url'] != '' ): ?>
<?php if( $is_lazyloader == true ): ?>
<img sm-src="<?php echo esc_url( $settings['shape2']['url'] ); ?>" class="shape-2" alt="<?php echo esc_attr__( 'شکل تصویر', 'ecademy-toolkit' ); ?>">
<?php else: ?>
<img src="<?php echo esc_url( $settings['shape2']['url'] ); ?>" class="shape-2" alt="<?php echo esc_attr__( 'شکل تصویر', 'ecademy-toolkit' ); ?>">
<?php endif; ?>
<?php endif; ?>
<?php if( $settings['shape3']['url'] != '' ): ?>
<?php if( $is_lazyloader == true ): ?>
<img sm-src="<?php echo esc_url( $settings['shape3']['url'] ); ?>" class="shape-3" alt="<?php echo esc_attr__( 'شکل تصویر', 'ecademy-toolkit' ); ?>">
<?php else: ?>
<img src="<?php echo esc_url( $settings['shape3']['url'] ); ?>" class="shape-3" alt="<?php echo esc_attr__( 'شکل تصویر', 'ecademy-toolkit' ); ?>">
<?php endif; ?>
<?php endif; ?>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
</div>
<?php endif; ?>
<?php
}
}
Plugin::instance()->widgets_manager->register( new eCademy_Feedback );