𝗖𝗨𝗥𝗥𝗘𝗡𝗧 𝗙𝗜𝗟𝗘 : /home/tdhomesa/public_html/wp-content/plugins/elementor-selio/widgets//top-bar.php
<?php
namespace ElementorSelio\Widgets;
use Elementor\Widget_Base;
use Elementor\Controls_Manager;
use Elementor\Utils;
use Elementor\Editor;
use Elementor\Plugin;
use Top_Nav_Menu_Walker;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
* @since 1.1.0
*/
class Top_Bar extends Widget_Base {
public static $multiple_instance=false;
// Default widget settings
private $defaults = array(
/*array(
'phone_number' => '(647) 346-0855',
'link' => '#',
),
array(
'address' => 'CF Fairview Mall, Toronto, ON',
'link' => '#',
),
array(
'social_1_icon' => 'fa-facebook',
'link' => '#',
),
array(
'social_2_icon' => 'fa-twitter',
'link' => '#',
),
array(
'social_3_icon' => 'fa-instagram',
'link' => '#',
),
array(
'social_4_icon' => 'fa-linkedin',
'link' => '#',
),*/
);
private $items_num = 6;
/**
* Retrieve the widget name.
*
* @since 1.1.0
*
* @access public
*
* @return string Widget name.
*/
public function get_name() {
return 'top-bar';
}
/**
* Retrieve the widget title.
*
* @since 1.1.0
*
* @access public
*
* @return string Widget title.
*/
public function get_title() {
return __( 'Top Bar', 'selio-blocks' );
}
/**
* Retrieve the widget icon.
*
* @since 1.1.0
*
* @access public
*
* @return string Widget icon.
*/
public function get_icon() {
return 'fa fa-address-card';
}
/**
* 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.1.0
*
* @access public
*
* @return array Widget categories.
*/
public function get_categories() {
return [ 'winter-themes' ];
}
/**
* Register the widget controls.
*
* Adds different input fields to allow the user to change and customize the widget settings.
*
* @since 1.1.0
*
* @access protected
*/
protected function register_controls() {
$this->start_controls_section(
'section_elements',
[
'label' => __( 'Block elements', 'selio-blocks' ),
]
);
$this->add_control(
'phone_title',
[
'label' => esc_html__('Share Links', 'elementinvader-addons-for-elementor'),
'type' => Controls_Manager::HEADING,
'separator' => 'before',
]
);
$this->add_control(
'phone_edit',
[
'type' => Controls_Manager::RAW_HTML,
'raw' => sprintf(__('<a href="%s" target="_blank">Open to Edit</a>', 'elementinvader-addons-for-elementor'), esc_url(add_query_arg(['autofocus[section]'=>'selio_share_plugin'], admin_url( 'customize.php' ) ))),
'separator' => 'after',
'content_classes' => 'wl-panel-alert wl-panel-alert-warning',
]
);
$this->add_control(
'share_title',
[
'label' => esc_html__('Contact Data', 'elementinvader-addons-for-elementor'),
'type' => Controls_Manager::HEADING,
'separator' => 'before',
]
);
$this->add_control(
'share_edit',
[
'type' => Controls_Manager::RAW_HTML,
'raw' => sprintf(__('<a href="%s" target="_blank">Open to Edit</a>', 'elementinvader-addons-for-elementor'), esc_url(add_query_arg(['autofocus[section]'=>'selio_contact'], admin_url( 'customize.php' ) ))),
'separator' => 'after',
'content_classes' => 'wl-panel-alert wl-panel-alert-warning',
]
);
/*
for($i=0;$i<$this->items_num;$i++)
{
$item_elements = $this->defaults[0];
if(isset($this->defaults[$i]))
{
$item_elements = $this->defaults[$i];
}
foreach($item_elements as $key=>$val)
{
$gen_item = 'item_'.($i+1).'_'.$key;
$gen_label = ucwords(str_replace('_', ' ', $key));
if(substr_count($key, 'link') > 0)
{
$this->add_control(
$gen_item,
[
'label' => $gen_label,
'type' => Controls_Manager::TEXT,
'default' => $val,
]
);
}
elseif(substr_count($key, 'image') > 0)
{
$this->add_control(
$gen_item,
[
'label' => $gen_label,
'type' => Controls_Manager::MEDIA,
'default' => [
'url' => Utils::get_placeholder_image_src(),
]
]
);
}
elseif(substr_count($key, 'description') > 0)
{
$this->add_control(
$gen_item,
[
'label' => $gen_label,
'type' => Controls_Manager::TEXT,
'default' => $val,
]
);
}
else
{
$this->add_control(
$gen_item,
[
'label' => $gen_label,
'type' => Controls_Manager::TEXT,
'default' => $val,
]
);
}
}
}
*/
$this->end_controls_section();
}
/**
* Render the widget output on the frontend.
*
* Written in PHP and used to generate the final HTML.
*
* @since 1.1.0
*
* @access protected
*/
protected function render() {
$settings = $this->get_settings();
//dump($settings);
sw_win_load_ci_frontend();
$CI = &get_instance();
$CI->load->model('treefield_m');
$treefield_list = $CI->treefield_m->get_all_list(array('field_id'=>2,'level'=>'0'), 40);
$langs = sw_get_languages();
?>
<h2 class="vis-hid"><?php echo esc_html__('Top bar elementor','selio-blocks');?></h2>
<div class="top-header section-top-bar <?php if(!get_theme_mod('enable_top_bar_mobile')):?> d-none d-sm-block<?php endif;?>">
<div class="container">
<div class="row justify-content-between">
<div class="col-xl-8 col-md-7 col-sm-12">
<div class="header-address">
<?php if(!get_theme_mod('country_dropdown_disable')):?>
<?php if(sw_count($treefield_list) && sw_count($treefield_list)>1): ?>
<a href='#' data-toggle="modal" data-target="#country-modal" class="country_selector">
<?php
$d_country = esc_html__('Global','selio-blocks');
if(sw_get_user_location())
$d_country = sw_get_user_location_value();
$sw_location_img = '';
if(sw_get_user_location_icon())
$sw_location_img = ' <img src="'.sw_get_user_location_icon().'" />';
?>
<?php if(sw_get_user_location_icon()):?>
<span><?php echo $sw_location_img;?> <?php echo $d_country;?></span>
<?php else:?>
<i class="fa fa-globe"></i><span><?php echo esc_html__('Select country','selio-blocks'); ?>: <?php echo $sw_location_img;?> <?php echo $d_country;?></span>
<?php endif;?>
</a>
<?php endif;?>
<?php endif;?>
<?php if(!get_theme_mod('tagline_enable')): ?>
<?php if (get_theme_mod('selio_phone_setting') != ""):?>
<a href="tel://<?php echo esc_attr(urlencode(get_theme_mod('selio_phone_setting')));?>">
<i class="la la-phone-square"></i>
<span><?php echo esc_html(get_theme_mod('selio_phone_setting'));?></span>
</a>
<?php endif; ?>
<?php if (get_theme_mod('selio_address_setting') != ""):?>
<a href="#">
<i class="la la-map-marker"></i>
<span><?php echo esc_html(get_theme_mod('selio_address_setting'));?></span>
</a>
<?php endif; ?>
<?php else: ?>
<span class='h-text'><?php echo esc_html(get_bloginfo('description'));?></span>
<?php endif; ?>
</div>
</div>
<?php if (function_exists('sw_count') && count($langs) > 1):?>
<div class="col-xl-3 col-lg-3 col-md-2 col-sm-6 col-6">
<?php else:?>
<div class="resp-grid din">
<?php endif;?>
<?php if (shortcode_exists('sw_win_selio_share_list')): ?>
<div class="header-social">
<?php echo do_shortcode('[sw_win_selio_share_list]'); ?>
</div>
<?php endif;?>
</div>
<?php if(!get_theme_mod('country_dropdown_disable')):?>
<div class="resp-grid"><?php sw_generate_currency_menu();?></div>
<?php endif;?>
<?php
if (function_exists('sw_count') && count($langs) > 1):
?>
<div class="col-xl-3 col-lg-3 col-md-2 col-sm-6 col-6">
<div class="language-selector">
<div class="drop-menu links">
<div class="select">
<span><img src="<?php echo esc_url(SELIO_IMAGES . '/flags/' . sw_current_language() . '.png'); ?>" alt="<?php esc_viewe(sw_get_language_name(sw_current_language())); ?>"><?php esc_viewe(sw_get_language_name(sw_current_language())); ?></span>
<i class="la la-caret-down"></i>
</div>
<input type="hidden" name="gender">
<ul class="dropeddown" style="display: none;">
<?php foreach ($langs as $lang): if ($lang['lang_code'] == sw_current_language()) continue; ?>
<li>
<a class="dropdown-item" href="<?php echo esc_url(sw_get_language_url($lang['lang_code'])); ?>">
<img src="<?php echo esc_url(SELIO_IMAGES . '/flags/' . $lang['lang_code'] . '.png'); ?>" alt="<?php echo esc_html($lang['title']); ?>" /> <?php echo esc_html($lang['title']); ?>
</a>
</li>
<?php endforeach; ?>
</ul>
</div>
</div><!--language-selector end-->
</div>
<?php endif; ?>
</div>
</div>
</div>
<?php if(Plugin::$instance->editor->is_edit_mode()): ?>
<script>
</script>
<?php endif; ?>
<?php
self::$multiple_instance = true;
}
}