<?php
/**
 * The template for adding color options in Customizer
 *
 * @package Gridalicious Catch Themes
 * @subpackage Gridalicious
 * @since Gridalicious 1.0
 */

 if ( ! defined( 'GRIDALICIOUS_THEME_VERSION' ) ) {
	header( 'Status: 403 Forbidden' );
	header( 'HTTP/1.1 403 Forbidden' );
	exit();
}
  	//Basic Color Options
  	$wp_customize->add_panel( 'gridalicious_color_options', array(
	    'capability'     => 'edit_theme_options',
	    'description'    => __( 'Color Options', 'gridalicious-pro' ),
	    'priority'       => 300,
	    'title'    		 => __( 'Color Options', 'gridalicious-pro' ),
	) );

	//Basic Color Options
	$wp_customize->add_section( 'gridalicious_color_scheme', array(
		'panel'	   => 'gridalicious_color_options',
		'priority' => 301,
		'title'    => __( 'Basic Color Options', 'gridalicious-pro' ),
	) );

	$wp_customize->add_setting( 'gridalicious_theme_options[color_scheme]', array(
		'capability' 		=> 'edit_theme_options',
		'default'    		=> $defaults['color_scheme'],
		'sanitize_callback'	=> 'gridalicious_sanitize_select'
	) );

	$wp_customize->add_control( 'gridalicious_theme_options[color_scheme]', array(
		'choices'  => gridalicious_color_schemes(),
		'label'    => __( 'Color Scheme', 'gridalicious-pro' ),
		'priority' => 5,
		'section'  => 'gridalicious_color_scheme',
		'settings' => 'gridalicious_theme_options[color_scheme]',
		'type'     => 'radio',
	) );

	$gridalicious_basic_color_options	=	gridalicious_get_basic_color_options();

	$i = 10;
	foreach ( $gridalicious_basic_color_options as $key => $color_option ) {
		$lower_color_option	=	$key;

		$wp_customize->add_setting( 'gridalicious_theme_options['. $lower_color_option .']', array(
			'capability'		=> 'edit_theme_options',
			'default'			=> $defaults[ $lower_color_option ],
			'sanitize_callback' => 'sanitize_hex_color',
		) );

		$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'gridalicious_theme_options['. $lower_color_option .']', array(
			'label'		=> $color_option,
			'priority'	=> $i,
			'section'	=> 'gridalicious_color_scheme',
			'settings'	=> 'gridalicious_theme_options['. $lower_color_option .']',
		) ) );

		$i++;
	}

	//Header Color Option
	$wp_customize->add_section( 'gridalicious_header_color_options', array(
		'panel'	   => 'gridalicious_color_options',
		'priority' => 302,
		'title'    => __( 'Header Color Options', 'gridalicious-pro' ),
	) );

	$gridalicious_header_color_options	=	gridalicious_get_header_color_options();

	$i = 10;
	foreach ( $gridalicious_header_color_options as $key => $color_option ) {
		$lower_color_option	=	$key;

		$wp_customize->add_setting( 'gridalicious_theme_options['. $lower_color_option .']', array(
			'capability'		=> 'edit_theme_options',
			'default'			=> $defaults[ $lower_color_option ],
			'sanitize_callback' => 'sanitize_hex_color',
		) );

		$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'gridalicious_theme_options['. $lower_color_option .']', array(
			'label'		=> $color_option,
			'priority'	=> $i,
			'section'	=> 'gridalicious_header_color_options',
			'settings'	=> 'gridalicious_theme_options['. $lower_color_option .']',
		) ) );

		$i++;
	}

	//Content Color Option
	$wp_customize->add_section( 'gridalicious_content_color_options', array(
		'panel'	   => 'gridalicious_color_options',
		'priority' => 303,
		'title'    => __( 'Content Color Options', 'gridalicious-pro' ),
	) );

	$gridalicious_content_color_options	=	gridalicious_get_content_color_options();

	$i = 10;
	foreach ( $gridalicious_content_color_options as $key => $color_option ) {
		$lower_color_option	=	$key;

		$wp_customize->add_setting( 'gridalicious_theme_options['. $lower_color_option .']', array(
			'capability'		=> 'edit_theme_options',
			'default'			=> $defaults[ $lower_color_option ],
			'sanitize_callback' => 'sanitize_hex_color',
		) );

		$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'gridalicious_theme_options['. $lower_color_option .']', array(
			'label'		=> $color_option,
			'priority'	=> $i,
			'section'	=> 'gridalicious_content_color_options',
			'settings'	=> 'gridalicious_theme_options['. $lower_color_option .']',
		) ) );

		$i++;
	}

	//Sidebar Color Option
	$wp_customize->add_section( 'gridalicious_sidebar_color_options', array(
		'description'	=> __( 'Only for Primary and Secondary Sidebars', 'gridalicious-pro' ),
		'panel'	   		=> 'gridalicious_color_options',
		'priority' 		=> 304,
		'title'    		=> __( 'Sidebar Color Options', 'gridalicious-pro' ),
	) );

	$gridalicious_sidebar_color_options	=	gridalicious_get_sidebar_color_options();

	$i = 1;
	foreach ( $gridalicious_sidebar_color_options as $key => $color_option ) {
		$lower_color_option	=	$key;

		$wp_customize->add_setting( 'gridalicious_theme_options['. $lower_color_option .']', array(
			'capability'		=> 'edit_theme_options',
			'default'			=> $defaults[ $lower_color_option ],
			'sanitize_callback' => 'sanitize_hex_color',
		) );

		$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'gridalicious_theme_options['. $lower_color_option .']', array(
			'label'		=> $color_option,
			'priority'	=> $i,
			'section'	=> 'gridalicious_sidebar_color_options',
			'settings'	=> 'gridalicious_theme_options['. $lower_color_option .']',
		) ) );

		$i++;
	}

	//Pagination Color Option
	$wp_customize->add_section( 'gridalicious_pagination_color_options', array(
		'panel'	   		=> 'gridalicious_color_options',
		'priority' 		=> 305,
		'title'    		=> __( 'Pagination Color Options', 'gridalicious-pro' ),
	) );

	$gridalicious_pagination_color_options	=	gridalicious_get_pagination_color_options();

	$i = 1;
	foreach ( $gridalicious_pagination_color_options as $key => $color_option ) {
		$lower_color_option	=	$key;

		$wp_customize->add_setting( 'gridalicious_theme_options['. $lower_color_option .']', array(
			'capability'		=> 'edit_theme_options',
			'default'			=> $defaults[ $lower_color_option ],
			'sanitize_callback' => 'sanitize_hex_color',
		) );

		$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'gridalicious_theme_options['. $lower_color_option .']', array(
			'label'		=> $color_option,
			'priority'	=> $i,
			'section'	=> 'gridalicious_pagination_color_options',
			'settings'	=> 'gridalicious_theme_options['. $lower_color_option .']',
		) ) );

		$i++;
	}

	//Footer Color Option
	$wp_customize->add_section( 'gridalicious_footer_color_options', array(
		'panel'	   => 'gridalicious_color_options',
		'priority' => 306,
		'title'    => __( 'Footer Color Options', 'gridalicious-pro' ),
	) );

	$gridalicious_footer_color_options	=	gridalicious_get_footer_color_options();

	$i = 1;
	foreach ( $gridalicious_footer_color_options as $key => $color_option ) {
		$lower_color_option	=	$key;

		$wp_customize->add_setting( 'gridalicious_theme_options['. $lower_color_option .']', array(
			'capability'		=> 'edit_theme_options',
			'default'			=> $defaults[ $lower_color_option ],
			'sanitize_callback' => 'sanitize_hex_color',
		) );

		$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'gridalicious_theme_options['. $lower_color_option .']', array(
			'label'		=> $color_option,
			'priority'	=> $i,
			'section'	=> 'gridalicious_footer_color_options',
			'settings'	=> 'gridalicious_theme_options['. $lower_color_option .']',
		) ) );

		$i++;
	}

	//Promotion Headline Color Option
	$wp_customize->add_section( 'gridalicious_promotion_headline_color_options', array(
		'panel'	   => 'gridalicious_color_options',
		'priority' => 307,
		'title'    => __( 'Promotion Headline Color Options', 'gridalicious-pro' ),
	) );

	$gridalicious_promotion_headline_options	=	gridalicious_get_promotion_headline_color_options();

	$i = 1;
	foreach ( $gridalicious_promotion_headline_options as $key => $color_option ) {
		$lower_color_option	=	$key;

		$wp_customize->add_setting( 'gridalicious_theme_options['. $lower_color_option .']', array(
			'capability'		=> 'edit_theme_options',
			'default'			=> $defaults[ $lower_color_option ],
			'sanitize_callback' => 'sanitize_hex_color',
		) );

		$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'gridalicious_theme_options['. $lower_color_option .']', array(
			'label'		=> $color_option,
			'priority'	=> $i,
			'section'	=> 'gridalicious_promotion_headline_color_options',
			'settings'	=> 'gridalicious_theme_options['. $lower_color_option .']',
		) ) );

		$i++;
	}

	//Scrollup Color Option
	$wp_customize->add_section( 'gridalicious_scrollup_color_options', array(
		'panel'	   => 'gridalicious_color_options',
		'priority' => 308,
		'title'    => __( 'Scrollup Color Options', 'gridalicious-pro' ),
	) );

	$gridalicious_scrollup_options	=	gridalicious_get_scrollup_color_options();

	$i = 1;
	foreach ( $gridalicious_scrollup_options as $key => $color_option ) {
		$lower_color_option	=	$key;

		$wp_customize->add_setting( 'gridalicious_theme_options['. $lower_color_option .']', array(
			'capability'		=> 'edit_theme_options',
			'default'			=> $defaults[ $lower_color_option ],
			'sanitize_callback' => 'sanitize_hex_color',
		) );

		$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'gridalicious_theme_options['. $lower_color_option .']', array(
			'label'		=> $color_option,
			'priority'	=> $i,
			'section'	=> 'gridalicious_scrollup_color_options',
			'settings'	=> 'gridalicious_theme_options['. $lower_color_option .']',
		) ) );

		$i++;
	}

	//Featured Grid Content Color Option
	$wp_customize->add_section( 'gridalicious_grid_content_color_options', array(
		'panel'	   => 'gridalicious_color_options',
		'priority' => 309,
		'title'    => __( 'Featured Grid Content Color Options', 'gridalicious-pro' ),
	) );

	$gridalicious_grid_content_options	=	gridalicious_get_grid_content_color_options();

	$i = 1;
	foreach ( $gridalicious_grid_content_options as $key => $color_option ) {
		$lower_color_option	=	$key;

		$wp_customize->add_setting( 'gridalicious_theme_options['. $lower_color_option .']', array(
			'capability'		=> 'edit_theme_options',
			'default'			=> $defaults[ $lower_color_option ],
			'sanitize_callback' => 'sanitize_hex_color',
		) );

		$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'gridalicious_theme_options['. $lower_color_option .']', array(
			'label'		=> $color_option,
			'priority'	=> $i,
			'section'	=> 'gridalicious_grid_content_color_options',
			'settings'	=> 'gridalicious_theme_options['. $lower_color_option .']',
		) ) );

		$i++;
	}

	//Featured Content Color Options
	$wp_customize->add_section( 'gridalicious_featured_content_color_options', array(
		'panel'	   => 'gridalicious_color_options',
		'priority' => 310,
		'title'    => __( 'Featured Content Color Options', 'gridalicious-pro' ),
	) );

	$gridalicious_featured_content_options	=	gridalicious_get_featured_content_color_options();

	$i = 1;
	foreach ( $gridalicious_featured_content_options as $key => $color_option ) {
		$lower_color_option	=	$key;

		$wp_customize->add_setting( 'gridalicious_theme_options['. $lower_color_option .']', array(
			'capability'		=> 'edit_theme_options',
			'default'			=> $defaults[ $lower_color_option ],
			'sanitize_callback' => 'sanitize_hex_color',
		) );

		$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'gridalicious_theme_options['. $lower_color_option .']', array(
			'label'		=> $color_option,
			'priority'	=> $i,
			'section'	=> 'gridalicious_featured_content_color_options',
			'settings'	=> 'gridalicious_theme_options['. $lower_color_option .']',
		) ) );

		$i++;
	}

	//Menu Color Options
	$wp_customize->add_section( 'gridalicious_primary_menu_color_options', array(
		'panel'	   => 'gridalicious_color_options',
		'title'    => __( 'Primary Menu Color Options', 'gridalicious-pro' ),
		'priority' => 351,
	) );

	$gridalicious_menu_color_options	=	gridalicious_get_menu_color_options();

	$i = 1;

	foreach ( $gridalicious_menu_color_options as $key => $color_option ) {
		$lower_color_option	=	$key;

		$wp_customize->add_setting( 'gridalicious_theme_options['. $lower_color_option .']', array(
			'capability'		=> 'edit_theme_options',
			'default'			=> $defaults[ $lower_color_option ],
			'sanitize_callback' => 'sanitize_hex_color',
		) );

		$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'gridalicious_theme_options['. $lower_color_option .']', array(
			'label'		=> $color_option,
			'priority'	=> $i++,
			'section'	=> 'gridalicious_primary_menu_color_options',
			'settings'	=> 'gridalicious_theme_options['. $lower_color_option .']',
		) ) );
	}

	$wp_customize->add_section( 'gridalicious_secondary_menu_color_options', array(
		'panel'	   => 'gridalicious_color_options',
		'priority' => 352,
		'title'    => __( 'Secondary Menu Color Options', 'gridalicious-pro' ),
	) );

	foreach ( $gridalicious_menu_color_options as $key => $color_option ) {
		$lower_color_option	= 'secondary_' . $key;

		$wp_customize->add_setting( 'gridalicious_theme_options['. $lower_color_option .']', array(
			'capability'		=> 'edit_theme_options',
			'default'			=> $defaults[ $lower_color_option ],
			'sanitize_callback' => 'sanitize_hex_color',
		) );

		$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'gridalicious_theme_options['. $lower_color_option .']', array(
			'label'		=> $color_option,
			'priority'	=> $i,
			'section'	=> 'gridalicious_secondary_menu_color_options',
			'settings'	=> 'gridalicious_theme_options['. $lower_color_option .']',
		) ) );

		$i++;
	}

	$wp_customize->add_section( 'gridalicious_header_right_menu_color_options', array(
		'panel'	   => 'gridalicious_color_options',
		'priority' => 352.5,
		'title'    => __( 'Header Right Menu Color Options', 'gridalicious-pro' ),
	) );

	foreach ( $gridalicious_menu_color_options as $key => $color_option ) {
		$lower_color_option	= 'header_right_' . $key;

		$wp_customize->add_setting( 'gridalicious_theme_options['. $lower_color_option .']', array(
			'capability'		=> 'edit_theme_options',
			'default'			=> $defaults[ $lower_color_option ],
			'sanitize_callback' => 'sanitize_hex_color',
		) );

		$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'gridalicious_theme_options['. $lower_color_option .']', array(
			'label'		=> $color_option,
			'priority'	=> $i,
			'section'	=> 'gridalicious_header_right_menu_color_options',
			'settings'	=> 'gridalicious_theme_options['. $lower_color_option .']',
		) ) );

		$i++;
	}

	$wp_customize->add_section( 'gridalicious_footer_menu_color_options', array(
		'panel'	   => 'gridalicious_color_options',
		'priority' => 353,
		'title'    => __( 'Footer Menu Color Options', 'gridalicious-pro' ),
	) );

	foreach ( $gridalicious_menu_color_options as $key => $color_option ) {
		$lower_color_option	= 'footer_' . $key;

		if ( 'footer_sub_menu_text_color' == $lower_color_option || 'footer_sub_menu_background_color' == $lower_color_option || 'footer_menu_background_color' == $lower_color_option ) {
			continue;
		}

		$wp_customize->add_setting( 'gridalicious_theme_options['. $lower_color_option .']', array(
			'capability'		=> 'edit_theme_options',
			'default'			=> $defaults[ $lower_color_option ],
			'sanitize_callback' => 'sanitize_hex_color',
		) );

		$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'gridalicious_theme_options['. $lower_color_option .']', array(
			'label'		=> $color_option,
			'section'	=> 'gridalicious_footer_menu_color_options',
			'settings'	=> 'gridalicious_theme_options['. $lower_color_option .']',
			'priority'	=> $i
		) ) );

		$i++;
	}//Basic Color Options End