File "web-security.php"

Full Path: /home/flipjqml/onlinebetsolution.com/next_old/wp-content/plugins/cyarb-toolkit/widgets/web-security.php
File size: 26.2 KB
MIME-type: text/x-php
Charset: utf-8

<?php
/**
 * Security Area Widget
 */

namespace Elementor;

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

class Cyarb_Security_Area extends Widget_Base {

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

	public function get_title() {
        return esc_html__( 'Web Security Area', 'cyarb-toolkit' );
    }

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

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

	protected function register_controls() {

        $this->start_controls_section(
			'Cyarb_Security_Area',
			[
				'label' => esc_html__( 'Cyarb Security Area', 'cyarb-toolkit' ),
				'tab' => Controls_Manager::TAB_CONTENT,
			]
        );

            $this->add_control(
                'sec_style',
                [
                    'label'   => __( 'Choose Style', 'cyarb-toolkit' ),
                    'type'    => Controls_Manager::SELECT,
                    'options' => [
                        '1'  => __( 'Style One', 'cyarb-toolkit' ),
                        '2'  => __( 'Style Two', 'cyarb-toolkit' ),
                        '3'  => __( 'Style Three', 'cyarb-toolkit' ),
                        '4'  => __( 'Style Four', 'cyarb-toolkit' ),
                    ],
                    'default' => '1',
                ]
            );

            $this->add_control(
                'title',
                [
                    'label' => esc_html__( 'Title', 'cyarb-toolkit' ),
                    'type' => Controls_Manager::TEXTAREA,
                ]
            );

            $this->add_control(
                'title_tag',
                [
                    'label' => esc_html__( 'Title Tag', 'cyarb-toolkit' ),
                    'type' => Controls_Manager::SELECT,
                    'options' => [
                        'h1'         => esc_html__( 'h1', 'cyarb-toolkit' ),
                        'h2'         => esc_html__( 'h2', 'cyarb-toolkit' ),
                        'h3'         => esc_html__( 'h3', 'cyarb-toolkit' ),
                        'h4'         => esc_html__( 'h4', 'cyarb-toolkit' ),
                        'h5'         => esc_html__( 'h5', 'cyarb-toolkit' ),
                        'h6'         => esc_html__( 'h6', 'cyarb-toolkit' ),
                    ],
                    'default' => 'h2',
                ]
            );

            $this->add_control(
                'content',
                [
                    'label' => esc_html__( 'Content', 'cyarb-toolkit' ),
                    'type'=>Controls_Manager:: WYSIWYG,
                ]
            ); 

        $this->end_controls_section();

        $this->start_controls_section(
			'Cyarb_Lists_Area',
			[
				'label' => esc_html__( 'Cyarb Lists Area', 'cyarb-toolkit' ),
				'tab' => Controls_Manager::TAB_CONTENT,
			]
        );

            $repeater = new Repeater();

            $repeater->add_control(
                'lists', [
                    'label' => __( 'Add List', 'cyarb-toolkit' ),
                    'type'=>Controls_Manager:: TEXTAREA,
                ]
            );

            $repeater->add_control(
                'icon_type',
                [
                    'label' => __( 'Icon Type', 'cyarb-toolkit' ),
                    'type' => Controls_Manager::SELECT,
                    'label_block' => true,
                    'options' => [
                        '1'  =>__( 'LineIcons Font', 'cyarb-toolkit' ),
                        '2'  => __('Font Awesome', 'cyarb-toolkit' ),
                    ], 
                    'default' => '1',
                ]
            );

            $repeater->add_control(
                'lineicon1',
                [
                    'label' => esc_html__( 'Choose Line Icon', 'cyarb-toolkit' ),
                    'type' => Controls_Manager::TEXT,
                    'condition' => [
                        'icon_type' => '1',
                    ],
                ]
            );

            $repeater->add_control(
                'icon1', [
                    'label' => __( 'Social Icon One', 'cyarb-toolkit' ),
                    'type' => Controls_Manager::ICONS,
                    'default' => [
                        'value' => 'fa fa-phone',
                        'library' => 'solid',
                    ],
                    'condition' => [
                        'icon_type' => '2',
                    ],
                ]
            );

            $this->add_control(
                'slider_content',
                [
                    'label' => __( 'Add Slider Content', 'cyarb-toolkit' ),
                    'type' => Controls_Manager::REPEATER,
                    'fields' => $repeater->get_controls(),
                ]
            );

        $this->end_controls_section();

        $this->start_controls_section(
			'section_images',
			[
				'label' => esc_html__( 'Images', 'cyarb-toolkit' ),
				'tab' => Controls_Manager::TAB_CONTENT,
			]
        );
            $this->add_control(
                'fimage',
                [
                    'label' => esc_html__( 'Add Background Image', 'cyarb-toolkit' ),
                    'type'	 => Controls_Manager::MEDIA,
                    'condition' => [
                        'sec_style' => ['1','2'],
                    ]
                ]
            );

            $this->add_control(
                'sec_image',
                [
                    'label'  => esc_html__( 'Add Section Image', 'cyarb-toolkit' ),
                    'type'	 => Controls_Manager::MEDIA,
                ]
            );

            $this->add_control(
                'shape1',
                [
                    'label'     => esc_html__( 'Shape1', 'cyarb-toolkit' ),
                    'type'	    => Controls_Manager::MEDIA,
                    'condition' => [
                        'sec_style' => ['3','4'],
                    ]
                ]
            );
            $this->add_control(
                'shape2',
                [
                    'label'     => esc_html__( 'Shape2', 'cyarb-toolkit' ),
                    'type'	    => Controls_Manager::MEDIA,
                    'condition' => [
                        'sec_style' => ['3','4'],
                    ]
                ]
            );
            $this->add_control(
                'shape3',
                [
                    'label'     => esc_html__( 'Shape3', 'cyarb-toolkit' ),
                    'type'	    => Controls_Manager::MEDIA,
                    'condition' => [
                        'sec_style' => '3',
                    ]
                ]
            );
            $this->add_control(
                'shape4',
                [
                    'label'     => esc_html__( 'Shape4', 'cyarb-toolkit' ),
                    'type'	    => Controls_Manager::MEDIA,
                    'condition' => [
                        'sec_style' => '3',
                    ]
                ]
            );
        $this->end_controls_section();

        $this->start_controls_section(
			'section_style',
			[
				'label' => esc_html__( 'Style', 'cyarb-toolkit' ),
				'tab' => Controls_Manager::TAB_STYLE,
			]
        );
        
            $this->add_control(
                'title_color',
                [
                    'label' => esc_html__( 'Title Color', 'cyarb-toolkit' ),
                    'type' => Controls_Manager::COLOR,
                    'selectors' => [
                        '{{WRAPPER}} .web-security-content h1, .web-security-content h2, .web-security-content h3, .web-security-content h4, .web-security-content h5, .web-security-content h6, .web-content h1, .web-content h2, .web-content h3, .web-content h4, .web-content h5, .web-content h6, .operation-center-content h2, .operation-center-content h1, .operation-center-content h3, .operation-center-content h4, .operation-center-content h5, .operation-center-content h6, .security-content .content h2, .security-content .content h1, .security-content .content h3, .security-content .content h4, .security-content .content h5, .security-content .content h6' => 'color: {{VALUE}}',
                    ],
                ]
            );
            $this->add_group_control(
                Group_Control_Typography::get_type(),
                [
                    'name' => 'title_typography',
                    'label' => __( 'Title Typography', 'cyarb-toolkit' ),
                    'selector' => '{{WRAPPER}}  .web-security-content h1, .web-security-content h2, .web-security-content h3, .web-security-content h4, .web-security-content h5, .web-security-content h6, .web-content h1, .web-content h2, .web-content h3, .web-content h4, .web-content h5, .web-content h6, .operation-center-content h2, .operation-center-content h1, .operation-center-content h3, .operation-center-content h4, .operation-center-content h5, .operation-center-content h6, .security-content .content h2, .security-content .content h1, .security-content .content h3, .security-content .content h4, .security-content .content h5, .security-content .content h6',
                ]
            );

            $this->add_control(
                'content_color',
                [
                    'label' => esc_html__( 'Content Color', 'cyarb-toolkit' ),
                    'type' => Controls_Manager::COLOR,
                    'selectors' => [
                        '{{WRAPPER}} p' => 'color: {{VALUE}}',
                    ],
                ]
            );
            
            $this->add_group_control(
                Group_Control_Typography::get_type(),
                [
                    'name' => 'content_typography',
                    'label' => __( 'Content Typography', 'cyarb-toolkit' ),
                    'selector' => '{{WRAPPER}} p',
                ]
            );

            $this->add_control(
                'list_color',
                [
                    'label' => esc_html__( 'List Color', 'cyarb-toolkit' ),
                    'type' => Controls_Manager::COLOR,
                    'selectors' => [
                        '{{WRAPPER}} .web-security-content .features-list li, .web-content .features-list li span, .operation-center-content .features-list li span, .security-content .content .features-list li' => 'color: {{VALUE}}',
                    ],
                ]
            );
            
            $this->add_group_control(
                Group_Control_Typography::get_type(),
                [
                    'name' => 'list_typography',
                    'label' => __( 'List Typography', 'cyarb-toolkit' ),
                    'selector' => '{{WRAPPER}} .web-security-content .features-list li, .web-content .features-list li span, .operation-center-content .features-list li span, .security-content .content .features-list li',
                ]
            );
            
        $this->end_controls_section();
    }

	protected function render() {

        $settings = $this->get_settings_for_display();

        ?>
        <?php if( $settings['sec_style'] == '1' ): ?>
            <div class="web-security-area bg-image2 ptb-100" style="background-image:url(<?php echo esc_url( $settings['fimage']['url'] ); ?>);">
                <div class="container">
                    <div class="row align-items-center">
                        <div class="col-lg-6 col-md-12">
                            <div class="web-content">
                                <<?php echo esc_attr( $settings['title_tag'] ); ?>><?php echo esc_html( $settings['title'] ); ?></<?php echo esc_attr( $settings['title_tag'] ); ?>>
                                <?php echo wp_kses_post( $settings['content'] ); ?>
                                <ul class="features-list">
                                    <?php
                                        if ( $settings['slider_content']!='' ) :
                                            foreach ( $settings['slider_content'] as $item ) :
                                                if($item['lists']!='') { 
                                                    ?>
                                                    <?php $inner_list = explode(",", $item['lists']);

                                                        foreach( $inner_list as $list ) : 
                                                            if( $list !='' ) : ?>
                                                                <li>
                                                                    <span>
                                                                        <?php if( $item['icon1'] != '' || $item['lineicon1']!='' ): ?>
                                                                            <?php if( $item['icon_type'] == 1 ){ ?>
                                                                                <i class="<?php echo esc_attr($item['lineicon1']);?>"></i>
                                                                            <?php } else {
                                                                                \Elementor\Icons_Manager::render_icon( $item['icon1'], [ 'aria-hidden' => 'true' ] ); 
                                                                            } ?>
                                                                        <?php endif; ?>

                                                                        <?php echo esc_html( $list ); ?>
                                                                    </span>
                                                                </li> <?php
                                                            endif;
                                                        endforeach; 
                                                    ?><?php
                                                } 
                                            endforeach; 
                                        endif;
                                    ?>  
                                </ul>
                            </div>
                        </div>
                        
                        <?php if( $settings['sec_image']['url'] != '' ) : ?>
                        <div class="col-lg-6 col-md-12">
                            <div class="web-image">
                                <img src="<?php echo esc_url( $settings['sec_image']['url'] ); ?>" alt="<?php echo esc_attr__( 'web-security' ); ?>">
                            </div>
                        </div>
                        <?php endif; ?>

                    </div>
                </div>
            </div>
        <?php elseif( $settings['sec_style'] == '2') : ?>
            <div class="web-security-area bg-image1 ptb-100" style="background-image:url(<?php echo esc_url( $settings['fimage']['url'] ); ?>);">
                <div class="container">
                    <div class="web-security-content">
                        <<?php echo esc_attr( $settings['title_tag'] ); ?>><?php echo esc_html( $settings['title'] ); ?></<?php echo esc_attr( $settings['title_tag'] ); ?>>
                        <?php echo wp_kses_post( $settings['content'] ); ?>
                        <ul class="features-list">
                            <?php if ( $settings['slider_content']!='' ) :
                                foreach ( $settings['slider_content'] as $item ) :
                                    if($item['lists']!='') { 
                                        $inner_list = explode(",", $item['lists']);
                                        foreach( $inner_list as $list ) : 
                                            if( $list !='' ) : ?>
                                                <li>
                                                    <?php if( $item['icon1'] != '' || $item['lineicon1']!='' ): ?>
                                                        <?php if( $item['icon_type'] == 1 ){ ?>
                                                            <i class="<?php echo esc_attr($item['lineicon1']);?>"></i>
                                                        <?php } else {
                                                            \Elementor\Icons_Manager::render_icon( $item['icon1'], [ 'aria-hidden' => 'true' ] ); 
                                                        } ?>
                                                    <?php endif; ?>

                                                    <?php echo esc_html( $list ); ?>
                                                </li> <?php
                                            endif;
                                        endforeach; 
                                    } 
                                endforeach; 
                            endif; ?>  
                        </ul>

                        <?php if( $settings['sec_image']['url'] != '' ) : ?>
                            <div class="shape4">
                                <img src="<?php echo esc_url( $settings['sec_image']['url'] ); ?>" alt="<?php echo esc_attr__( 'web-security' ); ?>">
                            </div>
                        <?php endif; ?>
                    </div>
                </div>
            </div>
        <?php elseif( $settings['sec_style'] == '3') : ?>
            <div class="operation-center-area pb-100">
                <div class="container">
                    <div class="row">
                        <?php if( $settings['sec_image']['url'] != '' ) : ?>
                            <div class="col-lg-6 col-md-12">
                                <div class="operation-center-image" style="background-image:url(<?php echo esc_url( $settings['sec_image']['url'] ); ?>);">
                                    <img src="<?php echo esc_url( $settings['sec_image']['url'] ); ?>" alt="<?php echo esc_attr__( 'web-security' ); ?>">
                                </div>
                            </div>
                            <div class="col-lg-6 col-md-12">
                        <?php else: ?>
                            <div class="col-lg-12 col-md-12">
                        <?php endif; ?>
                            <div class="operation-center-content">
                                <<?php echo esc_attr( $settings['title_tag'] ); ?>><?php echo esc_html( $settings['title'] ); ?></<?php echo esc_attr( $settings['title_tag'] ); ?>>
                                <?php echo wp_kses_post( $settings['content'] ); ?>

                                <ul class="features-list">
                                    <?php
                                        if ( $settings['slider_content']!='' ) :
                                            foreach ( $settings['slider_content'] as $item ) :
                                                if($item['lists']!='') { 
                                                    ?>
                                                    <?php $inner_list = explode(",", $item['lists']);

                                                        foreach( $inner_list as $list ) : 
                                                            if( $list !='' ) : ?>
                                                                <li>
                                                                    <span>
                                                                        <?php if( $item['icon1'] != '' || $item['lineicon1']!='' ): ?>
                                                                            <?php if( $item['icon_type'] == 1 ){ ?>
                                                                                <i class="<?php echo esc_attr($item['lineicon1']);?>"></i>
                                                                            <?php } else {
                                                                                \Elementor\Icons_Manager::render_icon( $item['icon1'], [ 'aria-hidden' => 'true' ] ); 
                                                                            } ?>
                                                                        <?php endif; ?>

                                                                        <?php echo esc_html( $list ); ?>
                                                                    </span>
                                                                </li> <?php
                                                            endif;
                                                        endforeach; 
                                                    ?><?php
                                                } 
                                            endforeach; 
                                        endif;
                                    ?>  
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>

                <?php if( $settings['shape1']['url'] != '' ) : ?>
                    <div class="shape2"> <img src="<?php echo esc_url( $settings['shape1']['url'] ); ?>" alt="<?php echo esc_attr__( 'Shape' ); ?>"></div>
                <?php endif; ?>
                <?php if( $settings['shape2']['url'] != '' ) : ?>
                    <div class="shape3"><img src="<?php echo esc_url( $settings['shape2']['url'] ); ?>" alt="<?php echo esc_attr__( 'Shape' ); ?>"></div>
                <?php endif; ?>
                <?php if( $settings['shape3']['url'] != '' ) : ?>
                    <div class="shape4"><img src="<?php echo esc_url( $settings['shape3']['url'] ); ?>" alt="<?php echo esc_attr__( 'Shape' ); ?>"></div>
                <?php endif; ?>
                <?php if( $settings['shape4']['url'] != '' ) : ?>
                    <div class="shape6"><img src="<?php echo esc_url( $settings['shape4']['url'] ); ?>" alt="<?php echo esc_attr__( 'Shape' ); ?>"></div>
                <?php endif; ?>
            </div>
        <?php else: ?>
            <div class="security-area">
                <div class="container-fluid">
                    <div class="row">
                        <?php if( $settings['sec_image']['url'] != '' ) : ?>
                            <div class="col-lg-8 col-md-12">
                                <div class="security-image" style="background-image:url(<?php echo esc_url( $settings['sec_image']['url'] ); ?>);">
                                    <img src="<?php echo esc_url( $settings['sec_image']['url'] ); ?>" alt="<?php echo esc_attr__( 'web-security' ); ?>">
                                </div>
                            </div>
                            <div class="col-lg-4 col-md-12">
                        <?php else: ?>
                            <div class="col-lg-12 col-md-12">
                        <?php endif; ?>
                            <div class="security-content">
                                <div class="content">
                                    <<?php echo esc_attr( $settings['title_tag'] ); ?>><?php echo esc_html( $settings['title'] ); ?></<?php echo esc_attr( $settings['title_tag'] ); ?>>
                                    <?php echo wp_kses_post( $settings['content'] ); ?>

                                    <ul class="features-list">
                                        <?php if ( $settings['slider_content']!='' ) :
                                            foreach ( $settings['slider_content'] as $item ) :
                                                if($item['lists']!='') { 
                                                    ?>
                                                    <?php $inner_list = explode(",", $item['lists']);

                                                        foreach( $inner_list as $list ) : 
                                                            if( $list !='' ) : ?>
                                                                <li>
                                                                    <?php if( $item['icon1'] != '' || $item['lineicon1']!='' ): ?>
                                                                        <?php if( $item['icon_type'] == 1 ){ ?>
                                                                            <i class="<?php echo esc_attr($item['lineicon1']);?>"></i>
                                                                        <?php } else {
                                                                            \Elementor\Icons_Manager::render_icon( $item['icon1'], [ 'aria-hidden' => 'true' ] ); 
                                                                        } ?>
                                                                    <?php endif; ?>

                                                                    <?php echo esc_html( $list ); ?>
                                                                </li> <?php
                                                            endif;
                                                        endforeach; 
                                                    ?><?php
                                                } 
                                            endforeach; 
                                        endif; ?>  
                                    </ul>

                                    <?php if( $settings['shape1']['url'] != '' ) : ?>
                                        <div class="shape4"> <img src="<?php echo esc_url( $settings['shape1']['url'] ); ?>" alt="<?php echo esc_attr__( 'Shape' ); ?>"></div>
                                    <?php endif; ?>
                                    <?php if( $settings['shape2']['url'] != '' ) : ?>
                                        <div class="shape2"><img src="<?php echo esc_url( $settings['shape2']['url'] ); ?>" alt="<?php echo esc_attr__( 'Shape' ); ?>"></div>
                                    <?php endif; ?>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        <?php endif; ?>

        <?php
	}

}

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