<?php
/**
 * Default theme options.
 *
 * @package Magic Notes
 */

if ( ! function_exists( 'magic_notes_get_default_theme_options' ) ) :

	/**
	 * Get default theme options.
	 *
	 * @since 1.0.0
	 *
	 * @return array Default theme options.
	 */
function magic_notes_get_default_theme_options() {

	$defaults = array();

	// Top Bar
	$defaults['show_header_contact_info'] 				= false;
    $defaults['show_header_social_links'] 				= false;
    $defaults['header_social_links']					= array();

    // Front Page Content
	$defaults['enable_frontpage_content'] 				= true;

	// Slider Section	
	$defaults['enable_featured_slider_section']		    = false;
	$defaults['number_of_featured_slider_items']	    = 3;
	$defaults['featured_slider_content_type']		    = 'featured_slider_post';

	// About Us Section	
	$defaults['enable_about_us_section']	   			= false;
	$defaults['about_us_title']	   	 					= esc_html__( 'We Are Creative', 'magic-notes' );
	$defaults['about_us_description']	   				= esc_html__( 'Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old.', 'magic-notes' );
	$defaults['about_us_read_more_text']	   			= esc_html__( 'Read More', 'magic-notes' );
	$defaults['about_us_read_more_url']	   	 			= '#';

	// Featured Posts Section	
	$defaults['enable_featured_posts_section']			= false;
	$defaults['featured_posts_section_title']			= esc_html__( 'Featured Posts', 'magic-notes' );
	$defaults['number_of_featured_posts_items']			= 3;
	$defaults['featured_posts_column']					= 'col-3';
	$defaults['featured_posts_content_type']			= 'featured_posts_post';

	// Gallery Section	
	$defaults['enable_featured_gallery_section']		= false;
	$defaults['featured_gallery_section_title']	    	= esc_html__( 'Gallery', 'magic-notes' );
	$defaults['number_of_featured_gallery_items']		= 4;
	$defaults['featured_gallery_column']				= 'col-4';
	$defaults['featured_gallery_content_type']			= 'featured_gallery_post';

	// Latest Posts Section
	$defaults['enable_latest_posts_section']			= false;
	$defaults['latest_posts_section_title']	    		= esc_html__( 'Latest Articles', 'magic-notes' );
	$defaults['latest_posts_category']	   	    		= 0; 
	$defaults['latest_posts_number']					= 3;
	$defaults['latest_posts_column']					= 'col-3';

	// Theme Options
	$defaults['show_header_image']		    			= 'header-image-enable';
	$defaults['show_page_title']		    			= 'page-title-enable';
	$defaults['layout_options_blog']					= 'no-sidebar';
	$defaults['layout_options_archive']					= 'no-sidebar';
	$defaults['layout_options_page']					= 'no-sidebar';	
	$defaults['layout_options_single']					= 'right-sidebar';	
	$defaults['excerpt_length']							= 25;
	$defaults['your_latest_posts_title']				= esc_html__('Blog','magic-notes');

	//Footer section 		
	$defaults['copyright_text']							= esc_html__( 'Copyright &copy; All rights reserved.', 'magic-notes' );

	// Pass through filter.
	$defaults = apply_filters( 'magic_notes_filter_default_theme_options', $defaults );
	return $defaults;
}

endif;

/**
*  Get theme options
*/
if ( ! function_exists( 'magic_notes_get_option' ) ) :

	/**
	 * Get theme option
	 *
	 * @since 1.0.0
	 *
	 * @param string $key Option key.
	 * @return mixed Option value.
	 */
	function magic_notes_get_option( $key ) {

		$default_options = magic_notes_get_default_theme_options();
		if ( empty( $key ) ) {
			return;
		}

		$theme_options = (array)get_theme_mod( 'theme_options' );
		$theme_options = wp_parse_args( $theme_options, $default_options );

		$value = null;

		if ( isset( $theme_options[ $key ] ) ) {
			$value = $theme_options[ $key ];
		}

		return $value;

	}

endif;