<?php
/**
 * Lusy Photography Portfolio Theme Customizer
 *
 * @package Lusy_Photography_Portfolio
 */

/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function lusy_photography_portfolio_customize_register( $wp_customize ) {
	$wp_customize->get_setting( 'blogname' )->transport         = 'postMessage';
	$wp_customize->get_setting( 'blogdescription' )->transport  = 'postMessage';
	$wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';

	if ( isset( $wp_customize->selective_refresh ) ) {
		$wp_customize->selective_refresh->add_partial(
			'blogname',
			array(
				'selector'        => '.site-title a',
				'render_callback' => 'lusy_photography_portfolio_customize_partial_blogname',
			)
		);
		$wp_customize->selective_refresh->add_partial(
			'blogdescription',
			array(
				'selector'        => '.site-description',
				'render_callback' => 'lusy_photography_portfolio_customize_partial_blogdescription',
			)
		);
	}
}
add_action( 'customize_register', 'lusy_photography_portfolio_customize_register' );

/**
 * Render the site title for the selective refresh partial.
 *
 * @return void
 */
function lusy_photography_portfolio_customize_partial_blogname() {
	bloginfo( 'name' );
}

/**
 * Render the site tagline for the selective refresh partial.
 *
 * @return void
 */
function lusy_photography_portfolio_customize_partial_blogdescription() {
	bloginfo( 'description' );
}

/**
 * Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
 */
function lusy_photography_portfolio_customize_preview_js() {
	wp_enqueue_script( 'lusy-photography-portfolio-customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), LUSY_PHOTOGRAPHY_PORTFOLIO_VERSION, true );
}
require get_template_directory() . '/inc/lusyphotographyportfolio_recommended_plugin.php';
add_action( 'customize_preview_init', 'lusy_photography_portfolio_customize_preview_js' );

/**
 * PRO PAGE
 */

 require get_template_directory() . '/inc/go-pro/class-customize.php';

/*-----------------------------------------------------------------------------------*/
/*	Customizer
/*-----------------------------------------------------------------------------------*/
/*-----------------------------------------------------------------------------------*/
/*	Theme Info 
/*-----------------------------------------------------------------------------------*/
function lusy_photography_portfolio_themeinfo_settings( $wp_customize ) {
	$wp_customize->add_section( 'theme_info', array(
		'title'       => __( 'Demo & Documentation', 'lusy-photography-portfolio' ),
		'priority'    => 6,
	) );
	
	/** Important Links */
	$wp_customize->add_setting( 'theme_info_theme',
		array(
			'default' => '',
			'sanitize_callback' => 'wp_kses_post',
		)
	);

	$theme_info = '';
	$theme_info .= sprintf( '<p>' . __( 'Pro Demo Link: %1$sClick here.%2$s', 'lusy-photography-portfolio' ) . '</p>', '<a href="' . esc_url( 'https://pixelonetry.com/previews/?theme=lusy-premium' ) . '" target="_blank">', '</a>' );
	$theme_info .= sprintf( '<p>' . __( 'Documentation: %1$sClick here.%2$s', 'lusy-photography-portfolio' ) . '</p>', '<a href="' . esc_url( 'https://pixelonetry.com/docs/spirallite/' ) . '" target="_blank">', '</a>' );
	$theme_info .= sprintf( '<p>' . __( 'Video Tutorial: %1$sClick here.%2$s', 'lusy-photography-portfolio' ) . '</p>', '<a href="' . esc_url( 'https://www.youtube.com/watch?v=NVbuDPmXuaU' ) . '" target="_blank">', '</a>' );
	$theme_info .= sprintf( '<p>' . __( 'Rate The Theme: %1$sClick here.%2$s', 'lusy-photography-portfolio' ) . '</p>', '<a href="' . esc_url( 'https://wordpress.org/support/theme/lusy-photography-portfolio/reviews/#new-post' ) . '" target="_blank">', '</a>' );
	$theme_info .= sprintf( '<p>' . __( 'Submit Ticket: %1$sClick here.%2$s', 'lusy-photography-portfolio' ) . '</p>', '<a href="' . esc_url( 'https://pixelonetry.freshdesk.com/support/tickets/new' ) . '" target="_blank">', '</a>' );

	$wp_customize->add_control( new WP_Customize_Control( $wp_customize,
		'theme_info_theme',
		array(
			'section'     => 'theme_info',
			'description' => $theme_info,
			'type'        => 'hidden', // Optional, can hide the control input
		)
	)); 
}
add_action( 'customize_register', 'lusy_photography_portfolio_themeinfo_settings' );
/*-----------------------------------------------------------------------------------*/
/*	Common 
/*-----------------------------------------------------------------------------------*/
function lusy_photography_portfolio_my_register_additional_customizer_settings( $wp_customize ) {
	
	$wp_customize->add_section(
		'lusy_blog_setting', 
		array(
			'title' => esc_html__( 'Blog Settings', 'lusy-photography-portfolio' ),
			'priority' => 30,
		)
	);
	
	/** Blog Head Title */
	$wp_customize->add_setting(
		'lusy_blog_heading_title',
		array(
			'default' => __( 'News & Blog', 'lusy-photography-portfolio' ),
			'sanitize_callback' => 'sanitize_text_field',
		)
	);
	
	$wp_customize->add_control(
		'lusy_blog_heading_title',
		array(
			'label' => __( 'Blog Head Title', 'lusy-photography-portfolio' ),
			'section' => 'lusy_blog_setting', // Corrected 'panel' to 'section'
			'type' => 'text',
		)
	);

	/** Blog Head Subtitle */
	$wp_customize->add_setting(
		'lusy_blog_heading_subtitle',
		array(
			'default' => __( 'Currient Reading', 'lusy-photography-portfolio' ),
			'sanitize_callback' => 'sanitize_text_field',
		)
	);
	
	$wp_customize->add_control(
		'lusy_blog_heading_subtitle',
		array(
			'label' => __( 'Blog Head Subtitle', 'lusy-photography-portfolio' ),
			'section' => 'lusy_blog_setting', // Corrected 'panel' to 'section'
			'type' => 'text',
		)
	);
	
 }
 add_action( 'customize_register', 'lusy_photography_portfolio_my_register_additional_customizer_settings' );

 function lusy_photography_portfolio_footer_customizer_settings( $wp_customize ) {

 /**  
 *  Section Footer
 */
$wp_customize->add_panel(
	'footer_sections', array(
		'priority' => 40,
		'title' => esc_html__( 'Footer', 'lusy-photography-portfolio' ),
	)
);

$wp_customize->add_section(
	'lusy_footer_content_section',
	array(
		'title' => __( 'Footer Content', 'lusy-photography-portfolio' ),
		'description' => __( 'Footer Content ', 'lusy-photography-portfolio' ),
		'panel' => 'footer_sections',
		'priority' => 40,
	)
);

  // Add the setting for the image
    $wp_customize->add_setting( 'footer_logo_img', array(
        'default'           => get_template_directory_uri() . '/assets/images/logo-light.png',  // Default image URL
        'sanitize_callback' => 'esc_url_raw', 
    ) );

    // Add the image control
    $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'footer_logo_img', array(
        'label'    => 'Footer Logo Image',
        'section'  => 'lusy_footer_content_section', 
        'settings' => 'footer_logo_img', 
    ) ) );

// Add the setting for the image
    $wp_customize->add_setting( 'footer_bg_img', array(
       // 'default' => '', 
	    'default'           => get_template_directory_uri() . '/assets/images/default-bg.jpg',  // Default image URL
        'sanitize_callback' => 'esc_url_raw', 
    ) );

    // Add the image control
    $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'footer_bg_img', array(
        'label'    => 'Footer Background Image',
        'section'  => 'lusy_footer_content_section', 
        'settings' => 'footer_bg_img', 
    ) ) );


$wp_customize->add_setting(
	'lusy_footer_content_section_footer_adress',
	array(
		'default'=> '<span>address: </span> Beverly Hills, Los Angeles CA, USA',
		'sanitize_callback' => 'wp_kses_post',
		
	)
);

$wp_customize->add_control(
	'lusy_footer_content_section_footer_adress',
	array(
		'label' => __( 'Adress', 'lusy-photography-portfolio' ),
		'section' => 'lusy_footer_content_section',
		'type' => 'textarea',
	)
);

$wp_customize->add_setting(
	'lusy_footer_content_section_footer_phone',
	array(
		'default'=> '<span>phone: </span> +(123) 456 789',
		'sanitize_callback' => 'wp_kses_post',
		
	)
);

$wp_customize->add_control(
	'lusy_footer_content_section_footer_phone',
	array(
		'label' => __( 'Phone', 'lusy-photography-portfolio' ),
		'section' => 'lusy_footer_content_section',
		'type' => 'textarea',
	)
);

$wp_customize->add_setting(
	'lusy_footer_content_section_footer_email',
	array(
		'default'=> '<span>e-mail: </span>info@thedomain.com',
		'sanitize_callback' => 'wp_kses_post',
		
	)
);

$wp_customize->add_control(
	'lusy_footer_content_section_footer_email',
	array(
		'label' => __( 'Phone', 'lusy-photography-portfolio' ),
		'section' => 'lusy_footer_content_section',
		'type' => 'textarea',
	)
);

$wp_customize->add_section(
	'lusy_footer',
	array(
		'title' => __( 'Footer Copyright', 'lusy-photography-portfolio' ),
		'description' => __( 'Footer Settings ', 'lusy-photography-portfolio' ),
		'panel' => 'footer_sections',
		'priority' => 40,
	)
);
 $wp_customize->add_setting(
	'lusy_copyright',
	array(
		'default' => sprintf(__('Copyright 2025. <span>%s</span> All Rights Reserved.', 'lusy-photography-portfolio'), get_bloginfo('name')),
		'sanitize_callback' => 'wp_kses_post',
	)
);

$wp_customize->add_control(
	'lusy_copyright',
	array(
		'label' => __( 'Copyright', 'lusy-photography-portfolio' ),
		'section' => 'lusy_footer',
		'type' => 'textarea',
	)
);
}
add_action( 'customize_register', 'lusy_photography_portfolio_footer_customizer_settings' );

function lusy_photography_portfolio_social_customizer_settings( $wp_customize ) {

	/*-----------------------------------------------------------------------------------*/
/*	Social Setting
/*-----------------------------------------------------------------------------------*/

$wp_customize->add_section(
	'lusy_social_settings',
	array(
		'title' => __( 'Social Settings', 'lusy-photography-portfolio' ),
		'description' => __( 'Leave blank if you do not want to show the social link.', 'lusy-photography-portfolio' ),
		'priority' => 40,
	)
);

/** Facebook */
$wp_customize->add_setting(
	'lusy_facebook',
	array(
		'default' => '',
		'sanitize_callback' => 'esc_url_raw',
	)
);

$wp_customize->add_control(
	'lusy_facebook',
	array(
		'label' => __( 'Facebook', 'lusy-photography-portfolio' ),
		'section' => 'lusy_social_settings',
		'type' => 'text',
	)
);

/** Twitter */
$wp_customize->add_setting(
	'lusy_twitter',
	array(
		'default' => '',
		'sanitize_callback' => 'esc_url_raw',
	)
);

$wp_customize->add_control(
	'lusy_twitter',
	array(
		'label' => __( 'Twitter', 'lusy-photography-portfolio' ),
		'section' => 'lusy_social_settings',
		'type' => 'text',
	)
);

/** Pinterest */
$wp_customize->add_setting(
	'lusy_pinterest',
	array(
		'default' => '',
		'sanitize_callback' => 'esc_url_raw',
	)
);

$wp_customize->add_control(
	'lusy_pinterest',
	array(
		'label' => __( 'Pinterest', 'lusy-photography-portfolio' ),
		'section' => 'lusy_social_settings',
		'type' => 'text',
	)
);

/** LinkedIn */
$wp_customize->add_setting(
	'lusy_linkedin',
	array(
		'default' => '',
		'sanitize_callback' => 'esc_url_raw',
	)
);

$wp_customize->add_control(
	'lusy_linkedin',
	array(
		'label' => __( 'LinkedIn', 'lusy-photography-portfolio' ),
		'section' => 'lusy_social_settings',
		'type' => 'text',
	)
);

/** Instagram Plus */
$wp_customize->add_setting(
	'lusy_instagram',
	array(
		'default' => '',
		'sanitize_callback' => 'esc_url_raw',
	)
);

$wp_customize->add_control(
	'lusy_instagram',
	array(
		'label' => __( 'Instagram', 'lusy-photography-portfolio' ),
		'section' => 'lusy_social_settings',
		'type' => 'text',
	)
);

/** Youtube Plus */
$wp_customize->add_setting(
	'lusy_youtube',
	array(
		'default' => '',
		'sanitize_callback' => 'esc_url_raw',
	)
);

$wp_customize->add_control(
	'lusy_youtube',
	array(
		'label' => __( 'YouTube', 'lusy-photography-portfolio' ),
		'section' => 'lusy_social_settings',
		'type' => 'text',
	)
);

/** Tiktok */
$wp_customize->add_setting(
	'lusy_tiktok',
	array(
		'default' => '',
		'sanitize_callback' => 'esc_url_raw',
	)
);

$wp_customize->add_control(
	'lusy_tiktok',
	array(
		'label' => __( 'Tiktok', 'lusy-photography-portfolio' ),
		'section' => 'lusy_social_settings',
		'type' => 'text',
	)
);


}
add_action( 'customize_register', 'lusy_photography_portfolio_social_customizer_settings' );
