Current Path : /storage/v11800/lifespanstoresnew/public_html/wp-content/plugins/suxnix-core/include/elementor/ |
Linux v11800 5.3.0-1023-aws #25~18.04.1-Ubuntu SMP Fri Jun 5 15:19:18 UTC 2020 aarch64
|
Current File : /storage/v11800/lifespanstoresnew/public_html/wp-content/plugins/suxnix-core/include/elementor/fact.php |
<?php
namespace TPCore\Widgets;
use Elementor\Widget_Base;
use Elementor\Controls_Manager;
use \Elementor\Group_Control_Image_Size;
use \Elementor\Repeater;
use \Elementor\Utils;
use \Elementor\Group_Control_Border;
use \Elementor\Group_Control_Box_Shadow;
use \Elementor\Group_Control_Text_Shadow;
use \Elementor\Group_Control_Typography;
Use \Elementor\Core\Schemes\Typography;
use \Elementor\Group_Control_Background;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
* Suxnix Core
*
* Elementor widget for hello world.
*
* @since 1.0.0
*/
class tg_fact extends Widget_Base {
/**
* Retrieve the widget name.
*
* @since 1.0.0
*
* @access public
*
* @return string Widget name.
*/
public function get_name() {
return 'tp-fact';
}
/**
* Retrieve the widget title.
*
* @since 1.0.0
*
* @access public
*
* @return string Widget title.
*/
public function get_title() {
return __( 'Fact', 'tpcore' );
}
/**
* Retrieve the widget icon.
*
* @since 1.0.0
*
* @access public
*
* @return string Widget icon.
*/
public function get_icon() {
return 'tp-icon';
}
/**
* 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 [ 'tpcore' ];
}
/**
* Retrieve the list of scripts the widget depended on.
*
* Used to set scripts dependencies required to run the widget.
*
* @since 1.0.0
*
* @access public
*
* @return array Widget scripts dependencies.
*/
public function get_script_depends() {
return [ 'tpcore' ];
}
/**
* 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() {
// Fact group
$this->start_controls_section(
'tg_fact',
[
'label' => esc_html__('Fact List', 'tpcore'),
'description' => esc_html__( 'Control all the style settings from Style tab', 'tpcore' ),
'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
]
);
$repeater = new \Elementor\Repeater();
$repeater->add_control(
'tg_fact_number', [
'label' => esc_html__('Number', 'tpcore'),
'description' => tp_get_allowed_html_desc( 'basic' ),
'type' => \Elementor\Controls_Manager::TEXT,
'default' => esc_html__('65', 'tpcore'),
'label_block' => true,
]
);
$repeater->add_control(
'tg_fact_formatting', [
'label' => esc_html__('Formatting Mask', 'tpcore'),
'description' => tp_get_allowed_html_desc( 'basic' ),
'type' => \Elementor\Controls_Manager::TEXT,
'default' => esc_html__('%', 'tpcore'),
'label_block' => true,
]
);
$repeater->add_control(
'tg_fact_title',
[
'label' => esc_html__('Fact Title', 'tpcore'),
'description' => tp_get_allowed_html_desc( 'intermediate' ),
'type' => \Elementor\Controls_Manager::TEXTAREA,
'default' => esc_html__('Active Members', 'tpcore'),
'label_block' => true,
]
);
$repeater->add_control(
'tg_fact_desc',
[
'label' => esc_html__('Fact Description', 'tpcore'),
'description' => tp_get_allowed_html_desc( 'intermediate' ),
'type' => \Elementor\Controls_Manager::TEXTAREA,
'default' => esc_html__('Yes we did it asap software', 'tpcore'),
'label_block' => true,
]
);
$this->add_control(
'tg_fact_list',
[
'label' => esc_html__('Fact Lists', 'tpcore'),
'type' => \Elementor\Controls_Manager::REPEATER,
'fields' => $repeater->get_controls(),
'default' => [
[
'tg_fact_number' => esc_html__('65', 'tpcore'),
'tg_fact_title' => esc_html__('Active Members', 'tpcore'),
'tg_fact_desc' => esc_html__('Yes we did it asap software', 'tpcore'),
],
[
'tg_fact_number' => esc_html__('90', 'tpcore'),
'tg_fact_title' => esc_html__('Projects Done', 'tpcore'),
'tg_fact_desc' => esc_html__('Yes we did it asap software', 'tpcore'),
],
[
'tg_fact_number' => esc_html__('80', 'tpcore'),
'tg_fact_title' => esc_html__('Get Rewards', 'tpcore'),
'tg_fact_desc' => esc_html__('Yes we did it asap software', 'tpcore'),
],
],
]
);
$this->end_controls_section();
// TAB_STYLE
$this->start_controls_section(
'section_style',
[
'label' => __( 'Style', 'tpcore' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'text_transform',
[
'label' => __( 'Text Transform', 'tpcore' ),
'type' => Controls_Manager::SELECT,
'default' => '',
'options' => [
'' => __( 'None', 'tpcore' ),
'uppercase' => __( 'UPPERCASE', 'tpcore' ),
'lowercase' => __( 'lowercase', 'tpcore' ),
'capitalize' => __( 'Capitalize', 'tpcore' ),
],
'selectors' => [
'{{WRAPPER}} .title' => 'text-transform: {{VALUE}};',
],
]
);
$this->end_controls_section();
// style tab here
$this->start_controls_section(
'_section_style_content',
[
'label' => __( 'Title / Content', 'tocore' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_responsive_control(
'content_padding',
[
'label' => __( 'Content Padding', 'tocore' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', 'em', '%' ],
'selectors' => [
'{{WRAPPER}} .tp-el-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_group_control(
Group_Control_Background::get_type(),
[
'name' => 'content_background',
'selector' => '{{WRAPPER}} .tp-el-content',
'exclude' => [
'image'
]
]
);
// Title
$this->add_control(
'_heading_title',
[
'type' => Controls_Manager::HEADING,
'label' => __( 'Title', 'tocore' ),
'separator' => 'before'
]
);
$this->add_responsive_control(
'title_spacing',
[
'label' => __( 'Bottom Spacing', 'tocore' ),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'selectors' => [
'{{WRAPPER}} .tp-el-title' => 'margin-bottom: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_control(
'title_color',
[
'label' => __( 'Text Color', 'tocore' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .tp-el-title' => 'color: {{VALUE}}',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'title',
'selector' => '{{WRAPPER}} .tp-el-title',
'scheme' => Typography::TYPOGRAPHY_2,
]
);
// Subtitle
$this->add_control(
'_heading_subtitle',
[
'type' => Controls_Manager::HEADING,
'label' => __( 'Subtitle', 'tocore' ),
'separator' => 'before'
]
);
$this->add_responsive_control(
'subtitle_spacing',
[
'label' => __( 'Bottom Spacing', 'tocore' ),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'selectors' => [
'{{WRAPPER}} .tp-el-subtitle' => 'margin-bottom: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_control(
'subtitle_color',
[
'label' => __( 'Text Color', 'tocore' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .tp-el-subtitle' => 'color: {{VALUE}}',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'subtitle',
'selector' => '{{WRAPPER}} .tp-el-subtitle',
'scheme' => Typography::TYPOGRAPHY_3,
]
);
// description
$this->add_control(
'_content_description',
[
'type' => Controls_Manager::HEADING,
'label' => __( 'Description', 'tocore' ),
'separator' => 'before'
]
);
$this->add_responsive_control(
'description_spacing',
[
'label' => __( 'Bottom Spacing', 'tocore' ),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'selectors' => [
'{{WRAPPER}} .tp-el-content p' => 'margin-bottom: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_control(
'description_color',
[
'label' => __( 'Text Color', 'tocore' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .tp-el-content p' => 'color: {{VALUE}}',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'description',
'selector' => '{{WRAPPER}} .tp-el-content p',
'scheme' => Typography::TYPOGRAPHY_4,
]
);
$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();
?>
<script>
jQuery(document).ready(function($){
/*=============================================
= easyPieChart Active =
=============================================*/
function easyPieChart() {
$('.fact-item').on('inview', function (event, isInView) {
if (isInView) {
$('.chart').easyPieChart({
scaleLength: 0,
lineWidth: 6,
trackWidth: 6,
size: 70,
lineCap: 'round',
rotate: 360,
trackColor: '#F4F4F4',
barColor:'#FAA432',
});
}
});
};
easyPieChart();
});
</script>
<!-- fact-area -->
<section class="fact-area">
<div class="container">
<div class="fact-items-wrapper">
<div class="row g-0 justify-content-center">
<?php foreach ($settings['tg_fact_list'] as $item) : ?>
<div class="col-lg-4 col-md-6 col-sm-9">
<div class="fact-item">
<div class="chart" data-percent="<?php echo tp_kses( $item['tg_fact_number'] ); ?>">
<span class="percentage"><?php echo tp_kses( $item['tg_fact_number'] ); ?><?php if (!empty( $item['tg_fact_formatting']) ): ?><small><?php echo tp_kses( $item['tg_fact_formatting'] ); ?></small><?php endif; ?>
</span>
</div>
<div class="fact-content">
<?php if (!empty( $item['tg_fact_title']) ): ?>
<h4 class="title"><?php echo tp_kses( $item['tg_fact_title'] ); ?></h4>
<?php endif; ?>
<?php if (!empty( $item['tg_fact_desc']) ): ?>
<span><?php echo tp_kses( $item['tg_fact_desc'] ); ?></span>
<?php endif; ?>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
</div>
</section>
<!-- fact-area-end -->
<?php
}
}
$widgets_manager->register( new tg_fact() );