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/ld-instructors.php
<?php
/**
 * Instructors Widget
 */

namespace Elementor;

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

class eCademy_LearnDash_Instructors extends Widget_Base {

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

	public function get_title() {
        return __( 'مربیان لرن دش', 'ecademy-toolkit' );
    }

	public function get_icon() {
        return 'eicon-user-circle-o';
    }

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

        $this->start_controls_section(
			'eCademy_LearnDash_Instructors',
			[
				'label' => __( 'eCademy مربیان', 'ecademy-toolkit' ),
				'tab' => Controls_Manager::TAB_CONTENT,
			]
        );
            $this->add_control(
                'instructor_style',
                [
                    'label' => __( 'سبک', 'ecademy-toolkit' ),
                    'type' => Controls_Manager::SELECT,
                    'options' => [
                        '1'         => __( 'سبک یک (لغزنده)', 'ecademy-toolkit' ),
                        '2'         => __( 'سبک 2', 'ecademy-toolkit' ),
                        '3'         => __( 'سبک سه (لغزنده)', 'ecademy-toolkit' ),
                    ],
                    'default' => '1',
                ]
            );

            $this->add_control(
                'count',
                [
                    'label' => __( 'آیتم', 'ecademy-toolkit' ),
                    'type' => Controls_Manager::NUMBER,
                    'default' => 3,
                ]
            );

            $this->add_control(
                'order',
                [
                    'label' => __( 'سفارش توسط', 'ecademy-toolkit' ),
                    'type' => Controls_Manager::SELECT,
                    'options' => [
                        'DESC'      => __( 'DESC', 'ecademy-toolkit' ),
                        'ASC'       => __( 'ASC', 'ecademy-toolkit' ),
                    ],
                    'default' => 'DESC',
                ]
            );

        $this->end_controls_section();

        $this->start_controls_section(
			'team_style',
			[
				'label' => __( 'سبک', 'ecademy-toolkit' ),
				'tab' => Controls_Manager::TAB_STYLE,
			]
        );
			$this->add_responsive_control(
				'name_size',
				[
					'label' => __( 'اندازه قلم نام', 'ecademy-toolkit' ),
					'type' => Controls_Manager::SLIDER,
					'size_units' => [ 'px' ],
					'range' => [
						'px' => [
							'min' => 1,
							'max' => 40,
							'step' => 1,
						],
					],
					'devices' => [ 'desktop', 'tablet', 'mobile' ],
					'selectors' => [
						'{{WRAPPER}} .single-advisor-box .advisor-content h3, .start-with-success-box .content h3, .single-advisor-item .advisor-content h3' => 'font-size: {{SIZE}}px;',
					],
				]
			);

			$this->add_responsive_control(
				'designation_size',
				[
					'label' => __( 'سمت اندازه قلم', 'ecademy-toolkit' ),
					'type' => Controls_Manager::SLIDER,
					'size_units' => [ 'px' ],
					'range' => [
						'px' => [
							'min' => 1,
							'max' => 70,
							'step' => 1,
						],
					],
					'devices' => [ 'desktop', 'tablet', 'mobile' ],
					'selectors' => [
						'{{WRAPPER}} .single-advisor-box .advisor-content .sub-title, .start-with-success-box .content h3, .single-advisor-item .advisor-content span' => 'font-size: {{SIZE}}px;',
					],
				]
            );

			$this->add_responsive_control(
				'description_size',
				[
					'label' => __( 'سایز فونت توضیحات', 'ecademy-toolkit' ),
					'type' => Controls_Manager::SLIDER,
					'size_units' => [ 'px' ],
					'range' => [
						'px' => [
							'min' => 1,
							'max' => 70,
							'step' => 1,
						],
					],
					'devices' => [ 'desktop', 'tablet', 'mobile' ],
					'selectors' => [
						'{{WRAPPER}} .single-advisor-box .advisor-content p' => 'font-size: {{SIZE}}px;',
					],
				]
			);

        $this->end_controls_section();

    }

	protected function render() {

        $settings = $this->get_settings_for_display();


        if ( !ecademy_plugin_active( 'sfwd-lms/sfwd_lms.php' ) ) {
            if( is_user_logged_in() ):
                ?>
                <div class="container">
                    <div class="alert alert-danger" role="alert">
                        <?php echo esc_html__( 'لطفا افزونه LearnDash LMS را نصب و فعال کنید', 'ecademy-toolkit' ); ?>
                    </div>
                </div>
                <?php
            endif;
            return;
        }

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

        $exclude_list = array( 14 );
        $args = array(
            'role'          => 'tutor_instructor',
            'order'         => $settings['order'],
            'number'         => $settings['count'],
        );
        $user_query = new \WP_User_Query( $args );
        $teachers   = $user_query->get_results();
		?>
        <?php if( $settings['instructor_style'] == '1' ): ?>
            <?php if( $settings['count'] == 1 ): ?>
                <div class="col-lg-6 offset-lg-3">
            <?php else: ?>
                <div class="advisor-slides owl-carousel owl-theme">
            <?php endif; ?>
                <?php
                if ( ! empty( $teachers ) ) {
                    foreach ( $teachers as $teacher ) {
                        $teacher_info = get_userdata( $teacher->ID );
						if( get_field('user_image', 'user_' .$teacher->ID) != '' ):
                            ?>
                            <div class="single-advisor-box">
                                <div class="row align-items-center">
                                    <div class="col-lg-4 col-md-4">
                                        <div class="advisor-image">
                                            <?php
                                            $image  = get_field('user_image', 'user_' .$teacher->ID);
                                            $size    = 'ecademy_advisor_thumb_one';
                                            if( $image ) {
                                                echo wp_get_attachment_image( $image, $size );
                                            }
                                            ?>
                                        </div>
                                    </div>

                                    <div class="col-lg-8 col-md-8">
                                        <div class="advisor-content">
                                            <h3><?php echo esc_html( $teacher_info->display_name ); ?></h3>
                                            <span class="sub-title"><p><?php the_field('designation_name', 'user_' .$teacher->ID ); ?></p></span>
                                            <p><?php echo esc_html( $teacher_info->description ); ?></p>
                                            <ul class="social-link">
                                                <?php
                                                if( have_rows('user_social_links', 'user_'. $teacher->ID ) ):
                                                    while ( have_rows('user_social_links', 'user_'. $teacher->ID ) ) : the_row();
                                                    ?>
                                                        <li><a href="<?php echo esc_url( the_sub_field('user_social_link')); ?>" class="d-block" target="_blank"><i class="<?php echo esc_attr( the_sub_field('user_select_social_icon') ); ?>"></i></a></li>
                                                    <?php
                                                    endwhile;
                                                endif;
                                                ?>
                                            </ul>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <?php
                        endif;
                    }
                } ?>
            </div>
        <?php elseif( $settings['instructor_style'] == '2' ): ?>
            <div class="container">
                <div class="row">
                    <?php
                    if ( ! empty( $teachers ) ) {
                        foreach ( $teachers as $teacher ) {
                            $teacher_info = get_userdata( $teacher->ID );
                            if( get_field('user_image', 'user_' .$teacher->ID) != '' ):
                                ?>
                                <div class="col-lg-4 col-md-6 col-sm-6">
                                    <div class="start-with-success-box">
                                        <div class="image">
                                            <?php
                                            $image  = get_field('user_image', 'user_' .$teacher->ID);
                                            $size    = 'ecademy_advisor_thumb_two';
                                            if( $image ) {
                                                echo wp_get_attachment_image( $image, $size );
                                            }
                                            ?>
                                        </div>

                                        <div class="content">
                                            <h3><?php echo esc_html( $teacher_info->display_name ); ?></h3>
                                            <span><?php the_field('designation_name', 'user_' .$teacher->ID ); ?></span>
                                        </div>
                                    </div>
                                </div>
                                <?php
                            endif;
                        }
                    } ?>
                </div>
            </div>
        <?php elseif( $settings['instructor_style'] == '3' ): ?>
            <div class="container">
                <?php if( $settings['count'] == 1 ): ?>
                    <div class="col-lg-6 offset-lg-3">
                <?php else: ?>
                    <div class="advisor-slides-two owl-carousel owl-theme">
                <?php endif; ?>
                <?php
                if ( ! empty( $teachers ) ) {
                    foreach ( $teachers as $teacher ) {
                        $teacher_info = get_userdata( $teacher->ID );
						if( get_field('user_image', 'user_' .$teacher->ID) != '' ):
                            ?>
                            <div class="single-advisor-item">
                                <div class="advisor-image">
                                    <?php
                                    $image  = get_field('user_image', 'user_' .$teacher->ID);
                                    $size    = 'ecademy_advisor_thumb_two';
                                    if( $image ) {
                                        echo wp_get_attachment_image( $image, $size );
                                    }
                                    ?>

                                    <ul class="social-link">
                                        <?php
                                        if( have_rows('user_social_links', 'user_'. $teacher->ID ) ):
                                            while ( have_rows('user_social_links', 'user_'. $teacher->ID ) ) : the_row();
                                            ?>
                                                <li><a href="<?php echo esc_url( the_sub_field('user_social_link')); ?>" class="d-block" target="_blank"><i class="<?php echo esc_attr( the_sub_field('user_select_social_icon') ); ?>"></i></a></li>
                                            <?php
                                            endwhile;
                                        endif;
                                        ?>
                                    </ul>
                                </div>

                                <div class="advisor-content">
                                    <h3><?php echo esc_html( $teacher_info->display_name ); ?></h3>
                                    <span><?php the_field('designation_name', 'user_' .$teacher->ID ); ?></span>
                                </div>
                            </div>
                            <?php
                        endif;
                    }
                } ?>
                </div>
            </div>
        <?php endif; ?>
        <?php
	}


}

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