HEX
Server: LiteSpeed
System: Linux premium221.web-hosting.com 4.18.0-553.45.1.lve.el8.x86_64 #1 SMP Wed Mar 26 12:08:09 UTC 2025 x86_64
User: madepabj (2566)
PHP: 8.3.26
Disabled: NONE
Upload Files
File: /home/madepabj/gamepointpk.com/wp-content/plugins/groovy-functions/widgets/social.php
<?php

$widget_id = 'epcl_social';

$args = array(
    'title'       => esc_html_x('(EP) Social', 'admin', 'groovy'),
    'classname'   => '',
    'description' => esc_html_x('Display your social profiles.', 'admin', 'groovy'),
    'fields'      => array(
        array(
            'id' => 'title',
            'type' => 'text',
            'title' => esc_html_x('Title:', 'admin', 'groovy'),
            'desc' => ''.esc_html_x('Don\'t forget to fill your social profiles', 'admin', 'groovy').' <a href="'.admin_url().'admin.php?page=epcl-theme-options#tab=social-profiles">'.esc_html_x('here.', 'admin', 'groovy').'</a>',
            'default' => 'Follow me!'
        ),
    )
);

$defaults = array(
    'enable_twitter' => true,
    'enable_facebook' => true,
    'enable_instagram' => true,
    'enable_linkedin' => true,
    'enable_pinterest' => true,
    'enable_dribbble' => true,
    'enable_tumblr' => true,
    'enable_youtube' => true,
    'enable_flickr' => true,
    'enable_twitch' => true,
    'enable_vk' => true,
    'enable_telegram' => true,
    'enable_tiktok' => true,
    'enable_email' => false,
    'enable_rss' => true
);

foreach( $defaults as $key => $value ){
    $label = 'Enable '.ucfirst( str_replace('enable_', '', $key) );
    $args['fields'][] = array(
        'id' => $key,
        'type' => 'checkbox',
        'class' => 'epcl-compact',
        // 'title' => esc_html_x( 'Twitter', 'admin', 'groovy'),
        'label'   => $label,
        'default' => $value
    );
}

function epcl_social( $args, $instance ){
    // WP 5.9 Patch: always disable widget preview in the backend
    if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) {
        return false;
    }
    global $epcl_theme;
    extract($args);
    $title = apply_filters('widget_title', $instance['title']); 

    echo $before_widget;

        if($title) echo $before_title.$title.$after_title;
        echo '<div class="icons">';

            foreach( $instance as $key => $value ){
                if($key != 'title' && $value == '1'){
                    $id = str_replace('enable_', '', $key);
                    $icon = '<i class="fa fa-'.$id.'"></i>';
                    $url = $epcl_theme[$id.'_url'];
                    // Change icon and sanitize email
                    if( $id == 'email' ){
                        if( is_email($url) ){
                            $url = antispambot('mailto:'.$url);
                        }
                        $icon = '<i class="fa fa-envelope"></i>';
                    }
                    // Fontawesome do not include Tiktok, so replace with SVG icon instead.
                    if( $id == 'tiktok' ){
                        $icon = '<svg><use xlink:href="#tiktok-icon"></use></svg>';
                    }
                    echo '<a href="'.$url.'" class="'.$id.'" target="_blank" rel="nofollow noopener"><span class="icon '.$id.'">'.$icon.'</span> <span class="name">'.ucfirst($id).'</span></a>';
                }
                
            }
          
        echo '</div>';

    echo $after_widget;
}   

$wp_widget_factory->register( EPCL_CreateWidget::instance( $widget_id, $args ) );