<?php
/**
 * Customizer settings: footer
 *
 * @package Multi
 */

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

/**
 * Customizer settings for footer
 */
class Multimagazine_Customize_Footer {

	/**
	 * 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(
			'footer',
			array(
				'title'    => __( 'Footer', 'multimagazine' ),
				'priority' => 50,
			)
		);
		do_action( 'multimagazine_customize_footer', $wp_customize );
	}

	/**
	 * Registers the footer display setting.
	 */
	public static function register_footer_display() {
		global $multimagazine_customize;
		$multimagazine_customize->select_setting(
			'multi_footer_display',
			'footer',
			array(
				'on'  => __( 'On', 'multimagazine' ),
				'off' => __( 'Off', 'multimagazine' ),
			),
			__( 'Footer display', 'multimagazine' )
		);
	}

	/**
	 * Registers the above footer widgets setting.
	 */
	public static function register_above_footer_widgets() {
		global $multimagazine_customize;
		$multimagazine_customize->select_setting(
			'multi_show_above_footer_widgets',
			'footer',
			array(
				'on'  => __( 'On', 'multimagazine' ),
				'off' => __( 'Off', 'multimagazine' ),
			),
			__( 'Above footer widget area display', 'multimagazine' )
		);
	}

	/**
	 * Registers the footer column count setting.
	 */
	public static function register_footer_column_count() {
		global $multimagazine_customize;
		$multimagazine_customize->select_setting(
			'multi_footer_column_count',
			'footer',
			array(
				1 => __( 'One column', 'multimagazine' ),
				2 => __( 'Two columns', 'multimagazine' ),
				3 => __( 'Three columns', 'multimagazine' ),
				4 => __( 'Four columns', 'multimagazine' ),
				5 => __( 'Five columns', 'multimagazine' ),
				6 => __( 'Six columns', 'multimagazine' ),
			),
			__( 'Number of columns', 'multimagazine' ),
			'',
			'postMessage'
		);
	}

	/**
	 * Registers the footer widget separator setting.
	 */
	public static function register_footer_widget_separator() {
		global $multimagazine_customize;
		$multimagazine_customize->checkbox_setting( 'multi_footer_widget_separator', 'footer', __( 'Show widget separators in footer', 'multimagazine' ) );
	}

	/**
	 * Registers the footer bg color setting.
	 */
	public static function register_footer_bg_color() {
		global $multimagazine_customize;
		$multimagazine_customize->color_setting( 'multi_footer_bg_color', 'footer', __( 'Footer background color', 'multimagazine' ), '', 'postMessage' );
	}

	/**
	 * Registers the footer bg image setting.
	 */
	public static function register_footer_bg_image() {
		global $multimagazine_customize;
		$multimagazine_customize->image_setting( 'multi_footer_bg_image', 'footer', __( 'Footer background image', 'multimagazine' ), '' );
	}

	/**
	 * Registers the footer bg size setting.
	 */
	public static function register_footer_bg_size() {
		global $multimagazine_customize;
		$multimagazine_customize->select_setting(
			'multi_footer_bg_size',
			'footer',
			array(
				'auto'    => __( 'Auto', 'multimagazine' ),
				'cover'   => __( 'Cover', 'multimagazine' ),
				'contain' => __( 'Contain', 'multimagazine' ),
			),
			__( 'Background image size', 'multimagazine' )
		);
	}

	/**
	 * Registers the footer bg repeat setting.
	 */
	public static function register_footer_bg_repeat() {
		global $multimagazine_customize;
		$multimagazine_customize->select_setting(
			'multi_footer_bg_repeat',
			'footer',
			array(
				'repeat'    => __( 'Repeat', 'multimagazine' ),
				'repeat-x'  => __( 'Repeat horizontally', 'multimagazine' ),
				'repeat-y'  => __( 'Repeat vertically', 'multimagazine' ),
				'no-repeat' => __( "Don't repeat", 'multimagazine' ),
			),
			__( 'Repeat background image', 'multimagazine' )
		);
	}

	/**
	 * Registers the footer widgets width setting.
	 */
	public static function register_footer_widgets_width() {
		global $multimagazine_customize;
		$multimagazine_customize->checkbox_setting( 'multi_footer_widgets_width', 'footer', __( 'Full width widget area', 'multimagazine' ) );
	}

	/**
	 * Registers the footer widgets padding top setting.
	 */
	public static function register_footer_widgets_padding_top() {
		multimagazine_register_range_setting( 'footer', 'multi_footer_widgets_padding_top', __( 'Widget area top padding', 'multimagazine' ), MULTIMAGAZINE_FOOTER_WIDGETS_PADDING_TOP, 0, 150, __( 'Number of pixels.', 'multimagazine' ), 1, 'postMessage' );
	}

	/**
	 * Registers the footer widgets padding bottom setting.
	 */
	public static function register_footer_widgets_padding_bottom() {
		multimagazine_register_range_setting( 'footer', 'multi_footer_widgets_padding_bottom', __( 'Widget area bottom padding', 'multimagazine' ), MULTIMAGAZINE_FOOTER_WIDGETS_PADDING_BOTTOM, 0, 150, __( 'Number of pixels.', 'multimagazine' ), 1, 'postMessage' );
	}

	/**
	 * Registers the footer bottom width setting.
	 */
	public static function register_footer_bottom_width() {
		global $multimagazine_customize;
		$multimagazine_customize->checkbox_setting( 'multi_footer_bottom_width', 'footer', __( 'Full width bottom bar', 'multimagazine' ) );
	}

	/**
	 * Registers the footer bottom content width setting.
	 */
	public static function register_footer_bottom_content_width() {
		global $multimagazine_customize;
		$multimagazine_customize->checkbox_setting( 'multi_footer_bottom_content_width', 'footer', __( 'Full width bottom bar content', 'multimagazine' ) );
	}

	/**
	 * Registers the footer bottom padding top setting.
	 */
	public static function register_footer_bottom_padding_top() {
		multimagazine_register_range_setting( 'footer', 'multi_footer_bottom_padding_top', __( 'Bottom bar top padding', 'multimagazine' ), MULTIMAGAZINE_FOOTER_BOTTOM_PADDING_TOP, 0, 150, __( 'Number of pixels.', 'multimagazine' ), 1, 'postMessage' );
	}

	/**
	 * Registers the footer bottom padding bottom setting.
	 */
	public static function register_footer_bottom_padding_bottom() {
		multimagazine_register_range_setting( 'footer', 'multi_footer_bottom_padding_bottom', __( 'Bottom bar bottom padding', 'multimagazine' ), MULTIMAGAZINE_FOOTER_BOTTOM_PADDING_BOTTOM, 0, 150, __( 'Number of pixels.', 'multimagazine' ), 1, 'postMessage' );
	}

	/**
	 * Registers the fixed footer setting.
	 */
	public static function register_fixed_footer() {
		global $multimagazine_customize;
		$multimagazine_customize->checkbox_setting( 'multi_fixed_footer', 'footer', __( 'Enable fixed footer', 'multimagazine' ) );
	}

	/**
	 * Registers the footer shadow setting.
	 */
	public static function register_footer_shadow() {
		global $multimagazine_customize;
		$multimagazine_customize->checkbox_setting( 'multi_footer_shadow', 'footer', __( 'Show shadow', 'multimagazine' ) );
	}

	/**
	 * Registers the footer copyright setting.
	 */
	public static function register_footer_copyright() {
		global $multimagazine_customize;
		$multimagazine_customize->checkbox_setting( 'multi_footer_copyright', 'footer', __( 'Show copyright with current year', 'multimagazine' ) );
	}

	/**
	 * Registers the footer priority1 setting.
	 */
	public static function register_footer_priority1() {
		global $multimagazine_customize;
		$multimagazine_customize->select_setting(
			'multi_footer_priority1',
			'footer',
			array(
				'menu'    => __( 'Menu', 'multimagazine' ),
				'content' => __( 'Footer content', 'multimagazine' ),
				'social'  => __( 'Social links', 'multimagazine' ),
			),
			__( 'First footer element', 'multimagazine' )
		);
	}

	/**
	 * Registers the footer priority2 setting.
	 */
	public static function register_footer_priority2() {
		global $multimagazine_customize;
		$multimagazine_customize->select_setting(
			'multi_footer_priority2',
			'footer',
			array(
				'menu'    => __( 'Menu', 'multimagazine' ),
				'content' => __( 'Footer content', 'multimagazine' ),
				'social'  => __( 'Social links', 'multimagazine' ),
			),
			__( 'Second footer element', 'multimagazine' )
		);
	}

	/**
	 * Registers the footer priority3 setting.
	 */
	public static function register_footer_priority3() {
		global $multimagazine_customize;
		$multimagazine_customize->select_setting(
			'multi_footer_priority3',
			'footer',
			array(
				'menu'    => __( 'Menu', 'multimagazine' ),
				'content' => __( 'Footer content', 'multimagazine' ),
				'social'  => __( 'Social links', 'multimagazine' ),
			),
			__( 'Third footer element', 'multimagazine' )
		);
	}

	/**
	 * Registers the footer menu position setting.
	 */
	public static function register_footer_menu_position() {
		global $multimagazine_customize;
		$multimagazine_customize->select_setting(
			'multi_footer_menu_position',
			'footer',
			array(
				0     => __( 'None', 'multimagazine' ),
				'0,0' => __( 'top left', 'multimagazine' ),
				'0,1' => __( 'top center', 'multimagazine' ),
				'0,2' => __( 'top right', 'multimagazine' ),
				'1,0' => __( 'middle left', 'multimagazine' ),
				'1,1' => __( 'middle center', 'multimagazine' ),
				'1,2' => __( 'middle right', 'multimagazine' ),
				'2,0' => __( 'bottom left', 'multimagazine' ),
				'2,1' => __( 'bottom center', 'multimagazine' ),
				'2,2' => __( 'bottom right', 'multimagazine' ),
			),
			__( 'Footer menu position', 'multimagazine' )
		);
	}

	/**
	 * Registers the footer content position setting.
	 */
	public static function register_footer_content_position() {
		global $multimagazine_customize;
		$multimagazine_customize->select_setting(
			'multi_footer_content_position',
			'footer',
			array(
				0     => __( 'None', 'multimagazine' ),
				'0,0' => __( 'top left', 'multimagazine' ),
				'0,1' => __( 'top center', 'multimagazine' ),
				'0,2' => __( 'top right', 'multimagazine' ),
				'1,0' => __( 'middle left', 'multimagazine' ),
				'1,1' => __( 'middle center', 'multimagazine' ),
				'1,2' => __( 'middle right', 'multimagazine' ),
				'2,0' => __( 'bottom left', 'multimagazine' ),
				'2,1' => __( 'bottom center', 'multimagazine' ),
				'2,2' => __( 'bottom right', 'multimagazine' ),
			),
			__( 'Footer content position', 'multimagazine' )
		);
	}

	/**
	 * Registers the footer social position setting.
	 */
	public static function register_footer_social_position() {
		global $multimagazine_customize;
		$multimagazine_customize->select_setting(
			'multi_footer_social_position',
			'footer',
			array(
				'none' => __( "Don't show", 'multimagazine' ),
				'0,0'  => __( 'top left', 'multimagazine' ),
				'0,1'  => __( 'top center', 'multimagazine' ),
				'0,2'  => __( 'top right', 'multimagazine' ),
				'1,0'  => __( 'middle left', 'multimagazine' ),
				'1,1'  => __( 'middle center', 'multimagazine' ),
				'1,2'  => __( 'middle right', 'multimagazine' ),
				'2,0'  => __( 'bottom left', 'multimagazine' ),
				'2,1'  => __( 'bottom center', 'multimagazine' ),
				'2,2'  => __( 'bottom right', 'multimagazine' ),
			),
			__( 'Footer social links position', 'multimagazine' )
		);
	}

	/**
	 * Registers the footer bottom separator setting.
	 */
	public static function register_footer_bottom_separator() {
		global $multimagazine_customize;
		$multimagazine_customize->checkbox_setting( 'multi_footer_bottom_separator', 'footer', __( 'Show bottom separator in footer', 'multimagazine' ) );
	}

	/**
	 * Registers the footer text color setting.
	 */
	public static function register_footer_text_color() {
		global $multimagazine_customize;
		$multimagazine_customize->color_setting( 'multi_footer_text_color', 'footer', __( 'Footer text color', 'multimagazine' ), '', 'postMessage' );
	}

	/**
	 * Registers the footer headings color setting.
	 */
	public static function register_footer_headings_color() {
		global $multimagazine_customize;
		$multimagazine_customize->color_setting( 'multi_footer_headings_color', 'footer', __( 'Footer headings color', 'multimagazine' ), '', 'postMessage' );
	}

	/**
	 * Registers the footer link color setting.
	 */
	public static function register_footer_link_color() {
		global $multimagazine_customize;
		$multimagazine_customize->color_setting( 'multi_footer_link_color', 'footer', __( 'Footer link color', 'multimagazine' ), '', 'postMessage' );
	}

	/**
	 * Registers the footer link hover color setting.
	 */
	public static function register_footer_link_hover_color() {
		global $multimagazine_customize;
		$multimagazine_customize->color_setting( 'multi_footer_link_hover_color', 'footer', __( 'Footer link hover color', 'multimagazine' ), '', 'postMessage' );
	}

	/**
	 * Registers the footer bottom link color setting.
	 */
	public static function register_footer_bottom_link_color() {
		global $multimagazine_customize;
		$multimagazine_customize->color_setting( 'multi_footer_bottom_link_color', 'footer', __( 'Footer bottom link color', 'multimagazine' ), '', 'postMessage' );
	}

	/**
	 * Registers the footer bottom link hover color setting.
	 */
	public static function register_footer_bottom_link_hover_color() {
		global $multimagazine_customize;
		$multimagazine_customize->color_setting( 'multi_footer_bottom_link_hover_color', 'footer', __( 'Footer bottom link hover color', 'multimagazine' ), '', 'postMessage' );
	}

	/**
	 * Registers the footer border color setting.
	 */
	public static function register_footer_border_color() {
		global $multimagazine_customize;
		$multimagazine_customize->color_setting( 'multi_footer_border_color', 'footer', __( 'Footer border color', 'multimagazine' ), '', 'postMessage' );
	}

	/**
	 * Registers the footer bottom bg color setting.
	 */
	public static function register_footer_bottom_bg_color() {
		global $multimagazine_customize;
		$multimagazine_customize->color_setting( 'multi_footer_bottom_bg_color', 'footer', __( 'Footer bottom background color', 'multimagazine' ), '', 'postMessage' );
	}

	/**
	 * Registers the footer bottom text color setting.
	 */
	public static function register_footer_bottom_text_color() {
		global $multimagazine_customize;
		$multimagazine_customize->color_setting( 'multi_footer_bottom_text_color', 'footer', __( 'Footer bottom text color', 'multimagazine' ), __( 'Text color for the bottom part of page footer', 'multimagazine' ), 'postMessage' );
	}

	/**
	 * Registers the footer middle ratio setting.
	 */
	public static function register_footer_middle_ratio() {
		global $multimagazine_customize;
		$multimagazine_customize->number_setting( 'multi_footer_middle_ratio', 'footer', __( 'Footer bottom middle part width ratio', 'multimagazine' ) );
	}
}

add_action( 'customize_register', array( 'Multimagazine_Customize_Footer', 'register_section' ) );
add_action( 'multimagazine_customize_footer', array( 'Multimagazine_Customize_Footer', 'register_footer_display' ), 10 );
add_action( 'multimagazine_customize_footer', array( 'Multimagazine_Customize_Footer', 'register_above_footer_widgets' ), 15 );
add_action( 'multimagazine_customize_footer', array( 'Multimagazine_Customize_Footer', 'register_footer_column_count' ), 20 );
add_action( 'multimagazine_customize_footer', array( 'Multimagazine_Customize_Footer', 'register_footer_widget_separator' ), 25 );
add_action( 'multimagazine_customize_footer', array( 'Multimagazine_Customize_Footer', 'register_footer_bg_color' ), 30 );
add_action( 'multimagazine_customize_footer', array( 'Multimagazine_Customize_Footer', 'register_footer_bg_image' ), 35 );
add_action( 'multimagazine_customize_footer', array( 'Multimagazine_Customize_Footer', 'register_footer_bg_size' ), 40 );
add_action( 'multimagazine_customize_footer', array( 'Multimagazine_Customize_Footer', 'register_footer_bg_repeat' ), 45 );
add_action( 'multimagazine_customize_footer', array( 'Multimagazine_Customize_Footer', 'register_footer_widgets_width' ), 50 );
add_action( 'multimagazine_customize_footer', array( 'Multimagazine_Customize_Footer', 'register_footer_widgets_padding_top' ), 55 );
add_action( 'multimagazine_customize_footer', array( 'Multimagazine_Customize_Footer', 'register_footer_widgets_padding_bottom' ), 60 );
add_action( 'multimagazine_customize_footer', array( 'Multimagazine_Customize_Footer', 'register_footer_bottom_width' ), 65 );
add_action( 'multimagazine_customize_footer', array( 'Multimagazine_Customize_Footer', 'register_footer_bottom_content_width' ), 70 );
add_action( 'multimagazine_customize_footer', array( 'Multimagazine_Customize_Footer', 'register_footer_bottom_padding_top' ), 75 );
add_action( 'multimagazine_customize_footer', array( 'Multimagazine_Customize_Footer', 'register_footer_bottom_padding_bottom' ), 80 );
add_action( 'multimagazine_customize_footer', array( 'Multimagazine_Customize_Footer', 'register_fixed_footer' ), 85 );
add_action( 'multimagazine_customize_footer', array( 'Multimagazine_Customize_Footer', 'register_footer_shadow' ), 90 );
add_action( 'multimagazine_customize_footer', array( 'Multimagazine_Customize_Footer', 'register_footer_copyright' ), 100 );
add_action( 'multimagazine_customize_footer', array( 'Multimagazine_Customize_Footer', 'register_footer_priority1' ), 105 );
add_action( 'multimagazine_customize_footer', array( 'Multimagazine_Customize_Footer', 'register_footer_priority2' ), 110 );
add_action( 'multimagazine_customize_footer', array( 'Multimagazine_Customize_Footer', 'register_footer_priority3' ), 115 );
add_action( 'multimagazine_customize_footer', array( 'Multimagazine_Customize_Footer', 'register_footer_menu_position' ), 120 );
add_action( 'multimagazine_customize_footer', array( 'Multimagazine_Customize_Footer', 'register_footer_content_position' ), 125 );
add_action( 'multimagazine_customize_footer', array( 'Multimagazine_Customize_Footer', 'register_footer_social_position' ), 130 );
add_action( 'multimagazine_customize_footer', array( 'Multimagazine_Customize_Footer', 'register_footer_bottom_separator' ), 135 );
add_action( 'multimagazine_customize_footer', array( 'Multimagazine_Customize_Footer', 'register_footer_text_color' ), 140 );
add_action( 'multimagazine_customize_footer', array( 'Multimagazine_Customize_Footer', 'register_footer_headings_color' ), 145 );
add_action( 'multimagazine_customize_footer', array( 'Multimagazine_Customize_Footer', 'register_footer_link_color' ), 150 );
add_action( 'multimagazine_customize_footer', array( 'Multimagazine_Customize_Footer', 'register_footer_link_hover_color' ), 155 );
add_action( 'multimagazine_customize_footer', array( 'Multimagazine_Customize_Footer', 'register_footer_bottom_link_color' ), 160 );
add_action( 'multimagazine_customize_footer', array( 'Multimagazine_Customize_Footer', 'register_footer_bottom_link_hover_color' ), 165 );
add_action( 'multimagazine_customize_footer', array( 'Multimagazine_Customize_Footer', 'register_footer_border_color' ), 170 );
add_action( 'multimagazine_customize_footer', array( 'Multimagazine_Customize_Footer', 'register_footer_bottom_bg_color' ), 175 );
add_action( 'multimagazine_customize_footer', array( 'Multimagazine_Customize_Footer', 'register_footer_bottom_text_color' ), 180 );
add_action( 'multimagazine_customize_footer', array( 'Multimagazine_Customize_Footer', 'register_footer_middle_ratio' ), 185 );
