OwlCyberSecurity - MANAGER
Edit File: testimonial.php
<?php use Elementor\Widget_Base; use Elementor\Controls_Manager; use Elementor\Group_Control_Typography; use Elementor\Utils; use Elementor\Group_Control_Border; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly class Chursy_Elementor_Testimonial extends Widget_Base { public function get_name() { return 'chursy_elementor_testimonial'; } public function get_title() { return esc_html__( 'Ova Testimonial', 'chursy' ); } public function get_icon() { return 'eicon-testimonial-carousel'; } public function get_categories() { return [ 'chursy' ]; } public function get_script_depends() { return [ 'chursy-elementor-testimonial' ]; } protected function register_controls() { $this->start_controls_section( 'section_content', [ 'label' => esc_html__( 'Content', 'chursy' ), ] ); $this->add_control( 'version', [ 'label' => esc_html__( 'Version', 'chursy' ), 'type' => \Elementor\Controls_Manager::SELECT, 'default' => 'version_1', 'options' => [ 'version_1' => esc_html__( 'Version 1', 'chursy' ), 'version_2' => esc_html__( 'Version 2', 'chursy' ), ] ] ); $this->add_control( 'show_rating', [ 'label' => esc_html__( 'Show Rating', 'chursy' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'options' => [ 'yes' => esc_html__( 'Yes', 'chursy' ), 'no' => esc_html__( 'No', 'chursy' ), ], ] ); // Item version 1 $repeater = new \Elementor\Repeater(); $repeater->add_control( 'name_author', [ 'label' => esc_html__( 'Author Name', 'chursy' ), 'type' => \Elementor\Controls_Manager::TEXT, ] ); $repeater->add_control( 'image_author', [ 'label' => esc_html__( 'Author Image', 'chursy' ), 'type' => \Elementor\Controls_Manager::MEDIA, 'default' => [ 'url' => Utils::get_placeholder_image_src(), ], ] ); $repeater->add_control( 'testimonial', [ 'label' => esc_html__( 'Testimonial ', 'chursy' ), 'type' => \Elementor\Controls_Manager::TEXTAREA, 'default' => esc_html__( '"Working with you in Canada has been great. The workshop about using their back-end system made everything so much easier and we were able to get our page ready to go live quickly."', 'chursy' ), ] ); $this->add_control( 'tab_item', [ 'label' => esc_html__( 'Items Testimonial', 'chursy' ), 'type' => \Elementor\Controls_Manager::REPEATER, 'fields' => $repeater->get_controls(), 'default' => [ [ 'name_author' => esc_html__('James Aiden', 'chursy'), ], [ 'name_author' => esc_html__('James Peter', 'chursy'), ], [ 'name_author' => esc_html__('Peek Thakul', 'chursy'), ], [ 'name_author' => esc_html__('Told Josy', 'chursy'), ], ], 'title_field' => '{{{ name_author }}}', 'condition' => [ 'version' => 'version_1', ], ] ); // Item Version 2 $repeater_v2 = new \Elementor\Repeater(); $repeater_v2->add_control( 'name_author', [ 'label' => esc_html__( 'Author Name', 'chursy' ), 'type' => \Elementor\Controls_Manager::TEXT, ] ); $repeater_v2->add_control( 'image_author', [ 'label' => esc_html__( 'Author Image', 'chursy' ), 'type' => \Elementor\Controls_Manager::MEDIA, 'default' => [ 'url' => Utils::get_placeholder_image_src(), ], ] ); $repeater_v2->add_control( 'testimonial', [ 'label' => esc_html__( 'Testimonial ', 'chursy' ), 'type' => \Elementor\Controls_Manager::TEXTAREA, 'default' => esc_html__( 'The Church is not an automobile showroom - a place to put ourselves on display.', 'chursy' ), ] ); $this->add_control( 'tab_item_v2', [ 'label' => esc_html__( 'Items Testimonial', 'chursy' ), 'type' => \Elementor\Controls_Manager::REPEATER, 'fields' => $repeater_v2->get_controls(), 'default' => [ [ 'name_author' => esc_html__('James Aiden', 'chursy'), ], [ 'name_author' => esc_html__('James Peter', 'chursy'), ], ], 'title_field' => '{{{ name_author }}}', 'condition' => [ 'version' => 'version_2', ], ] ); $this->end_controls_section(); /***************** END SECTION CONTENT ******************/ /***************************************************************** START SECTION ADDITIONAL ******************************************************************/ $this->start_controls_section( 'section_additional_options', [ 'label' => esc_html__( 'Additional Options', 'chursy' ), ] ); /*************************** VERSION 1 ***********************/ $this->add_control( 'margin_items', [ 'label' => esc_html__( 'Margin Right Items', 'chursy' ), 'type' => \Elementor\Controls_Manager::NUMBER, 'default' => 30, ] ); $this->add_control( 'item_number', [ 'label' => esc_html__( 'Item Number', 'chursy' ), 'type' => \Elementor\Controls_Manager::NUMBER, 'description' => esc_html__( 'Number Item', 'chursy' ), 'default' => 3, 'condition' => [ 'version' => 'version_1', ], ] ); $this->add_control( 'item_number_v2', [ 'label' => esc_html__( 'Item Number', 'chursy' ), 'type' => \Elementor\Controls_Manager::NUMBER, 'description' => esc_html__( 'Number Item', 'chursy' ), 'default' => 1, 'condition' => [ 'version' => 'version_2', ], ] ); $this->add_control( 'slides_to_scroll', [ 'label' => esc_html__( 'Slides to Scroll', 'chursy' ), 'type' => \Elementor\Controls_Manager::NUMBER, 'description' => esc_html__( 'Set how many slides are scrolled per swipe.', 'chursy' ), 'default' => 1, ] ); $this->add_control( 'pause_on_hover', [ 'label' => esc_html__( 'Pause on Hover', 'chursy' ), 'type' => \Elementor\Controls_Manager::SWITCHER, 'default' => 'yes', 'options' => [ 'yes' => esc_html__( 'Yes', 'chursy' ), 'no' => esc_html__( 'No', 'chursy' ), ], 'frontend_available' => true, ] ); $this->add_control( 'infinite', [ 'label' => esc_html__( 'Infinite Loop', 'chursy' ), 'type' => \Elementor\Controls_Manager::SWITCHER, 'default' => 'yes', 'options' => [ 'yes' => esc_html__( 'Yes', 'chursy' ), 'no' => esc_html__( 'No', 'chursy' ), ], 'frontend_available' => true, ] ); $this->add_control( 'autoplay', [ 'label' => esc_html__( 'Autoplay', 'chursy' ), 'type' => \Elementor\Controls_Manager::SWITCHER, 'default' => 'yes', 'options' => [ 'yes' => esc_html__( 'Yes', 'chursy' ), 'no' => esc_html__( 'No', 'chursy' ), ], 'frontend_available' => true, ] ); $this->add_control( 'autoplay_speed', [ 'label' => esc_html__( 'Autoplay Speed', 'chursy' ), 'type' => \Elementor\Controls_Manager::NUMBER, 'default' => 3000, 'step' => 500, 'condition' => [ 'autoplay' => 'yes', ], 'frontend_available' => true, ] ); $this->add_control( 'smartspeed', [ 'label' => esc_html__( 'Smart Speed', 'chursy' ), 'type' => \Elementor\Controls_Manager::NUMBER, 'default' => 500, ] ); $this->add_control( 'dot_control', [ 'label' => esc_html__( 'Show Dots', 'chursy' ), 'type' => \Elementor\Controls_Manager::SWITCHER, 'default' => 'yes', 'options' => [ 'yes' => esc_html__( 'Yes', 'chursy' ), 'no' => esc_html__( 'No', 'chursy' ), ], 'frontend_available' => true, 'condition' => [ 'version' => 'version_1', ], ] ); $this->add_control( 'dot_control_v2', [ 'label' => esc_html__( 'Show Dots', 'chursy' ), 'type' => \Elementor\Controls_Manager::SWITCHER, 'default' => 'no', 'options' => [ 'yes' => esc_html__( 'Yes', 'chursy' ), 'no' => esc_html__( 'No', 'chursy' ), ], 'frontend_available' => true, 'condition' => [ 'version' => 'version_2', ], ] ); $this->add_control( 'nav_control', [ 'label' => esc_html__( 'Show Nav', 'chursy' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'no', 'options' => [ 'yes' => esc_html__( 'Yes', 'chursy' ), 'no' => esc_html__( 'No', 'chursy' ), ], 'frontend_available' => true, 'condition' => [ 'version' => 'version_1', ], ] ); $this->add_control( 'nav_control_v2', [ 'label' => esc_html__( 'Show Nav', 'chursy' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'options' => [ 'yes' => esc_html__( 'Yes', 'chursy' ), 'no' => esc_html__( 'No', 'chursy' ), ], 'frontend_available' => true, 'condition' => [ 'version' => 'version_2', ], ] ); $this->end_controls_section(); /**************************** END SECTION ADDITIONAL *********************/ /************* SECTION GENERAL. *******************/ $this->start_controls_section( 'section_general', [ 'label' => esc_html__( 'General', 'chursy' ), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'dot_active_color', [ 'label' => esc_html__( 'Dot Active Color', 'chursy' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-testimonial .slide-testimonials .owl-dots .owl-dot.active span' => 'background : {{VALUE}};', ], ] ); $this->add_control( 'background_version_2', [ 'label' => esc_html__( 'Background', 'chursy' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-testimonial.testimonial-version_2 .slide-testimonials .client_info' => 'background-color : {{VALUE}};', ], 'condition' =>[ 'version' => 'version_2' ], ] ); $this->add_group_control( \Elementor\Group_Control_Border::get_type(), [ 'name' => 'border_general_version_2', 'label' => esc_html__( 'Border', 'chursy' ), 'selector' => '{{WRAPPER}} .ova-testimonial.testimonial-version_2', 'condition' =>[ 'version' => 'version_2' ], ] ); $this->add_responsive_control( 'general_version_2_padding', [ 'label' => esc_html__( 'Padding', 'chursy' ), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ova-testimonial.testimonial-version_2' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' =>[ 'version' => 'version_2' ], ] ); $this->end_controls_section(); /************* SECTION Content *******************/ $this->start_controls_section( 'section_content_testimonial', [ 'label' => esc_html__( 'Content', 'chursy' ), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ] ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'content_testimonial_typography', 'selector' => '{{WRAPPER}} .ova-testimonial .slide-testimonials .client_info p.evaluate', ] ); $this->add_control( 'content_color', [ 'label' => esc_html__( 'Color', 'chursy' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-testimonial .slide-testimonials .client_info p.evaluate' => 'color : {{VALUE}};', ], ] ); $this->add_responsive_control( 'content_margin', [ 'label' => esc_html__( 'Margin', 'chursy' ), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ova-testimonial .slide-testimonials .client_info p.evaluate' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'content_padding', [ 'label' => esc_html__( 'Padding', 'chursy' ), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ova-testimonial .slide-testimonials .client_info p.evaluate' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_section(); /************* SECTION NAME AUTHOR. *******************/ $this->start_controls_section( 'section_author_name', [ 'label' => esc_html__( 'Author Name', 'chursy' ), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ] ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'author_name_typography', 'selector' => '{{WRAPPER}} .ova-testimonial .slide-testimonials .client_info .info .name-job .name', ] ); $this->add_control( 'author_name_color', [ 'label' => esc_html__( 'Color Author', 'chursy' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-testimonial .slide-testimonials .client_info .info .name-job .name' => 'color : {{VALUE}};', ], ] ); $this->add_responsive_control( 'author_name_margin', [ 'label' => esc_html__( 'Margin', 'chursy' ), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ova-testimonial .slide-testimonials .client_info .info .name-job .name' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'author_name_padding', [ 'label' => esc_html__( 'Padding', 'chursy' ), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ova-testimonial .slide-testimonials .client_info .info .name-job .name' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_rating', [ 'label' => esc_html__( 'Rating', 'chursy' ), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, 'condition' => [ 'show_rating' => 'yes', ], ] ); $this->add_responsive_control( 'rating_size', [ 'label' => esc_html__( 'Size', 'chursy' ), 'type' => \Elementor\Controls_Manager::SLIDER, 'size_units' => [ 'px', '%', 'em', 'rem' ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, 'step' => 1, ], '%' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ova-testimonial .slide-testimonials .item .rating i' => 'font-size: {{SIZE}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'rating_spacing', [ 'label' => esc_html__( 'Spacing', 'chursy' ), 'type' => \Elementor\Controls_Manager::SLIDER, 'size_units' => [ 'px', '%', 'em', 'rem' ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, 'step' => 1, ], '%' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ova-testimonial .slide-testimonials .item .rating i' => 'margin-right: {{SIZE}}{{UNIT}};', ], ] ); $this->add_control( 'rating_color', [ 'label' => esc_html__( 'Color', 'chursy' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-testimonial .slide-testimonials .item .rating i' => 'color: {{VALUE}}', ], ] ); $this->add_responsive_control( 'rating_margin', [ 'label' => esc_html__( 'Margin', 'chursy' ), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em'], 'selectors' => [ '{{WRAPPER}} .ova-testimonial .item .rating' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_section(); /* Begin Nav Arrow Style */ $this->start_controls_section( 'nav_style', [ 'label' => esc_html__( 'Arrows Control', 'chursy' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'size_nav_icon', [ 'label' => esc_html__( 'Icon Size', 'chursy' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px'], 'range' => [ 'px' => [ 'min' => 0, 'max' => 30, 'step' => 1, ], ], 'selectors' => [ '{{WRAPPER}} .ova-testimonial .slide-testimonials .owl-nav button i' => 'font-size: {{SIZE}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'nav_bg_size', [ 'label' => esc_html__( 'Background Size', 'chursy' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 10, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ova-testimonial .slide-testimonials .owl-nav button' => 'width: {{SIZE}}{{UNIT}};height: {{SIZE}}{{UNIT}}', ], ] ); $this->add_responsive_control( 'arrow_border_radius', [ 'label' => esc_html__( 'Border Radius', 'chursy' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ova-testimonial .slide-testimonials .owl-nav button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->start_controls_tabs( 'tabs_nav_style' ); $this->start_controls_tab( 'tab_nav_normal', [ 'label' => esc_html__( 'Normal', 'chursy' ), ] ); $this->add_control( 'color_nav_icon', [ 'label' => esc_html__( 'Color', 'chursy' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-testimonial .slide-testimonials .owl-nav button i' => 'color : {{VALUE}};', ], ] ); $this->add_control( 'color_nav_bg_prev', [ 'label' => esc_html__( ' Background Prev', 'chursy' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-testimonial .slide-testimonials .owl-nav button.owl-prev' => 'background-color : {{VALUE}};', ], ] ); $this->add_control( 'color_nav_bg_next', [ 'label' => esc_html__( ' Background Next', 'chursy' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-testimonial .slide-testimonials .owl-nav button.owl-next' => 'background-color : {{VALUE}};', ], ] ); $this->add_group_control( \Elementor\Group_Control_Border::get_type(), [ 'name' => 'border_nav', 'label' => esc_html__( 'Border', 'chursy' ), 'selector' => '{{WRAPPER}} .ova-testimonial .slide-testimonials .owl-nav button', ] ); $this->end_controls_tab(); $this->start_controls_tab( 'tab_icon_hover', [ 'label' => esc_html__( 'Hover', 'chursy' ), ] ); $this->add_control( 'color_nav_icon_hover', [ 'label' => esc_html__( 'Color Hover', 'chursy' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-testimonial .slide-testimonials .owl-nav button:hover i' => 'color : {{VALUE}};', ], ] ); $this->add_control( 'color_nav_bg_hover', [ 'label' => esc_html__( 'Background Hover', 'chursy' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-testimonial .slide-testimonials .owl-nav button:hover' => 'background-color : {{VALUE}};', ], ] ); $this->add_control( 'color_nav_icon_border_hover', [ 'label' => esc_html__( 'Border Hover', 'chursy' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-testimonial .slide-testimonials .owl-nav button:hover ' => 'border-color : {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); /* End Nav Arrow Style */ } protected function render() { $settings = $this->get_settings(); $version = $settings['version']; $tab_item = $version == 'version_1' ? $settings['tab_item'] : $settings['tab_item_v2']; $show_rating = $settings['show_rating']; $data_options['version'] = $version; $data_options['items'] = $version ==='version_1' ? $settings['item_number'] : $settings['item_number_v2']; $data_options['slideBy'] = $settings['slides_to_scroll']; $data_options['margin'] = $settings['margin_items']; $data_options['autoplayHoverPause'] = $settings['pause_on_hover'] === 'yes' ? true : false; $data_options['loop'] = $settings['infinite'] === 'yes' ? true : false; $data_options['autoplay'] = $settings['autoplay'] === 'yes' ? true : false; $data_options['autoplayTimeout'] = $settings['autoplay_speed']; $data_options['smartSpeed'] = $settings['smartspeed']; $dot_v1 = $settings['dot_control'] === 'yes' ? true : false; $dot_v2 = $settings['dot_control_v2'] === 'yes' ? true : false; $nav_v1 = $settings['nav_control'] === 'yes' ? true : false; $nav_v2 = $settings['nav_control_v2'] === 'yes' ? true : false; $data_options['dots'] = $version ==='version_1' ? $dot_v1 : $dot_v2; $data_options['nav'] = $version ==='version_1' ? $nav_v1 : $nav_v2; $data_options['rtl'] = is_rtl() ? true: false; ?> <section class="ova-testimonial testimonial-<?php echo esc_html( $version ); ?>"> <div class="slide-testimonials owl-carousel owl-theme slider-count" data-options="<?php echo esc_attr(json_encode($data_options)) ?>"> <?php if ( ! empty( $tab_item ) ) : foreach( $tab_item as $item ): ?> <div class="item"> <div class="client_info"> <div class="client"> <?php if ( $item['image_author'] != '' ) { ?> <?php $alt = isset($item['name_author']) && $item['name_author'] ? $item['name_author'] : esc_html__( 'testimonial','chursy' ); ?> <img src="<?php echo esc_attr( $item['image_author']['url'] ); ?>" alt="<?php echo esc_attr( $alt ); ?>" > <?php } ?> </div> <?php if ( $item['testimonial'] != '' ): ?> <p class="evaluate"> <?php echo esc_html( $item['testimonial'] ); ?> </p> <?php endif; ?> <div class="info"> <?php if( $show_rating == 'yes') : ?> <div class="rating"> <i aria-hidden="true" class="fas fa-star"></i> <i aria-hidden="true" class="fas fa-star"></i> <i aria-hidden="true" class="fas fa-star"></i> <i aria-hidden="true" class="fas fa-star"></i> <i aria-hidden="true" class="fas fa-star"></i> </div> <?php endif; ?> <div class="name-job"> <?php if ( $item['name_author'] != '' ) { ?> <p class="name second_font"> <?php echo esc_html( $item['name_author'] ); ?> </p> <?php } ?> </div> </div> </div> </div> <?php endforeach; endif; ?> </div> </section> <?php } } $widgets_manager->register( new Chursy_Elementor_Testimonial() );