File "keep-world.php"

Full Path: /home/flipjqml/onlinebetsolution.com/wp-content/plugins/cyarb-toolkit/widgets/keep-world.php
File size: 10.69 KB
MIME-type: text/x-php
Charset: utf-8

<?php
/**
 * Keep World Widget
 */

namespace Elementor;

// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

class Cyarb_Keep_World extends Widget_Base {

	public function get_name() {
        return 'Cyarb_KeepWorld';
    }

	public function get_title() {
        return __( 'Keep World', 'cyarb-toolkit' );
    }

	public function get_icon() {
        return 'eicon-counter';
    }

	public function get_categories() {
        return [ 'cyarb-elements' ];
    }

	protected function register_controls() {

        $this->start_controls_section(
			'keepworld_section',
			[
				'label' => __( 'Keep World Control', 'cyarb-toolkit' ),
				'tab'   => Controls_Manager::TAB_CONTENT,
			]
		);
            $this->add_control(
                'sec_title', [
                    'type'    => Controls_Manager::TEXTAREA,
                    'label'   => __( 'Section Title', 'cyarb-toolkit' ),
                ]
            );
            $this->add_control(
                'title_tag',
                [
                    'label'   => __( 'Title Tag', 'cyarb-toolkit' ),
                    'type'    => Controls_Manager::SELECT,
                    'options' => [
                        'h1'    => __( 'h1', 'cyarb-toolkit' ),
                        'h2'    => __( 'h2', 'cyarb-toolkit' ),
                        'h3'    => __( 'h3', 'cyarb-toolkit' ),
                        'h4'    => __( 'h4', 'cyarb-toolkit' ),
                        'h5'    => __( 'h5', 'cyarb-toolkit' ),
                        'h6'    => __( 'h6', 'cyarb-toolkit' ),
                    ],
                    'default' => 'h2',
                ]
            );
            $this->add_control(
                'left_number', [
					'type'    => Controls_Manager::TEXT,
					'label'   => __( 'Left Number', 'cyarb-toolkit' ),
                ]
            );
            $this->add_control(
                'left_num_suffix', [
                    'type'    => Controls_Manager::TEXT,
                    'label'   => __( 'Left Number Suffix', 'cyarb-toolkit' ),
                ]
            );
            $this->add_control(
                'left_title', [
                    'type'    => Controls_Manager::TEXT,
                    'label'   => __( 'Left Title', 'cyarb-toolkit' ),
                ]
            );
            $this->add_control(
				'left_image', [
					'label' => __( 'Left Image', 'cyarb-toolkit' ),
					'type'  => Controls_Manager::MEDIA,
				]
			);
            $this->add_control(
				'middle_image', [
					'label' => __( 'Middle Image', 'cyarb-toolkit' ),
					'type'  => Controls_Manager::MEDIA,
				]
			);
            $this->add_control(
				'right_image', [
					'label' => __( 'Right Image', 'cyarb-toolkit' ),
					'type'  => Controls_Manager::MEDIA,
				]
			);
            $this->add_control(
                'right_number', [
					'type'    => Controls_Manager::TEXT,
					'label'   => __( 'Right Number', 'cyarb-toolkit' ),
                ]
            );
            $this->add_control(
                'right_num_suffix', [
                    'type'    => Controls_Manager::TEXT,
                    'label'   => __( 'Right Number Suffix', 'cyarb-toolkit' ),
                ]
            );
            $this->add_control(
                'right_title', [
                    'type'    => Controls_Manager::TEXT,
                    'label'   => __( 'Right Title', 'cyarb-toolkit' ),
                ]
            );

            $this->add_control(
				'shape1', [
					'label' => __( 'Shape Image 1', 'cyarb-toolkit' ),
					'type'  => Controls_Manager::MEDIA,
				]
			);
            $this->add_control(
				'shape2', [
					'label' => __( 'Shape Image 2', 'cyarb-toolkit' ),
					'type'  => Controls_Manager::MEDIA,
				]
			);
            $this->add_control(
				'shape3', [
					'label' => __( 'Shape Image 3', 'cyarb-toolkit' ),
					'type'  => Controls_Manager::MEDIA,
				]
			);
        $this->end_controls_section();

        $this->start_controls_section(
			'counter_style',
			[
				'label' => __( 'Style', 'cyarb-toolkit' ),
				'tab'   => Controls_Manager::TAB_STYLE,
			]
		);

            $this->add_control(
                'sec_bg_color',
                [
                    'label'     => __( 'Section Background Color', 'cyarb-toolkit' ),
                    'type'      => Controls_Manager::COLOR,
                    'selectors' => [
                        '{{WRAPPER}} .keep-world-area, .body-with-black-color .keep-world-area' => 'background-color: {{VALUE}}',
                    ],
                ]
            );
            $this->add_control(
				'title_color',
				[
					'label' => __( 'Title Color', 'cyarb-toolkit' ),
					'type' => Controls_Manager::COLOR,
					'selectors' => [
						'{{WRAPPER}} .keep-world-area .section-title h1, .keep-world-area .section-title h2, .keep-world-area .section-title h3, .keep-world-area .section-title h4, .keep-world-area .section-title h5, .keep-world-area .section-title h6' => 'color: {{VALUE}}',
					],
				]
			);
			$this->add_group_control(
                Group_Control_Typography::get_type(),
                [
                    'name' => 'title_typography',
                    'label' => __( 'Title Typography', 'cyarb-toolkit' ),
                    'selector' => '{{WRAPPER}} .keep-world-area .section-title h1, .keep-world-area .section-title h2, .keep-world-area .section-title h3, .keep-world-area .section-title h4, .keep-world-area .section-title h5, .keep-world-area .section-title h6',
                ]
            );
            $this->add_control(
				'counter_color',
				[
					'label' => __( 'Counter Color', 'cyarb-toolkit' ),
					'type' => Controls_Manager::COLOR,
					'selectors' => [
						'{{WRAPPER}} .keep-world-card h3' => 'color: {{VALUE}}',
					],
				]
			);
			$this->add_group_control(
                Group_Control_Typography::get_type(),
                [
                    'name' => 'counter_typography',
                    'label' => __( 'Counter Typography', 'cyarb-toolkit' ),
                    'selector' => '{{WRAPPER}} .keep-world-card h3',
                ]
            );
            $this->add_control(
				'counter_tcolor',
				[
					'label' => __( 'Counter Title Color', 'cyarb-toolkit' ),
					'type' => Controls_Manager::COLOR,
					'selectors' => [
						'{{WRAPPER}} .keep-world-card p' => 'color: {{VALUE}}',
					],
				]
			);
			$this->add_group_control(
                Group_Control_Typography::get_type(),
                [
                    'name' => 'counter_ttypography',
                    'label' => __( 'Counter Title Typography', 'cyarb-toolkit' ),
                    'selector' => '{{WRAPPER}} .keep-world-card p',
                ]
            );
        $this->end_controls_section();
    }

	protected function render() {
        $settings = $this->get_settings_for_display();

        ?>

        <div class="keep-world-area pt-100 pb-75">
            <div class="container">
                <?php if($settings['sec_title'] != '') : ?>
                <div class="section-title">
                    <<?php echo esc_attr( $settings['title_tag'] ); ?>><?php echo esc_html( $settings['sec_title'] ); ?></<?php echo esc_attr( $settings['title_tag'] ); ?>>
                </div>
                <?php endif; ?>

                <div class="row align-items-center justify-content-center">
                    <div class="col-lg-4 col-sm-4">
                        <div class="keep-world-card">
                            <h3><span class="odometer" data-count="<?php echo esc_attr( $settings['left_number'] ); ?>">00</span><span class="sign"><?php echo esc_html( $settings['left_num_suffix'] ); ?></span></h3>
                            <p><?php echo esc_html( $settings['left_title'] ); ?></p>

                            <?php if($settings['left_image']['url'] != '' ) : ?>
                            <div class="keep-world-shape">
                                <img src="<?php echo esc_url( $settings['left_image']['url'] ); ?>" alt="<?php echo esc_attr__( 'Left image', 'cyarb-toolkit' ); ?>">
                            </div>
                            <?php endif; ?>
                        </div>
                    </div>

                    <?php if( $settings['middle_image']['url'] != '' ) : ?>
                    <div class="col-lg-4 col-sm-4">
                        <div class="keep-world-card">
                            <img src="<?php echo esc_url( $settings['middle_image']['url'] ); ?>" alt="<?php echo esc_attr__( 'Middle image', 'cyarb-toolkit' ); ?>">
                        </div>
                    </div>
                    <?php endif; ?>

                    <div class="col-lg-4 col-sm-4">
                        <div class="keep-world-card">
                            <h3><span class="odometer" data-count="<?php echo esc_attr( $settings['right_number'] ); ?>">00</span><span class="sign"><?php echo esc_html( $settings['right_num_suffix'] ); ?></span></h3>
                            <p><?php echo esc_html( $settings['right_title'] ); ?></p>

                            <?php if( $settings['right_image']['url'] != '' ) : ?>
                            <div class="keep-world-shape-2">
                                <img src="<?php echo esc_url( $settings['right_image']['url'] ); ?>" alt="<?php echo esc_attr__( 'Right image', 'cyarb-toolkit' ); ?>">
                            </div>
                            <?php endif; ?>
                        </div>
                    </div>
                </div>
            </div>

            <?php if( $settings['shape1']['url'] != '' ) : ?>
                <div class="keep-world-rectangle-shape">
                    <img src="<?php echo esc_url( $settings['shape1']['url'] ); ?>" alt="<?php echo esc_attr__( 'Shape1', 'cyarb-toolkit' ); ?>">
                </div>
            <?php endif; ?>
            <?php if( $settings['shape2']['url'] != '' ) : ?>
                <div class="keep-world-circle-dot">
                    <img src="<?php echo esc_url( $settings['shape2']['url'] ); ?>" alt="<?php echo esc_attr__( 'Shape2', 'cyarb-toolkit' ); ?>">
                </div>
            <?php endif; ?>
            <?php if( $settings['shape3']['url'] != '' ) : ?>
                <div class="keep-world-circle-dot-2">
                    <img src="<?php echo esc_url( $settings['shape3']['url'] ); ?>" alt="<?php echo esc_attr__( 'Shape3', 'cyarb-toolkit' ); ?>">
                </div>
            <?php endif; ?>
        </div>

        <?php
	}

}

Plugin::instance()->widgets_manager->register_widget_type( new Cyarb_Keep_World );