File: /home/parhudrw/anqa.it/wp-content/plugins/pixfort-core/functions/elementor/widgets/img.php
<?php
namespace Elementor;
class Pix_Eor_Img extends Widget_Base {
public function __construct($data = [], $args = null) {
parent::__construct($data, $args);
}
public function get_name() {
return 'pix-img';
}
public function get_title() {
return 'Image';
}
public function get_icon() {
return 'fa fa-image';
}
public function get_categories() {
return [ 'pixfort' ];
}
protected function _register_controls() {
$infinite_animation = array(
"None" => "",
"Rotating" => "pix-rotating",
"Rotating inversed" => "pix-rotating-inverse",
"Fade" => "pix-fade",
"Bounce Small" => "pix-bounce-sm",
"Bounce Medium" => "pix-bounce-md",
"Bounce Large" => "pix-bounce-lg",
"Scale Small" => "pix-scale-sm",
"Scale Medium" => "pix-scale-md",
"Scale Large" => "pix-scale-lg",
);
$animation_speeds = array(
"Fast" => "pix-duration-fast",
"Medium" => "pix-duration-md",
"Slow" => "pix-duration-slow",
);
$this->start_controls_section(
'section_title',
[
'label' => __( 'General', 'essentials-core' ),
]
);
$this->add_control(
'image',
[
'label' => __( 'Choose Image', 'pixfort-core' ),
'type' => \Elementor\Controls_Manager::MEDIA,
'dynamic' => array(
'active' => true
),
'default' => [
'url' => \Elementor\Utils::get_placeholder_image_src(),
]
]
);
$this->add_control(
'alt',
[
'label' => __( 'Image alternative text', 'elementor' ),
'label_block' => true,
'type' => Controls_Manager::TEXT,
'dynamic' => array(
'active' => true
),
'placeholder' => __( '', 'elementor' ),
'default' => '',
]
);
$this->add_control(
'rounded_img',
[
'label' => __( 'Rounded corners', 'essentials-core' ),
'type' => Controls_Manager::SELECT,
'default' => 'rounded-lg',
'options' => [
'rounded-0' => __( 'No', 'essentials-core' ),
'rounded' => __( 'Rounded', 'essentials-core' ),
'rounded-lg' => __( 'Rounded Large', 'essentials-core' ),
'rounded-xl' => __( 'Rounded 5px', 'essentials-core' ),
'rounded-10' => __( 'Rounded 10px', 'essentials-core' ),
],
]
);
$this->add_responsive_control(
'align',
[
'label' => __( 'Image alignment', 'essentials-core' ),
'type' => Controls_Manager::SELECT,
'default' => 'left',
'options' => [
'' => 'Default',
'left' => 'Left',
'center' => 'Center',
'right' => 'Right',
],
'selectors' => [
'{{WRAPPER}} .pix-img-el, {{WRAPPER}} .pix-img-div, {{WRAPPER}} div' => 'text-align: {{value}} !important;',
],
]
);
$this->add_control(
'width',
[
'label' => __( 'Width (Optional)', 'elementor' ),
'label_block' => true,
'type' => Controls_Manager::TEXT,
'placeholder' => __( 'input the value (with the unit: %, px,.. etc).', 'elementor' ),
]
);
$this->add_control(
'height',
[
'label' => __( 'Height (Optional)', 'elementor' ),
'label_block' => true,
'type' => Controls_Manager::TEXT,
'placeholder' => __( 'input the value (with the unit: %, px,.. etc).', 'elementor' ),
]
);
$this->add_control(
'link',
[
'label' => __( 'Link', 'elementor' ),
'label_block' => true,
'type' => Controls_Manager::TEXT,
'placeholder' => __( '', 'elementor' ),
]
);
$this->add_control(
'target',
[
'label' => __( 'Open in a new tab', 'essentials-core' ),
'type' => \Elementor\Controls_Manager::SWITCHER,
'label_on' => __( 'Yes', 'essentials-core' ),
'label_off' => __( 'No', 'essentials-core' ),
'return_value' => 'Yes',
// 'default' => '',
]
);
$this->add_control(
'pix_scale_in',
[
'label' => __( 'Image Scale In effect', 'essentials-core' ),
'type' => Controls_Manager::SELECT,
'default' => '',
'options' => array(
'' => 'Disabled',
'pix-scale-in-sm' => 'Small scale',
'pix-scale-in' => 'Normal scale',
'pix-scale-in-lg' => 'Large scale',
),
]
);
$this->add_control(
'pix_scroll_parallax',
[
'label' => __( 'Scroll Parallax', 'essentials-core' ),
'type' => \Elementor\Controls_Manager::SWITCHER,
'label_on' => __( 'Enable', 'essentials-core' ),
'label_off' => __( 'Disable', 'essentials-core' ),
'return_value' => 'scroll_parallax',
'default' => 'no',
]
);
$this->add_control(
'xaxis',
[
'label' => __( 'X axis', 'essentials-core' ),
'type' => \Elementor\Controls_Manager::TEXT,
'default' => __( '0', 'essentials-core' ),
'placeholder' => __( 'X axix value', 'essentials-core' ),
'condition' => [
'pix_scroll_parallax' => 'scroll_parallax',
],
]
);
$this->add_control(
'yaxis',
[
'label' => __( 'Y axis', 'essentials-core' ),
'type' => \Elementor\Controls_Manager::TEXT,
'default' => __( '0', 'essentials-core' ),
'placeholder' => __( 'Y axix value', 'essentials-core' ),
'condition' => [
'pix_scroll_parallax' => 'scroll_parallax',
],
]
);
$this->add_control(
'pix_tilt',
[
'label' => __( '3D Hover', 'essentials-core' ),
'type' => \Elementor\Controls_Manager::SWITCHER,
'label_on' => __( 'Enable', 'essentials-core' ),
'label_off' => __( 'Disable', 'essentials-core' ),
'return_value' => 'tilt',
'default' => false,
]
);
$this->add_control(
'pix_tilt_size',
[
'label' => __( '3d hover size', 'essentials-core' ),
'type' => Controls_Manager::SELECT,
'default' => 'tilt',
'options' => [
'tilt' => __( 'Default', 'essentials-core' ),
'tilt_big' => __( 'Big', 'essentials-core' ),
'tilt_small' => __( 'Small', 'essentials-core' ),
],
'condition' => [
'pix_tilt' => 'tilt',
],
]
);
$this->add_control(
'animation',
[
'label' => __( 'Animation', 'essentials-core' ),
'type' => Controls_Manager::SELECT,
'default' => '',
'options' => array_flip(array(
"None" => "",
"Fade in" => "fade-in",
'fade-in-down' => 'fade-in-down',
'fade-in-left' => 'fade-in-left',
'fade-in-right' => 'fade-in-right',
'fade-in-up' => 'fade-in-up',
'fade-in-up-big' => 'fade-in-up-big',
'fade-in-right-big' => 'fade-in-right-big',
'fade-in-left-big' => 'fade-in-left-big',
"Slide in up" => "slide-in-up",
"Fade in & Scale" => "fade-in-Img",
)),
]
);
$this->add_control(
'delay',
[
'label' => __( 'Animation delay (in miliseconds)', 'essentials-core' ),
'type' => \Elementor\Controls_Manager::TEXT,
'default' => __( '0', 'essentials-core' ),
'placeholder' => __( '', 'essentials-core' ),
'condition' => [
'animation!' => '',
],
]
);
$this->add_control(
'pix_infinite_animation',
[
'label' => __( 'Infinite Animation type', 'essentials-core' ),
'type' => Controls_Manager::SELECT,
'default' => '',
'options' => array_flip($infinite_animation),
]
);
$this->add_control(
'pix_infinite_speed',
[
'label' => __( 'Infinite Animation Speed', 'essentials-core' ),
'type' => Controls_Manager::SELECT,
'default' => '',
'options' => array_flip($animation_speeds),
]
);
$this->add_control(
'img_div',
[
'label' => __( 'Image inside a container', 'essentials-core' ),
'type' => Controls_Manager::SELECT,
'default' => '',
'options' => [
'' => 'Disabled',
'text-center' => 'Center align',
'text-left' => 'Left align',
'text-right' => 'Right align',
],
]
);
$this->end_controls_section();
pix_get_elementor_effects($this);
}
protected function render() {
$settings = $this->get_settings_for_display();
echo sc_pix_img($settings);
}
protected function _content_template() {
}
public function get_script_depends() {
if(is_user_logged_in()) return [ 'pix-global' ];
return [];
}
}