| Server IP : 104.26.5.103 / Your IP : 216.73.216.4 Web Server : nginx/1.27.1 System : Linux in-5 5.15.0-143-generic #153-Ubuntu SMP Fri Jun 13 19:10:45 UTC 2025 x86_64 User : arabianexpress ( 1872) PHP Version : 8.0.30 Disable Function : exec,passthru,shell_exec,system,proc_open,popen,parse_ini_file,show_source MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /storage/v9321/leapdubai/public_html/wp-content/plugins/printx-core/include/elementor/ |
Upload File : |
<?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 {
use \TPCore\Widgets\TPCoreElementFunctions;
/**
* 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-f' => 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-in' => 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(){
$this->register_controls_section();
$this->style_tab_content();
}
protected function register_controls_section() {
// 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'),
'layout-3' => esc_html__('Layout 3', '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-f'
],
[
'link' => ['url' => 'https://linkedin.com/'],
'name' => 'linkedin-in'
],
[
'link' => ['url' => 'https://twitter.com/'],
'name' => 'twitter'
]
],
]
);
$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',
],
],
'toggle' => false,
'selectors' => [
'{{WRAPPER}} .box-align' => 'text-align: {{VALUE}};'
]
]
);
$this->end_controls_section();
}
// style_tab_content
protected function style_tab_content() {
$this->tp_section_style_controls('social_section', 'Section Style', '.ele-section');
$this->tp_link_controls_style('social_icon', 'Social - Icon', '.tp-el-sicon');
}
/**
* 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' ): ?>
<div class="tp-copyright__social-box d-none d-lg-block box-alig">
<?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 tp-el-sicon "><i class="fa-brands fa-%s" aria-hidden="true"></i></a>',
$url,
esc_attr($profile['_id']),
esc_attr($icon)
);
endforeach;
?>
</div>
<?php elseif ( $settings['tp_design_style'] === 'layout-3' ) : ?>
<div class="tp-footer-2__social-box">
<?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 tp-el-sicon "><i class="fa-brands fa-%s" aria-hidden="true"></i></a>',
$url,
esc_attr($profile['_id']),
esc_attr($icon)
);
endforeach;
?>
</div>
<?php else : ?>
<div class="tp-footer__social-box box-align">
<?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 tp-el-sicon "><i class="fa-brands fa-%s" aria-hidden="true"></i></a>',
$url,
esc_attr($profile['_id']),
esc_attr($icon)
);
endforeach;
?>
</div>
<?php endif;
}
}
$widgets_manager->register( new TP_Social() );