File: /home/parhudrw/anqa.it/wp-content/plugins/pixfort-core/functions/elementor/widgets/badge.php
<?php
namespace Elementor;
class Pix_Eor_Badge extends Widget_Base {
public function __construct($data = [], $args = null) {
parent::__construct($data, $args);
// wp_register_script( 'pix-badge-handle', PIX_CORE_PLUGIN_URI.'functions/elementor/js/badge.js', [ 'elementor-frontend' ], PIXFORT_PLUGIN_VERSION, true );
}
public function get_name() {
return 'pix-badge';
}
public function get_title() {
return 'Badge';
}
public function get_icon() {
return 'fa fa-ad';
}
public function get_categories() {
return [ 'pixfort' ];
}
protected function _register_controls() {
$colors = array(
"Body default" => "body-default",
"Heading default" => "heading-default",
"Primary" => "primary",
"Primary Gradient" => "gradient-primary",
"Secondary" => "secondary",
"White" => "white",
"Black" => "black",
"Green" => "green",
"Blue" => "blue",
"Red" => "red",
"Yellow" => "yellow",
"Brown" => "brown",
"Purple" => "purple",
"Orange" => "orange",
"Cyan" => "cyan",
// "Transparent" => "transparent",
"Gray 1" => "gray-1",
"Gray 2" => "gray-2",
"Gray 3" => "gray-3",
"Gray 4" => "gray-4",
"Gray 5" => "gray-5",
"Gray 6" => "gray-6",
"Gray 7" => "gray-7",
"Gray 8" => "gray-8",
"Gray 9" => "gray-9",
"Dark opacity 1" => "dark-opacity-1",
"Dark opacity 2" => "dark-opacity-2",
"Dark opacity 3" => "dark-opacity-3",
"Dark opacity 4" => "dark-opacity-4",
"Dark opacity 5" => "dark-opacity-5",
"Dark opacity 6" => "dark-opacity-6",
"Dark opacity 7" => "dark-opacity-7",
"Dark opacity 8" => "dark-opacity-8",
"Dark opacity 9" => "dark-opacity-9",
"Light opacity 1" => "light-opacity-1",
"Light opacity 2" => "light-opacity-2",
"Light opacity 3" => "light-opacity-3",
"Light opacity 4" => "light-opacity-4",
"Light opacity 5" => "light-opacity-5",
"Light opacity 6" => "light-opacity-6",
"Light opacity 7" => "light-opacity-7",
"Light opacity 8" => "light-opacity-8",
"Light opacity 9" => "light-opacity-9",
"Custom" => "custom"
);
$bg_colors = array(
"Primary" => "primary",
"Primary Light" => "primary-light",
"Primary Gradient" => "gradient-primary",
"Primary Gradient Light" => "gradient-primary-light",
"Secondary" => "secondary",
"Secondary Light" => "secondary-light",
"White" => "white",
"Black" => "black",
"Green" => "green",
"Green Light" => "green-light",
"Blue" => "blue",
"Blue Light" => "blue-light",
"Red" => "red",
"Red Light" => "red-light",
"Yellow" => "yellow",
"Yellow Light" => "yellow-light",
"Brown" => "brown",
"Brown Light" => "brown-light",
"Purple" => "purple",
"Purple Light" => "purple-light",
"Orange" => "orange",
"Orange Light" => "orange-light",
"Cyan" => "cyan",
"Cyan Light" => "cyan-light",
"Transparent" => "transparent",
"Gray 1" => "gray-1",
"Gray 2" => "gray-2",
"Gray 3" => "gray-3",
"Gray 4" => "gray-4",
"Gray 5" => "gray-5",
"Gray 6" => "gray-6",
"Gray 7" => "gray-7",
"Gray 8" => "gray-8",
"Gray 9" => "gray-9",
"Dark opacity 1" => "dark-opacity-1",
"Dark opacity 2" => "dark-opacity-2",
"Dark opacity 3" => "dark-opacity-3",
"Dark opacity 4" => "dark-opacity-4",
"Dark opacity 5" => "dark-opacity-5",
"Dark opacity 6" => "dark-opacity-6",
"Dark opacity 7" => "dark-opacity-7",
"Dark opacity 8" => "dark-opacity-8",
"Dark opacity 9" => "dark-opacity-9",
"Light opacity 1" => "light-opacity-1",
"Light opacity 2" => "light-opacity-2",
"Light opacity 3" => "light-opacity-3",
"Light opacity 4" => "light-opacity-4",
"Light opacity 5" => "light-opacity-5",
"Light opacity 6" => "light-opacity-6",
"Light opacity 7" => "light-opacity-7",
"Light opacity 8" => "light-opacity-8",
"Light opacity 9" => "light-opacity-9",
"Custom" => "custom"
);
$this->start_controls_section(
'section_title',
[
'label' => __( 'Content', 'elementor' ),
]
);
$this->add_control(
'text',
[
'label' => __( 'Text', 'elementor' ),
'label_block' => true,
'type' => Controls_Manager::TEXT,
'placeholder' => __( 'Badge text', 'elementor' ),
'default' => 'Badge text',
'dynamic' => array(
'active' => true
),
]
);
$this->add_control(
'bold',
[
'label' => __( 'Bold', 'essentials-core' ),
'type' => \Elementor\Controls_Manager::SWITCHER,
'label_on' => __( 'Yes', 'essentials-core' ),
'label_off' => __( 'No', 'essentials-core' ),
'return_value' => 'font-weight-bold',
'default' => 'font-weight-bold',
]
);
$this->add_control(
'italic',
[
'label' => __( 'Italic', 'essentials-core' ),
'type' => \Elementor\Controls_Manager::SWITCHER,
'label_on' => __( 'Yes', 'essentials-core' ),
'label_off' => __( 'No', 'essentials-core' ),
'return_value' => 'font-italic',
'default' => '',
]
);
$this->add_control(
'secondary_font',
[
'label' => __( 'Secondary font', 'essentials-core' ),
'type' => \Elementor\Controls_Manager::SWITCHER,
'label_on' => __( 'Yes', 'essentials-core' ),
'label_off' => __( 'No', 'essentials-core' ),
'return_value' => 'secondary-font',
'default' => '',
]
);
$this->add_control(
'rounded',
[
'label' => __( 'Rounded corners', 'essentials-core' ),
'type' => \Elementor\Controls_Manager::SWITCHER,
'label_on' => __( 'Yes', 'essentials-core' ),
'label_off' => __( 'No', 'essentials-core' ),
'return_value' => 'badge-pill',
'default' => '',
]
);
$this->add_control(
'extra_classes',
[
'label' => __( 'Extra Classes', 'elementor' ),
'label_block' => true,
'type' => Controls_Manager::TEXT,
'placeholder' => __( '', 'elementor' ),
'default' => '',
]
);
$this->end_controls_section();
$this->start_controls_section(
'style_section',
[
'label' => __( 'Style', 'pixfort-core' ),
'tab' => \Elementor\Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'text_color',
[
'label' => __( 'Text color', 'pixfort-core' ),
'type' => \Elementor\Controls_Manager::SELECT,
'options' => array_flip($colors),
'default' => 'primary',
]
);
$this->add_control(
'text_custom_color',
[
'label' => __( 'Custom Text color', 'pixfort-core' ),
'type' => \Elementor\Controls_Manager::COLOR,
'default' => '',
'condition' => [
'text_color' => 'custom',
],
]
);
$this->add_control(
'bg_color',
[
'label' => __( 'Background color', 'pixfort-core' ),
'type' => \Elementor\Controls_Manager::SELECT,
'options' => array_flip($bg_colors),
'default' => 'primary-light',
]
);
$this->add_control(
'custom_bg_color',
[
'label' => __( 'Custom Background color', 'pixfort-core' ),
'type' => \Elementor\Controls_Manager::COLOR,
'default' => '',
'condition' => [
'bg_color' => 'custom',
],
]
);
$this->add_control(
'text_size',
[
'label' => __( 'Text size', 'pixfort-core' ),
'type' => \Elementor\Controls_Manager::SELECT,
'options' => array_flip(array(
__('H1','pix-opts') => 'h1',
__('H2','pix-opts') => 'h2',
__('H3','pix-opts') => 'h3',
__('H4','pix-opts') => 'h4',
__('H5','pix-opts') => 'h5',
__('H6','pix-opts') => 'h6',
__('Custom','pix-opts') => 'custom',
)),
'default' => 'h6',
]
);
$this->add_responsive_control(
'text_custom_size',
[
'label' => __( 'Custom Text size', 'elementor' ),
'label_block' => false,
'type' => Controls_Manager::TEXT,
'placeholder' => __( 'Enter custom title size', 'elementor' ),
'default' => '',
'selectors' => [
'{{WRAPPER}} .badge' => 'font-size: {{value}} !important;',
],
'condition' => [
'text_size' => 'custom',
],
]
);
$this->add_control(
'style',
[
'label' => __( 'Shadow Style', 'pixfort-core' ),
'type' => \Elementor\Controls_Manager::SELECT,
'options' => array(
"" => "Default",
"1" => "Small shadow",
"2" => "Medium shadow",
"3" => "Large shadow",
"4" => "Inverse Small shadow",
"5" => "Inverse Medium shadow",
"6" => "Inverse Large shadow",
),
'default' => '',
]
);
$this->add_control(
'hover_effect',
[
'label' => __( 'Shadow Hover Style', 'pixfort-core' ),
'type' => \Elementor\Controls_Manager::SELECT,
'options' => array(
"" => "None",
"1" => "Small hover shadow",
"2" => "Medium hover shadow",
"3" => "Large hover shadow",
"4" => "Inverse Small hover shadow",
"5" => "Inverse Medium hover shadow",
"6" => "Inverse Large hover shadow",
),
'default' => '',
]
);
$this->add_control(
'add_hover_effect',
[
'label' => __( 'Hover Animation', 'pixfort-core' ),
'type' => \Elementor\Controls_Manager::SELECT,
'options' => array(
"" => "None",
"1" => "Fly Small",
"2" => "Fly Medium",
"3" => "Fly Large",
"4" => "Scale Small",
"5" => "Scale Medium",
"6" => "Scale Large",
"7" => "Scale Inverse Small",
"8" => "Scale Inverse Medium",
"9" => "Scale Inverse Large",
),
'default' => '',
]
);
$this->add_control(
'element_div',
[
'label' => __( 'Badge inside a container', 'pixfort-core' ),
'type' => \Elementor\Controls_Manager::SELECT,
'options' => array(
'' => 'Disabled',
'text-center' => 'Center align',
'text-left' => 'Left align',
'text-right' => 'Right align',
),
'default' => '',
]
);
$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->end_controls_section();
$this->start_controls_section(
'section_element_adv_style',
[
'label' => __( 'Advanced Style', 'elementor' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_responsive_control(
'align',
[
'label' => __( 'Alignment', 'elementor' ),
'type' => Controls_Manager::CHOOSE,
'options' => [
'left' => [
'title' => __( 'Left', 'elementor' ),
'icon' => 'eicon-text-align-left',
],
'center' => [
'title' => __( 'Center', 'elementor' ),
'icon' => 'eicon-text-align-center',
],
'right' => [
'title' => __( 'Right', 'elementor' ),
'icon' => 'eicon-text-align-right',
],
'justify' => [
'title' => __( 'Justified', 'elementor' ),
'icon' => 'eicon-text-align-justify',
],
],
'selectors' => [
'{{WRAPPER}}' => 'text-align: {{VALUE}} !important;',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'heading_inner_typography',
'selector' => '{{WRAPPER}} .badge',
]
);
$this->add_group_control(
Group_Control_Text_Shadow::get_type(),
[
'name' => 'text_shadow',
'selector' => '{{WRAPPER}} .badge',
]
);
$this->add_responsive_control(
'badge_padding',
[
'label' => __( 'Inner Padding', 'elementor' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%' ],
'selectors' => [
'{{WRAPPER}} .badge' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
],
]
);
$this->end_controls_section();
}
protected function render() {
$settings = $this->get_settings_for_display();
echo sc_pix_badge($settings);
}
protected function _content_template() {
}
public function get_script_depends() {
if(is_user_logged_in()) return [ 'pix-global' ];
return [];
}
}