Current Path : /storage/v11800/lifespanstoresnew/public_html/wp-content/plugins/suxnix-core/include/elementor/ |
Linux v11800 5.3.0-1023-aws #25~18.04.1-Ubuntu SMP Fri Jun 5 15:19:18 UTC 2020 aarch64
|
Current File : /storage/v11800/lifespanstoresnew/public_html/wp-content/plugins/suxnix-core/include/elementor/video-popup.php |
<?php
namespace TPCore\Widgets;
use Elementor\Widget_Base;
use Elementor\Controls_Manager;
use \Elementor\Group_Control_Image_Size;
use \Elementor\Group_Control_Background;
use \Elementor\Control_Media;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
* Suxnix Core
*
* Elementor widget for hello world.
*
* @since 1.0.0
*/
class TP_Video_Popup extends Widget_Base {
/**
* Retrieve the widget name.
*
* @since 1.0.0
*
* @access public
*
* @return string Widget name.
*/
public function get_name() {
return 'tp-video-popup';
}
/**
* Retrieve the widget title.
*
* @since 1.0.0
*
* @access public
*
* @return string Widget title.
*/
public function get_title() {
return __( 'Popup Video', '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 function register_controls() {
// _tg_image
$this->start_controls_section(
'_tg_image_section',
[
'label' => esc_html__('Background', 'tpcore'),
]
);
$this->add_control(
'tg_image',
[
'label' => esc_html__( 'Choose Image', 'tpcore' ),
'type' => \Elementor\Controls_Manager::MEDIA,
'default' => [
'url' => \Elementor\Utils::get_placeholder_image_src(),
],
]
);
$this->add_group_control(
Group_Control_Image_Size::get_type(),
[
'name' => 'tg_image_size',
'default' => 'full',
'exclude' => [
'custom'
]
]
);
$this->end_controls_section();
// tp_video
$this->start_controls_section(
'tp_video',
[
'label' => esc_html__('Video', 'tpcore'),
]
);
if (tp_is_elementor_version('<', '2.6.0')) {
$this->add_control(
'tg_service_icon',
[
'show_label' => false,
'type' => Controls_Manager::ICON,
'label_block' => true,
'default' => 'fa fa-play',
]
);
} else {
$this->add_control(
'tg_service_selected_icon',
[
'show_label' => false,
'type' => Controls_Manager::ICONS,
'fa4compatibility' => 'icon',
'label_block' => true,
'default' => [
'value' => 'fas fa-play',
'library' => 'solid',
],
]
);
}
$this->add_control(
'tg_video_url',
[
'label' => esc_html__('Video', 'tpcore'),
'type' => Controls_Manager::TEXT,
'default' => 'https://www.youtube.com/watch?v=HQfF5XRVXjU',
'title' => esc_html__('Video url', 'tpcore'),
'label_block' => true,
]
);
$this->end_controls_section();
// _tg_image
$this->start_controls_section(
'_tg_shape_section',
[
'label' => esc_html__('Background Shape', 'tpcore'),
]
);
$this->add_control(
'tg_shape_image01',
[
'label' => esc_html__( 'Choose Left Shape', 'tpcore' ),
'type' => \Elementor\Controls_Manager::MEDIA,
'default' => [
'url' => \Elementor\Utils::get_placeholder_image_src(),
],
]
);
$this->add_control(
'tg_shape_image02',
[
'label' => esc_html__( 'Choose Right Shape', 'tpcore' ),
'type' => \Elementor\Controls_Manager::MEDIA,
'default' => [
'url' => \Elementor\Utils::get_placeholder_image_src(),
],
]
);
$this->add_group_control(
Group_Control_Image_Size::get_type(),
[
'name' => 'tg_shape_size',
'default' => 'full',
'exclude' => [
'custom'
]
]
);
$this->end_controls_section();
// TAB_STYLE
$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();
if ( !empty($settings['tg_image']['url']) ) {
$tg_image_url = !empty($settings['tg_image']['id']) ? wp_get_attachment_image_url( $settings['tg_image']['id'], $settings['tg_image_size_size']) : $settings['tg_image']['url'];
$tg_image_alt = get_post_meta($settings["tg_image"]["id"], "_wp_attachment_image_alt", true);
}
if ( !empty($settings['tg_shape_image01']['url']) ) {
$tg_shape_url01 = !empty($settings['tg_shape_image01']['id']) ? wp_get_attachment_image_url( $settings['tg_shape_image01']['id'], $settings['tg_shape_size_size']) : $settings['tg_shape_image01']['url'];
$tg_shape_alt = get_post_meta($settings["tg_shape_image01"]["id"], "_wp_attachment_image_alt", true);
}
if ( !empty($settings['tg_shape_image02']['url']) ) {
$tg_shape_url02 = !empty($settings['tg_shape_image02']['id']) ? wp_get_attachment_image_url( $settings['tg_shape_image02']['id'], $settings['tg_shape_size_size']) : $settings['tg_shape_image02']['url'];
$tg_shape_alt = get_post_meta($settings["tg_shape_image02"]["id"], "_wp_attachment_image_alt", true);
}
?>
<script>
jQuery(document).ready(function($){
/*=============================================
= Data Background =
=============================================*/
$("[data-background]").each(function () {
$(this).css("background-image", "url(" + $(this).attr("data-background") + ")")
});
});
</script>
<!-- video-area -->
<div class="video-area video-bg" data-background="<?php echo esc_url($tg_image_url); ?>">
<div class="video-bg-overlay"></div>
<div class="container">
<div class="row">
<div class="col-12">
<?php if (!empty($settings['tg_service_icon']) || !empty($settings['tg_service_selected_icon']['value'])) : ?>
<div class="video-btn">
<a href="<?php echo esc_url($settings["tg_video_url"]); ?>" class="popup-video ripple-white">
<?php tp_render_icon($settings, 'tg_service_icon', 'tg_service_selected_icon'); ?>
</a>
</div>
<?php endif; ?>
</div>
</div>
</div>
<div class="video-shape one"><img src="<?php echo esc_url($tg_shape_url01); ?>" alt="<?php echo esc_attr($tg_shape_alt); ?>"></div>
<div class="video-shape two"><img src="<?php echo esc_url($tg_shape_url02); ?>" alt="<?php echo esc_attr($tg_shape_alt); ?>"></div>
</div>
<!-- video-area-end -->
<?php
}
}
$widgets_manager->register( new TP_Video_Popup() );