HEX
Server: LiteSpeed
System: Linux dune179.sitesanctuary.org 5.14.0-427.40.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Oct 16 07:08:17 EDT 2024 x86_64
User: h278792 (1076)
PHP: 7.4.33
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: /home/h278792/public_html/wp-content/plugins/ecademy-toolkit/widgets/program-area.php
<?php
/**
 * Program Area Widget
 */

namespace Elementor;

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

class eCademy_Program_Area extends Widget_Base {

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

	public function get_title() {
        return esc_html__( 'منطقه برنامه', 'ecademy-toolkit' );
    }

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

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

	protected function register_controls() {

        $this->start_controls_section(
			'eCademy_Program_Area_controls',
			[
				'label' => esc_html__( 'کنترل های ناحیه برنامه', 'ecademy-toolkit' ),
				'tab' => Controls_Manager::TAB_CONTENT,
			]
        );

            $this->add_group_control(
                Group_Control_Background::get_type(),
                [
                    'name' => 'section_background',
                    'label' => esc_html__( 'پس زمینه', 'ecademy-toolkit' ),
                    'types' => [ 'classic', 'gradient' ],
                    'selector' => '{{WRAPPER}} .program-area',
                ]
            );

            $this->add_control(
                'title',
                [
                    'label' => esc_html__( 'عنوان', 'ecademy-toolkit' ),
                    'type' => Controls_Manager::TEXT,
                    'default' => esc_html__('برنامه خود را در زیر انتخاب کنید تا ببینید چگونه می توانیم به کنترل ها کمک کنیم', 'ecademy-toolkit'),
                ]
            );

            $this->add_control(
                'title_tag',
                [
                    'label' => esc_html__( 'عنوان برچسب', 'ecademy-toolkit' ),
                    'type' => Controls_Manager::SELECT,
                    'options' => [
                        'h1'         => esc_html__( 'h1', 'ecademy-toolkit' ),
                        'h2'         => esc_html__( 'h2', 'ecademy-toolkit' ),
                        'h3'         => esc_html__( 'h3', 'ecademy-toolkit' ),
                        'h4'         => esc_html__( 'h4', 'ecademy-toolkit' ),
                        'h5'         => esc_html__( 'h5', 'ecademy-toolkit' ),
                        'h6'         => esc_html__( 'h6', 'ecademy-toolkit' ),
                    ],
                    'default' => 'h2',
                ]
            );

            $this->add_control(
                'content',
                [
                    'label' => esc_html__( 'محتوا', 'ecademy-toolkit' ),
                    'type' => Controls_Manager::TEXTAREA,
                    'default' => esc_html__('برنامه های آموزشی eCademy می تواند یک تجربه فوق العاده هیجان انگیز از یادگیری از طریق آنلاین را برای شما به ارمغان بیاورد! در حالی که با نشستن در منطقه راحتی خود به طور مجازی از کلاس های خود لذت می برید، هرگز با هیچ تجربه منفی روبرو نمی شوید. ابتکارات یادگیری انعطاف پذیر ما به شما کمک می کند تا بهتر و سریعتر از روش های سنتی یادگیری مهارت ها یاد بگیرید.', 'ecademy-toolkit'),
                ]
            );

            $this->add_control(
                'shape1',
                [
                    'label' => esc_html__( 'شکل تصویر', 'ecademy-toolkit' ),
                    'type' => Controls_Manager::MEDIA,
                ]
            );

            $this->add_control(
                'user_button_text',
                [
                    'label' 	=> esc_html__(  ' ورود کاربر به متن دکمه', 'ecademy-toolkit' ),
                    'type' 		=> Controls_Manager::TEXT,
                    'default' 	=> esc_html__('پروفایل', 'ecademy-toolkit'),
                ]
            );

            $this->add_control(
                'button_text',
                [
                    'label' 	=> esc_html__( 'متن دکمه', 'ecademy-toolkit' ),
                    'type' 		=> Controls_Manager::TEXT,
                    'default' 	=> esc_html__('در حال حاضر آغاز شده است', 'ecademy-toolkit'),
                ]
            );

            $this->add_control(
                'button_icon',
                [
                    'label' => esc_html__( 'آیکن دکمه', 'ecademy-toolkit' ),
                    'type' => Controls_Manager::ICON,
                    'label_block' => true,
                    'options' => ecademy_flaticons(),
                ]
            );

            $this->add_control(
                'link_type',
                [
                    'label' 		=> esc_html__( 'نوع پیوند دکمه  ', 'ecademy-toolkit' ),
                    'type' 			=> Controls_Manager::SELECT,
                    'label_block' 	=> true,
                    'options' => [
                        '1'  	=> esc_html__( 'پیوند به صفحه', 'ecademy-toolkit' ),
                        '2' 	=> esc_html__( 'لینک خارجی', 'ecademy-toolkit' ),
                    ],
                ]
            );

            $this->add_control(
                'link_to_page',
                [
                    'label' 		=> esc_html__( '  صفحه پیوند دکمه ', 'ecademy-toolkit' ),
                    'type' 			=> Controls_Manager::SELECT,
                    'label_block' 	=> true,
                    'options' 		=> ecademy_toolkit_get_page_as_list(),
                    'condition' => [
                        'link_type' => '1',
                    ]
                ]
            );

            $this->add_control(
                'ex_link',
                [
                    'label'		=> esc_html__('دکمه لینک خارجی', 'ecademy-toolkit'),
                    'type'		=> Controls_Manager:: TEXT,
                    'condition' => [
                        'link_type' => '2',
                    ]
                ]
            );
            $repeater = new Repeater();
            $repeater->add_control(
                'shape_image', [
                    'label'     => esc_html__( 'شکل تصویر', 'ecademy-toolkit' ),
                    'type'      => Controls_Manager::MEDIA,
                ]
            );
            $repeater->add_control(
                'title', [
                    'label'     => esc_html__( 'عنوان', 'ecademy-toolkit' ),
                    'type'      => Controls_Manager::TEXT,
                    'default'   => esc_html__('دوره های صدور گواهینامه', 'ecademy-toolkit'),
                ]
            );
            $repeater->add_control(
                'content', [
                    'label'     => esc_html__( 'محتوا', 'ecademy-toolkit' ),
                    'type'      => Controls_Manager::TEXTAREA,
                    'default'   => esc_html__('لورم ایپسوم متن ساختگی با تولید سادگی نامفهوم از صنعت چاپ و با استفاده از طراحان گرافیک است. .', 'ecademy-toolkit'),
                ]
            );
            $repeater->add_control(
                'default_icon', [
                    'label' => esc_html__( 'انتخاب آیکن', 'ecademy-toolkit' ),
                    'type' => Controls_Manager::ICON,
                    'label_block' => true,
                    'options' => ecademy_flaticons(),
                ]
            );
            $repeater->add_control(
                'link_text', [
                    'label'     => esc_html__( 'متن لینک', 'ecademy-toolkit' ),
                    'type'      => Controls_Manager::TEXTAREA,
                    'default'   => esc_html__('ادامه مطلب', 'ecademy-toolkit'),
                ]
            );
            $repeater->add_control(
                'link_type', [
                    'label'     => esc_html__( ' نوع پیوند ', 'ecademy-toolkit' ),
                    'type'      => Controls_Manager::SELECT,
                    'label_block' => true,
                    'options' => [
                        '1'     => esc_html__( 'پیوند به صفحه', 'ecademy-toolkit' ),
                        '2'     => esc_html__( 'لینک خارجی', 'ecademy-toolkit' ),
                    ],
                ]
            );
            $repeater->add_control(
                'link_to_page', [
                    'label'     => esc_html__( 'پیوند صفحه  ', 'ecademy-toolkit' ),
                    'type'      => Controls_Manager::SELECT,
                    'label_block' => true,
                    'options' => ecademy_toolkit_get_page_as_list(),
                    'condition' => [
                        'link_type' => '1',
                    ]
                ]
            );
            $repeater->add_control(
                'ex_link', [
                    'label'     => esc_html__( 'صفحه خارجی', 'ecademy-toolkit' ),
                    'type'      => Controls_Manager::TEXT,
                    'condition' => [
                        'link_type' => '2',
                    ]
                ]
            );
            $this->add_control(
                'card_item',
                [
                    'label' => esc_html__('کارت آیتم', 'ecademy-toolkit'),
                    'type' => Controls_Manager::REPEATER,
                    'fields' => $repeater->get_controls(),
                ]
            );
        $this->end_controls_section();

        $this->start_controls_section(
			'style',
			[
				'label' => esc_html__( 'سبک', 'ecademy-toolkit' ),
				'tab' => Controls_Manager::TAB_STYLE,
			]
		);

			$this->add_control(
				'card_bg_color',
				[
					'label' => esc_html__( 'رنگ پس زمینه کارت', 'ecademy-toolkit' ),
					'type' => Controls_Manager::COLOR,
					'selectors' => [
						'{{WRAPPER}} .single-program-box' => 'background-color: {{VALUE}}',
					],
				]
            );

            $this->add_group_control(
                Group_Control_Typography::get_type(),
                [
                    'name' => 'title_typography',
                    'label' => esc_html__( 'عنوان تایپوگرافی', 'ecademy-toolkit' ),
                    'scheme' => Core\Schemes\Typography::TYPOGRAPHY_1,
                    'selector' => '{{WRAPPER}} .program-section-title h1, .program-section-title h2, .program-section-title h3, .program-section-title h4, .program-section-title h5, .program-section-title h6',
                ]
            );

            $this->add_control(
				'title_color',
				[
					'label' => esc_html__( 'رنگ عنوان', 'ecademy-toolkit' ),
					'type' => Controls_Manager::COLOR,
					'selectors' => [
						'{{WRAPPER}} .program-section-title h1, .program-section-title h2, .program-section-title h3, .program-section-title h4, .program-section-title h5, .program-section-title h6' => 'color: {{VALUE}}',
					],
				]
            );

            $this->add_group_control(
                Group_Control_Typography::get_type(),
                [
                    'name' => 'content_typography',
                    'label' => esc_html__( 'محتوای تایپوگرافی', 'ecademy-toolkit' ),
                    'scheme' => Core\Schemes\Typography::TYPOGRAPHY_1,
                    'selector' => '{{WRAPPER}} .program-section-title p',
                ]
            );

            $this->add_control(
				'content_color',
				[
					'label' => __( 'رنگ محتوا', 'ecademy-toolkit' ),
					'type' => Controls_Manager::COLOR,
					'selectors' => [
						'{{WRAPPER}} .program-section-title p' => 'color: {{VALUE}}',
					],
				]
            );

            $this->add_group_control(
                Group_Control_Typography::get_type(),
                [
                    'name' => 'card_title_typography',
                    'label' => esc_html__( ' تایپوگرافی عنوان کارت ', 'ecademy-toolkit' ),
                    'scheme' => Core\Schemes\Typography::TYPOGRAPHY_1,
                    'selector' => '{{WRAPPER}} .single-program-box h3',
                ]
            );

            $this->add_control(
				'card_title_color',
				[
					'label' => esc_html__( 'رنگ عنوان کارت', 'ecademy-toolkit' ),
					'type' => Controls_Manager::COLOR,
					'selectors' => [
						'{{WRAPPER}} .single-program-box h3' => 'color: {{VALUE}}',
					],
				]
            );

            $this->add_group_control(
                Group_Control_Typography::get_type(),
                [
                    'name' => 'card_content_typography',
                    'label' => esc_html__( 'تایپوگرافی محتوای کارت', 'ecademy-toolkit' ),
                    'scheme' => Core\Schemes\Typography::TYPOGRAPHY_1,
                    'selector' => '{{WRAPPER}} .single-program-box p',
                ]
            );

            $this->add_control(
				'card_content_color',
				[
					'label' => esc_html__( 'رنگ محتوای کارت', 'ecademy-toolkit' ),
					'type' => Controls_Manager::COLOR,
					'selectors' => [
						'{{WRAPPER}} .single-program-box p' => 'color: {{VALUE}}',
					],
				]
            );

            $this->add_group_control(
                Group_Control_Typography::get_type(),
                [
                    'name' => 'link_typography',
                    'label' => esc_html__( 'تایپوگرافی متن پیوند', 'ecademy-toolkit' ),
                    'scheme' => Core\Schemes\Typography::TYPOGRAPHY_1,
                    'selector' => '{{WRAPPER}} .single-program-box .link-btn',
                ]
            );

            $this->add_control(
				'link_color',
				[
					'label' => esc_html__( 'رنگ متن پیوند', 'ecademy-toolkit' ),
					'type' => Controls_Manager::COLOR,
					'selectors' => [
						'{{WRAPPER}} .single-program-box .link-btn' => 'color: {{VALUE}}',
					],
				]
            );
            $this->add_control(
				'link_hover_color',
				[
					'label' => esc_html__( 'رنگ شناور متن پیوند', 'ecademy-toolkit' ),
					'type' => Controls_Manager::COLOR,
					'selectors' => [
						'{{WRAPPER}} .single-program-box .link-btn:hover' => 'color: {{VALUE}}',
					],
				]
            );

        $this->end_controls_section();

    }

	protected function render() {

		$settings = $this->get_settings_for_display();

        global $ecademy_opt;
		if( isset( $ecademy_opt['enable_lazyloader'] ) ):
			$is_lazyloader = $ecademy_opt['enable_lazyloader'];
		else:
			$is_lazyloader = true;
		endif;

        // Inline Editing
        $this-> add_inline_editing_attributes('title','none');
        $this-> add_inline_editing_attributes('content','none');

        ?>
        <div class="program-area ptb-100">
            <div class="container">
                <div class="row align-items-center">
                    <div class="col-lg-6 col-md-12">
                        <div class="program-section-title">
                            <<?php echo esc_attr( $settings['title_tag'] ); ?> <?php echo $this-> get_render_attribute_string('title'); ?>><?php echo esc_html( $settings['title'] ); ?></<?php echo esc_attr( $settings['title_tag'] ); ?>>
                            <p <?php echo $this-> get_render_attribute_string('content'); ?>><?php echo wp_kses_post( $settings['content'] ); ?></p>
                            <?php
                            if ( is_user_logged_in() ):
                                $button_text = $settings['user_button_text'];
                            else:
                                $button_text = $settings['button_text'];
                            endif;
                            if( $button_text ):
                                // Button Icon
                                if( $settings['button_icon'] != '' ):
                                    $icon = $settings['button_icon'];
                                else:
                                    $icon = 'flaticon-user';
                                endif;

                                // Get Button Link
                                if($settings['link_type'] == 1){
                                    $link = get_page_link( $settings['link_to_page'] );
                                } else {
                                    $link = $settings['ex_link'];
                                }
                            ?>
                                <a href="<?php echo esc_url( $link ); ?>" class="default-btn"><i class="<?php echo esc_attr( $icon ); ?>"></i><?php echo esc_html( $button_text ); ?><span></span></a>
                            <?php endif; ?>
                        </div>
                    </div>

                    <div class="col-lg-6 col-md-12">
                        <div class="program-list">
                            <div class="row align-items-center">
                                <div class="col-lg-6 col-md-6">
                                    <?php $i = 1; foreach( $settings['card_item'] as $item ):

                                        // Get Button Link
                                        if( $item['link_type'] == 1 ){
                                            $link = get_page_link( $item['link_to_page'] );
                                        } else {
                                            $link = $item['ex_link'];
                                        }

                                        // Icon
                                        $icon =$item['default_icon'];
                                        if( $i == 1 || $i == 2 || $i == 5 || $i == 7 || $i == 9 || $i == 11 || $i == 13 || $i == 15 || $i == 17 ):
                                            ?>
                                            <div class="single-program-box">
                                                <?php if( $item['shape_image']['url'] != '' ): ?>
                                                    <div class="shape">
                                                        <?php if( $is_lazyloader == true ): ?>
                                                            <img sm-src="<?php echo esc_url( $item['shape_image']['url'] ); ?>" alt="<?php echo esc_attr_e('شکل تصویر', 'ecademy-toolkit'); ?>">
                                                        <?php else: ?>
                                                            <img src="<?php echo esc_url( $item['shape_image']['url'] ); ?>" alt="<?php echo esc_attr_e('شکل تصویر', 'ecademy-toolkit'); ?>">
                                                        <?php endif; ?>
                                                    </div>
                                                <?php endif; ?>
                                                <?php if( $icon != '' ): ?>
                                                    <div class="icon">
                                                        <i class="<?php echo esc_attr( $icon ); ?>"></i>
                                                    </div>
                                                <?php endif;?>
                                                <h3><?php echo esc_html( $item['title'] ); ?></h3>
                                                <p><?php echo esc_html( $item['content'] ); ?></p>
                                                <?php if( $link != '' ): ?>
                                                    <a href="<?php echo esc_url( $link ); ?>" class="link-btn"><?php echo esc_html( $item['link_text'] ); ?></a>
                                                <?php endif; ?>
                                            </div>
                                            <?php
                                        endif;
                                    $i++;
                                    endforeach;
                                    ?>
                                </div>

                                <div class="col-lg-6 col-md-6">
                                    <?php $i = 1; foreach( $settings['card_item'] as $item ):

                                        // Get Button Link
                                        if( $item['link_type'] == 1 ){
                                            $link = get_page_link( $item['link_to_page'] );
                                        } else {
                                            $link = $item['ex_link'];
                                        }

                                        // Icon
                                        if( $i != 1 && $i != 2 && $i != 5 && $i != 7 && $i != 9 && $i != 11 && $i != 13 && $i != 15 && $i != 17 ):
                                            ?>
                                            <div class="single-program-box mb-20">
                                                <?php if( $item['shape_image']['url'] != '' ): ?>
                                                    <div class="shape">
                                                        <?php if( $is_lazyloader == true ): ?>
                                                            <img sm-src="<?php echo esc_url( $item['shape_image']['url'] ); ?>" alt="<?php echo esc_attr_e('شکل تصویر', 'ecademy-toolkit'); ?>">
                                                        <?php else: ?>
                                                            <img src="<?php echo esc_url( $item['shape_image']['url'] ); ?>" alt="<?php echo esc_attr_e('شکل تصویر', 'ecademy-toolkit'); ?>">
                                                        <?php endif; ?>
                                                    </div>
                                                <?php endif; ?>
                                                <?php if( $icon != '' ): ?>
                                                    <div class="icon">
                                                        <i class="<?php echo esc_attr( $icon ); ?>"></i>
                                                    </div>
                                                <?php endif;?>
                                                <h3><?php echo esc_html( $item['title'] ); ?></h3>
                                                <p><?php echo esc_html( $item['content'] ); ?></p>
                                                <?php if( $link != '' ): ?>
                                                    <a href="<?php echo esc_url( $link ); ?>" class="link-btn"><?php echo esc_html( $item['link_text'] ); ?></a>
                                                <?php endif; ?>
                                            </div>
                                            <?php
                                        endif;
                                    $i++;
                                    endforeach;
                                    ?>
                                </div>
                            </div>

                            <?php if( $settings['shape1']['url'] != '' ): ?>
                                <div class="program-circle-shape">
                                    <?php if( $is_lazyloader == true ): ?>
                                        <img sm-src="<?php echo esc_urL( $settings['shape1']['url'] ); ?>" alt="<?php echo esc_attr__( 'شکل تصویر', 'ecademy-toolkit' ); ?>">
                                    <?php else: ?>
                                        <img src="<?php echo esc_urL( $settings['shape1']['url'] ); ?>" alt="<?php echo esc_attr__( 'شکل تصویر', 'ecademy-toolkit' ); ?>">
                                    <?php endif; ?>
                                </div>
                            <?php endif; ?>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <?php
	}


}

Plugin::instance()->widgets_manager->register( new eCademy_Program_Area );