Current File : /home/bravrvjk/cepurhuye.rw/wp-content/plugins/bopea-function/block//current-date.php
<?php
namespace bopeaElementor\Widgets;
use Elementor\Widget_Base;
use Elementor\Controls_Manager;
use Elementor\Group_Control_Image_Size;
use Elementor\Group_Control_Typography;
use Elementor\Schemes\Color;
use Elementor\Schemes\Typography;
use Elementor\Utils;
use Elementor\Control_Media;
use Elementor\Group_Control_Border;
use Elementor\Group_Control_Box_Shadow;
use Elementor\Group_Control_Text_Shadow;
use Elementor\Group_Control_Background;
use Elementor\Repeater;
use Elementor\Icons_Manager;
defined('ABSPATH') || die();
class bopea_section_current_date extends Widget_Base {
public function get_name() {
return 'bopea-current-date';
}
public function get_title() {
return esc_html__( 'Jelly Current Date', 'bopea-function' );
}
public function get_icon() {
return 'eicon-calendar jl-icons';
}
public function get_categories() {
return [ 'bopea-elements-head' ];
}
protected function register_controls() {
$this->start_controls_section(
'text_elements',
[
'label' => __( 'Date Settings', 'bopea-function' ),
]
);
$this->add_control(
'jl_label_title', [
'label' => esc_html__( 'Label title', 'bopea-function' ),
'default' => 'Current date',
'type' => Controls_Manager::TEXT,
'label_block' => true
]
);
$this->add_control(
'current_date', [
'label' => esc_html__( 'Date format', 'bopea-function' ),
'type' => Controls_Manager::TEXT,
'label_block' => true,
'default' => 'l , j F Y'
]
);
$this->end_controls_section();
$this->start_controls_section(
'section_tab_style', [
'label' => esc_html__( 'Date Style', 'bopea-function' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'title_typography',
'label' =>esc_html__( 'Date typography', 'bopea-function' ),
'selector' => '{{WRAPPER}} .jl_cur_date',
]
);
$this->add_control(
'jl_date_color',
[
'label' =>esc_html__( 'Color', 'bopea-function' ),
'type' => Controls_Manager::COLOR,
'default' => '#000',
'selectors' => [
'{{WRAPPER}} .jl_cur_date' => 'color: {{VALUE}} !important;',
],
]
);
$this->add_control(
'jl_date_color_dark',
[
'label' =>esc_html__( 'Color dark mode', 'bopea-function' ),
'type' => Controls_Manager::COLOR,
'default' => '#FFF',
'selectors' => [
'.options_dark_skin {{WRAPPER}} .jl_cur_date' => 'color: {{VALUE}} !important;',
],
]
);
$this->end_controls_section();
$this->start_controls_section(
'section_label_style', [
'label' => esc_html__( 'Label Style', 'bopea-function' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'jl_label_typography',
'label' => __( 'Label Typography', 'bopea-function' ),
'selector' => '{{WRAPPER}} .jl_lbl_op',
]
);
$this->add_control(
'jl_label_color',
[
'label' => __( 'Label Color', 'bopea-function' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .jl_lbl_op' => 'color: {{VALUE}}',
],
]
);
$this->add_control(
'jl_label_color_dark',
[
'label' => __( 'Label Color Dark Mode', 'bopea-function' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'.options_dark_skin {{WRAPPER}} .jl_lbl_op' => 'color: {{VALUE}}',
],
]
);
$this->add_control(
'jl_label_background',
[
'label' => __( 'Label Background', 'bopea-function' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .jl_lbl_op' => 'background: {{VALUE}}',
],
]
);
$this->add_control(
'jl_label_background_dark',
[
'label' => __( 'Label Background Dark Mode', 'bopea-function' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'.options_dark_skin {{WRAPPER}} .jl_lbl_op' => 'background: {{VALUE}}',
],
]
);
$this->add_responsive_control(
'jl_label_spacing',
[
'label' => esc_html__( 'Label spacing', 'bopea-function' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px'],
'range' => [
'px' => [
'min' => 0,
'max' => 300,
'step' => 1,
]
],
'selectors' => [
'{{WRAPPER}}' => '--jl-gap-lbl: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'jl_label_rounded',
[
'label' => esc_html__( 'Label border rounded', 'bopea-function' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px'],
'range' => [
'px' => [
'min' => 0,
'max' => 300,
'step' => 1,
]
],
'selectors' => [
'{{WRAPPER}} .jl_lbl_op' => 'border-radius: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'jl_label_padding',
[
'label' => __( 'Label padding', 'bopea-function' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%'],
'selectors' => [
'{{WRAPPER}} .jl_lbl_op' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
]
]
);
$this->end_controls_section();
}
protected function render( ) {
$settings = $this->get_settings_for_display();
$current_date = $settings['current_date'];
$jl_label_title = $settings['jl_label_title'];
?>
<div class="jl_cur_date jl_lbl_in">
<?php if (!empty($jl_label_title)) {?><span class="jl_lbl_op"><?php echo $jl_label_title;?></span><?php }?>
<span class="jl_lbl_date"><?php echo date_i18n( $current_date, current_time( 'timestamp' ) ); ?></span>
</div>
<?php
}
}