File: /home/parhudrw/anqa.it/wp-content/plugins/pixfort-core/functions/elementor/widgets/numbers.php
<?php
namespace Elementor;
class Pix_Eor_Numbers extends Widget_Base {
public function __construct($data = [], $args = null) {
parent::__construct($data, $args);
wp_register_script( 'pix-numbers-handle', PIX_CORE_PLUGIN_URI.'functions/elementor/js/numbers.js', [ 'elementor-frontend' ], PIXFORT_PLUGIN_VERSION, true );
}
public function get_name() {
return 'pix-numbers';
}
public function get_title() {
return 'Numbers';
}
public function get_icon() {
return 'fa fa-sort-numeric-up-alt';
}
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"
);
$this->start_controls_section(
'section_title',
[
'label' => __( 'Content', 'elementor' ),
]
);
$this->add_control(
'numbers_style',
[
'label' => __( 'Style', 'pixfort-core' ),
'type' => \Elementor\Controls_Manager::SELECT,
'options' => array_flip(array(
'Inline' => 'numbers-inline',
'Stack' => 'numbers-stack',
)),
'default' => 'numbers-inline',
]
);
$this->add_control(
'text_before',
[
'label' => __( 'Text Before', 'essentials-core' ),
'type' => \Elementor\Controls_Manager::TEXT,
'default' => __( '', 'essentials-core' ),
'placeholder' => __( '', 'essentials-core' ),
'dynamic' => array(
'active' => true
),
]
);
$this->add_control(
'number',
[
'label' => __( 'Number', 'essentials-core' ),
'type' => \Elementor\Controls_Manager::TEXT,
'default' => __( '', 'essentials-core' ),
'dynamic' => array(
'active' => true
),
'placeholder' => __( '', 'essentials-core' ),
]
);
$this->add_control(
'duration',
[
'label' => __( 'Duration', 'essentials-core' ),
'type' => \Elementor\Controls_Manager::TEXT,
'default' => __( '3000', 'essentials-core' ),
'placeholder' => __( 'The duration in miliseconds', 'essentials-core' ),
]
);
$this->add_control(
'text_after',
[
'label' => __( 'Text After', 'essentials-core' ),
'type' => \Elementor\Controls_Manager::TEXT,
'default' => __( '', 'essentials-core' ),
'placeholder' => __( '', 'essentials-core' ),
'dynamic' => array(
'active' => true
),
]
);
$this->add_control(
'content',
[
'label' => __( 'Content', 'essentials-core' ),
'type' => \Elementor\Controls_Manager::TEXTAREA,
'default' => __( '', 'essentials-core' ),
'placeholder' => __( '', 'essentials-core' ),
'dynamic' => array(
'active' => true
),
]
);
$this->end_controls_section();
$this->start_controls_section(
'title_section',
[
'label' => __( 'Top Text Format', 'pixfort-core' ),
'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'before_format',
[
'label' => __( 'Before text format', 'pixfort-core' ),
'type' => \Elementor\Controls_Manager::RAW_HTML,
// 'raw' => __( 'A very important message to show in the panel.', 'pixfort-core' ),
'content_classes' => 'your-class',
]
);
$this->add_control(
'before_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(
'before_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(
'before_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(
'number_format',
[
'label' => __( 'Number format', 'pixfort-core' ),
'type' => \Elementor\Controls_Manager::RAW_HTML,
'content_classes' => 'your-class',
]
);
$this->add_control(
'number_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(
'number_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(
'number_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(
'after_format',
[
'label' => __( 'After text format', 'pixfort-core' ),
'type' => \Elementor\Controls_Manager::RAW_HTML,
'content_classes' => 'your-class',
]
);
$this->add_control(
'after_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(
'after_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(
'after_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(
'title_color',
[
'label' => __( 'Text color', 'pixfort-core' ),
'type' => \Elementor\Controls_Manager::SELECT,
'options' => array_flip($colors),
'default' => 'heading-default',
]
);
$this->add_control(
'title_custom_color',
[
'label' => __( 'Custom Text color', 'pixfort-core' ),
'type' => \Elementor\Controls_Manager::COLOR,
'default' => '',
'condition' => [
'title_color' => 'custom',
],
]
);
$this->add_control(
'title_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' => 'h3',
]
);
$this->add_control(
'title_custom_size',
[
'label' => __( 'Custom Text size', 'elementor' ),
'label_block' => false,
'type' => Controls_Manager::TEXT,
'placeholder' => __( 'Enter custom title size', 'elementor' ),
'default' => '',
'condition' => [
'text_size' => 'custom',
],
]
);
$this->add_control(
'title_display',
[
'label' => __( 'Bigger Text', 'pixfort-core' ),
'type' => \Elementor\Controls_Manager::SELECT,
'options' => array(
'' => 'None',
'display-1' => 'Display 1',
'display-2' => 'Display 2',
'display-3' => 'Display 3',
'display-4' => 'Display 4',
),
'default' => '',
'condition' => [
'title_size' => array('h1', 'h2', 'h3', 'h4', 'h5', 'h6')
],
]
);
$this->end_controls_section();
$this->start_controls_section(
'text_section',
[
'label' => __( 'Content format', 'pixfort-core' ),
'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'content_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(
'content_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(
'content_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(
'content_color',
[
'label' => __( 'Content color', 'pixfort-core' ),
'type' => \Elementor\Controls_Manager::SELECT,
'options' => array_flip($colors),
'default' => 'dark-opacity-5',
]
);
$this->add_control(
'content_custom_color',
[
'label' => __( 'Custom Text color', 'pixfort-core' ),
'type' => \Elementor\Controls_Manager::COLOR,
'default' => '',
'condition' => [
'content_color' => 'custom',
],
]
);
$this->add_control(
'content_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_control(
'content_custom_size',
[
'label' => __( 'Content custom size', 'elementor' ),
'label_block' => false,
'type' => Controls_Manager::TEXT,
'placeholder' => __( 'Enter custom content size', 'elementor' ),
'default' => '',
'condition' => [
'content_size' => 'custom',
],
]
);
$this->add_control(
'content_position',
[
'label' => __( 'Content position', 'pixfort-core' ),
'type' => \Elementor\Controls_Manager::SELECT,
'options' => array_flip(array(
__('Left','pix-opts') => 'text-left',
__('Center','pix-opts') => 'text-center',
__('Right','pix-opts') => 'text-right',
)),
'default' => 'text-left',
]
);
$this->end_controls_section();
}
protected function render() {
$settings = $this->get_settings_for_display();
echo sc_pix_numbers($settings, $settings['content']);
}
protected function _content_template() {
}
public function get_script_depends() {
if(is_user_logged_in()) return [ 'pix-global', 'pix-numbers-handle' ];
return [];
}
}