<?php
/**
 * Inspiro Lite: Adds settings, sections, controls to Customizer
 *
 * @package Inspiro
 * @subpackage Inspiro_Lite
 * @since Inspiro 1.3.0
 */

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

/**
 * PHP Class for Registering Customizer Configuration
 *
 * @since 1.3.0
 */
class Inspiro_Post_Options_Config {
	/**
	 * Configurations
	 *
	 * @since 1.4.0 Store configurations to class method.
	 * @return array
	 */
	public static function config() {
		return array(
			'panel' => array(
				'id'   => 'blog_post_options_panel',
				'args' => array(
					'title'      => esc_html__( 'Blog Post Options', 'inspiro' ),
					'capability' => 'edit_theme_options',
					'priority'   => 51,
				),
			),
			'section' => array(
				array(
					'id'   => 'blog_page_section',
					'args' => array(
						'title'    => esc_html__( 'Blog Page', 'inspiro' ),
						'panel'    => 'blog_post_options_panel',
						'priority' => 1,
					),
				),
				array(
					'id'   => 'single_post_section',
					'args' => array(
						'title'    => esc_html__( 'Single Post', 'inspiro' ),
						'panel'    => 'blog_post_options_panel',
						'priority' => 2,
					),
				),
			),
			'setting' => array(
                array(
    				'id'   => 'display_content',
    				'args' => array(
    					'default'           => 'excerpt',
    					'sanitize_callback' => 'inspiro_sanitize_display_content',
    					'transport'         => 'refresh',
    				),
                ),
                array(
                    'id'   => 'display_featured_image',
                    'args' => array(
                        'default'           => true,
                        'sanitize_callback' => 'inspiro_sanitize_checkbox',
                        'transport'         => 'refresh',
                    ),
                ),
                array(
                    'id'   => 'featured_image_position',
                    'args' => array(
                        'default'           => 'header',
                        'sanitize_callback' => 'inspiro_sanitize_choices',
                        'transport'         => 'refresh',
                    ),
                ),
                array(
                    'id'   => 'featured_image_above_size',
                    'args' => array(
                        'default'           => 'inspiro-loop',
                        'sanitize_callback' => 'inspiro_sanitize_image_size',
                        'transport'         => 'refresh',
                    ),
                ),
                array(
                    'id'   => 'display_post_navigation',
                    'args' => array(
                        'default'           => true,
                        'sanitize_callback' => 'inspiro_sanitize_checkbox',
                        'transport'         => 'refresh',
                    ),
                ),
                array(
                    'id'   => 'blog_options_upgrade',
                    'args' => array(
                        'default' => null,
                        'sanitize_callback' => 'sanitize_text_field',
                    ),
                ),
			),
			'control' => array(
                array(
    				'id'   => 'display_content',
    				'args' => array(
    					'priority' => 6,
    					'label'   => esc_html__( 'Content to Display in Archive Pages', 'inspiro' ),
    					'section' => 'blog_page_section',
    					'type'    => 'select',
    					'choices' => array(
    						'excerpt'      => esc_html__( 'Excerpt', 'inspiro' ),
    						'full-content' => esc_html__( 'Full Content', 'inspiro' ),
    						'none'         => esc_html__( 'None', 'inspiro' ),
    					),
    					'active_callback' => 'inspiro_is_blog_layout_list',
    				),
                ),
                array(
                    'id'   => 'display_featured_image',
                    'args' => array(
                        'priority' => 1,
                        'label'   => esc_html__( 'Display the Featured Image in the Header', 'inspiro' ),
                        'section' => 'single_post_section',
                        'type'    => 'checkbox',
                        'description' => esc_html__( 'Choose if you want to show the Featured Image in the header', 'inspiro' ),
                    ),
                ),
                array(
                    'id'   => 'featured_image_position',
                    'args' => array(
                        'priority'        => 2,
                        'label'           => esc_html__( 'Featured Image Position', 'inspiro' ),
                        'description'     => esc_html__( 'Choose where the Featured Image appears on single posts.', 'inspiro' ),
                        'section'         => 'single_post_section',
                        'type'            => 'select',
                        'choices'         => array(
                            'header'      => esc_html__( 'In the Header (background)', 'inspiro' ),
                            'above_title' => esc_html__( 'Above the Title', 'inspiro' ),
                        ),
                        'active_callback' => 'inspiro_is_featured_image_enabled',
                    ),
                ),
                array(
                    'id'   => 'featured_image_above_size',
                    'args' => array(
                        'priority'        => 3,
                        'label'           => esc_html__( 'Featured Image Size', 'inspiro' ),
                        'section'         => 'single_post_section',
                        'type'            => 'select',
                        'choices'         => inspiro_get_image_sizes_choices(),
                        'description'     => sprintf(
                            /* translators: %s: link to regenerate thumbnails documentation */
                            esc_html__( 'Image size used when the Featured Image is shown above the title. If images don\'t appear correctly cropped, you may need to %s.', 'inspiro' ),
                            '<a href="https://wp.md/regenerate" target="_blank">' . esc_html__( 'regenerate thumbnails', 'inspiro' ) . '</a>'
                        ),
                        'active_callback' => 'inspiro_is_featured_image_above_title',
                    ),
                ),
                array(
                    'id'   => 'display_post_navigation',
                    'args' => array(
                        'priority'    => 4,
                        'label'       => esc_html__( 'Display the Previous Post Banner', 'inspiro' ),
                        'section'     => 'single_post_section',
                        'type'        => 'checkbox',
                        'description' => esc_html__( 'Show the large banner with the previous post\'s featured image at the bottom of single posts.', 'inspiro' ),
                    ),
                ),
                array(
                    'id'           => 'blog_options_upgrade',
                    'control_type' => 'Inspiro_Customize_Title_Control',
                    'args'         => array(
                        'priority' => 99,
                        'label' => esc_html__( '⚙️ You can control every detail in your theme with Inspiro Premium!', 'inspiro' ),
                        'description' => esc_html__( 'Unlock all customization and post options by upgrading to the Premium version of the theme. Disable specific elements and features, customize colors, fonts, header, footer & much more!', 'inspiro' ),
                        'pro_text'    => esc_html__( '👉 Unlock all options and features', 'inspiro' ),
                        'pro_url'     => 'https://www.wpzoom.com/themes/inspiro-lite/upgrade/?utm_source=wpadmin&utm_medium=customizer&utm_campaign=blogpostbutton',
                        'section' => 'single_post_section',
                    ),
                ),
			),
		);
	}
}
