<?php
/**
 * Theme Options
 *
 * @package Signify
 */

/**
 * Add theme options
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function signify_theme_options( $wp_customize ) {
	$wp_customize->add_panel( 'signify_theme_options', array(
		'title'    => esc_html__( 'Theme Options', 'signify-pro' ),
		'priority' => 130,
	) );

	// Font Family Options.
	$wp_customize->add_section( 'signify_font_family', array(
		'panel' => 'signify_theme_options',
		'title' => esc_html__( 'Font Family Options', 'signify-pro' ),
	) );

	/**
	* Check if navigation type is Jetpack Infinite Scroll and if it is enabled
	*/
	$load_font_cdn_desc = sprintf(
		wp_kses(
			__( 'A German court fined a website using Google-hosted webfonts for violating Europe’s General Data Protection Regulation (GDPR). So this has been discouraged. More info %1$shere%2$s', 'signify-pro' ),
			array(
				'a' => array(
					'href' => array(),
					'target' => array(),
				)
			)
		),
		'<a target="_blank" href="https://make.wordpress.org/themes/2022/06/18/complying-with-gdpr-when-using-google-fonts/">',
		'</a>'
	);
	
	signify_register_option( $wp_customize, array(
			'name'               => 'signify_load_font_cdn',
			'description'        => $load_font_cdn_desc,
			'sanitize_callback'  => 'signify_sanitize_checkbox',
			'label'              => esc_html__( 'Load Google Font from CDN', 'signify-pro' ),
			'section'            => 'signify_font_family',
			'type'    			 => 'checkbox',
		)
	);

	$avaliable_fonts = signify_avaliable_fonts();

	$choices = array();

	foreach ( $avaliable_fonts as $font ) {
		$choices[ $font['value'] ] = str_replace( '"', '', $font['label'] );
	}

	$font_family_options = signify_font_family_options();

	foreach ( $font_family_options as $key => $value ) {
		signify_register_option( $wp_customize, array(
				'name'              => $key,
				'default'           => $value['default'],
				'sanitize_callback' => 'signify_sanitize_select',
				'choices'           => $choices,
				'label'             => $value['label'],
				'section'           => 'signify_font_family',
				'type'              => 'select',
			)
		);
	}

	signify_register_option( $wp_customize, array(
			'name'              => 'signify_reset_typography',
			'sanitize_callback' => 'signify_sanitize_checkbox',
			'transport'         => 'postMessage',
			'label'             => esc_html__( 'Check to reset fonts', 'signify-pro' ),
			'section'           => 'signify_font_family',
			'type'              => 'checkbox',
		)
	);


	// Footer Options.
	$wp_customize->add_section( 'signify_footer_options', array(
		'title'       => esc_html__( 'Footer Options', 'signify-pro' ),
		'description' => esc_html__( 'You can either add html or plain text or custom shortcodes, which will be automatically inserted into your theme. Some shorcodes: [the-year], [site-link] and [privacy-policy-link] for current year, site link and privacy policy link respectively.', 'signify-pro' ),
		'panel'       => 'signify_theme_options',
	) );

	$theme_data = wp_get_theme();

	signify_register_option( $wp_customize, array(
			'name'              => 'signify_footer_copyright_text',
			'default'           => sprintf( _x( 'Copyright &copy; %1$s %2$s %3$s', '1: Year, 2: Site Title with home URL, 3: Privacy Policy Link', 'signify-pro' ), '[the-year]', '[site-link]', '[privacy-policy-link]' ) . '<span class="sep"> | </span>',
			'sanitize_callback' => 'wp_kses_post',
			'label'             => esc_html__( 'Copyright Text', 'signify-pro' ),
			'section'           => 'signify_footer_options',
			'type'              => 'textarea',
		)
	);

	signify_register_option( $wp_customize, array(
			'name'              => 'signify_footer_powered_by',
			'default'           => esc_html( $theme_data->get( 'Name' ) ) . '&nbsp;' . esc_html__( 'by', 'signify-pro' ) . '&nbsp;<a target="_blank" href="' . esc_url( $theme_data->get( 'AuthorURI' ) ) . '">' . esc_html( $theme_data->get( 'Author' ) ) . '</a>',
			'sanitize_callback' => 'wp_kses_post',
			'label'             => esc_html__( 'Powered By Text', 'signify-pro' ),
			'section'           => 'signify_footer_options',
			'type'              => 'textarea',
		)
	);

	signify_register_option( $wp_customize, array(
			'name'              => 'signify_reset_footer_content',
			'sanitize_callback' => 'signify_sanitize_checkbox',
			'label'             => esc_html__( 'Reset Footer Content', 'signify-pro' ),
			'description'       => esc_html__( 'Refresh the page after save to view full effects.', 'signify-pro' ),
			'section'           => 'signify_footer_options',
			'transport'         => 'postMessage',
			'type'              => 'checkbox',
		)
	);

	signify_register_option( $wp_customize, array(
			'name'              => 'signify_latest_posts_title',
			'default'           => esc_html__( 'From Our Blog', 'signify-pro' ),
			'sanitize_callback' => 'wp_kses_post',
			'label'             => esc_html__( 'Latest Posts Title', 'signify-pro' ),
			'section'           => 'signify_theme_options',
		)
	);

	// Layout Options
	$wp_customize->add_section( 'signify_layout_options', array(
		'title' => esc_html__( 'Layout Options', 'signify-pro' ),
		'panel' => 'signify_theme_options',
		)
	);

	/* Layout Type */
	signify_register_option( $wp_customize, array(
			'name'              => 'signify_layout_type',
			'default'           => 'fluid',
			'sanitize_callback' => 'signify_sanitize_select',
			'label'             => esc_html__( 'Site Layout', 'signify-pro' ),
			'section'           => 'signify_layout_options',
			'type'              => 'select',
			'choices'           => array(
				'fluid' => esc_html__( 'Fluid', 'signify-pro' ),
				'boxed' => esc_html__( 'Boxed', 'signify-pro' ),
			),
		)
	);

	// Header Layout
	signify_register_option( $wp_customize, array(
			'name'              => 'signify_header_layout',
			'default'           => 'header-style-one',
			'sanitize_callback' => 'signify_sanitize_select',
			'label'             => esc_html__( 'Header Layout', 'signify-pro' ),
			'section'           => 'signify_layout_options',
			'type'              => 'select',
			'choices'           => array(
				'header-style-one' => esc_html__( 'Style 1 (Center Header)', 'signify-pro' ),
				'header-style-two' => esc_html__( 'Style 2 (Header Logo Left- Menu Right)', 'signify-pro' ),
			),
		)
	);


	/* Default Layout */
	signify_register_option( $wp_customize, array(
			'name'              => 'signify_default_layout',
			'default'           => 'right-sidebar',
			'sanitize_callback' => 'signify_sanitize_select',
			'label'             => esc_html__( 'Default Layout', 'signify-pro' ),
			'section'           => 'signify_layout_options',
			'type'              => 'select',
			'choices'           => array(
				'right-sidebar'         => esc_html__( 'Right Sidebar ( Content, Primary Sidebar )', 'signify-pro' ),
				'left-sidebar'          => esc_html__( 'Left Sidebar ( Primary Sidebar, Content )', 'signify-pro' ),
				'no-sidebar'            => esc_html__( 'No Sidebar', 'signify-pro' ),
				'no-sidebar-full-width' => esc_html__( 'No Sidebar: Full Width', 'signify-pro' ),
			),
		)
	);

	// Header Top Options
	$wp_customize->add_section( 'signify_header_top', array(
		'panel'       => 'signify_theme_options',
		'title'       => esc_html__( 'Header Top Options', 'signify-pro' ),
	) );

	signify_register_option( $wp_customize, array(
			'name'              => 'signify_display_header_top',
			'sanitize_callback' => 'signify_sanitize_checkbox',
			'label'             => esc_html__( 'Header Top', 'signify-pro' ),
			'section'           => 'signify_header_top',
			'type'    			=> 'checkbox',
		)
	);

	signify_register_option( $wp_customize, array(
			'name'              => 'signify_display_header_search',
			'sanitize_callback' => 'signify_sanitize_checkbox',
			'active_callback'   => 'signify_is_header_top_enabled',
			'label'             => esc_html__( 'Search', 'signify-pro' ),
			'section'           => 'signify_header_top',
			'type'    			=> 'checkbox',
		)
	);

	signify_register_option( $wp_customize, array(
			'name'              => 'signify_display_date',
			'sanitize_callback' => 'signify_sanitize_checkbox',
			'active_callback'   => 'signify_is_header_top_enabled',
			'label'             => esc_html__( 'Display Date', 'signify-pro' ),
			'section'           => 'signify_header_top',
			'type'    			=> 'checkbox',
		)
	);

	signify_register_option( $wp_customize, array(
			'name'              => 'signify_email_label',
			'default'           => 	esc_html__( 'Email Us:', 'signify-pro' ),
			'sanitize_callback' => 'sanitize_text_field',
			'active_callback'   => 'signify_is_header_top_enabled',
			'label'             => esc_html__( 'Email Label', 'signify-pro' ),
			'section'           => 'signify_header_top',
			'type'              => 'text',
		)
	);

	signify_register_option( $wp_customize, array(
			'name'              => 'signify_email',
			'sanitize_callback' => 'sanitize_email',
			'active_callback'   => 'signify_is_header_top_enabled',
			'label'             => esc_html__( 'Email', 'signify-pro' ),
			'section'           => 'signify_header_top',
			'type'              => 'text',
		)
	);

	signify_register_option( $wp_customize, array(
			'name'              => 'signify_phone_label',
			'default'           => 	esc_html__( 'Call Us:', 'signify-pro' ),
			'sanitize_callback' => 'sanitize_text_field',
			'active_callback'   => 'signify_is_header_top_enabled',
			'label'             => esc_html__( 'Phone Label', 'signify-pro' ),
			'section'           => 'signify_header_top',
			'type'              => 'text',
		)
	);

	signify_register_option( $wp_customize, array(
			'name'              => 'signify_phone',
			'sanitize_callback' => 'sanitize_text_field',
			'active_callback'   => 'signify_is_header_top_enabled',
			'label'             => esc_html__( 'Phone', 'signify-pro' ),
			'section'           => 'signify_header_top',
			'type'              => 'text',
		)
	);

	signify_register_option( $wp_customize, array(
			'name'              => 'signify_address_label',
			'default'           => 	esc_html__( 'Address:', 'signify-pro' ),
			'sanitize_callback' => 'sanitize_text_field',
			'active_callback'   => 'signify_is_header_top_enabled',
			'label'             => esc_html__( 'Address Label', 'signify-pro' ),
			'section'           => 'signify_header_top',
			'type'              => 'text',
		)
	);

	signify_register_option( $wp_customize, array(
			'name'              => 'signify_address',
			'sanitize_callback' => 'wp_kses_post',
			'active_callback'   => 'signify_is_header_top_enabled',
			'label'             => esc_html__( 'Address', 'signify-pro' ),
			'section'           => 'signify_header_top',
			'type'              => 'text',
		)
	);

	signify_register_option( $wp_customize, array(
			'name'              => 'signify_header_top_display_cart_link',
			'sanitize_callback' => 'signify_sanitize_checkbox',
			'active_callback'   => 'signify_is_header_top_enabled',
			'label'             => esc_html__( 'Display Cart Link', 'signify-pro' ),
			'section'           => 'signify_header_top',
			'type'    			=> 'checkbox',
		)
	);

	

	/* Homepage/Archive Layout */
	signify_register_option( $wp_customize, array(
			'name'              => 'signify_homepage_archive_layout',
			'default'           => 'right-sidebar',
			'sanitize_callback' => 'signify_sanitize_select',
			'label'             => esc_html__( 'Homepage/Archive Layout', 'signify-pro' ),
			'section'           => 'signify_layout_options',
			'type'              => 'select',
			'choices'           => array(
				'right-sidebar'         => esc_html__( 'Right Sidebar ( Content, Primary Sidebar )', 'signify-pro' ),
				'left-sidebar'          => esc_html__( 'Left Sidebar ( Primary Sidebar, Content )', 'signify-pro' ),
				'no-sidebar'            => esc_html__( 'No Sidebar', 'signify-pro' ),
				'no-sidebar-full-width' => esc_html__( 'No Sidebar: Full Width', 'signify-pro' ),
			),
		)
	);

	/* Archive Content Layout */
	signify_register_option( $wp_customize, array(
			'name'              => 'signify_content_layout',
			'default'           => 'excerpt',
			'sanitize_callback' => 'signify_sanitize_select',
			'label'             => esc_html__( 'Archive Content Layout', 'signify-pro' ),
			'section'           => 'signify_layout_options',
			'type'              => 'select',
			'choices'           => array(
				'excerpt'            => esc_html__( 'Excerpt with Featured Image', 'signify-pro' ),
				'full-content-custom' => esc_html__( 'Show Full Content With Image', 'signify-pro' ),
				'full-content'       => esc_html__( 'Show Full Content ( No Featured Image )', 'signify-pro' ),
			),
		)
	);

	/* Archive Image Size */
	signify_register_option( $wp_customize, array(
			'name'              => 'signify_archive_image',
			'default'           => 'post-thumbnail',
			'sanitize_callback' => 'signify_sanitize_select',
			'active_callback'   => 'signify_archive_image_active',
			'label'             => esc_html__( 'Archive Image Size', 'signify-pro' ),
			'section'           => 'signify_layout_options',
			'type'              => 'select',
			'choices'           => array(
				'post-thumbnail'            => esc_html__( 'Post Thumbnail 666px by 666px', 'signify-pro' ),
				'signify-photography' => esc_html__( 'Photography 507px by 338px', 'signify-pro' ),
				'signify-featured-content'       => esc_html__( 'Featured Content 440px by 330px', 'signify-pro' ),
				'signify-slider'       => esc_html__( 'Slider 1920px by 1080px', 'signify-pro' ),
				'medium'       => esc_html__( 'Original Image Resolution', 'signify-pro' ),
				'large'       => esc_html__( 'Large Image size in Media Settings', 'signify-pro' ),
				'full'       => esc_html__( 'Large Image size in Media Settings', 'signify-pro' ),
			),
		)
	);

	signify_register_option( $wp_customize, array(
    		'name'              => 'signify_blog_post_layout',
    		'default'           => 'layout-one',
    		'sanitize_callback' => 'signify_sanitize_select',
    		'label'             => esc_html__( 'Blog/Archive Posts Column', 'signify-pro' ),
    		'section'           => 'signify_layout_options',
    		'type'              => 'select',
    		'choices'           => array(
				'layout-one'   => esc_html__( '1 Column', 'signify-pro' ),
				'layout-two'   => esc_html__( '2 Columns', 'signify-pro' ),
				'layout-three' => esc_html__( '3 Columns', 'signify-pro' ),
    		),
    	)
	);

    signify_register_option( $wp_customize, array(
    		'name'              => 'signify_homepage_post_layout',
    		'default'           => 'layout-one',
    		'sanitize_callback' => 'signify_sanitize_select',
    		'label'             => esc_html__( 'Homepage Posts Column', 'signify-pro' ),
    		'section'           => 'signify_layout_options',
    		'type'              => 'select',
    		'choices'           => array(
				'layout-one'   => esc_html__( '1 Column', 'signify-pro' ),
				'layout-two'   => esc_html__( '2 Columns', 'signify-pro' ),
				'layout-three' => esc_html__( '3 Columns', 'signify-pro' ),
    		),
    	)
	);

	signify_register_option( $wp_customize, array(
            'name'               => 'signify_single_page_title',
            'default'			 => 1,
            'sanitize_callback'  => 'signify_sanitize_checkbox',
            'label'              => esc_html__( 'Single Page title', 'signify-pro' ),
            'section'            => 'signify_layout_options',
            'type'    			 => 'checkbox',
        )
    );

	/* Single Page/Post Image */
	signify_register_option( $wp_customize, array(
			'name'              => 'signify_single_layout',
			'default'           => 'disabled',
			'sanitize_callback' => 'signify_sanitize_select',
			'label'             => esc_html__( 'Single Page/Post Image', 'signify-pro' ),
			'section'           => 'signify_layout_options',
			'type'              => 'select',
			'choices'           => array(
				'disabled'        => esc_html__( 'Disabled', 'signify-pro' ),
				'post-thumbnail'  => esc_html__( 'Post Thumbnail', 'signify-pro' ),
				'signify-slider' => esc_html__( 'Slider Image Size (1920x1080)', 'signify-pro' ),
				'full'            => esc_html__( 'Original Image Size', 'signify-pro' ),
			),
		)
	);

	// Excerpt Options.
	$wp_customize->add_section( 'signify_excerpt_options', array(
		'panel'     => 'signify_theme_options',
		'title'     => esc_html__( 'Excerpt Options', 'signify-pro' ),
	) );

	signify_register_option( $wp_customize, array(
			'name'              => 'signify_excerpt_length',
			'default'           => '20',
			'sanitize_callback' => 'absint',
			'input_attrs' => array(
				'min'   => 10,
				'max'   => 200,
				'step'  => 5,
				'style' => 'width: 60px;',
			),
			'label'    => esc_html__( 'Excerpt Length (words)', 'signify-pro' ),
			'section'  => 'signify_excerpt_options',
			'type'     => 'number',
		)
	);

	signify_register_option( $wp_customize, array(
			'name'              => 'signify_excerpt_more_text',
			'default'           => esc_html__( 'Continue reading...', 'signify-pro' ),
			'sanitize_callback' => 'sanitize_text_field',
			'label'             => esc_html__( 'Read More Text', 'signify-pro' ),
			'section'           => 'signify_excerpt_options',
			'type'              => 'text',
		)
	);

	// Excerpt Options.
	$wp_customize->add_section( 'signify_search_options', array(
		'panel'     => 'signify_theme_options',
		'title'     => esc_html__( 'Search Options', 'signify-pro' ),
	) );

	signify_register_option( $wp_customize, array(
			'name'              => 'signify_search_text',
			'default'           => esc_html__( 'Search', 'signify-pro' ),
			'sanitize_callback' => 'sanitize_text_field',
			'label'             => esc_html__( 'Search Text', 'signify-pro' ),
			'section'           => 'signify_search_options',
			'type'              => 'text',
		)
	);

	// Comment Option.
	$wp_customize->add_section( 'signify_comment_option', array(
		'description'   => esc_html__( 'Comments can also be disabled on a per post/page basis when creating/editing posts/pages.', 'signify-pro' ),
		'panel'         => 'signify_theme_options',
		'title'         => esc_html__( 'Comment Options', 'signify-pro' ),
	) );

	signify_register_option( $wp_customize, array(
			'name'              => 'signify_comment_option',
			'default'           => 'use-wordpress-setting',
			'sanitize_callback' => 'signify_sanitize_select',
			'choices'           => array(
				'use-wordpress-setting' => esc_html__( 'Use WordPress Setting', 'signify-pro' ),
				'disable-in-pages'      => esc_html__( 'Disable in Pages', 'signify-pro' ),
				'disable-completely'    => esc_html__( 'Disable Completely', 'signify-pro' ),
			),
			'label'             => __( 'Comment Option', 'signify-pro' ),
			'section'           => 'signify_comment_option',
			'type'              => 'select',
		)
	);

	signify_register_option( $wp_customize, array(
			'name'              => 'signify_website_field',
			'sanitize_callback' => 'signify_sanitize_checkbox',
			'default'           => 1,
			'label'             => esc_html__( 'Display Website Field', 'signify-pro' ),
			'section'           => 'signify_comment_option',
			'type'    			=> 'checkbox',
		)
	);

	// Homepage / Frontpage Options.
	$wp_customize->add_section( 'signify_homepage_options', array(
		'description' => esc_html__( 'Only posts that belong to the categories selected here will be displayed on the front page', 'signify-pro' ),
		'panel'       => 'signify_theme_options',
		'title'       => esc_html__( 'Homepage / Frontpage Options', 'signify-pro' ),
	) );

	signify_register_option( $wp_customize, array(
			'name'              => 'signify_display_homepage_posts',
			'default'			=> 1,
			'sanitize_callback' => 'signify_sanitize_checkbox',
			'label'             => esc_html__( 'Recent Posts/Content on homepage', 'signify-pro' ),
			'section'           => 'signify_homepage_options',
			'type'    			=> 'checkbox',
		)
	);

	signify_register_option( $wp_customize, array(
			'name'              => 'signify_recent_posts_subtitle',
			'sanitize_callback' => 'sanitize_text_field',
			'label'             => esc_html__( 'Recent Posts Subtitle', 'signify-pro' ),
			'section'           => 'signify_homepage_options',
		)
	);

	signify_register_option( $wp_customize, array(
			'name'              => 'signify_recent_posts_heading',
			'sanitize_callback' => 'sanitize_text_field',
			'default'           => esc_html__( 'From Our Blog', 'signify-pro' ),
			'label'             => esc_html__( 'Recent Posts Heading', 'signify-pro' ),
			'section'           => 'signify_homepage_options',
		)
	);

	signify_register_option( $wp_customize, array(
			'name'              => 'signify_static_page_heading',
			'sanitize_callback' => 'sanitize_text_field',
			'active_callback'	=> 'signify_is_static_page_enabled',
			'default'           => esc_html__( 'Archives', 'signify-pro' ),
			'label'             => esc_html__( 'Posts Page Header Text', 'signify-pro' ),
			'section'           => 'signify_homepage_options',
		)
	);

	signify_register_option( $wp_customize, array(
			'name'              => 'signify_recent_posts_subheading',
			'sanitize_callback' => 'wp_kses_post',
			'label'             => esc_html__( 'Recent Posts Description', 'signify-pro' ),
			'section'           => 'signify_homepage_options',
			'type'              => 'textarea'
		)
	);

	signify_register_option( $wp_customize, array(
			'name'              => 'signify_front_page_category',
			'sanitize_callback' => 'signify_sanitize_category_list',
			'custom_control'    => 'Signify_Multi_Cat',
			'active_callback'   => 'signify_is_homepage_posts_enabled',
			'label'             => esc_html__( 'Categories', 'signify-pro' ),
			'section'           => 'signify_homepage_options',
			'type'              => 'dropdown-categories',
		)
	);

	// Disable Recent post in static frontpage
    signify_register_option( $wp_customize, array(
			'name'              => 'signify_enable_static_page_posts',
			'sanitize_callback' => 'signify_sanitize_checkbox',
			'label'             => esc_html__( 'Recent Posts on Static Page', 'signify-pro' ),
			'section'           => 'signify_homepage_options',
			'type'    			=> 'checkbox',
	    )
	);

	// Important Links.
	$wp_customize->add_section( 'signify_important_links_options', array(
		'title'       => esc_html__( 'Important Links Options', 'signify-pro' ),
		'panel'       => 'signify_theme_options',
	) );

	signify_register_option( $wp_customize, array(
			'name'              => 'signify_hide_important_links',
			'sanitize_callback' => 'signify_sanitize_checkbox',
			'label'             => esc_html__( 'Check to hide important links. Refresh after saving.', 'signify-pro' ),
			'section'           => 'signify_important_links_options',
			'type'    			=> 'checkbox',
		)
	);

	//Menu Options
	$wp_customize->add_section( 'signify_menu_options', array(
		'description' => esc_html__( 'Extra Menu Options specific to this theme', 'signify-pro' ),
		'title'       => esc_html__( 'Menu Options', 'signify-pro' ),
		'panel'       => 'signify_theme_options',
	) );

	signify_register_option( $wp_customize, array(
			'name'              => 'signify_primary_below_header_media',
			'sanitize_callback' => 'signify_sanitize_checkbox',
			'label'             => esc_html__( 'Move Primary Menu below Header Media', 'signify-pro' ),
			'description'       => esc_html__( 'Only avaliable when Theme Options-> Layout Options-> Header Layout is set to Style 1 (Center Header)', 'signify-pro' ),
			'section'           => 'signify_menu_options',
			'type'              => 'checkbox',
		)
	);
	
	signify_register_option( $wp_customize, array(
			'name'              => 'signify_primary_search_enable',
			'default'			=> 0,
			'sanitize_callback' => 'signify_sanitize_checkbox',
			'label'             => esc_html__( 'Search in Primary Menu', 'signify-pro' ),
			'section'           => 'signify_menu_options',
			'type'    			=> 'checkbox',
		)
	);

	signify_register_option( $wp_customize, array(
			'name'              => 'signify_header_cart_enable',
			'default'			=> 0,
			'description'       => esc_html__( 'Enable WooCommerce Plugin for cart icon', 'signify-pro' ),
			'sanitize_callback' => 'signify_sanitize_checkbox',
			'label'             => esc_html__( 'Cart Icon', 'signify-pro' ),
			'section'           => 'signify_menu_options',
			'type'    			=> 'checkbox',
		)
	);

	signify_register_option( $wp_customize, array(
			'name'              => 'signify_menu_type',
			'default'           => 'classic',
			'sanitize_callback' => 'signify_sanitize_select',
			'label'             => esc_html__( 'Menu Type', 'signify-pro' ),
			'section'           => 'signify_menu_options',
			'type'              => 'select',
			'choices'           => array(
				'modern'  => esc_html__( 'Modern', 'signify-pro' ),
				'classic' => esc_html__( 'Classic', 'signify-pro' ),
	        ),
	    )
	);
	//Menu Options End

	// Pagination Options.
	$pagination_type = get_theme_mod( 'signify_pagination_type', 'default' );

	$nav_desc = '';

	/**
	* Check if navigation type is Jetpack Infinite Scroll and if it is enabled
	*/
	$nav_desc = sprintf(
		wp_kses(
			__( 'For infinite scrolling, use %1$sCatch Infinite Scroll Plugin%2$s with Infinite Scroll module Enabled.', 'signify-pro' ),
			array(
				'a' => array(
					'href' => array(),
					'target' => array(),
				),
				'br'=> array()
			)
		),
		'<a target="_blank" href="https://wordpress.org/plugins/catch-infinite-scroll/">',
		'</a>'
	);

	$wp_customize->add_section( 'signify_pagination_options', array(
		'description'     => $nav_desc,
		'panel'           => 'signify_theme_options',
		'title'           => esc_html__( 'Pagination Options', 'signify-pro' ),
		'active_callback' => 'signify_scroll_plugins_inactive'
	) );

	signify_register_option( $wp_customize, array(
			'name'              => 'signify_pagination_type',
			'default'           => 'default',
			'sanitize_callback' => 'signify_sanitize_select',
			'choices'           => signify_get_pagination_types(),
			'label'             => esc_html__( 'Pagination type', 'signify-pro' ),
			'section'           => 'signify_pagination_options',
			'type'              => 'select',
		)
	);

	// For WooCommerce layout: signify_woocommerce_layout, check woocommerce-options.php.
	/* Scrollup Options */
	$wp_customize->add_section( 'signify_scrollup', array(
		'panel'    => 'signify_theme_options',
		'title'    => esc_html__( 'Scrollup Options', 'signify-pro' ),
	) );

	signify_register_option( $wp_customize, array(
			'name'              => 'signify_disable_scrollup',
			'default'			=> 1,
			'sanitize_callback' => 'signify_sanitize_checkbox',
			'label'             => esc_html__( 'Scroll Up', 'signify-pro' ),
			'section'           => 'signify_scrollup',
			'type'    			=> 'checkbox',
		)
	);

	// Sort Section.
	$wp_customize->add_section( 'signify_sections_sort', array(
		'title'       => esc_html__( 'Sections Sorter', 'signify-pro' ),
		'description' => esc_html__( 'Drag and drop to sort your sections', 'signify-pro' ),
		'panel'       => 'signify_theme_options',
	) );

	signify_register_option( $wp_customize, array(
			'name'              => 'signify_sections_sort',
			'default'           => signify_get_default_sections_value(),
			'label'             => esc_html__( 'Sortable Sections', 'signify-pro' ),
			'custom_control'    => 'Signify_Sortable_Custom_Control',
			'sanitize_callback' => 'sanitize_text_field',
			'section'           => 'signify_sections_sort',
			'type'              => 'custom-sortable',
		)
	);
}
add_action( 'customize_register', 'signify_theme_options' );


/**
 * Returns an array of avaliable fonts registered for Signify
 *
 * @since 1.0.0
 */
function signify_avaliable_fonts() {
	$avaliable_fonts = array(
		'arial-black' => array(
			'value' => 'arial-black',
			'label' => '"Arial Black", Gadget, sans-serif',
		),
		'allan' => array(
			'value' => 'allan',
			'label' => '"Allan", sans-serif',
		),
		'allerta' => array(
			'value' => 'allerta',
			'label' => '"Allerta", sans-serif',
		),
		'amaranth' => array(
			'value' => 'amaranth',
			'label' => '"Amaranth", sans-serif',
		),
		'amatic-sc' => array(
			'value' => 'amatic-sc',
			'label' => '"Amatic SC", cursive',
		),
		'arial' => array(
			'value' => 'arial',
			'label' => 'Arial, Helvetica, sans-serif',
		),
		'bitter' => array(
			'value' => 'bitter',
			'label' => '"Bitter", sans-serif',
		),
		'cabin' => array(
			'value' => 'cabin',
			'label' => '"Cabin", sans-serif',
		),
		'cantarell' => array(
			'value' => 'cantarell',
			'label' => '"Cantarell", sans-serif',
		),
		'century-gothic' => array(
			'value' => 'century-gothic',
			'label' => '"Century Gothic", sans-serif',
		),
		'courier-new' => array(
			'value' => 'courier-new',
			'label' => '"Courier New", Courier, monospace',
		),
		'crimson-text' => array(
			'value' => 'crimson-text',
			'label' => '"Crimson Text", sans-serif',
		),
		'cuprum' => array(
			'value' => 'cuprum',
			'label' => '"Cuprum", sans-serif',
		),
		'dancing-script' => array(
			'value' => 'dancing-script',
			'label' => '"Dancing Script", sans-serif',
		),
		'droid-sans' => array(
			'value' => 'droid-sans',
			'label' => '"Droid Sans", sans-serif',
		),
		'droid-serif' => array(
			'value' => 'droid-serif',
			'label' => '"Droid Serif", sans-serif',
		),
		'exo' => array(
			'value' => 'exo',
			'label' => '"Exo", sans-serif',
		),
		'exo-2' => array(
			'value' => 'exo-2',
			'label' => '"Exo 2", sans-serif',
		),
		'georgia' => array(
			'value' => 'georgia',
			'label' => 'Georgia, "Times New Roman", Times, serif',
		),
		'helvetica' => array(
			'value' => 'helvetica',
			'label' => 'Helvetica, "Helvetica Neue", Arial, sans-serif',
		),
		'helvetica-neue' => array(
			'value' => 'helvetica-neue',
			'label' => '"Helvetica Neue",Helvetica,Arial,sans-serif',
		),
		'istok-web' => array(
			'value' => 'istok-web',
			'label' => '"Istok Web", sans-serif',
		),
		'impact' => array(
			'value' => 'impact',
			'label' => 'Impact, Charcoal, sans-serif',
		),
		'josefin-sans' => array(
			'value' => 'josefin-sans',
			'label' => '"Josefin Sans", sans-serif',
		),
		'lato' => array(
			'value' => 'lato',
			'label' => '"Lato", sans-serif',
		),
		'lucida-sans-unicode' => array(
			'value' => 'lucida-sans-unicode',
			'label' => '"Lucida Sans Unicode", "Lucida Grande", sans-serif',
		),
		'lucida-grande' => array(
			'value' => 'lucida-grande',
			'label' => '"Lucida Grande", "Lucida Sans Unicode", sans-serif',
		),
		'lobster' => array(
			'value' => 'lobster',
			'label' => '"Lobster", sans-serif',
		),
		'lora' => array(
			'value' => 'lora',
			'label' => '"Lora", serif',
		),
		'monaco' => array(
			'value' => 'monaco',
			'label' => 'Monaco, Consolas, "Lucida Console", monospace, sans-serif',
		),
		'muli' => array(
			'value' => 'muli',
			'label' => 'Muli, sans-serif',
		),
		'mrs-saint-delafield' => array(
			'value' => 'mrs-saint-delafield',
			'label' => '"Mrs Saint Delafield", cursive',
		),
		'montserrat' => array(
			'value' => 'montserrat',
			'label' => '"Montserrat", sans-serif',
		),
		'nobile' => array(
			'value' => 'nobile',
			'label' => '"Nobile", sans-serif',
		),
		'noto-serif' => array(
			'value' => 'noto-serif',
			'label' => '"Noto Serif", serif',
		),
		'neuton' => array(
			'value' => 'neuton',
			'label' => '"Neuton", serif',
		),
		'open-sans' => array(
			'value' => 'open-sans',
			'label' => '"Open Sans", sans-serif',
		),
		'oswald' => array(
			'value' => 'oswald',
			'label' => '"Oswald", sans-serif',
		),
		'oxygen' => array(
			'value' => 'oxygen',
			'label' => '"Oxygen", sans-serif',
		),
		'palatino' => array(
			'value' => 'palatino',
			'label' => 'Palatino, "Palatino Linotype", "Book Antiqua", serif',
		),
		'patua-one' => array(
			'value' => 'patua-one',
			'label' => '"Patua One", sans-serif',
		),
		'poppins' => array(
			'value' => 'poppins',
			'label' => '"Poppins", sans-serif',
		),
		'playfair-display' => array(
			'value' => 'playfair-display',
			'label' => '"Playfair Display", sans-serif',
		),
		'pt-sans' => array(
			'value' => 'pt-sans',
			'label' => '"PT Sans", sans-serif',
		),
		'pt-serif' => array(
			'value' => 'pt-serif',
			'label' => '"PT Serif", serif',
		),
		'quattrocento-sans' => array(
			'value' => 'quattrocento-sans',
			'label' => '"Quattrocento Sans", sans-serif',
		),
		'roboto' => array(
			'value' => 'roboto',
			'label' => '"Roboto", sans-serif',
		),
		'roboto-slab' => array(
			'value' => 'roboto-slab',
			'label' => '"Roboto Slab", serif',
		),
		'rubik' => array(
			'value' => 'rubik',
			'label' => '"Rubik", serif',
		),
		'sans-serif' => array(
			'value' => 'sans-serif',
			'label' => 'Sans Serif, Arial',
		),
		'source-sans-pro' => array(
			'value' => 'source-sans-pro',
			'label' => '"Source Sans Pro", sans-serif',
		),
		'tahoma' => array(
			'value' => 'tahoma',
			'label' => 'Tahoma, Geneva, sans-serif',
		),
		'trebuchet-ms' => array(
			'value' => 'trebuchet-ms',
			'label' => '"Trebuchet MS", "Helvetica", sans-serif',
		),
		'times-new-roman' => array(
			'value' => 'times-new-roman',
			'label' => '"Times New Roman", Times, serif',
		),
		'ubuntu' => array(
			'value' => 'ubuntu',
			'label' => '"Ubuntu", sans-serif',
		),
		'varela' => array(
			'value' => 'varela',
			'label' => '"Varela", sans-serif',
		),
		'verdana' => array(
			'value' => 'verdana',
			'label' => 'Verdana, Geneva, sans-serif',
		),
		'yanone-kaffeesatz' => array(
			'value' => 'yanone-kaffeesatz',
			'label' => '"Yanone Kaffeesatz", sans-serif',
		),
	);

	return apply_filters( 'signify_avaliable_fonts', $avaliable_fonts );
}


/**
 * Returns an array of font family options
 *
 * @since 1.0.0
 */
function signify_font_family_options() {
	$options = array(
		'signify_body_font'         => array(
			'label'    => esc_html__( 'Default Font Family', 'signify-pro' ),
			'default'  => 'open-sans',
			'selector' => 'body, button, input, select, textarea, #stats-section h2.entry-title, .woocommerce .product-container .button, #testimonial-content-section .entry-title, .sidebar .widget-title, .widget-area:not(.sidebar) .widget .widget-title, .widget-area .wp-block-group h2:first-child, .menu-label, #infinite-handle span button',
		),
		'signify_title_font'        => array(
			'label'    => esc_html__( 'Site Title Font Family', 'signify-pro' ),
			'default'  => 'playfair-display',
			'selector' => '.site-title',
		),
		'signify_tagline_font'      => array(
			'label'    => esc_html__( 'Site Tagline Font Family', 'signify-pro' ),
			'default'  => 'open-sans',
			'selector' => '.site-description',
		),
		'signify_content_title_font' => array(
			'label'    => esc_html__( 'Content Title Font Family', 'signify-pro' ),
			'default'  => 'playfair-display',
			'selector' => '.entry-title, .page-title, #main .entry-title, #main .entry-subtitle',
		),
		'signify_headings_font'     => array(
			'label'    => esc_html__( 'Headings Tags from h1 to h6 Font Family', 'signify-pro' ),
			'default'  => 'playfair-display',
			'selector' => 'h1, h2, h3, h4, h5, h6',
		),
		'signify_section_title_font'     => array(
			'label'    => esc_html__( 'Section Title Font', 'signify-pro' ),
			'default'  => 'playfair-display',
			'selector' => '.section-title ,button, #testimonial-content-section .entry-content,
			#testimonial-content-section .entry-summary .button, input[type="button"], input[type="reset"], input[type="submit"], .woocommerce #respond input#submit, .woocommerce a.button, .woocommerce button.button, .woocommerce input.button, .posts-navigation a, .post-navigation .post-title, .comment-meta .author-name, #content #infinite-handle span button, .catch-instagram-feed-gallery-widget-wrapper .button, .ui-tabs .ui-tabs-nav li a',
		),
	);

	return apply_filters( 'signify_font_family_options', $options );
}

/** Active Callback Functions */

if ( ! function_exists( 'signify_is_homepage_posts_enabled' ) ) :
	/**
	* Return true if hommepage posts/content is enabled
	*
	* @since 1.0.0
	*/
	function signify_is_homepage_posts_enabled( $control ) {
		return ( $control->manager->get_setting( 'signify_display_homepage_posts' )->value() ? true : false );
	}
endif;

if( ! function_exists( 'signify_is_header_top_enabled' ) ) :
    /**
    * Return true if header top is enabled
    *
    * @since 1.0.0
    */
    function signify_is_header_top_enabled( $control ) {
        return ( $control->manager->get_setting( 'signify_display_header_top' )->value() );
    }
endif;

if ( ! function_exists( 'signify_scroll_plugins_inactive' ) ) :
	/**
	* Return true if infinite scroll functionality exists
	*
	* @since 1.0.0
	*/
	function signify_scroll_plugins_inactive( $control ) {
		if ( ( class_exists( 'Jetpack' ) && Jetpack::is_module_active( 'infinite-scroll' ) ) || class_exists( 'Catch_Infinite_Scroll' ) ) {
			// Support infinite scroll plugins.
			return false;
		}

		return true;
	}
endif;

if ( ! function_exists( 'signify_is_static_page_enabled' ) ) :
	/**
	* Return true if A Static Page is enabled
	*
	* @since Signify Pro 1.1.2
	*/
	function signify_is_static_page_enabled( $control ) {
		$enable = $control->manager->get_setting( 'show_on_front' )->value();
		if ( 'page' === $enable ) {
			return true;
		}
		return false;
	}
endif;


if( ! function_exists( 'signify_archive_image_active' ) ) :
    /**
    * Return true if header top is enabled
    *
    * @since 1.0.0
    */
    function signify_archive_image_active( $control ) {
    	$content_layout = $control->manager->get_setting( 'signify_content_layout' )->value();

        if ( 'full-content' != $content_layout ) {
        	return true;
        }
        return false;
    }
endif;
