<?php
/**
 * Customizer settings: message boxes
 *
 * @package Multi
 */

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

/**
 * Customizer settings for message boxes
 */
class Multimagazine_Customize_Messages {

	/**
	 * Registers the section and fires the extension hook.
	 *
	 * @param WP_Customize_Manager $wp_customize Customizer manager instance.
	 */
	public static function register_section( $wp_customize ) {
		$wp_customize->add_section(
			'messages',
			array(
				'title'    => __( 'Messages', 'multimagazine' ),
				'priority' => 39,
			)
		);
		do_action( 'multimagazine_customize_messages', $wp_customize );
	}

	/**
	 * Registers the info color setting.
	 */
	public static function register_info_color() {
		global $multimagazine_customize;
		$multimagazine_customize->color_setting( 'multi_msg_type_info_color', 'messages', __( 'Info color', 'multimagazine' ), '', 'postMessage' );
	}

	/**
	 * Registers the success color setting.
	 */
	public static function register_success_color() {
		global $multimagazine_customize;
		$multimagazine_customize->color_setting( 'multi_msg_type_success_color', 'messages', __( 'Success color', 'multimagazine' ), '', 'postMessage' );
	}

	/**
	 * Registers the notice color setting.
	 */
	public static function register_notice_color() {
		global $multimagazine_customize;
		$multimagazine_customize->color_setting( 'multi_msg_type_notice_color', 'messages', __( 'Notice color', 'multimagazine' ), '', 'postMessage' );
	}

	/**
	 * Registers the error color setting.
	 */
	public static function register_error_color() {
		global $multimagazine_customize;
		$multimagazine_customize->color_setting( 'multi_msg_type_error_color', 'messages', __( 'Error color', 'multimagazine' ), '', 'postMessage' );
	}

	/**
	 * Registers the color border setting.
	 */
	public static function register_color_border() {
		global $multimagazine_customize;
		$multimagazine_customize->checkbox_setting( 'multi_msg_type_color_border', 'messages', __( 'Use message type color for border', 'multimagazine' ) );
	}

	/**
	 * Registers the color bg setting.
	 */
	public static function register_color_bg() {
		global $multimagazine_customize;
		$multimagazine_customize->checkbox_setting( 'multi_msg_type_color_bg', 'messages', __( 'Use message type color for background', 'multimagazine' ) );
	}

	/**
	 * Registers the color text setting.
	 */
	public static function register_color_text() {
		global $multimagazine_customize;
		$multimagazine_customize->checkbox_setting( 'multi_msg_type_color_text', 'messages', __( 'Use message type color for text', 'multimagazine' ) );
	}

	/**
	 * Registers the color icon setting.
	 */
	public static function register_color_icon() {
		global $multimagazine_customize;
		$multimagazine_customize->checkbox_setting( 'multi_msg_type_color_icon', 'messages', __( 'Use message type color for icon', 'multimagazine' ) );
	}

	/**
	 * Registers the border width setting.
	 */
	public static function register_border_width() {
		global $multimagazine_customize;
		$multimagazine_customize->range_setting( 'multi_msg_border_width', 'messages', 0, 20, 1, __( 'Border width', 'multimagazine' ), __( 'Number of pixels', 'multimagazine' ), 'postMessage' );
	}

	/**
	 * Registers the border radius setting.
	 */
	public static function register_border_radius() {
		global $multimagazine_customize;
		$multimagazine_customize->range_setting( 'multi_msg_border_radius', 'messages', 0, 20, 1, __( 'Border radius', 'multimagazine' ), __( 'Number of pixels', 'multimagazine' ), 'postMessage' );
	}

	/**
	 * Registers the border color setting.
	 */
	public static function register_border_color() {
		global $multimagazine_customize;
		$multimagazine_customize->color_setting( 'multi_msg_border_color', 'messages', __( 'Border color', 'multimagazine' ), '', 'postMessage' );
	}

	/**
	 * Registers the bg color setting.
	 */
	public static function register_bg_color() {
		global $multimagazine_customize;
		$multimagazine_customize->color_setting( 'multi_msg_bg_color', 'messages', __( 'Background color', 'multimagazine' ), '', 'postMessage' );
	}

	/**
	 * Registers the text color setting.
	 */
	public static function register_text_color() {
		global $multimagazine_customize;
		$multimagazine_customize->color_setting( 'multi_msg_text_color', 'messages', __( 'Text color', 'multimagazine' ), '', 'postMessage' );
	}

	/**
	 * Registers the icon color setting.
	 */
	public static function register_icon_color() {
		global $multimagazine_customize;
		$multimagazine_customize->color_setting( 'multi_msg_icon_color', 'messages', __( 'Icon color', 'multimagazine' ), '', 'postMessage' );
	}

	/**
	 * Registers the shadow setting.
	 */
	public static function register_shadow() {
		global $multimagazine_customize;
		$multimagazine_customize->checkbox_setting( 'multi_msg_shadow', 'messages', __( 'Shadow', 'multimagazine' ) );
	}
}

add_action( 'customize_register', array( 'Multimagazine_Customize_Messages', 'register_section' ) );
add_action( 'multimagazine_customize_messages', array( 'Multimagazine_Customize_Messages', 'register_info_color' ), 10 );
add_action( 'multimagazine_customize_messages', array( 'Multimagazine_Customize_Messages', 'register_success_color' ), 15 );
add_action( 'multimagazine_customize_messages', array( 'Multimagazine_Customize_Messages', 'register_notice_color' ), 20 );
add_action( 'multimagazine_customize_messages', array( 'Multimagazine_Customize_Messages', 'register_error_color' ), 25 );
add_action( 'multimagazine_customize_messages', array( 'Multimagazine_Customize_Messages', 'register_color_border' ), 30 );
add_action( 'multimagazine_customize_messages', array( 'Multimagazine_Customize_Messages', 'register_color_bg' ), 35 );
add_action( 'multimagazine_customize_messages', array( 'Multimagazine_Customize_Messages', 'register_color_text' ), 40 );
add_action( 'multimagazine_customize_messages', array( 'Multimagazine_Customize_Messages', 'register_color_icon' ), 45 );
add_action( 'multimagazine_customize_messages', array( 'Multimagazine_Customize_Messages', 'register_border_width' ), 50 );
add_action( 'multimagazine_customize_messages', array( 'Multimagazine_Customize_Messages', 'register_border_radius' ), 55 );
add_action( 'multimagazine_customize_messages', array( 'Multimagazine_Customize_Messages', 'register_border_color' ), 60 );
add_action( 'multimagazine_customize_messages', array( 'Multimagazine_Customize_Messages', 'register_bg_color' ), 65 );
add_action( 'multimagazine_customize_messages', array( 'Multimagazine_Customize_Messages', 'register_text_color' ), 70 );
add_action( 'multimagazine_customize_messages', array( 'Multimagazine_Customize_Messages', 'register_icon_color' ), 75 );
add_action( 'multimagazine_customize_messages', array( 'Multimagazine_Customize_Messages', 'register_shadow' ), 80 );
