<?php
/**
 * lz-one-page: Customizer
 *
 * @subpackage lz-one-page
 * @since 1.0
 */

function lz_one_page_customize_register( $wp_customize ) {

	$wp_customize->add_setting('lz_one_page_logo_size',array(
		'sanitize_callback'	=> 'lz_one_page_sanitize_float'
	));
	$wp_customize->add_control('lz_one_page_logo_size',array(
		'type' => 'range',
		'label' => __('Logo Size','lz-one-page'),
		'section' => 'title_tagline'
	));

	$wp_customize->add_setting('lz_one_page_logo_padding',array(
		'sanitize_callback'	=> 'esc_html'
	));
	$wp_customize->add_control('lz_one_page_logo_padding',array(
		'label' => __('Logo Padding','lz-one-page'),
		'section' => 'title_tagline'
	));

	$wp_customize->add_setting('lz_one_page_logo_top_padding',array(
		'default' => '',
		'sanitize_callback'	=> 'lz_one_page_sanitize_float'
	));
	$wp_customize->add_control('lz_one_page_logo_top_padding',array(
		'type' => 'number',
		'description' => __('Top','lz-one-page'),
		'section' => 'title_tagline',
	));

	$wp_customize->add_setting('lz_one_page_logo_bottom_padding',array(
		'default' => '',
		'sanitize_callback'	=> 'lz_one_page_sanitize_float'
	));
	$wp_customize->add_control('lz_one_page_logo_bottom_padding',array(
		'type' => 'number',
		'description' => __('Bottom','lz-one-page'),
		'section' => 'title_tagline',
	));

	$wp_customize->add_setting('lz_one_page_logo_left_padding',array(
		'default' => '',
		'sanitize_callback'	=> 'lz_one_page_sanitize_float'
	));
	$wp_customize->add_control('lz_one_page_logo_left_padding',array(
		'type' => 'number',
		'description' => __('Left','lz-one-page'),
		'section' => 'title_tagline',
	));

	$wp_customize->add_setting('lz_one_page_logo_right_padding',array(
		'default' => '',
		'sanitize_callback'	=> 'lz_one_page_sanitize_float'
	));
	$wp_customize->add_control('lz_one_page_logo_right_padding',array(
		'type' => 'number',
		'description' => __('Right','lz-one-page'),
		'section' => 'title_tagline',
	));

	$wp_customize->add_setting('lz_one_page_show_site_title',array(
      'default' => true,
      'sanitize_callback'	=> 'lz_one_page_sanitize_checkbox'
   ));
   $wp_customize->add_control('lz_one_page_show_site_title',array(
      'type' => 'checkbox',
      'label' => __('Show / Hide Site Title','lz-one-page'),
      'section' => 'title_tagline'
   ));

	$wp_customize->add_setting('lz_one_page_site_title_font_size',array(
		'default' => '',
		'sanitize_callback'	=> 'lz_one_page_sanitize_float'
	));
	$wp_customize->add_control('lz_one_page_site_title_font_size',array(
		'type' => 'number',
		'label' => __('Site Title Font Size','lz-one-page'),
		'section' => 'title_tagline',
	));

	$wp_customize->add_setting( 'lz_one_page_site_title_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'lz_one_page_site_title_color', array(
		'label' => 'Color',
		'section' => 'title_tagline',
	)));

   $wp_customize->add_setting('lz_one_page_show_tagline',array(
      'default' => true,
      'sanitize_callback'	=> 'lz_one_page_sanitize_checkbox'
   ));
   $wp_customize->add_control('lz_one_page_show_tagline',array(
      'type' => 'checkbox',
      'label' => __('Show / Hide Site Tagline','lz-one-page'),
      'section' => 'title_tagline'
   ));

	$wp_customize->add_setting('lz_one_page_site_tagline_font_size',array(
		'default' => '',
		'sanitize_callback'	=> 'lz_one_page_sanitize_float'
	));
	$wp_customize->add_control('lz_one_page_site_tagline_font_size',array(
		'type' => 'number',
		'label' => __('Site Tagline Font Size','lz-one-page'),
		'section' => 'title_tagline',
	));

	$wp_customize->add_setting( 'lz_one_page_site_tagline_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'lz_one_page_site_tagline_color', array(
		'label' => 'Color',
		'section' => 'title_tagline',
	)));

	$wp_customize->add_panel( 'lz_one_page_panel_id', array(
	   'priority' => 10,
	   'capability' => 'edit_theme_options',
	   'theme_supports' => '',
	   'title' => __( 'Theme Settings', 'lz-one-page' ),
	   'description' => __( 'Description of what this panel does.', 'lz-one-page' ),
	) );

	$wp_customize->add_section( 'lz_one_page_theme_options_section', array(
    	'title'      => __( 'General Settings', 'lz-one-page' ),
		'priority'   => 30,
		'panel' => 'lz_one_page_panel_id'
	) );

	// Add Settings and Controls for Layout
	$wp_customize->add_setting('lz_one_page_theme_options',array(
      'default' => 'Right Sidebar',
      'sanitize_callback' => 'lz_one_page_sanitize_choices'
	));
	$wp_customize->add_control('lz_one_page_theme_options',array(
        'type' => 'radio',
        'label' => __('Do you want this section','lz-one-page'),
        'section' => 'lz_one_page_theme_options_section',
        'choices' => array(
            'Left Sidebar' => __('Left Sidebar','lz-one-page'),
            'Right Sidebar' => __('Right Sidebar','lz-one-page'),
            'One Column' => __('One Column','lz-one-page'),
            'Three Columns' => __('Three Columns','lz-one-page'),
            'Four Columns' => __('Four Columns','lz-one-page'),
            'Grid Layout' => __('Grid Layout','lz-one-page')
        ),
	));

	$wp_customize->add_setting( 'lz_one_page_boxfull_width', array(
		'default'           => '',
		'sanitize_callback' => 'lz_one_page_sanitize_choices'
	));
	
	$wp_customize->add_control( 'lz_one_page_boxfull_width', array(
		'label'    => __( 'Section Width', 'lz-one-page' ),
		'section'  => 'lz_one_page_theme_options_section',
		'type'     => 'select',
		'choices'  => array(
			'container'  => __('Box Width', 'lz-one-page'),
			'container-fluid' => __('Full Width', 'lz-one-page'),
			'none' => __('None', 'lz-one-page')
		),
	));

	$wp_customize->add_setting( 'lz_one_page_dropdown_anim', array(
		'default'           => 'None',
		'sanitize_callback' => 'lz_one_page_sanitize_choices'
	));
	$wp_customize->add_control( 'lz_one_page_dropdown_anim', array(
		'label'    => __( 'Menu Dropdown Animations', 'lz-one-page' ),
		'section'  => 'lz_one_page_theme_options_section',
		'type'     => 'select',
		'choices'  => array(
			'bounceInUp'  => __('bounceInUp', 'lz-one-page'),
			'fadeInUp' => __('fadeInUp', 'lz-one-page'),
			'zoomIn'    => __('zoomIn', 'lz-one-page'),
			'None'    => __('None', 'lz-one-page')
		),
	));

	// Top Bar
	$wp_customize->add_section( 'lz_one_page_contact_details', array(
    	'title'      => __( 'Top Bar', 'lz-one-page' ),
		'priority'   => null,
		'panel' => 'lz_one_page_panel_id'
	) );

	$wp_customize->add_setting('lz_one_page_call',array(
		'default'=> '',
		'sanitize_callback'	=> 'sanitize_text_field'
	));	
	$wp_customize->add_control('lz_one_page_call',array(
		'label'	=> __('Phone text','lz-one-page'),
		'section'=> 'lz_one_page_contact_details',
		'setting'=> 'lz_one_page_call',
		'type'=> 'text'
	));

	$wp_customize->add_setting('lz_one_page_call1',array(
		'default'=> '',
		'sanitize_callback'	=> 'lz_one_page_sanitize_phone_number'
	));	
	$wp_customize->add_control('lz_one_page_call1',array(
		'label'	=> __('Phone Number','lz-one-page'),
		'section'=> 'lz_one_page_contact_details',
		'setting'=> 'lz_one_page_call1',
		'type'=> 'text'
	));

	$wp_customize->add_setting('lz_one_page_address',array(
		'default'=> '',
		'sanitize_callback'	=> 'sanitize_text_field'
	));	
	$wp_customize->add_control('lz_one_page_address',array(
		'label'	=> __('Address Text','lz-one-page'),
		'section'=> 'lz_one_page_contact_details',
		'setting'=> 'lz_one_page_address',
		'type'=> 'text'
	));

	$wp_customize->add_setting('lz_one_page_address1',array(
		'default'=> '',
		'sanitize_callback'	=> 'sanitize_text_field'
	));	
	$wp_customize->add_control('lz_one_page_address1',array(
		'label'	=> __('Address','lz-one-page'),
		'section'=> 'lz_one_page_contact_details',
		'setting'=> 'lz_one_page_address1',
		'type'=> 'text'
	));

	$wp_customize->add_setting('lz_one_page_mail',array(
		'default'=> '',
		'sanitize_callback'	=> 'sanitize_text_field'
	));	
	$wp_customize->add_control('lz_one_page_mail',array(
		'label'	=> __('Email text','lz-one-page'),
		'section'=> 'lz_one_page_contact_details',
		'setting'=> 'lz_one_page_mail',
		'type'=> 'text'
	));	

	$wp_customize->add_setting('lz_one_page_mail1',array(
		'default'=> '',
		'sanitize_callback'	=> 'sanitize_email'
	));	
	$wp_customize->add_control('lz_one_page_mail1',array(
		'label'	=> __('Email Address','lz-one-page'),
		'section'=> 'lz_one_page_contact_details',
		'setting'=> 'lz_one_page_mail1',
		'type'=> 'text'
	));

	$wp_customize->add_setting( 'lz_one_page_top_icon_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'lz_one_page_top_icon_color', array(
		'label' => 'Icon Color',
		'section' => 'lz_one_page_contact_details',
	)));

	$wp_customize->add_setting( 'lz_one_page_top_iconbg_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'lz_one_page_top_iconbg_color', array(
		'label' => 'Icon Bg Color',
		'section' => 'lz_one_page_contact_details',
	)));

	$wp_customize->add_setting( 'lz_one_page_top_title_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'lz_one_page_top_title_color', array(
		'label' => 'Title Color',
		'section' => 'lz_one_page_contact_details',
	)));

	$wp_customize->add_setting( 'lz_one_page_top_text_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'lz_one_page_top_text_color', array(
		'label' => 'Text Color',
		'section' => 'lz_one_page_contact_details',
	)));

	$wp_customize->add_setting( 'lz_one_page_topbg_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'lz_one_page_topbg_color', array(
		'label' => 'Top Bar Bg Color',
		'section' => 'lz_one_page_contact_details',
	)));

	$wp_customize->add_setting( 'lz_one_page_hdrmenu_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'lz_one_page_hdrmenu_color', array(
		'label' => 'Menu Color',
		'section' => 'lz_one_page_contact_details',
	)));

	$wp_customize->add_setting( 'lz_one_page_hdrmenuhvr_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'lz_one_page_hdrmenuhvr_color', array(
		'label' => 'Menu Hover Color',
		'section' => 'lz_one_page_contact_details',
	)));

	$wp_customize->add_setting( 'lz_one_page_hdrmenubg_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'lz_one_page_hdrmenubg_color', array(
		'label' => 'Menu Bg Color',
		'section' => 'lz_one_page_contact_details',
	)));
	
	//home page slider
	$wp_customize->add_section( 'lz_one_page_slider_section' , array(
    	'title'      => __( 'Slider Settings', 'lz-one-page' ),
		'priority'   => null,
		'panel' => 'lz_one_page_panel_id'
	) );

	$wp_customize->add_setting('lz_one_page_slider_hide_show',array(
    	'default' => false,
    	'sanitize_callback'	=> 'lz_one_page_sanitize_checkbox'
	));
	$wp_customize->add_control('lz_one_page_slider_hide_show',array(
   	'type' => 'checkbox',
   	'label' => __('Show / Hide slider','lz-one-page'),
   	'section' => 'lz_one_page_slider_section',
	));

	$wp_customize->add_setting( 'lz_one_page_slider_effect', array(
		'default'           => '',
		'sanitize_callback' => 'lz_one_page_sanitize_choices'
	));
	$wp_customize->add_control( 'lz_one_page_slider_effect', array(
		'label'    => __( 'Onload Transactions Effects', 'lz-one-page' ),
		'section'  => 'lz_one_page_slider_section',
		'type'     => 'select',
		'choices'  => array(
			'bounceInLeft'  => __('bounceInLeft', 'lz-one-page'),
			'bounceInRight' => __('bounceInRight', 'lz-one-page'),
			'bounceInUp'    => __('bounceInUp', 'lz-one-page'),
			'bounceInDown'    => __('bounceInDown', 'lz-one-page'),
			'zoomIn'  => __('zoomIn', 'lz-one-page'),
			'zoomOut' => __('zoomOut', 'lz-one-page'),
			'fadeInDown'    => __('fadeInDown', 'lz-one-page'),
			'fadeInUp'    => __('fadeInUp', 'lz-one-page'),
			'fadeInLeft'  => __('fadeInLeft', 'lz-one-page'),
			'fadeInRight' => __('fadeInRight', 'lz-one-page'),
			'flip-up'    => __('flip-up', 'lz-one-page'),
			'none'    => __('none', 'lz-one-page')
		),
	));

	for ( $count = 1; $count <= 4; $count++ ) {
		$wp_customize->add_setting( 'lz_one_page_slider' . $count, array(
			'default'           => '',
			'sanitize_callback' => 'lz_one_page_sanitize_dropdown_pages'
		) );
		$wp_customize->add_control( 'lz_one_page_slider' . $count, array(
			'label'    => __( 'Select Slide Image Page', 'lz-one-page' ),
        	'description'=> __('Image size (1400px x 650px)','lz-one-page'),
			'section'  => 'lz_one_page_slider_section',
			'type'     => 'dropdown-pages'
		) );
	}

	$wp_customize->add_setting('lz_one_page_slider_excerpt_length',array(
		'default' => '15',
		'sanitize_callback'	=> 'lz_one_page_sanitize_float'
	));
	$wp_customize->add_control('lz_one_page_slider_excerpt_length',array(
		'type' => 'number',
		'label' => __('Slider Excerpt Length','lz-one-page'),
		'section' => 'lz_one_page_slider_section',
	));

	$wp_customize->add_setting('lz_one_page_slider_font_size',array(
		'default' => '',
		'sanitize_callback'	=> 'lz_one_page_sanitize_float'
	));
	$wp_customize->add_control('lz_one_page_slider_font_size',array(
		'type' => 'number',
		'label' => __('Title Font Size','lz-one-page'),
		'section' => 'lz_one_page_slider_section',
	));

	$wp_customize->add_setting('lz_one_page_slider_text_font_size',array(
		'default' => '',
		'sanitize_callback'	=> 'lz_one_page_sanitize_float'
	));
	$wp_customize->add_control('lz_one_page_slider_text_font_size',array(
		'type' => 'number',
		'label' => __('Text Font Size','lz-one-page'),
		'section' => 'lz_one_page_slider_section',
	));

	$wp_customize->add_setting( 'lz_one_page_slider_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'lz_one_page_slider_color', array(
		'label' => 'Title Color',
		'section' => 'lz_one_page_slider_section',
	)));

	$wp_customize->add_setting( 'lz_one_page_slider_text_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'lz_one_page_slider_text_color', array(
		'label' => 'Text Color',
		'section' => 'lz_one_page_slider_section',
	)));

	$wp_customize->add_setting( 'lz_one_page_slider_btn_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'lz_one_page_slider_btn_color', array(
		'label' => 'Button Text Color',
		'section' => 'lz_one_page_slider_section',
	)));

	$wp_customize->add_setting( 'lz_one_page_slider_btnbg_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'lz_one_page_slider_btnbg_color', array(
		'label' => 'Button Bg Color',
		'section' => 'lz_one_page_slider_section',
	)));

	//About Us
	$wp_customize->add_section('lz_one_page_about',array(
		'title'	=> __('About Us','lz-one-page'),
		'description'	=> __('<b>Note :</b> Add About Us below.','lz-one-page'),
		'panel' => 'lz_one_page_panel_id',
	));

	$wp_customize->add_setting('lz_one_page_about_title',array(
		'default'	=> '',
		'sanitize_callback'	=> 'sanitize_text_field'
	));	
	$wp_customize->add_control('lz_one_page_about_title',array(
		'label'	=> __('Section Small Title','lz-one-page'),
		'section'	=> 'lz_one_page_about',
		'setting'	=> 'lz_one_page_about_title',
		'type'		=> 'text'
	));

	$args = array('numberposts' => -1);
	$post_list = get_posts($args);
	$i = 0;
	$psts[]='Select';  
	foreach($post_list as $post){
		$psts[$post->post_title] = $post->post_title;
	}

	$wp_customize->add_setting('lz_one_page_post',array(
		'sanitize_callback' => 'lz_one_page_sanitize_choices',
	));
	$wp_customize->add_control('lz_one_page_post',array(
		'type'    => 'select',
		'choices' => $psts,
		'label' => __('Select About Post','lz-one-page'),
        'description'=> __('Image size (540px x 540px)','lz-one-page'),
		'section' => 'lz_one_page_about',
	));

	$wp_customize->add_setting('lz_one_page_small_image',array(
		'default'	=> '',
		'sanitize_callback'	=> 'esc_url_raw',
	));
	$wp_customize->add_control( new WP_Customize_Image_Control($wp_customize,'lz_one_page_small_image',array(
        'label' => __('Small Image','lz-one-page'),
        'description'=> __('Image size (200px x 200px)','lz-one-page'),
        'section' => 'lz_one_page_about'
	)));

	$wp_customize->add_setting('lz_one_page_img_hight',array(
		'default' => '',
		'sanitize_callback'	=> 'lz_one_page_sanitize_float'
	));
	$wp_customize->add_control('lz_one_page_img_hight',array(
		'type' => 'number',
		'label' => __('Image Hight','lz-one-page'),
		'section' => 'lz_one_page_about',
	));

	$wp_customize->add_setting('lz_one_page_about_section_padding',array(
      'default' => '',
      'sanitize_callback'	=> 'lz_one_page_sanitize_float'
	));
	$wp_customize->add_control('lz_one_page_about_section_padding',array(
		'type' => 'number',
		'label' => __('Section Top Bottom Padding','lz-one-page'),
		'section' => 'lz_one_page_about',
	));

  	$wp_customize->add_setting( 'lz_one_page_about_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'lz_one_page_about_color', array(
		'label' => 'Small Title Color',
		'section' => 'lz_one_page_about',
	)));

	$wp_customize->add_setting( 'lz_one_page_about_title_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'lz_one_page_about_title_color', array(
		'label' => 'Title Color',
		'section' => 'lz_one_page_about',
	)));

	$wp_customize->add_setting( 'lz_one_page_about_titlebdr_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'lz_one_page_about_titlebdr_color', array(
		'label' => 'Title Border Color',
		'section' => 'lz_one_page_about',
	)));

	$wp_customize->add_setting( 'lz_one_page_about_text_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'lz_one_page_about_text_color', array(
		'label' => 'Text Color',
		'section' => 'lz_one_page_about',
	)));

	//Footer
    $wp_customize->add_section( 'lz_one_page_footer', array(
    	'title'      => __( 'Footer Text', 'lz-one-page' ),
		'priority'   => null,
		'panel' => 'lz_one_page_panel_id'
	) );

	$wp_customize->add_setting('lz_one_page_show_back_totop',array(
 		'default' => true,
   	'sanitize_callback'	=> 'lz_one_page_sanitize_checkbox'
	));
	$wp_customize->add_control('lz_one_page_show_back_totop',array(
   	'type' => 'checkbox',
   	'label' => __('Show / Hide Back to Top','lz-one-page'),
   	'section' => 'lz_one_page_footer'
	));

 	$wp_customize->add_setting('lz_one_page_footer_copy',array(
		'default'	=> 'One Page WordPress Theme By Luzuk',
		'sanitize_callback'	=> 'sanitize_text_field'
	));	
	$wp_customize->add_control('lz_one_page_footer_copy',array(
		'label'	=> __('Footer Text','lz-one-page'),
		'section'	=> 'lz_one_page_footer',
		'setting'	=> 'lz_one_page_footer_copy',
		'type'		=> 'text'
	));

	$wp_customize->add_setting('lz_one_page_footer_copylink',array(
		'default'	=> 'https://www.luzuk.com/products/free-one-page-wordpress-theme/',
		'sanitize_callback'	=> 'sanitize_text_field'
	));	
	$wp_customize->add_control('lz_one_page_footer_copylink',array(
		'label'	=> __('Footer Link','lz-one-page'),
		'section'	=> 'lz_one_page_footer',
		'setting'	=> 'lz_one_page_footer_copylink',
		'type'		=> 'text'
	));

	$wp_customize->add_setting('lz_one_page_copyright_padding',array(
		'default' => '',
		'sanitize_callback'	=> 'lz_one_page_sanitize_float'
 	));
 	$wp_customize->add_control('lz_one_page_copyright_padding',array(
		'type' => 'number',
		'label' => __('Copyright Top Bottom Padding','lz-one-page'),
		'section' => 'lz_one_page_footer',
	));

	$wp_customize->get_setting( 'blogname' )->transport          = 'postMessage';
	$wp_customize->get_setting( 'blogdescription' )->transport   = 'postMessage';
	$wp_customize->get_setting( 'header_textcolor' )->transport  = 'postMessage';

	$wp_customize->selective_refresh->add_partial( 'blogname', array(
		'selector' => '.site-title a',
		'render_callback' => 'lz_one_page_customize_partial_blogname',
	) );
	$wp_customize->selective_refresh->add_partial( 'blogdescription', array(
		'selector' => '.site-description',
		'render_callback' => 'lz_one_page_customize_partial_blogdescription',
	) );
}
add_action( 'customize_register', 'lz_one_page_customize_register' );

function lz_one_page_customize_partial_blogname() {
	bloginfo( 'name' );
}

function lz_one_page_customize_partial_blogdescription() {
	bloginfo( 'description' );
}

function lz_one_page_is_static_front_page() {
	return ( is_front_page() && ! is_home() );
}

function lz_one_page_is_view_with_layout_option() {
	// This option is available on all pages. It's also available on archives when there isn't a sidebar.
	return ( is_page() || ( is_archive() && ! is_active_sidebar( 'sidebar-1' ) ) );
}

/**
 * Singleton class for handling the theme's customizer integration.
 *
 * @since  1.0.0
 * @access public
 */
final class LZ_One_Page_Customize {

	/**
	 * Returns the instance.
	 *
	 * @since  1.0.0
	 * @access public
	 * @return object
	 */
	public static function get_instance() {

		static $instance = null;

		if ( is_null( $instance ) ) {
			$instance = new self;
			$instance->setup_actions();
		}

		return $instance;
	}

	/**
	 * Constructor method.
	 *
	 * @since  1.0.0
	 * @access private
	 * @return void
	 */
	private function __construct() {}

	/**
	 * Sets up initial actions.
	 *
	 * @since  1.0.0
	 * @access private
	 * @return void
	 */
	private function setup_actions() {

		// Register panels, sections, settings, controls, and partials.
		add_action( 'customize_register', array( $this, 'sections' ) );

		// Register scripts and styles for the controls.
		add_action( 'customize_controls_enqueue_scripts', array( $this, 'enqueue_control_scripts' ), 0 );
	}

	/**
	 * Sets up the customizer sections.
	 *
	 * @since  1.0.0
	 * @access public
	 * @param  object  $manager
	 * @return void
	 */
	public function sections( $manager ) {

		// Load custom sections.
		load_template( trailingslashit( get_template_directory() ) . '/inc/section-pro.php' );

		// Register custom section types.
		$manager->register_section_type( 'LZ_One_Page_Customize_Section_Pro' );

		// Register sections.
		$manager->add_section(
			new LZ_One_Page_Customize_Section_Pro(
				$manager,
				'lz_one_page_example_1',
				array(
					'priority' => 9,
					'title'    => esc_html__( 'One Page Pro Theme', 'lz-one-page' ),
					'pro_text' => esc_html__( 'Go Pro','lz-one-page' ),
					'pro_url'  => esc_url( 'https://www.luzuk.com/products/one-page-wordpress-theme/' ),
				)
			)
		);
	}

	/**
	 * Loads theme customizer CSS.
	 *
	 * @since  1.0.0
	 * @access public
	 * @return void
	 */
	public function enqueue_control_scripts() {

		wp_enqueue_script( 'lz-one-page-customize-controls', trailingslashit( esc_url(get_template_directory_uri()) ) . '/assets/js/customize-controls.js', array( 'customize-controls' ) );

		wp_enqueue_style( 'lz-one-page-customize-controls', trailingslashit( esc_url(get_template_directory_uri()) ) . '/assets/css/customize-controls.css' );
	}
}

// Doing this customizer thang!
LZ_One_Page_Customize::get_instance();