<?php
/**
 * Theme Palace options
 *
 * @package Theme Palace
 * @subpackage Enlightme
 * @since Enlightme 1.0.0
 */

/**
 * List of pages for page choices.
 * @return Array Array of page ids and name.
 */
function enlightme_page_choices() {
    $pages = get_pages();
    $choices = array();
    $choices[0] = esc_html__( '--Select--', 'enlightme' );
    foreach ( $pages as $page ) {
        $choices[ $page->ID ] = $page->post_title;
    }
    return  $choices;
}

/**
 * List of posts for post choices.
 * @return Array Array of post ids and name.
 */
function enlightme_post_choices() {
    $posts = get_posts( array( 'numberposts' => -1 ) );
    $choices = array();
    $choices[0] = esc_html__( '--Select--', 'enlightme' );
    foreach ( $posts as $post ) {
        $choices[ $post->ID ] = $post->post_title;
    }
    return  $choices;
}

/**
 * List of products for post choices.
 * @return Array Array of post ids and name.
 */
function enlightmeduct_choices() {
    $posts = get_posts( array( 'numberposts' => -1, 'post_type' => 'product' ) );
    $choices = array();
    $choices[0] = esc_html__( '--Select--', 'enlightme' );
    foreach ( $posts as $post ) {
        $choices[ $post->ID ] = $post->post_title;
    }
    return  $choices;
}

/**
 * List of posts for course choices.
 * @return Array Array of course ids and name.
 */
function enlightme_course_choices() {
    $courses = get_posts( array( 'numberposts' => -1, 'post_type'=>'tp-course' ) );
    $choices = array();
    $choices[0] = esc_html__( '--Select--', 'enlightme' );
    foreach ( $courses as $course ) {
        $choices[ $course->ID ] = $course->post_title;
    }
    return  $choices;
}

/**
 * List of posts for course choices.
 * @return Array Array of course ids and name.
 */
function enlightme_event_choices() {
    $events = get_posts( array( 'numberposts' => -1, 'post_type'=>'tp-event' ) );
    $choices = array();
    $choices[0] = esc_html__( '--Select--', 'enlightme' );
    foreach ( $events as $event ) {
        $choices[ $event->ID ] = $event->post_title;
    }
    return  $choices;
}

/**
 * List of posts for team choices.
 * @return Array Array of team ids and name.
 */
function enlightme_team_choices() {
    $teams = get_posts( array( 'numberposts' => -1, 'post_type'=>'tp-team' ) );
    $choices = array();
    $choices[0] = esc_html__( '--Select--', 'enlightme' );
    foreach ( $teams as $team ) {
        $choices[ $team->ID ] = $team->post_title;
    }
    return  $choices;
}

/**
 * List of pages for page choices.
 * @return Array Array of page ids and name.
 */
function enlightme_testimonial_choices() {
    $testimonials = get_posts( array( 'numberposts' => -1, 'post_type'=>'tp-testimonial' ) );
    $choices = array();
    $choices[0] = esc_html__( '--Select--', 'enlightme' );
    foreach ( $testimonials as $testimonial ) {
        $choices[ $testimonial->ID ] = $testimonial->post_title;
    }
    return  $choices;
}

if ( ! function_exists( 'enlightme_selected_sidebar' ) ) :
    /**
     * Sidebars options
     * @return array Sidbar positions
     */
    function enlightme_selected_sidebar() {
        $enlightme_selected_sidebar = array(
            'sidebar-1'             => esc_html__( 'Default Sidebar', 'enlightme' ),
            'optional-sidebar'      => esc_html__( 'Optional Sidebar 1', 'enlightme' ),
            'optional-sidebar-2'    => esc_html__( 'Optional Sidebar 2', 'enlightme' ),
            'optional-sidebar-3'    => esc_html__( 'Optional Sidebar 3', 'enlightme' ),
            'optional-sidebar-4'    => esc_html__( 'Optional Sidebar 4', 'enlightme' ),
        );

        $output = apply_filters( 'enlightme_selected_sidebar', $enlightme_selected_sidebar );

        return $output;
    }
endif;

if ( ! function_exists( 'enlightme_site_layout' ) ) :
    /**
     * Site Layout
     * @return array site layout options
     */
    function enlightme_site_layout() {
        $enlightme_site_layout = array(
            'wide-layout'  => get_template_directory_uri() . '/assets/images/full.png',
            'boxed-layout' => get_template_directory_uri() . '/assets/images/boxed.png',
        );

        $output = apply_filters( 'enlightme_site_layout', $enlightme_site_layout );
        return $output;
    }
endif;


if ( ! function_exists( 'enlightme_global_sidebar_position' ) ) :
    /**
     * Global Sidebar position
     * @return array Global Sidebar positions
     */
    function enlightme_global_sidebar_position() {
        $enlightme_global_sidebar_position = array(
            'right-sidebar' => get_template_directory_uri() . '/assets/images/right.png',
            'no-sidebar'    => get_template_directory_uri() . '/assets/images/full.png',
        );

        $output = apply_filters( 'enlightme_global_sidebar_position', $enlightme_global_sidebar_position );

        return $output;
    }
endif;


if ( ! function_exists( 'enlightme_sidebar_position' ) ) :
    /**
     * Sidebar position
     * @return array Sidbar positions
     */
    function enlightme_sidebar_position() {
        $enlightme_sidebar_position = array(
            'right-sidebar' => get_template_directory_uri() . '/assets/images/right.png',
            'no-sidebar'    => get_template_directory_uri() . '/assets/images/full.png',
        );

        $output = apply_filters( 'enlightme_sidebar_position', $enlightme_sidebar_position );

        return $output;
    }
endif;


if ( ! function_exists( 'enlightme_pagination_options' ) ) :
    /**
     * Pagination
     * @return array site pagination options
     */
    function enlightme_pagination_options() {
        $enlightme_pagination_options = array(
            'numeric'   => esc_html__( 'Numeric', 'enlightme' ),
            'default'   => esc_html__( 'Default(Older/Newer)', 'enlightme' ),
        );

        $output = apply_filters( 'enlightme_pagination_options', $enlightme_pagination_options );

        return $output;
    }
endif;

if ( ! function_exists( 'enlightme_get_spinner_list' ) ) :
    /**
     * List of spinner icons options.
     * @return array List of all spinner icon options.
     */
    function enlightme_get_spinner_list() {
        $arr = array(
            'default'               => esc_html__( 'Default', 'enlightme' ),
            'spinner-wheel'         => esc_html__( 'Wheel', 'enlightme' ),
            'spinner-double-circle' => esc_html__( 'Double Circle', 'enlightme' ),
            'spinner-two-way'       => esc_html__( 'Two Way', 'enlightme' ),
            'spinner-umbrella'      => esc_html__( 'Umbrella', 'enlightme' ),
            'spinner-dots'          => esc_html__( 'Dots', 'enlightme' ),
            'spinner-one-way'       => esc_html__( 'One Way', 'enlightme' ),
            'spinner-fidget'        => esc_html__( 'Fidget', 'enlightme' ),
        );
        return apply_filters( 'enlightme_spinner_list', $arr );
    }
endif;

if ( ! function_exists( 'enlightme_switch_options' ) ) :
    /**
     * List of custom Switch Control options
     * @return array List of switch control options.
     */
    function enlightme_switch_options() {
        $arr = array(
            'on'        => esc_html__( 'Enable', 'enlightme' ),
            'off'       => esc_html__( 'Disable', 'enlightme' )
        );
        return apply_filters( 'enlightme_switch_options', $arr );
    }
endif;

if ( ! function_exists( 'enlightme_hide_options' ) ) :
    /**
     * List of custom Switch Control options
     * @return array List of switch control options.
     */
    function enlightme_hide_options() {
        $arr = array(
            'on'        => esc_html__( 'Yes', 'enlightme' ),
            'off'       => esc_html__( 'No', 'enlightme' )
        );
        return apply_filters( 'enlightme_hide_options', $arr );
    }
endif;

if ( ! function_exists( 'enlightme_popular_course_content_type' ) ) :
    /**
     * Destination Options
     * @return array site gallery options
     */
    function enlightme_popular_course_content_type() {
        $enlightme_popular_course_content_type = array(
            'page'      => esc_html__( 'Page', 'enlightme' ),
            'post'      => esc_html__( 'Post', 'enlightme' ),
            'category'  => esc_html__( 'Category', 'enlightme' ),
        );

        if ( class_exists( 'TP_Education' ) ) {
            $enlightme_popular_course_content_type_plugin = array();

            if ( post_type_exists( 'tp-course' ) ) {
                $enlightme_popular_course_content_type_plugin['course'] = esc_html__('Course', 'enlightme');
                $enlightme_popular_course_content_type_plugin['course-category'] = esc_html__('Course Category', 'enlightme');
            }
        }
         if ( !class_exists('TP_Education')) {
            $enlightme_popular_course_content_type_plugin = array();
        }
        $enlightme_popular_course_content_type = array_merge( $enlightme_popular_course_content_type, $enlightme_popular_course_content_type_plugin );
        $output = apply_filters( 'enlightme_popular_course_content_type', $enlightme_popular_course_content_type );


        return $output;
    }
endif;

if ( ! function_exists( 'enlightme_popular_team_content_type' ) ) :
    /**
     * Destination Options
     * @return array site gallery options
     */
    function enlightme_popular_team_content_type() {
        $enlightme_popular_team_content_type = array(
            'page'      => esc_html__( 'Page', 'enlightme' ),
        );

        if ( class_exists( 'TP_Education' ) ) {
            $custom_choices = array();
            if ( post_type_exists( 'tp-team' ) ) {
               $custom_choices['tp-team']   =  esc_html__( 'Team', 'enlightme' );  
            }
        }
        if ( !class_exists('TP_Education')) {
            $custom_choices = array();
        }
        $enlightme_popular_team_content_type = array_merge( $enlightme_popular_team_content_type, $custom_choices );
        $output = apply_filters( 'enlightme_popular_team_content_type', $enlightme_popular_team_content_type );


        return $output;
    }
endif;

if ( ! function_exists( 'enlightme_popular_event_content_type' ) ) :
    /**
     * Destination Options
     * @return array site gallery options
     */
    function enlightme_popular_event_content_type() {
        $enlightme_popular_event_content_type = array(
                'page'      => esc_html__( 'Page', 'enlightme' ),
                'post'      => esc_html__( 'Post', 'enlightme' ),
                'category'  => esc_html__( 'Category', 'enlightme' ),
            ) ;
        if ( class_exists( 'TP_Education' ) ) {
            $enlightme_popular_event_content_type = array_merge($enlightme_popular_event_content_type, array(
                'event'            => esc_html__( 'Event', 'enlightme' ),
                'event-category'   => esc_html__( 'Event Category', 'enlightme' ),
                ) );
        }
       
        $output = apply_filters( 'enlightme_popular_event_content_type', $enlightme_popular_event_content_type );


        return $output;
    }
endif;

if ( ! function_exists( 'enlightme_testimonial_content_type' ) ) :
    /**
     * Package Options
     * @return array site testimonial options
     */
    function enlightme_testimonial_content_type() {
        $enlightme_testimonial_content_type = array(
            'page'      => esc_html__( 'Page', 'enlightme' ),
            'post'      => esc_html__( 'Post', 'enlightme' ),
            'category'  => esc_html__( 'Category', 'enlightme' ),
        );

        if ( class_exists( 'TP_Education' ) ) {
            $enlightme_testimonial_content_type = array_merge( $enlightme_testimonial_content_type, array(
                'testimonial'            => esc_html__( 'Testimonial', 'enlightme' ),
                ) );
        }

        $output = apply_filters( 'enlightme_testimonial_content_type', $enlightme_testimonial_content_type );

        return $output;
    }
endif;

if ( ! function_exists( 'enlightme_career_content_type' ) ) :
    /**
     * Package Options
     * @return array site career options
     */
    function enlightme_career_content_type() {
        $enlightme_career_content_type = array(
            'category'  => esc_html__( 'Category', 'enlightme' ),
        );

        if ( class_exists( 'TP_Education' ) ) {
            $enlightme_career_content_type = array_merge( $enlightme_career_content_type, array(
                'course-category'   => esc_html__( 'Course Category', 'enlightme' ),
                ) );
        }

        $output = apply_filters( 'enlightme_career_content_type', $enlightme_career_content_type );

        return $output;
    }
endif;