<?php
/**
 * Skin file for the theme.
 */

// Disable direct call
if ( ! defined( 'ABSPATH' ) ) { exit; }

// Theme init
if (!function_exists('seohub_action_skin_theme_setup')) {
	add_action( 'seohub_action_init_theme', 'seohub_action_skin_theme_setup', 1 );
	function seohub_action_skin_theme_setup() {

		// Add skin fonts in the used fonts list
		add_filter('seohub_filter_used_fonts',			'seohub_filter_skin_used_fonts');
		// Add skin fonts (from Google fonts) in the main fonts list (if not present).
		add_filter('seohub_filter_list_fonts',			'seohub_filter_skin_list_fonts');

		// Add skin stylesheets
		add_action('seohub_action_add_styles',			'seohub_action_skin_add_styles');
		// Add skin inline styles
		add_filter('seohub_filter_add_styles_inline',		'seohub_filter_skin_add_styles_inline');
		// Add skin responsive styles
		add_action('seohub_action_add_responsive',		'seohub_action_skin_add_responsive');
		// Add skin responsive inline styles
		add_filter('seohub_filter_add_responsive_inline',	'seohub_filter_skin_add_responsive_inline');

		// Add skin scripts
		add_action('seohub_action_add_scripts',			'seohub_action_skin_add_scripts');
		// Add skin scripts inline
		add_action('seohub_action_add_scripts_inline',	'seohub_action_skin_add_scripts_inline');

		// Add skin less files into list for compilation
		add_filter('seohub_filter_compile_less',			'seohub_filter_skin_compile_less');


		/* Color schemes
		
		// Accenterd colors
		accent1			- theme accented color 1
		accent1_hover	- theme accented color 1 (hover state)
		accent2			- theme accented color 2
		accent2_hover	- theme accented color 2 (hover state)		
		accent3			- theme accented color 3
		accent3_hover	- theme accented color 3 (hover state)		
		
		// Headers, text and links
		text			- main content
		text_light		- post info
		text_dark		- headers
		inverse_text	- text on accented background
		inverse_light	- post info on accented background
		inverse_dark	- headers on accented background
		inverse_link	- links on accented background
		inverse_hover	- hovered links on accented background
		
		// Block's border and background
		bd_color		- border for the entire block
		bg_color		- background color for the entire block
		bg_image, bg_image_position, bg_image_repeat, bg_image_attachment  - first background image for the entire block
		bg_image2,bg_image2_position,bg_image2_repeat,bg_image2_attachment - second background image for the entire block
		
		// Alternative colors - highlight blocks, form fields, etc.
		alter_text		- text on alternative background
		alter_light		- post info on alternative background
		alter_dark		- headers on alternative background
		alter_link		- links on alternative background
		alter_hover		- hovered links on alternative background
		alter_bd_color	- alternative border
		alter_bd_hover	- alternative border for hovered state or active field
		alter_bg_color	- alternative background
		alter_bg_hover	- alternative background for hovered state or active field 
		alter_bg_image, alter_bg_image_position, alter_bg_image_repeat, alter_bg_image_attachment - background image for the alternative block
		
		*/

		// Add color schemes
		seohub_add_color_scheme('original', array(

			'title'					=> esc_html__('Original', 'seohub'),

			// Accent colors
			'accent1'				=> '#9dca5d',       //green
			'accent1_hover'			=> '#6ab139',       //
			'accent2'				=> '#ff5831',       //red
			'accent2_hover'			=> '#da421e',       //
			'accent3'				=> '#ffc300',       //yellow
			'accent3_hover'			=> '#e4af02',       //
			
			// Headers, text and links colors
			'text'					=> '#646566',       //text                              //
			'text_light'			=> '#b1d57d',       // hover on main menu item
			'text_dark'				=> '#2e2b3a',       //headers                           //
			'inverse_text'			=> '#ffffff',       //
			'inverse_light'			=> '#c3ec89',       //breadcrumbs
			'inverse_dark'			=> '#797a7a',       //inputs text
			'inverse_link'			=> '#ffcf33',       //priceblock1
			'inverse_hover'			=> '#88bf52',       //priceblock2


			// Whole block border and background
			'bd_color'				=> '#d7d7d7',       //
			'bg_color'				=> '#f5f5f5',       //
			'bg_image'				=> '',
			'bg_image_position'		=> 'left top',
			'bg_image_repeat'		=> 'repeat',
			'bg_image_attachment'	=> 'scroll',
			'bg_image2'				=> '',
			'bg_image2_position'	=> 'left top',
			'bg_image2_repeat'		=> 'repeat',
			'bg_image2_attachment'	=> 'scroll',
		
			// Alternative blocks (submenu items, form's fields, etc.)
			'alter_text'			=> '#8a8a8a',
			'alter_light'			=> '#acb4b6',
			'alter_dark'			=> '#2e2b3a',       //footer sidebar
			'alter_link'			=> '#3a3747',       //subscribe area
			'alter_hover'			=> '#4496fb',       //soc1
			'alter_bd_color'		=> '#60c5ff',       //soc2
			'alter_bd_hover'		=> '#2288c2',       //soc3
			'alter_bg_color'		=> '#eaeaea',       //inputs
			'alter_bg_hover'		=> '#f0f0f0',       //
			'alter_bg_image'			=> '',
			'alter_bg_image_position'	=> 'left top',
			'alter_bg_image_repeat'		=> 'repeat',
			'alter_bg_image_attachment'	=> 'scroll',
			)
		);

		// Add color schemes
		seohub_add_color_scheme('light', array(

			'title'					=> esc_html__('Light', 'seohub'),

			// Accent colors
			'accent1'				=> '#9dca5d',
			'accent1_hover'			=> '#189799',
			'accent2'				=> '#ff0000',
			'accent2_hover'			=> '#aa0000',
			'accent3'				=> '',
			'accent3_hover'			=> '',
			
			// Headers, text and links colors
			'text'					=> '#797a7a',       //
			'text_light'			=> '#acb4b6',
			'text_dark'				=> '#2e2b3a',       //
			'inverse_text'			=> '#ffffff',
			'inverse_light'			=> '#ffffff',
			'inverse_dark'			=> '#ffffff',
			'inverse_link'			=> '#ffffff',
			'inverse_hover'			=> '#ffffff',
			
			// Whole block border and background
			'bd_color'				=> '#dddddd',
			'bg_color'				=> '#f7f7f7',
			'bg_image'				=> '',
			'bg_image_position'		=> 'left top',
			'bg_image_repeat'		=> 'repeat',
			'bg_image_attachment'	=> 'scroll',
			'bg_image2'				=> '',
			'bg_image2_position'	=> 'left top',
			'bg_image2_repeat'		=> 'repeat',
			'bg_image2_attachment'	=> 'scroll',
		
			// Alternative blocks (submenu items, form's fields, etc.)
			'alter_text'			=> '#8a8a8a',
			'alter_light'			=> '#acb4b6',
			'alter_dark'			=> '#232a34',
			'alter_link'			=> '#20c7ca',
			'alter_hover'			=> '#189799',
			'alter_bd_color'		=> '#e7e7e7',
			'alter_bd_hover'		=> '#dddddd',
			'alter_bg_color'		=> '#ffffff',
			'alter_bg_hover'		=> '#f0f0f0',
			'alter_bg_image'			=> '',
			'alter_bg_image_position'	=> 'left top',
			'alter_bg_image_repeat'		=> 'repeat',
			'alter_bg_image_attachment'	=> 'scroll',
			)
		);

		// Add color schemes
		seohub_add_color_scheme('dark', array(

			'title'					=> esc_html__('Dark', 'seohub'),

			// Accent colors
			'accent1'				=> '#20c7ca',
			'accent1_hover'			=> '#189799',
			'accent2'				=> '#ff0000',
			'accent2_hover'			=> '#aa0000',
			'accent3'				=> '',
			'accent3_hover'			=> '',
			
			// Headers, text and links colors
			'text'					=> '#909090',
			'text_light'			=> '#b1d57d',
			'text_dark'				=> '#e0e0e0',
			'inverse_text'			=> '#f0f0f0',
			'inverse_light'			=> '#e0e0e0',
			'inverse_dark'			=> '#ffffff',
			'inverse_link'			=> '#ffffff',
			'inverse_hover'			=> '#e5e5e5',
			
			// Whole block border and background
			'bd_color'				=> '#000000',
			'bg_color'				=> '#333333',
			'bg_image'				=> '',
			'bg_image_position'		=> 'left top',
			'bg_image_repeat'		=> 'repeat',
			'bg_image_attachment'	=> 'scroll',
			'bg_image2'				=> '',
			'bg_image2_position'	=> 'left top',
			'bg_image2_repeat'		=> 'repeat',
			'bg_image2_attachment'	=> 'scroll',
		
			// Alternative blocks (submenu items, form's fields, etc.)
			'alter_text'			=> '#999999',
			'alter_light'			=> '#aaaaaa',
			'alter_dark'			=> '#d0d0d0',
			'alter_link'			=> '#20c7ca',
			'alter_hover'			=> '#29fbff',
			'alter_bd_color'		=> '#909090',
			'alter_bd_hover'		=> '#888888',
			'alter_bg_color'		=> '#666666',
			'alter_bg_hover'		=> '#505050',
			'alter_bg_image'			=> '',
			'alter_bg_image_position'	=> 'left top',
			'alter_bg_image_repeat'		=> 'repeat',
			'alter_bg_image_attachment'	=> 'scroll',
			)
		);

		/* Font slugs:
		h1 ... h6	- headers
		p			- plain text
		link		- links
		info		- info blocks (Posted 15 May, 2015 by John Doe)
		menu		- main menu
		submenu		- dropdown menus
		logo		- logo text
		button		- button's caption
		input		- input fields
		*/

		// Add Custom fonts
		seohub_add_custom_font('h1', array(
			'title'			=> esc_html__('Heading 1', 'seohub'),
			'description'	=> '',
			'font-family'	=> 'Roboto',
			'font-size' 	=> '3em',
			'font-weight'	=> '400',
			'font-style'	=> '',
			'line-height'	=> '1.3em',
			'margin-top'	=> '0.05em',
			'margin-bottom'	=> '0.4em'
			)
		);
		seohub_add_custom_font('h2', array(
			'title'			=> esc_html__('Heading 2', 'seohub'),
			'description'	=> '',
			'font-family'	=> 'Roboto',
			'font-size' 	=> '2em',
			'font-weight'	=> '400',
			'font-style'	=> '',
			'line-height'	=> '1.3em',
			'margin-top'	=> '1.52em',
			'margin-bottom'	=> '0.75em'
			)
		);
		seohub_add_custom_font('h3', array(
			'title'			=> esc_html__('Heading 3', 'seohub'),
			'description'	=> '',
			'font-family'	=> 'Roboto',
			'font-size' 	=> '1.667em',
			'font-weight'	=> '400',
			'font-style'	=> '',
			'line-height'	=> '1.3em',
			'margin-top'	=> '1.91em',
			'margin-bottom'	=> '1.1em'
			)
		);
		seohub_add_custom_font('h4', array(
			'title'			=> esc_html__('Heading 4', 'seohub'),
			'description'	=> '',
			'font-family'	=> 'Roboto',
			'font-size' 	=> '1.4667em',
			'font-weight'	=> '400',
			'font-style'	=> '',
			'line-height'	=> '1.3em',
			'margin-top'	=> '2.15em',
			'margin-bottom'	=> '1.25em'
			)
		);
		seohub_add_custom_font('h5', array(
			'title'			=> esc_html__('Heading 5', 'seohub'),
			'description'	=> '',
			'font-family'	=> 'Roboto',
			'font-size' 	=> '1.3333em',
			'font-weight'	=> '400',
			'font-style'	=> '',
			'line-height'	=> '1.3em',
			'margin-top'	=> '2.35em',
			'margin-bottom'	=> '1.4em'
			)
		);
		seohub_add_custom_font('h6', array(
			'title'			=> esc_html__('Heading 6', 'seohub'),
			'description'	=> '',
			'font-family'	=> 'Roboto',
			'font-size' 	=> '0.933em',
			'font-weight'	=> '400',
			'font-style'	=> '',
			'line-height'	=> '1.3em',
			'margin-top'	=> '3.8em',
			'margin-bottom'	=> '1.3em'
			)
		);
		seohub_add_custom_font('p', array(
			'title'			=> esc_html__('Text', 'seohub'),
			'description'	=> '',
			'font-family'	=> 'Roboto',
			'font-size' 	=> '15px',
			'font-weight'	=> '400',
			'font-style'	=> '',
			'line-height'	=> '1.6em',
			'margin-top'	=> '0',
			'margin-bottom'	=> '1em'
			)
		);
		seohub_add_custom_font('link', array(
			'title'			=> esc_html__('Links', 'seohub'),
			'description'	=> '',
			'font-family'	=> '',
			'font-size' 	=> '',
			'font-weight'	=> '',
			'font-style'	=> ''
			)
		);
		seohub_add_custom_font('info', array(
			'title'			=> esc_html__('Post info', 'seohub'),
			'description'	=> '',
			'font-family'	=> '',
			'font-size' 	=> '',
			'font-weight'	=> '',
			'font-style'	=> '',
			'line-height'	=> '1.3em',
			'margin-top'	=> '',
			'margin-bottom'	=> '1.5em'
			)
		);
		seohub_add_custom_font('menu', array(
			'title'			=> esc_html__('Main menu items', 'seohub'),
			'description'	=> '',
			'font-family'	=> '',
			'font-size' 	=> '',
			'font-weight'	=> '700',
			'font-style'	=> '',
			'line-height'	=> '1.3em',
			'margin-top'	=> '0.1em',
			'margin-bottom'	=> '0.1em'
			)
		);
		seohub_add_custom_font('submenu', array(
			'title'			=> esc_html__('Dropdown menu items', 'seohub'),
			'description'	=> '',
			'font-family'	=> '',
			'font-size' 	=> '15px',
			'font-weight'	=> '400',
			'font-style'	=> '',
			'line-height'	=> '1.3em',
			'margin-top'	=> '',
			'margin-bottom'	=> ''
			)
		);
		seohub_add_custom_font('logo', array(
			'title'			=> esc_html__('Logo', 'seohub'),
			'description'	=> '',
			'font-family'	=> 'Montserrat',
			'font-size' 	=> '1.5384em',
			'font-weight'	=> '400',
			'font-style'	=> '',
			'line-height'	=> '1.2em',
			'margin-top'	=> '2.4em',
			'margin-bottom'	=> '0.5em'
			)
		);
		seohub_add_custom_font('button', array(
			'title'			=> esc_html__('Buttons', 'seohub'),
			'description'	=> '',
			'font-family'	=> '',
			'font-size' 	=> '',
			'font-weight'	=> '',
			'font-style'	=> '',
			'line-height'	=> '1.3em'
			)
		);
		seohub_add_custom_font('input', array(
			'title'			=> esc_html__('Input fields', 'seohub'),
			'description'	=> '',
			'font-family'	=> '',
			'font-size' 	=> '',
			'font-weight'	=> '',
			'font-style'	=> '',
			'line-height'	=> '1.3em'
			)
		);

	}
}





//------------------------------------------------------------------------------
// Skin's fonts
//------------------------------------------------------------------------------

// Add skin fonts in the used fonts list
if (!function_exists('seohub_filter_skin_used_fonts')) {
	//add_filter('seohub_filter_used_fonts', 'seohub_filter_skin_used_fonts');
	function seohub_filter_skin_used_fonts($theme_fonts) {
		//$theme_fonts['Roboto'] = 1;
		//$theme_fonts['Love Ya Like A Sister'] = 1;
        $theme_fonts['Roboto'] = 1;
        $theme_fonts['Montserrat'] = 1;
		return $theme_fonts;
	}
}

// Add skin fonts (from Google fonts) in the main fonts list (if not present).
// To use custom font-face you not need add it into list in this function
// How to install custom @font-face fonts into the theme?
// All @font-face fonts are located in "theme_name/css/font-face/" folder in the separate subfolders for the each font. Subfolder name is a font-family name!
// Place full set of the font files (for each font style and weight) and css-file named stylesheet.css in the each subfolder.
// Create your @font-face kit by using Fontsquirrel @font-face Generator (http://www.fontsquirrel.com/fontface/generator)
// and then extract the font kit (with folder in the kit) into the "theme_name/css/font-face" folder to install
if (!function_exists('seohub_filter_skin_list_fonts')) {
	//add_filter('seohub_filter_list_fonts', 'seohub_filter_skin_list_fonts');
	function seohub_filter_skin_list_fonts($list) {
		// Example:
		// if (!isset($list['Advent Pro'])) {
		//		$list['Advent Pro'] = array(
		//			'family' => 'sans-serif',																						// (required) font family
		//			'link'   => 'Advent+Pro:100,100italic,300,300italic,400,400italic,500,500italic,400,400italic,900,900italic',	// (optional) if you use Google font repository
		//			'css'    => seohub_get_file_url('/css/font-face/Advent-Pro/stylesheet.css')									// (optional) if you use custom font-face
		//			);
		// }
		if (!isset($list['Roboto']))	$list['Roboto'] = array('family'=>'sans-serif', 'link'   => 'Roboto');
        if (!isset($list['Montserrat']))	$list['Montserrat'] = array('family'=>'sans-serif', 'link'   => 'Montserrat');
		return $list;
	}
}



//------------------------------------------------------------------------------
// Skin's stylesheets
//------------------------------------------------------------------------------
// Add skin stylesheets
if (!function_exists('seohub_action_skin_add_styles')) {
	//add_action('seohub_action_add_styles', 'seohub_action_skin_add_styles');
	function seohub_action_skin_add_styles() {
		// Add stylesheet files
		seohub_enqueue_style( 'seohub-skin-style', seohub_get_file_url('skin.css'), array(), null );
		if (file_exists(seohub_get_file_dir('skin.customizer.css')))
			seohub_enqueue_style( 'seohub-skin-customizer-style', seohub_get_file_url('skin.customizer.css'), array(), null );
	}
}

// Add skin inline styles
if (!function_exists('seohub_filter_skin_add_styles_inline')) {
	//add_filter('seohub_filter_add_styles_inline', 'seohub_filter_skin_add_styles_inline');
	function seohub_filter_skin_add_styles_inline($custom_style) {
		// Todo: add skin specific styles in the $custom_style to override
		//       rules from style.css and shortcodes.css
		// Example:
		//		$scheme = seohub_get_custom_option('body_scheme');
		//		if (empty($scheme)) $scheme = 'original';
		//		$clr = seohub_get_scheme_color('accent1');
		//		if (!empty($clr)) {
		// 			$custom_style .= '
		//				a,
		//				.bg_tint_light a,
		//				.top_panel .content .search_wrap.search_style_regular .search_form_wrap .search_submit,
		//				.top_panel .content .search_wrap.search_style_regular .search_icon,
		//				.search_results .post_more,
		//				.search_results .search_results_close {
		//					color:'.esc_attr($clr).';
		//				}
		//			';
		//		}
		return $custom_style;	
	}
}

// Add skin responsive styles
if (!function_exists('seohub_action_skin_add_responsive')) {
	//add_action('seohub_action_add_responsive', 'seohub_action_skin_add_responsive');
	function seohub_action_skin_add_responsive() {
		$suffix = seohub_param_is_off(seohub_get_custom_option('show_sidebar_outer')) ? '' : '-outer';
		if (file_exists(seohub_get_file_dir('skin.responsive'.($suffix).'.css'))) 
			seohub_enqueue_style( 'theme-skin-responsive-style', seohub_get_file_url('skin.responsive'.($suffix).'.css'), array(), null );
	}
}

// Add skin responsive inline styles
if (!function_exists('seohub_filter_skin_add_responsive_inline')) {
	//add_filter('seohub_filter_add_responsive_inline', 'seohub_filter_skin_add_responsive_inline');
	function seohub_filter_skin_add_responsive_inline($custom_style) {
		return $custom_style;	
	}
}

// Add skin.less into list files for compilation
if (!function_exists('seohub_filter_skin_compile_less')) {
	//add_filter('seohub_filter_compile_less', 'seohub_filter_skin_compile_less');
	function seohub_filter_skin_compile_less($files) {
		if (file_exists(seohub_get_file_dir('skin.less'))) {
		 	$files[] = seohub_get_file_dir('skin.less');
		}
		return $files;	
	}
}



//------------------------------------------------------------------------------
// Skin's scripts
//------------------------------------------------------------------------------

// Add skin scripts
if (!function_exists('seohub_action_skin_add_scripts')) {
	//add_action('seohub_action_add_scripts', 'seohub_action_skin_add_scripts');
	function seohub_action_skin_add_scripts() {
		if (file_exists(seohub_get_file_dir('skin.js')))
			seohub_enqueue_script( 'theme-skin-script', seohub_get_file_url('skin.js'), array(), null );
		if (seohub_get_theme_option('show_theme_customizer') == 'yes' && file_exists(seohub_get_file_dir('skin.customizer.js')))
			seohub_enqueue_script( 'theme-skin-customizer-script', seohub_get_file_url('skin.customizer.js'), array(), null );
        if (file_exists(seohub_get_file_dir('add_title_to_link.js')))
            seohub_enqueue_script( 'theme-skin-link-script', seohub_get_file_url('add_title_to_link.js'), array(), null );
	}
}

// Add skin scripts inline
if (!function_exists('seohub_action_skin_add_scripts_inline')) {
	//add_action('seohub_action_add_scripts_inline', 'seohub_action_skin_add_scripts_inline');
	function seohub_action_skin_add_scripts_inline() {
		// Todo: add skin specific scripts
		// Example:
		// echo '<script type="text/javascript">'
		//	. 'jQuery(document).ready(function() {'
		//	. "if (SEOHUB_GLOBALS['theme_font']=='') SEOHUB_GLOBALS['theme_font'] = '" . seohub_get_custom_font_settings('p', 'font-family') . "';"
		//	. "SEOHUB_GLOBALS['theme_skin_color'] = '" . seohub_get_scheme_color('accent1') . "';"
		//	. "});"
		//	. "< /script>";
	}
}
?>