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

/**
 * List of pages for page choices.
 * @return Array Array of page ids and name.
 */
function ultravel_page_choices() {
    $pages = get_pages();
    $choices = array();
    $choices[0] = esc_html__( '--Select--', 'ultravel' );
    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 ultravel_post_choices() {
    $posts = get_posts( array( 'numberposts' => -1 ) );
    $choices = array();
    $choices[0] = esc_html__( '--Select--', 'ultravel' );
    foreach ( $posts as $post ) {
        $choices[ $post->ID ] = $post->post_title;
    }
    return  $choices;
}

/**
 * List of category for category choices.
 * @return Array Array of post ids and name.
 */
function ultravel_category_choices() {
    $tax_args = array(
        'hierarchical' => 0,
        'taxonomy'     => 'category',
    );
    $taxonomies = get_categories( $tax_args );
    $choices = array();
    $choices[0] = esc_html__( '--Select--', 'ultravel' );
    foreach ( $taxonomies as $tax ) {
        $choices[ $tax->term_id ] = $tax->name;
    }
    return  $choices;
}

function ultravelduct_category_choices() {
    $tax_args = array(
        'hierarchical' => 0,
        'taxonomy'     => 'product_cat',
    );
    $taxonomies = get_categories( $tax_args );
    $choices = array();
    $choices[0] = esc_html__( '--Select--', 'ultravel' );
    foreach ( $taxonomies as $tax ) {
        $choices[ $tax->term_id ] = $tax->name;
    }
    return  $choices;
}

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

function ultravelduct_choices() {
    $full_product_list = array();
    $product_id = array();
    $loop = new WP_Query(array('post_type' => array('product', 'product_variation'), 'posts_per_page' => -1));
    while ($loop->have_posts()) : $loop->the_post();
        $product_id[] = get_the_id();
    endwhile;
    wp_reset_postdata();
    $choices = array();
    $choices[0] = esc_html__( '--Select--', 'ultravel' );
    foreach ( $product_id  as $id ) {
        $choices[ $id ] = get_the_title( $id );
    }
    return  $choices;
}


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

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

        return $output;
    }
endif;

if ( ! function_exists( 'ultravel_site_layout' ) ) :
    /**
     * Site Layout
     * @return array site layout options
     */
    function ultravel_site_layout() {
        $ultravel_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( 'ultravel_site_layout', $ultravel_site_layout );
        return $output;
    }
endif;


if ( ! function_exists( 'ultravel_global_sidebar_position' ) ) :
    /**
     * Global Sidebar position
     * @return array Global Sidebar positions
     */
    function ultravel_global_sidebar_position() {
        $ultravel_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( 'ultravel_global_sidebar_position', $ultravel_global_sidebar_position );

        return $output;
    }
endif;


if ( ! function_exists( 'ultravel_sidebar_position' ) ) :
    /**
     * Sidebar position
     * @return array Sidbar positions
     */
    function ultravel_sidebar_position() {
        $ultravel_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( 'ultravel_sidebar_position', $ultravel_sidebar_position );

        return $output;
    }
endif;


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

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

        return $output;
    }
endif;

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

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

if ( ! function_exists( 'ultravel_main_slider_content_type' ) ) :
    /**
     * main slider Options
     * @return array site main slider options
     */
    function ultravel_main_slider_content_type() {
        $ultravel_main_slider_content_type = array(
            'page'      => esc_html__( 'Page', 'ultravel' ),
        );

        if ( class_exists( 'WP_Travel' ) ) {
            $ultravel_main_slider_content_type = array_merge( $ultravel_main_slider_content_type, array(
                'trip'          => esc_html__( 'Trip', 'ultravel' ),
                ) );
        }

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


        return $output;
    }
endif;

if ( ! function_exists( 'ultravel_service_content_type' ) ) :
    /**
     * service options
     * @return array site service options
     */
    function ultravel_service_content_type() {
        $ultravel_service_content_type = array(
            'page'      => esc_html__( 'Page', 'ultravel' ),
            'post'      => esc_html__( 'Post', 'ultravel' ),
            'category'  => esc_html__( 'Category', 'ultravel' ),
        );

        if ( class_exists( 'WP_Travel' ) ) {
            $ultravel_service_content_type = array_merge( $ultravel_service_content_type, array(
                'trip'          => esc_html__( 'Trip', 'ultravel' ),
                'trip-types'    => esc_html__( 'Trip Types', 'ultravel' ),
                'destination'   => esc_html__( 'Destination', 'ultravel' ),
                'activity'      => esc_html__( 'Activity', 'ultravel' ),
                ) );
        }

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


        return $output;
    }
endif;

if ( ! function_exists( 'ultravel_popular_posts_section_content_type' ) ) :
    /**
     * blog options
     * @return array site blog options
     */
    function ultravel_popular_posts_section_content_type() {
        $ultravel_popular_posts_section_content_type = array(
            'page'      => esc_html__( 'Page', 'ultravel' ),
            'post'      => esc_html__( 'Post', 'ultravel' ),
            'category'  => esc_html__( 'Category', 'ultravel' ),
        );

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


        return $output;
    }
endif;



if ( ! function_exists( 'ultravel_activities_content_type' ) ) :
    /**
     * featured Options
     * @return array site featured options
     */
    function ultravel_activities_content_type() {
        $ultravel_activities_content_type = array(
            'category'  => esc_html__( 'Category', 'ultravel' ),
        );

        if ( class_exists( 'WP_Travel' ) ) {
            $ultravel_activities_content_type = array_merge( $ultravel_activities_content_type, array(
                'trip-types'    => esc_html__( 'Trip Types', 'ultravel' ),
                ) );
        }

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


        return $output;
    }
endif;


if ( ! function_exists( 'ultravel_heading_tags' ) ) :
    /**
     * Destination Options
     * @return array site gallery options
     */
    function ultravel_heading_tags() {
        
        $ultravel_heading_tags = array(
			'h1'	=> esc_html__('H1', 'ultravel'),
			'h2'	=> esc_html__('H2', 'ultravel'),
			'h3'	=> esc_html__('H3', 'ultravel'),
			'h4'	=> esc_html__('H4', 'ultravel'),
			'h5'	=> esc_html__('H5', 'ultravel'),
			'h6'	=> esc_html__('H6', 'ultravel'),
			'p'		=> esc_html__('Paragraph', 'ultravel'),
		);

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


        return $output;
    }
endif;