D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
etb1lp46s9ed
/
www
/
lalpathamroha.site
/
wp-content
/
plugins
/
tp-core
/
include
/
elementor
/
Filename :
skill.php
back
Copy
<?php namespace TPCore\Widgets; use Elementor\Widget_Base; use \Elementor\Control_Media; use \Elementor\Group_Control_Background; use \Elementor\Group_Control_Css_Filter; use \Elementor\Repeater; use \Elementor\Controls_Manager; use \Elementor\Group_Control_Border; use \Elementor\Group_Control_Image_Size; use \Elementor\Group_Control_Typography; Use \Elementor\Core\Schemes\Typography; use \Elementor\Utils; use \Elementor\Group_Control_Box_Shadow; use TPCore\Elementor\Controls\Group_Control_TPBGGradient; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * Tp Core * * Elementor widget for hello world. * * @since 1.0.0 */ class TP_Skill extends Widget_Base { /** * Retrieve the widget name. * * @since 1.0.0 * * @access public * * @return string Widget name. */ public function get_name() { return 'skill-bar'; } /** * Retrieve the widget title. * * @since 1.0.0 * * @access public * * @return string Widget title. */ public function get_title() { return __( 'Skill', '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() { // layout Panel $this->start_controls_section( 'tp_layout', [ 'label' => esc_html__('Design Layout', 'tpcore'), ] ); $this->add_control( 'tp_design_style', [ 'label' => esc_html__('Select Layout', 'tpcore'), 'type' => Controls_Manager::SELECT, 'options' => [ 'layout-1' => esc_html__('Layout 1', 'tpcore'), 'layout-2' => esc_html__('Layout 2', 'tpcore'), ], 'default' => 'layout-1', ] ); $this->end_controls_section(); // tp_section_title $this->start_controls_section( 'tp_section_title', [ 'label' => esc_html__('Title & Content', 'tpcore'), ] ); $this->add_control( 'tp_section_title_show', [ 'label' => esc_html__( 'Section Title & Content', 'tpcore' ), 'type' => Controls_Manager::SWITCHER, 'label_on' => esc_html__( 'Show', 'tpcore' ), 'label_off' => esc_html__( 'Hide', 'tpcore' ), 'return_value' => 'yes', 'default' => 'yes', ] ); $this->add_control( 'tp_sub_title', [ 'label' => esc_html__('Sub Title', 'tpcore'), 'description' => tp_get_allowed_html_desc( 'basic' ), 'type' => Controls_Manager::TEXT, 'default' => esc_html__('TP Sub Title', 'tpcore'), 'placeholder' => esc_html__('Type Sub Heading Text', 'tpcore'), 'label_block' => true, ] ); $this->add_control( 'tp_title', [ 'label' => esc_html__('Title', 'tpcore'), 'description' => tp_get_allowed_html_desc( 'intermediate' ), 'type' => Controls_Manager::TEXT, 'default' => esc_html__('TP Title Here', 'tpcore'), 'placeholder' => esc_html__('Type Heading Text', 'tpcore'), 'label_block' => true, ] ); $this->add_control( 'tp_description', [ 'label' => esc_html__('Description', 'tpcore'), 'description' => tp_get_allowed_html_desc( 'intermediate' ), 'type' => Controls_Manager::TEXTAREA, 'default' => esc_html__('TP section description here', 'tpcore'), 'placeholder' => esc_html__('Type section description here', 'tpcore'), ] ); $this->add_control( 'tp_title_tag', [ 'label' => esc_html__('Title HTML Tag', 'tpcore'), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'h1' => [ 'title' => esc_html__('H1', 'tpcore'), 'icon' => 'eicon-editor-h1' ], 'h2' => [ 'title' => esc_html__('H2', 'tpcore'), 'icon' => 'eicon-editor-h2' ], 'h3' => [ 'title' => esc_html__('H3', 'tpcore'), 'icon' => 'eicon-editor-h3' ], 'h4' => [ 'title' => esc_html__('H4', 'tpcore'), 'icon' => 'eicon-editor-h4' ], 'h5' => [ 'title' => esc_html__('H5', 'tpcore'), 'icon' => 'eicon-editor-h5' ], 'h6' => [ 'title' => esc_html__('H6', 'tpcore'), 'icon' => 'eicon-editor-h6' ] ], 'default' => 'h2', 'toggle' => false, ] ); $this->add_responsive_control( 'tp_align', [ 'label' => esc_html__('Alignment', 'tpcore'), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => esc_html__('Left', 'tpcore'), 'icon' => 'eicon-text-align-left', ], 'center' => [ 'title' => esc_html__('Center', 'tpcore'), 'icon' => 'eicon-text-align-center', ], 'right' => [ 'title' => esc_html__('Right', 'tpcore'), 'icon' => 'eicon-text-align-right', ], ], 'default' => 'left', 'toggle' => false, 'selectors' => [ '{{WRAPPER}}' => 'text-align: {{VALUE}};' ] ] ); $this->end_controls_section(); // tp_video $this->start_controls_section( 'tp_video', [ 'label' => esc_html__('Video', 'tpcore'), ] ); $this->add_control( 'tp_video_text', [ 'label' => esc_html__('Title', 'tpcore'), 'type' => Controls_Manager::TEXT, 'default' => esc_html__( 'Play', 'tpcore' ), 'label_block' => true, ] ); $this->add_control( 'tp_video_url', [ 'label' => esc_html__('Video', 'tpcore'), 'type' => Controls_Manager::TEXT, 'default' => 'https://www.youtube.com/watch?v=AjgD3CvWzS0', 'title' => esc_html__('Video url', 'tpcore'), 'label_block' => true, ] ); $this->end_controls_section(); // _tp_image $this->start_controls_section( '_tp_image_section', [ 'label' => esc_html__('Thumbnail', 'tpcore'), ] ); $this->add_control( 'tp_image', [ 'label' => esc_html__( 'Choose Image', 'tpcore' ), 'type' => \Elementor\Controls_Manager::MEDIA, 'default' => [ 'url' => \Elementor\Utils::get_placeholder_image_src(), ], ] ); $this->add_group_control( Group_Control_Image_Size::get_type(), [ 'name' => 'tp_image_size', 'default' => 'full', 'exclude' => [ 'custom' ] ] ); $this->end_controls_section(); // Skill $this->start_controls_section( 'tp_progress_bar', [ 'label' => esc_html__('Skill Bar', 'tpcore'), ] ); $repeater = new Repeater(); $repeater->add_control( 'name', [ 'type' => Controls_Manager::TEXT, 'label' => esc_html__( 'Name', 'tpcore' ), 'default' => esc_html__( 'Design', 'tpcore' ), 'placeholder' => esc_html__( 'Type a skill name', 'tpcore' ), ] ); $repeater->add_control( 'level', [ 'label' => esc_html__( 'Level (Out Of 100)', 'tpcore' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'unit' => '%', 'size' => 95 ], 'size_units' => ['%'], 'range' => [ '%' => [ 'min' => 0, 'max' => 100, ], ], 'dynamic' => [ 'active' => true, ] ] ); $repeater->add_control( 'want_customize', [ 'label' => esc_html__( 'Want To Customize?', 'tpcore' ), 'type' => Controls_Manager::SWITCHER, 'label_on' => esc_html__( 'Yes', 'tpcore' ), 'label_off' => esc_html__( 'No', 'tpcore' ), 'return_value' => 'yes', 'description' => esc_html__( 'You can customize this skill bar color from here or customize from Style tab', 'tpcore' ), 'style_transfer' => true, ] ); $repeater->add_control( 'title_color', [ 'label' => esc_html__( 'Title Color', 'tpcore' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}} .title' => 'color: {{VALUE}};', ], 'condition' => ['want_customize' => 'yes'], 'style_transfer' => true, ] ); $repeater->add_control( 'percentage_color', [ 'label' => esc_html__( 'Percentage label Color', 'tpcore' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}} .percentage' => 'color: {{VALUE}};', ], 'condition' => ['want_customize' => 'yes'], 'style_transfer' => true, ] ); $repeater->add_group_control( Group_Control_TPBGGradient::get_type(), [ 'name' => 'level_color', 'label' => esc_html__('Level Color', 'tpcore'), 'selector' => '{{WRAPPER}} {{CURRENT_ITEM}} .progress-bar', 'condition' => ['want_customize' => 'yes'], ] ); $repeater->add_control( 'base_color', [ 'label' => esc_html__( 'Base Color', 'tpcore' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}} .progress' => 'background-color: {{VALUE}};', ], 'condition' => ['want_customize' => 'yes'], ] ); $this->add_control( 'skills', [ 'show_label' => false, 'type' => Controls_Manager::REPEATER, 'fields' => $repeater->get_controls(), 'title_field' => '<# print((name || level.size) ? (name || "Skill") + " - " + level.size + level.unit : "Skill - 0%") #>', 'default' => [ [ 'name' => 'Design', 'level' => ['size' => 95, 'unit' => '%'] ], [ 'name' => 'UX', 'level' => ['size' => 85, 'unit' => '%'] ], [ 'name' => 'Coding', 'level' => ['size' => 75, 'unit' => '%'] ], [ 'name' => 'Speed', ], [ 'name' => 'Passion', 'level' => ['size' => 90, 'unit' => '%'] ] ] ] ); $this->add_control( 'view', [ 'type' => Controls_Manager::SELECT, 'label' => esc_html__( 'Layout', 'tpcore' ), 'separator' => 'before', 'default' => 'progress-bar--1', 'options' => [ 'progress-bar--2' => esc_html__( 'Thin', 'tpcore' ), 'progress-bar--1' => esc_html__( 'Normal', 'tpcore' ), 'progress-bar--3' => esc_html__( 'Bold', 'tpcore' ), ], 'style_transfer' => true, ] ); $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(); } /** * 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(); ?> <?php if ( $settings['tp_design_style'] == 'layout-2' ): ?> <?php foreach ( $settings['skills'] as $index => $skill ) : ?> <div class="team__skill-progress-item fix"> <h4><?php echo esc_html( $skill['name'] ); ?></h4> <span class="progress-count"><?php echo esc_attr( $skill['level']['size'] ); ?>%</span> <div class="progress"> <div class="progress-bar wow slideInLeft" data-wow-duration="1s" data-wow-delay=".3s" role="progressbar" data-width="79%" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"> </div> </div> </div> <?php endforeach; ?> <?php else: if ( !empty($settings['tp_image']['url']) ) { $tp_image = !empty($settings['tp_image']['id']) ? wp_get_attachment_image_url( $settings['tp_image']['id'], $settings['tp_image_size_size']) : $settings['tp_image']['url']; $tp_image_alt = get_post_meta($settings["tp_image"]["id"], "_wp_attachment_image_alt", true); } $this->add_render_attribute('title_args', 'class', 'section__title mb-20 tp-el-title'); ?> <section class="video__area black-bg p-relative"> <div class="video__thumb include-bg" style="background-image:url(<?php echo esc_url($tp_image); ?>);"> <?php if ( !empty($settings['tp_video_url']) ) : ?> <a href="<?php echo esc_url($settings["tp_video_url"]); ?>" class="video__play-btn pulse-btn popup-video"><?php echo tp_kses($settings["tp_video_text"]); ?></a> <?php endif; ?> </div> <div class="container"> <div class="row"> <div class="col-xxl-6 offset-xxl-6 col-xl-7 offset-xl-5 col-lg-6 offset-lg-6"> <div class="video__wrapper pt-110 pb-120 pl-80"> <div class="section__title-wrapper section-titile-white mb-60"> <?php if ( !empty($settings['tp_sub_title']) ) : ?> <span class="section__title-pre tp-el-subtitle"> <?php echo tp_kses( $settings['tp_sub_title'] ); ?> </span> <?php endif; ?> <?php if ( !empty($settings['tp_title' ]) ) : printf( '<%1$s %2$s>%3$s</%1$s>', tag_escape( $settings['tp_title_tag'] ), $this->get_render_attribute_string( 'title_args' ), tp_kses( $settings['tp_title' ] ) ); endif; ?> <?php if ( !empty($settings['tp_description']) ) : ?> <p><?php echo tp_kses( $settings['tp_description'] ); ?></p> <?php endif; ?> </div> <div class="video__progress"> <?php foreach ( $settings['skills'] as $index => $skill ) : ?> <div class="video__progress-item fix mb-30 <?php echo esc_attr( $settings['view'] ); ?> elementor-repeater-item-<?php echo $skill['_id']; ?>"> <h4><?php echo esc_html( $skill['name'] ); ?></h4> <span class="progress-count"><?php echo esc_attr( $skill['level']['size'] ); ?>%</span> <div class="progress"> <div class="progress-bar wow slideInLeft" data-wow-duration="1s" data-wow-delay=".3s" role="progressbar" data-width="<?php echo esc_attr( $skill['level']['size'] ); ?>%" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"> </div> </div> </div> <?php endforeach; ?> </div> </div> </div> </div> </div> </section> <?php endif; ?> <?php } } $widgets_manager->register( new TP_Skill() );