<?php
/**
* Elementor Classes.
*
* @package motiox
*/
//namespace HFE\WidgetsManager\Widgets;
use Elementor\Controls_Manager;
use Elementor\Control_Media;
use Elementor\Utils;
use Elementor\Group_Control_Border;
use Elementor\Group_Control_Typography;
use Elementor\Group_Control_Box_Shadow;
use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
use Elementor\Core\Kits\Documents\Tabs\Global_Colors;
use Elementor\Group_Control_Image_Size;
use Elementor\Repeater;
use Elementor\Group_Control_Css_Filter;
use Elementor\Group_Control_Text_Shadow;
use Elementor\Plugin;
use Elementor\Widget_Base;
if (!defined('ABSPATH')) {
exit; // Exit if accessed directly.
}
/**
* HFE Site Logo widget
*
* HFE widget for Site Logo.
*
* @since 1.3.0
*/
class Motiox_Site_Logo extends Widget_Base {
/**
* Retrieve the widget name.
*
* @return string Widget name.
* @since 1.3.0
*
* @access public
*
*/
public function get_name() {
return 'motiox-site-logo';
}
/**
* Retrieve the widget title.
*
* @return string Widget title.
* @since 1.3.0
*
* @access public
*
*/
public function get_title() {
return __('Site Logo', 'motiox');
}
/**
* Retrieve the widget icon.
*
* @return string Widget icon.
* @since 1.3.0
*
* @access public
*
*/
public function get_icon() {
return 'eicon-logo';
}
/**
* 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.
*
* @return array Widget categories.
* @since 1.3.0
*
* @access public
*
*/
public function get_categories() {
return ['motiox-widgets'];
}
/**
* Register Site Logo controls.
*
* @since 1.5.7
* @access protected
*/
protected function register_controls() {
$this->register_content_site_logo_controls();
$this->register_site_logo_styling_controls();
$this->register_site_logo_caption_styling_controls();
}
/**
* Register Site Logo General Controls.
*
* @since 1.3.0
* @access protected
*/
protected function register_content_site_logo_controls() {
$this->start_controls_section(
'section_site_image',
[
'label' => esc_html__('Site Logo', 'motiox'),
]
);
$this->add_control(
'site_logo_fallback',
[
'label' => esc_html__('Custom Image', 'motiox'),
'type' => Controls_Manager::SWITCHER,
'yes' => esc_html__('Yes', 'motiox'),
'no' => esc_html__('No', 'motiox'),
'default' => 'no',
'render_type' => 'template',
]
);
$this->add_control(
'custom_image',
[
'label' => esc_html__('Add Image', 'motiox'),
'type' => Controls_Manager::MEDIA,
'dynamic' => [
'active' => true,
],
'default' => [
'url' => Utils::get_placeholder_image_src(),
],
'condition' => [
'site_logo_fallback' => 'yes',
],
]
);
$this->add_group_control(
Group_Control_Image_Size::get_type(),
[
'name' => 'site_logo_size',
'label' => esc_html__('Image Size', 'motiox'),
'default' => 'medium',
]
);
$this->add_responsive_control(
'align',
[
'label' => esc_html__('Alignment', 'motiox'),
'type' => Controls_Manager::CHOOSE,
'options' => [
'left' => [
'title' => esc_html__('Left', 'motiox'),
'icon' => 'fa fa-align-left',
],
'center' => [
'title' => esc_html__('Center', 'motiox'),
'icon' => 'fa fa-align-center',
],
'right' => [
'title' => esc_html__('Right', 'motiox'),
'icon' => 'fa fa-align-right',
],
],
'default' => 'center',
'selectors' => [
'{{WRAPPER}} .motiox-site-logo-container, {{WRAPPER}} .motiox-caption-width figcaption' => 'text-align: {{VALUE}};',
],
]
);
$this->add_control(
'caption_source',
[
'label' => esc_html__('Caption', 'motiox'),
'type' => Controls_Manager::SELECT,
'options' => [
'no' => esc_html__('No', 'motiox'),
'yes' => esc_html__('Yes', 'motiox'),
],
'default' => 'no',
]
);
$this->add_control(
'caption',
[
'label' => esc_html__('Custom Caption', 'motiox'),
'type' => Controls_Manager::TEXT,
'default' => '',
'placeholder' => esc_html__('Enter caption', 'motiox'),
'condition' => [
'caption_source' => 'yes',
],
'dynamic' => [
'active' => true,
],
'label_block' => true,
]
);
$this->add_control(
'link_to',
[
'label' => esc_html__('Link', 'motiox'),
'type' => Controls_Manager::SELECT,
'default' => 'default',
'options' => [
'default' => esc_html__('Default', 'motiox'),
'none' => esc_html__('None', 'motiox'),
'file' => esc_html__('Media File', 'motiox'),
'custom' => esc_html__('Custom URL', 'motiox'),
],
]
);
$this->add_control(
'link',
[
'label' => esc_html__('Link', 'motiox'),
'type' => Controls_Manager::URL,
'dynamic' => [
'active' => true,
],
'placeholder' => esc_html__('https://your-link.com', 'motiox'),
'condition' => [
'link_to' => 'custom',
],
'show_label' => false,
]
);
$this->add_control(
'open_lightbox',
[
'label' => esc_html__('Lightbox', 'motiox'),
'type' => Controls_Manager::SELECT,
'default' => 'default',
'options' => [
'default' => esc_html__('Default', 'motiox'),
'yes' => esc_html__('Yes', 'motiox'),
'no' => esc_html__('No', 'motiox'),
],
'condition' => [
'link_to' => 'file',
],
]
);
$this->add_control(
'view',
[
'label' => esc_html__('View', 'motiox'),
'type' => Controls_Manager::HIDDEN,
'default' => 'traditional',
]
);
$this->end_controls_section();
}
/**
* Register Site Image Style Controls.
*
* @since 1.3.0
* @access protected
*/
protected function register_site_logo_styling_controls() {
$this->start_controls_section(
'section_style_site_logo_image',
[
'label' => esc_html__('Site logo', 'motiox'),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_responsive_control(
'width',
[
'label' => esc_html__('Width', 'motiox'),
'type' => Controls_Manager::SLIDER,
'default' => [
'unit' => '%',
],
'tablet_default' => [
'unit' => '%',
],
'mobile_default' => [
'unit' => '%',
],
'size_units' => ['%', 'px', 'vw'],
'range' => [
'%' => [
'min' => 1,
'max' => 100,
],
'px' => [
'min' => 1,
'max' => 1000,
],
'vw' => [
'min' => 1,
'max' => 100,
],
],
'selectors' => [
'{{WRAPPER}} .motiox-site-logo .motiox-site-logo-container img' => 'width: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'space',
[
'label' => esc_html__('Max Width', 'motiox') . ' (%)',
'type' => Controls_Manager::SLIDER,
'default' => [
'unit' => '%',
],
'tablet_default' => [
'unit' => '%',
],
'mobile_default' => [
'unit' => '%',
],
'size_units' => ['%'],
'range' => [
'%' => [
'min' => 1,
'max' => 100,
],
],
'selectors' => [
'{{WRAPPER}} .motiox-site-logo img' => 'max-width: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_control(
'separator_panel_style',
[
'type' => Controls_Manager::DIVIDER,
'style' => 'thick',
]
);
$this->add_control(
'site_logo_background_color',
[
'label' => esc_html__('Background Color', 'motiox'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .motiox-site-logo-set .motiox-site-logo-container' => 'background-color: {{VALUE}};',
],
]
);
$this->add_control(
'site_logo_image_border',
[
'label' => esc_html__('Border Style', 'motiox'),
'type' => Controls_Manager::SELECT,
'default' => 'none',
'label_block' => false,
'options' => [
'none' => esc_html__('None', 'motiox'),
'solid' => esc_html__('Solid', 'motiox'),
'double' => esc_html__('Double', 'motiox'),
'dotted' => esc_html__('Dotted', 'motiox'),
'dashed' => esc_html__('Dashed', 'motiox'),
],
'selectors' => [
'{{WRAPPER}} .motiox-site-logo-container .motiox-site-logo-img' => 'border-style: {{VALUE}};',
],
]
);
$this->add_control(
'site_logo_image_border_size',
[
'label' => esc_html__('Border Width', 'motiox'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px'],
'default' => [
'top' => '1',
'bottom' => '1',
'left' => '1',
'right' => '1',
'unit' => 'px',
],
'condition' => [
'site_logo_image_border!' => 'none',
],
'selectors' => [
'{{WRAPPER}} .motiox-site-logo-container .motiox-site-logo-img' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_control(
'site_logo_image_border_color',
[
'label' => esc_html__('Border Color', 'motiox'),
'type' => Controls_Manager::COLOR,
'global' => [
'default' => Global_Colors::COLOR_PRIMARY,
],
'condition' => [
'site_logo_image_border!' => 'none',
],
'default' => '',
'selectors' => [
'{{WRAPPER}} .motiox-site-logo-container .motiox-site-logo-img' => 'border-color: {{VALUE}};',
],
]
);
$this->add_responsive_control(
'image_border_radius',
[
'label' => esc_html__('Border Radius', 'motiox'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px', '%'],
'selectors' => [
'{{WRAPPER}} .motiox-site-logo img' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_group_control(
Group_Control_Box_Shadow::get_type(),
[
'name' => 'image_box_shadow',
'exclude' => [
'box_shadow_position',
],
'selector' => '{{WRAPPER}} .motiox-site-logo img',
]
);
$this->start_controls_tabs('image_effects');
$this->start_controls_tab(
'normal',
[
'label' => esc_html__('Normal', 'motiox'),
]
);
$this->add_control(
'opacity',
[
'label' => esc_html__('Opacity', 'motiox'),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'max' => 1,
'min' => 0.10,
'step' => 0.01,
],
],
'selectors' => [
'{{WRAPPER}} .motiox-site-logo img' => 'opacity: {{SIZE}};',
],
]
);
$this->add_group_control(
Group_Control_Css_Filter::get_type(),
[
'name' => 'css_filters',
'selector' => '{{WRAPPER}} .motiox-site-logo img',
]
);
$this->end_controls_tab();
$this->start_controls_tab(
'hover',
[
'label' => esc_html__('Hover', 'motiox'),
]
);
$this->add_control(
'opacity_hover',
[
'label' => esc_html__('Opacity', 'motiox'),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'max' => 1,
'min' => 0.10,
'step' => 0.01,
],
],
'selectors' => [
'{{WRAPPER}} .motiox-site-logo:hover img' => 'opacity: {{SIZE}};',
],
]
);
$this->add_control(
'background_hover_transition',
[
'label' => esc_html__('Transition Duration', 'motiox'),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'max' => 3,
'step' => 0.1,
],
],
'selectors' => [
'{{WRAPPER}} .motiox-site-logo img' => 'transition-duration: {{SIZE}}s',
],
]
);
$this->add_group_control(
Group_Control_Css_Filter::get_type(),
[
'name' => 'css_filters_hover',
'selector' => '{{WRAPPER}} .motiox-site-logo:hover img',
]
);
$this->add_control(
'hover_animation',
[
'label' => esc_html__('Hover Animation', 'motiox'),
'type' => Controls_Manager::HOVER_ANIMATION,
]
);
$this->end_controls_tab();
$this->end_controls_tabs();
$this->end_controls_section();
}
/**
* Register Site Logo style Controls.
*
* @since 1.3.0
* @access protected
*/
protected function register_site_logo_caption_styling_controls() {
$this->start_controls_section(
'section_style_caption',
[
'label' => esc_html__('Caption', 'motiox'),
'tab' => Controls_Manager::TAB_STYLE,
'condition' => [
'caption_source!' => 'none',
],
]
);
$this->add_control(
'text_color',
[
'label' => esc_html__('Text Color', 'motiox'),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .widget-image-caption' => 'color: {{VALUE}};',
],
'global' => [
'default' => Global_Colors::COLOR_TEXT,
],
]
);
$this->add_control(
'caption_background_color',
[
'label' => esc_html__('Background Color', 'motiox'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .widget-image-caption' => 'background-color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'caption_typography',
'selector' => '{{WRAPPER}} .widget-image-caption',
'global' => [
'default' => Global_Typography::TYPOGRAPHY_TEXT,
],
]
);
$this->add_group_control(
Group_Control_Text_Shadow::get_type(),
[
'name' => 'caption_text_shadow',
'selector' => '{{WRAPPER}} .widget-image-caption',
]
);
$this->add_responsive_control(
'caption_padding',
[
'label' => esc_html__('Padding', 'motiox'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px', 'em', '%'],
'selectors' => [
'{{WRAPPER}} .widget-image-caption' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'caption_space',
[
'label' => esc_html__('Spacing', 'motiox'),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
],
'default' => [
'size' => 0,
'unit' => 'px',
],
'selectors' => [
'{{WRAPPER}} .widget-image-caption' => 'margin-top: {{SIZE}}{{UNIT}}; margin-bottom: 0px;',
],
]
);
$this->end_controls_section();
}
/**
* Check if the current widget has caption
*
* @access private
* @param array $settings returns settings.
*
* @return boolean
* @since 1.3.0
*
*/
private function has_caption($settings) {
return (!empty($settings['caption_source']) && 'no' !== $settings['caption_source']);
}
/**
* Get the caption for current widget.
*
* @access private
* @param array $settings returns the caption.
*
* @return string
* @since 1.3.0
*/
private function get_caption($settings) {
$caption = '';
if ('yes' === $settings['caption_source']) {
$caption = !empty($settings['caption']) ? $settings['caption'] : '';
}
return $caption;
}
/**
* Render Site Image output on the frontend.
*
* Written in PHP and used to generate the final HTML.
*
* @param array $size returns the size of an image.
* @access public
* @since 1.3.0
*/
public function site_image_url($size) {
$settings = $this->get_settings_for_display();
if (!empty($settings['custom_image']['url'])) {
$logo = wp_get_attachment_image_src($settings['custom_image']['id'], $size, true);
} else {
$logo = wp_get_attachment_image_src(get_theme_mod('custom_logo'), $size, true);
}
return $logo[0];
}
/**
* Render Site Image output on the frontend.
*
* Written in PHP and used to generate the final HTML.
*
* @since 1.3.0
* @access protected
*/
protected function render() {
$link = '';
$settings = $this->get_settings_for_display();
$has_caption = $this->has_caption($settings);
$this->add_render_attribute('wrapper', 'class', 'motiox-site-logo');
$size = $settings['site_logo_size_size'];
$site_image = $this->site_image_url($size);
if (site_url() . '/wp-includes/images/media/default.png' === $site_image) {
$site_image = site_url() . '/wp-content/plugins/elementor/assets/images/placeholder.png';
} else {
$site_image = $site_image;
}
if ('file' === $settings['link_to']) {
$link = $site_image;
$this->add_render_attribute('link', 'href', $link);
} elseif ('default' === $settings['link_to']) {
$link = site_url();
$this->add_render_attribute('link', 'href', $link);
} else {
$link = $this->get_link_url($settings);
if ($link) {
$this->add_link_attributes('link', $link);
}
}
$class = '';
if (Plugin::$instance->editor->is_edit_mode()) {
$class = 'elementor-non-clickable';
} else {
$class = 'elementor-clickable';
}
?>
<div <?php $this->print_render_attribute_string('wrapper'); ?>>
<?php if ($has_caption) : ?>
<figure class="wp-caption">
<?php endif; ?>
<?php if ($link) : ?>
<?php
if ('no' === $settings['open_lightbox']) {
$class = 'elementor-non-clickable';
}
?>
<a data-elementor-open-lightbox="<?php echo esc_attr($settings['open_lightbox']); ?>" class='<?php echo esc_attr($class); ?>' <?php $this->print_render_attribute_string('link'); ?>>
<?php endif; ?>
<?php
if (empty($site_image)) {
return;
}
$img_animation = '';
if ('custom' !== $size) {
$image_size = $size;
} else {
require_once ELEMENTOR_PATH . 'includes/libraries/bfi-thumb/bfi-thumb.php';
$image_dimension = $settings['site_logo_size_custom_dimension'];
$image_size = [
// Defaults sizes.
0 => null, // Width.
1 => null, // Height.
'bfi_thumb' => true,
'crop' => true,
];
$has_custom_size = false;
if (!empty($image_dimension['width'])) {
$has_custom_size = true;
$image_size[0] = $image_dimension['width'];
}
if (!empty($image_dimension['height'])) {
$has_custom_size = true;
$image_size[1] = $image_dimension['height'];
}
if (!$has_custom_size) {
$image_size = 'full';
}
}
$image_url = $site_image;
if (!empty($settings['custom_image']['url'])) {
$image_data = wp_get_attachment_image_src($settings['custom_image']['id'], $image_size, true);
} else {
$image_data = wp_get_attachment_image_src(get_theme_mod('custom_logo'), $image_size, true);
}
$site_image_class = 'elementor-animation-';
if (!empty($settings['hover_animation'])) {
$img_animation = $settings['hover_animation'];
}
if (!empty($image_data)) {
$image_url = $image_data[0];
}
if (site_url() . '/wp-includes/images/media/default.png' === $image_url) {
$image_url = site_url() . '/wp-content/plugins/elementor/assets/images/placeholder.png';
} else {
$image_url = $image_url;
}
$class_animation = $site_image_class . $img_animation;
$image_unset = site_url() . '/wp-content/plugins/elementor/assets/images/placeholder.png';
if ($image_unset !== $image_url) {
$image_url = $image_url;
}
?>
<div class="motiox-site-logo-set">
<div class="motiox-site-logo-container">
<img class="motiox-site-logo-img <?php echo esc_attr($class_animation); ?>" src="<?php echo esc_url($image_url); ?>" alt="<?php echo esc_attr(Control_Media::get_image_alt($settings['custom_image'])); ?>"/>
<?php
$id_page = get_the_ID();
if ($id_page === 18478) { ?>
<div class="logo-free">
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="89" height="32" viewBox="0 0 89 32">
<title>free_label</title>
<path fill="#f4c340" d="M89.143 0h-89.143v22.857h89.143l-6.669-11.427 6.669-11.43z"/>
<path fill="#d7a41e" d="M0 22.857l16.059 8.416v-8.416h-16.059z"/>
<path fill="#000" d="M8.966 14.857h-1.234v-7.293h4.536v1.162h-3.302v2.047h2.962v1.142h-2.962v2.942zM17.139 14.857l-1.533-2.88h-0.905v2.88h-1.245v-7.293h2.798c0.686 0 1.238 0.213 1.656 0.638 0.418 0.418 0.627 0.943 0.627 1.574 0 0.521-0.147 0.967-0.442 1.337s-0.696 0.617-1.203 0.741l1.646 3.003h-1.399zM14.701 10.887h1.327c0.377 0 0.679-0.099 0.905-0.298 0.233-0.206 0.35-0.477 0.35-0.813 0-0.343-0.117-0.614-0.35-0.813-0.226-0.206-0.528-0.309-0.905-0.309h-1.327v2.232zM24.36 14.857h-4.505v-7.293h4.505v1.152h-3.271v1.934h2.962v1.121h-2.962v1.934h3.271v1.152zM30.347 14.857h-4.505v-7.293h4.505v1.152h-3.271v1.934h2.962v1.121h-2.962v1.934h3.271v1.152zM36.982 13.242l2.047-5.678h1.306l-2.757 7.293h-1.255l-2.715-7.293h1.337l2.037 5.678zM45.816 14.857h-4.505v-7.293h4.505v1.152h-3.271v1.934h2.962v1.121h-2.962v1.934h3.271v1.152zM50.98 14.857l-1.533-2.88h-0.905v2.88h-1.245v-7.293h2.798c0.686 0 1.238 0.213 1.656 0.638 0.418 0.418 0.627 0.943 0.627 1.574 0 0.521-0.147 0.967-0.442 1.337s-0.696 0.617-1.203 0.741l1.646 3.003h-1.399zM48.542 10.887h1.327c0.377 0 0.679-0.099 0.905-0.298 0.233-0.206 0.35-0.477 0.35-0.813 0-0.343-0.117-0.614-0.35-0.813-0.226-0.206-0.528-0.309-0.905-0.309h-1.327v2.232zM58.489 9.272l-1.111 0.35c-0.048-0.281-0.189-0.538-0.422-0.771s-0.569-0.35-1.008-0.35c-0.363 0-0.665 0.103-0.905 0.309-0.233 0.206-0.35 0.453-0.35 0.741 0 0.501 0.285 0.813 0.854 0.936l1.049 0.216c0.631 0.123 1.118 0.374 1.461 0.751s0.514 0.826 0.514 1.347c0 0.603-0.233 1.125-0.699 1.563-0.459 0.432-1.087 0.648-1.882 0.648-0.857 0-1.526-0.223-2.006-0.669-0.48-0.453-0.751-0.977-0.813-1.574l1.152-0.329c0.041 0.411 0.206 0.758 0.494 1.039s0.679 0.422 1.173 0.422c0.425 0 0.751-0.093 0.977-0.278 0.233-0.192 0.35-0.435 0.35-0.73 0-0.24-0.086-0.446-0.257-0.617-0.171-0.178-0.411-0.302-0.72-0.37l-1.029-0.216c-0.569-0.117-1.022-0.353-1.358-0.71-0.329-0.357-0.494-0.802-0.494-1.337 0-0.61 0.243-1.135 0.73-1.574s1.070-0.658 1.749-0.658c0.775 0 1.368 0.189 1.779 0.566 0.411 0.37 0.669 0.802 0.771 1.296zM61.108 14.857h-1.255v-7.293h1.255v7.293zM64.399 9.272c-0.48 0.459-0.72 1.104-0.72 1.934s0.24 1.478 0.72 1.944c0.48 0.459 1.053 0.689 1.718 0.689s1.238-0.23 1.718-0.689c0.487-0.466 0.73-1.114 0.73-1.944s-0.243-1.474-0.73-1.934c-0.48-0.466-1.053-0.699-1.718-0.699s-1.238 0.233-1.718 0.699zM62.939 13.242c-0.35-0.59-0.525-1.269-0.525-2.037s0.175-1.443 0.525-2.026c0.357-0.59 0.813-1.032 1.368-1.327s1.159-0.442 1.81-0.442c0.651 0 1.255 0.147 1.81 0.442s1.011 0.737 1.368 1.327c0.357 0.583 0.535 1.258 0.535 2.026s-0.178 1.447-0.535 2.037c-0.357 0.59-0.813 1.032-1.368 1.327s-1.159 0.442-1.81 0.442c-0.651 0-1.255-0.147-1.81-0.442s-1.011-0.737-1.368-1.327zM77.253 14.857h-1.286l-3.6-5.523v5.523h-1.234v-7.293h1.574l3.312 5.174v-5.174h1.234v7.293z"/>
</svg>
</div>
<?php } ?>
</div>
</div>
<?php if ($link) : ?>
</a>
<?php endif; ?>
<?php
if ($has_caption) :
$caption_text = $this->get_caption($settings);
?>
<?php if (!empty($caption_text)) : ?>
<div class="motiox-caption-width">
<figcaption class="widget-image-caption wp-caption-text"><?php echo wp_kses_post($caption_text); ?></figcaption>
</div>
<?php endif; ?>
</figure>
<?php endif; ?>
</div>
<?php
}
/**
* Retrieve Site Logo widget link URL.
*
* @param array $settings returns settings.
* @return array|string|false An array/string containing the link URL, or false if no link.
* @since 1.3.0
* @access private
*
*/
private function get_link_url($settings) {
if ('none' === $settings['link_to']) {
return false;
}
if ('custom' === $settings['link_to']) {
if (empty($settings['link']['url'])) {
return false;
}
return $settings['link'];
}
if ('default' === $settings['link_to']) {
if (empty($settings['link']['url'])) {
return false;
}
return site_url();
}
}
}
$widgets_manager->register(new Motiox_Site_Logo());