<?php
/**
 * Additional site identity customizer settings
 *
 * @package Multi
 */

if ( ! defined( 'ABSPATH' ) ) {
	die;
}

/**
 * Additional site identity customizer settings
 */
class Multimagazine_Customize_Site_Identity {

	/**
	 * Registers the section and fires the extension hook.
	 *
	 * @param WP_Customize_Manager $wp_customize Customizer manager instance.
	 */
	public static function register_section( $wp_customize ) {
		do_action( 'multimagazine_customize_title_tagline', $wp_customize );
	}

	/**
	 * Registers the logo width setting.
	 */
	public static function register_logo_width() {
		global $multimagazine_customize;
		$multimagazine_customize->number_setting( 'multi_logo_width', 'title_tagline', __( 'Logo width: ', 'multimagazine' ) );
	}

	/**
	 * Registers the logo height setting.
	 */
	public static function register_logo_height() {
		global $multimagazine_customize;
		$multimagazine_customize->number_setting( 'multi_logo_height', 'title_tagline', __( 'Logo height: ', 'multimagazine' ) );
	}

	/**
	 * Registers the logo link setting.
	 */
	public static function register_logo_link() {
		global $multimagazine_customize;
		$multimagazine_customize->text_setting( 'multi_logo_link', 'title_tagline', __( 'Logo link: ', 'multimagazine' ), __( 'Logo links to the home page by default', 'multimagazine' ) );
	}

	/**
	 * Registers the logo hover image setting.
	 */
	public static function register_logo_hover_image() {
		global $multimagazine_customize;
		$multimagazine_customize->image_setting( 'multi_logo_hover_image', 'title_tagline', __( 'Mouse over logo', 'multimagazine' ) );
	}

	/**
	 * Registers the logo v offset setting.
	 */
	public static function register_logo_v_offset() {
		multimagazine_register_range_setting( 'title_tagline', 'multi_logo_v_offset', __( 'Logo vertical offset', 'multimagazine' ), MULTIMAGAZINE_LOGO_V_OFFSET, -100, 100, __( 'Number of pixels', 'multimagazine' ) );
	}

	/**
	 * Registers the logo v offset mobile setting.
	 */
	public static function register_logo_v_offset_mobile() {
		multimagazine_register_range_setting( 'title_tagline', 'multi_logo_v_offset_mobile', __( 'Logo vertical offset (small screens)', 'multimagazine' ), MULTIMAGAZINE_LOGO_V_OFFSET_MOBILE, -100, 100, __( 'Number of pixels', 'multimagazine' ) );
	}
}

add_action( 'customize_register', array( 'Multimagazine_Customize_Site_Identity', 'register_section' ) );
add_action( 'multimagazine_customize_title_tagline', array( 'Multimagazine_Customize_Site_Identity', 'register_logo_width' ), 10 );
add_action( 'multimagazine_customize_title_tagline', array( 'Multimagazine_Customize_Site_Identity', 'register_logo_height' ), 15 );
add_action( 'multimagazine_customize_title_tagline', array( 'Multimagazine_Customize_Site_Identity', 'register_logo_link' ), 20 );
add_action( 'multimagazine_customize_title_tagline', array( 'Multimagazine_Customize_Site_Identity', 'register_logo_hover_image' ), 25 );
add_action( 'multimagazine_customize_title_tagline', array( 'Multimagazine_Customize_Site_Identity', 'register_logo_v_offset' ), 30 );
add_action( 'multimagazine_customize_title_tagline', array( 'Multimagazine_Customize_Site_Identity', 'register_logo_v_offset_mobile' ), 35 );
