D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
etb1lp46s9ed
/
www
/
lalpathamroha.site
/
wp-content
/
plugins
/
tp-core
/
include
/
elementor
/
Filename :
social.php
back
Copy
<?php namespace TPCore\Widgets; use Elementor\Widget_Base; use Elementor\Controls_Manager; use \Elementor\Group_Control_Background; use \Elementor\Group_Control_Image_Size; use \Elementor\Repeater; use \Elementor\Utils; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * Tp Core * * Elementor widget for hello world. * * @since 1.0.0 */ class TP_Social extends Widget_Base { /** * Retrieve the widget name. * * @since 1.0.0 * * @access public * * @return string Widget name. */ public function get_name() { return 'tp-social'; } /** * Retrieve the widget title. * * @since 1.0.0 * * @access public * * @return string Widget title. */ public function get_title() { return __( 'Social', '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 static function get_profile_names() { return [ '500px' => esc_html__('500px', 'tpcore'), 'apple' => esc_html__('Apple', 'tpcore'), 'behance' => esc_html__('Behance', 'tpcore'), 'bitbucket' => esc_html__('BitBucket', 'tpcore'), 'codepen' => esc_html__('CodePen', 'tpcore'), 'delicious' => esc_html__('Delicious', 'tpcore'), 'deviantart' => esc_html__('DeviantArt', 'tpcore'), 'digg' => esc_html__('Digg', 'tpcore'), 'dribbble' => esc_html__('Dribbble', 'tpcore'), 'email' => esc_html__('Email', 'tpcore'), 'facebook' => esc_html__('Facebook', 'tpcore'), 'flickr' => esc_html__('Flicker', 'tpcore'), 'foursquare' => esc_html__('FourSquare', 'tpcore'), 'github' => esc_html__('Github', 'tpcore'), 'houzz' => esc_html__('Houzz', 'tpcore'), 'instagram' => esc_html__('Instagram', 'tpcore'), 'jsfiddle' => esc_html__('JS Fiddle', 'tpcore'), 'linkedin' => esc_html__('LinkedIn', 'tpcore'), 'medium' => esc_html__('Medium', 'tpcore'), 'pinterest' => esc_html__('Pinterest', 'tpcore'), 'product-hunt' => esc_html__('Product Hunt', 'tpcore'), 'reddit' => esc_html__('Reddit', 'tpcore'), 'slideshare' => esc_html__('Slide Share', 'tpcore'), 'snapchat' => esc_html__('Snapchat', 'tpcore'), 'soundcloud' => esc_html__('SoundCloud', 'tpcore'), 'spotify' => esc_html__('Spotify', 'tpcore'), 'stack-overflow' => esc_html__('StackOverflow', 'tpcore'), 'tripadvisor' => esc_html__('TripAdvisor', 'tpcore'), 'tumblr' => esc_html__('Tumblr', 'tpcore'), 'twitch' => esc_html__('Twitch', 'tpcore'), 'twitter' => esc_html__('Twitter', 'tpcore'), 'vimeo' => esc_html__('Vimeo', 'tpcore'), 'vk' => esc_html__('VK', 'tpcore'), 'website' => esc_html__('Website', 'tpcore'), 'whatsapp' => esc_html__('WhatsApp', 'tpcore'), 'wordpress' => esc_html__('WordPress', 'tpcore'), 'xing' => esc_html__('Xing', 'tpcore'), 'yelp' => esc_html__('Yelp', 'tpcore'), 'youtube' => esc_html__('YouTube', 'tpcore'), ]; } 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(); $this->start_controls_section( '_section_social', [ 'label' => esc_html__('Social Profiles', 'tpcore'), 'tab' => Controls_Manager::TAB_CONTENT, ] ); $repeater = new Repeater(); $repeater->add_control( 'name', [ 'label' => esc_html__('Profile Name', 'tpcore'), 'type' => Controls_Manager::SELECT2, 'label_block' => true, 'select2options' => [ 'allowClear' => false, ], 'options' => self::get_profile_names() ] ); $repeater->add_control( 'link', [ 'label' => esc_html__('Profile Link', 'tpcore'), 'placeholder' => esc_html__('Add your profile link', 'tpcore'), 'type' => Controls_Manager::URL, 'label_block' => true, 'autocomplete' => false, 'show_external' => false, 'condition' => [ 'name!' => 'email' ], 'dynamic' => [ 'active' => true, ] ] ); $this->add_control( 'profiles', [ 'show_label' => false, 'type' => Controls_Manager::REPEATER, 'fields' => $repeater->get_controls(), 'title_field' => '<# print(name.slice(0,1).toUpperCase() + name.slice(1)) #>', 'default' => [ [ 'link' => ['url' => 'https://facebook.com/'], 'name' => 'facebook' ], [ 'link' => ['url' => 'https://linkedin.com/'], 'name' => 'linkedin' ], [ 'link' => ['url' => 'https://twitter.com/'], 'name' => 'twitter' ] ], ] ); $this->add_control( 'show_profiles', [ 'label' => esc_html__('Show Profiles', 'tpcore'), 'type' => Controls_Manager::SWITCHER, 'label_on' => esc_html__('Show', 'tpcore'), 'label_off' => esc_html__('Hide', 'tpcore'), 'return_value' => 'yes', 'default' => 'yes', 'separator' => 'before', 'style_transfer' => true, ] ); $this->add_control( 'tp_profile_title', [ 'label' => esc_html__('Profile Title', 'tpcore'), 'description' => tp_get_allowed_html_desc( 'basic' ), 'type' => Controls_Manager::TEXT, 'default' => esc_html__('TP Profile Title', 'tpcore'), 'placeholder' => esc_html__('Type Sub Heading Text', 'tpcore'), 'label_block' => true, ] ); $this->add_responsive_control( 'align', [ 'label' => __( 'Alignment', 'tpcore' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => __( 'Left', 'tpcore' ), 'icon' => 'eicon-text-align-left', ], 'center' => [ 'title' => __( 'Center', 'tpcore' ), 'icon' => 'eicon-text-align-center', ], 'right' => [ 'title' => __( 'Right', 'tpcore' ), 'icon' => 'eicon-text-align-right', ], ], 'toggle' => true, 'selectors' => [ '{{WRAPPER}} .ft-social' => 'text-align: {{VALUE}};' ] ] ); $this->end_controls_section(); $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(); ?> <!-- style 2 --> <?php if ( $settings['tp_design_style'] === 'layout-2' ): ?> <?php if ($settings['show_profiles'] && is_array($settings['profiles'])) : ?> <div class="ft-social ft-social-2 ft-social-12"> <?php foreach ($settings['profiles'] as $profile) : $icon = $profile['name']; $url = esc_url($profile['link']['url']); printf('<a target="_blank" rel="noopener" href="%s" class="elementor-repeater-item-%s"><i class="fab fa-%s" aria-hidden="true"></i></a>', $url, esc_attr($profile['_id']), esc_attr($icon) ); endforeach; ?> </div> <?php endif; ?> <!-- style default --> <?php else : $this->add_render_attribute( 'title', 'class', 'tp-title mb-15' ); $this->add_render_attribute( 'title_team', 'class', 'tp-team__title mb-15' ); ?> <?php if ($settings['show_profiles'] && is_array($settings['profiles'])) : ?> <div class="tpoverview__social"> <?php foreach ($settings['profiles'] as $profile) : $icon = $profile['name']; $url = esc_url($profile['link']['url']); printf('<a target="_blank" rel="noopener" href="%s" class="elementor-repeater-item-%s"><i class="fab fa-%s" aria-hidden="true"></i></a>', $url, esc_attr($profile['_id']), esc_attr($icon) ); endforeach; ?> </div> <?php endif; ?> <?php endif; ?> <?php } } $widgets_manager->register( new TP_Social() );