
­­­­­­­­­­­­­­­­­­
<!DOCTYPE html>
<html>
<?php
/**
 * Custom styling for header
 *
 */	

// Header
add_filter( 'go_pricing_front_header_html_yet', 'yet_header_html', 10, 2 );

function yet_header_html( $html, $data ) {
	
	global $go_pricing;
	
	$css = array();
	$col_index = !empty( $data['col_index'] ) ? $data['col_index'] : 0;
	$col_data = !empty( $data['col_data'] ) ? $data['col_data'] : array();
	$default_font = isset( $data['default_font'] ) ? $data['default_font'] : '';
	$table_data = !empty( $data['table_data'] ) ? $data['table_data'] : array();
	$google_fonts = isset( $data['google_fonts'] ) ? $data['google_fonts'] : array();
	

	///////////////////////////////////////////////////////////////////	
	// Colum styling
	///////////////////////////////////////////////////////////////////
	
	$layout_style_data = !empty( $data['col_data']['layout-style'] ) ? $data['col_data']['layout-style'] : array();
	$layout_style_css = array();

	// Inner border
	$inner_border_width = !empty( $table_data['col-inner-border-width'] ) ? (int)$table_data['col-inner-border-width'] : 0;
	
	if ( !empty( $inner_border_width ) && !empty( $layout_style_data['inner-border-color'] ) ) 	$css[] = sprintf( '.gw-go-col-wrap-%1$s .gw-go-col-inner:before { box-shadow: 0 0 0 %2$spx %3$s inset; }', $col_index, $inner_border_width, $layout_style_data['inner-border-color'] );
	if ( !empty( $inner_border_width ) && !empty( $layout_style_data['inner-border-color-hover'] ) ) 	$css[] = sprintf( '.gw-go-hover.gw-go-col-wrap-%1$s .gw-go-col-inner:before { box-shadow: 0 0 0 %2$spx %3$s inset; }', $col_index, $inner_border_width, $layout_style_data['inner-border-color-hover'] );	

	// General Style - Normal
	if ( !empty( $layout_style_data['bg-img']['data'] ) ) {
		if ( !empty( $layout_style_data['bg-img']['data'] ) ) $layout_style_css['normal-bg'][] = sprintf( 'background-image:url(%s)', $layout_style_data['bg-img']['data'] );
		if ( !empty( $layout_style_data['bg-img']['repeat'] )  && $layout_style_data['bg-img']['repeat'] != 'repeat' ) $layout_style_css['normal-bg'][] = sprintf( 'background-repeat:%s', $layout_style_data['bg-img']['repeat'] );
		if ( !empty( $layout_style_data['bg-img']['size'] ) && $layout_style_data['bg-img']['size'] != 'auto' ) $layout_style_css['normal-bg'][] = sprintf( 'background-size:%s', $layout_style_data['bg-img']['size'] );
		if ( !empty( $layout_style_data['bg-img']['attachment'] ) && $layout_style_data['bg-img']['attachment'] != 'scroll' ) $layout_style_css['normal-bg'][] = sprintf( 'background-attachment:%s', $layout_style_data['bg-img']['attachment'] );		
		if ( isset( $layout_style_data['bg-img']['posx'] ) && isset( $layout_style_data['bg-img']['posy'] ) && ( (int)$layout_style_data['bg-img']['posx'] != 0 || (int)$layout_style_data['bg-img']['posy'] != 0 ) ) $layout_style_css['normal-bg'][] = sprintf( 'background-position:%1$d%% %2$d%%', (int)$layout_style_data['bg-img']['posx'], (int)$layout_style_data['bg-img']['posy'] );			
		
		if ( isset( $layout_style_data['grayscale'] ) ) $layout_style_css['normal-bg'][] = sprintf( '-webkit-filter:grayscale(%s%%)', (int)$layout_style_data['grayscale'] );
		if ( isset( $layout_style_data['grayscale'] ) ) $layout_style_css['normal-bg'][] = sprintf( 'filter:grayscale(%s%%)', (int)$layout_style_data['grayscale'] );		
		if ( isset( $layout_style_data['scale'] ) ) $layout_style_css['normal-bg'][] = sprintf( '-webkit-transform:scale(%s)', (int)$layout_style_data['scale'] * 0.01 );
		if ( isset( $layout_style_data['scale'] ) ) $layout_style_css['normal-bg'][] = sprintf( 'transform:scale(%s)', (int)$layout_style_data['scale'] * 0.01 );		
		
		if ( !empty( $layout_style_css['normal-bg'] ) ) $css[] = sprintf( '.gw-go-col-wrap-%1$s .gw-go-col-inner-layer { %2$s; }', $col_index, implode( '; ', $layout_style_css['normal-bg'] ) );
		
	}

	if ( !empty( $layout_style_data['bg-color'] ) && empty( $layout_style_data['bg-grad'] ) ) $layout_style_css['normal'][] = sprintf( 'background-color:%s', $layout_style_data['bg-color'] );

	if ( !empty( $layout_style_data['bg-grad'] ) ) {
		$layout_style_css['normal'][] =  !empty( $layout_style_data['bg-color'] ) || !empty( $layout_style_data['bg-color2'] ) ? sprintf( 'background-image:linear-gradient(%1$s, %2$s, %3$s)', 
			!empty( $layout_style_data['bg-grad-angle'] ) ? sprintf( '%ddeg', (int) $layout_style_data['bg-grad-angle'] ) : '0deg',						
			!empty( $layout_style_data['bg-color'] ) ? $layout_style_data['bg-color']  : 'transparent',
			!empty( $layout_style_data['bg-color2'] ) ? $layout_style_data['bg-color2']  : 'transparent'
		) : '';
	}

	if ( !empty( $layout_style_css['normal'] ) ) $css[] = sprintf( '.gw-go-col-wrap-%1$s .gw-go-col-inner-layer-over { %2$s; }', $col_index, implode( '; ', $layout_style_css['normal'] ) );
		
	// General Style - Hover
	if ( isset( $layout_style_data['grayscale-hover'] ) ) $layout_style_css['hover-bg'][] = sprintf( '-webkit-filter:grayscale(%s%%)', (int)$layout_style_data['grayscale-hover'] );
	if ( isset( $layout_style_data['grayscale-hover'] ) ) $layout_style_css['hover-bg'][] = sprintf( 'filter:grayscale(%s%%)', (int)$layout_style_data['grayscale-hover'] );		
	if ( isset( $layout_style_data['scale-hover'] ) ) $layout_style_css['hover-bg'][] = sprintf( '-webkit-transform:scale(%s)', (int)$layout_style_data['scale-hover'] * 0.01 );
	if ( isset( $layout_style_data['scale-hover'] ) ) $layout_style_css['hover-bg'][] = sprintf( 'transform:scale(%s)', (int)$layout_style_data['scale-hover'] * 0.01 );
	if ( !empty( $layout_style_css['hover-bg'] ) ) $css[] = sprintf( '.gw-go-hover.gw-go-col-wrap-%1$s .gw-go-col-inner-layer { %2$s; }', $col_index, implode( '; ', $layout_style_css['hover-bg'] ) );	
	
	if ( !empty( $layout_style_data['bg-color-hover'] ) && empty( $layout_style_data['bg-grad'] ) ) $layout_style_css['hover'][] = sprintf( 'background-color:%s', $layout_style_data['bg-color-hover'] );

	if ( !empty( $layout_style_data['bg-grad'] ) ) {
		$layout_style_css['hover'][] =  !empty( $layout_style_data['bg-color-hover'] ) || !empty( $layout_style_data['bg-color2-hover'] ) ? sprintf( 'background-image:linear-gradient(%1$s, %2$s, %3$s)', 
			!empty( $layout_style_data['bg-grad-angle'] ) ? sprintf( '%ddeg', (int) $layout_style_data['bg-grad-angle'] ) : '0deg',						
			!empty( $layout_style_data['bg-color-hover'] ) ? $layout_style_data['bg-color-hover']  : 'transparent',
			!empty( $layout_style_data['bg-color2-hover'] ) ? $layout_style_data['bg-color2-hover']  : 'transparent'
		) : '';
	}
	if ( !empty( $layout_style_css['hover'] ) ) $css[] = sprintf( '.gw-go-hover.gw-go-col-wrap-%1$s .gw-go-col-inner-layer-over { %2$s; }', $col_index, implode( '; ', $layout_style_css['hover'] ) );

	
	///////////////////////////////////////////////////////////////////	
	// Header custom -if replace is enabled
	///////////////////////////////////////////////////////////////////

	$header_custom_data = !empty( $data['col_data']['header']['general'] ) ? $data['col_data']['header']['general'] : array();
	
	if ( !empty( $header_custom_data['replace'] ) ) {
	
		$html = sprintf( '<div class="gw-go-header"%2$s>%1$s</div>',
			isset( $header_custom_data['html'] ) ? $header_custom_data['html'] : '',
			!empty( $header_custom_data['css'] ) ? ' style="' . esc_attr( preg_replace("/[\n\r]/","", trim( $header_custom_data['css'], ';' ) ) ) .  ';"' : ''
		);

		return array( 
			'html' => $html,
			'css' => $css
		);

	}

	///////////////////////////////////////////////////////////////////	
	// Header style
	///////////////////////////////////////////////////////////////////

	$header_style_data = !empty( $data['col_data']['header']['style'] ) ? $data['col_data']['header']['style'] : array();
	$header_style_css = array();
	
	// Header style - Normal
	if ( isset( $header_style_data['margin-bottom'] ) && $header_style_data['margin-bottom'] != '22' ) $css[] = sprintf( '.gw-go-col-wrap-%1$s ul.gw-go-body { margin-top:%2$dpx !important; }', $col_index, (int)$header_style_data['margin-bottom']  );	
	if ( isset( $header_style_data['height'] ) && $header_style_data['height'] != '' ) $header_style_css['normal-bg'][] = sprintf( 'height:%dpx', (int)$header_style_data['height'] );

	/* Tricky */
	if ( !empty( $header_style_data['bg-img']['data'] ) ) {
		if ( !empty( $header_style_data['bg-img']['data'] ) ) $header_style_css['normal-bg'][] = sprintf( 'background-image:url(%s)', $header_style_data['bg-img']['data'] );
		if ( !empty( $header_style_data['bg-img']['repeat'] )  && $header_style_data['bg-img']['repeat'] != 'repeat' ) $header_style_css['normal-bg'][] = sprintf( 'background-repeat:%s', $header_style_data['bg-img']['repeat'] );
		if ( !empty( $header_style_data['bg-img']['size'] ) && $header_style_data['bg-img']['size'] != 'auto' ) $header_style_css['normal-bg'][] = sprintf( 'background-size:%s', $header_style_data['bg-img']['size'] );
		if ( !empty( $header_style_data['bg-img']['attachment'] ) && $header_style_data['bg-img']['attachment'] != 'scroll' ) $header_style_css['normal-bg'][] = sprintf( 'background-attachment:%s', $header_style_data['bg-img']['attachment'] );
		if ( isset( $header_style_data['bg-img']['posx'] ) && isset( $header_style_data['bg-img']['posy'] ) && ( (int)$header_style_data['bg-img']['posx'] != 0 || (int)$header_style_data['bg-img']['posy'] != 0 ) ) $header_style_css['normal-bg'][] = sprintf( 'background-position:%1$d%% %2$d%%', (int)$header_style_data['bg-img']['posx'], (int)$header_style_data['bg-img']['posy'] );
	}
	if ( !empty( $header_style_css['normal-bg'] ) ) $css[] = sprintf( '.gw-go-col-wrap-%1$s .gw-go-header { %2$s; }', $col_index, implode( '; ', $header_style_css['normal-bg'] ) );

	if ( !empty( $header_style_data['bg-color'] ) && empty( $header_style_data['bg-grad'] ) ) $header_style_css['normal'][] = sprintf( 'background-color:%s', $header_style_data['bg-color'] );
	
	if ( !empty( $header_style_data['bg-grad'] ) ) {
		$header_style_css['normal'][] =  !empty( $header_style_data['bg-color'] ) || !empty( $header_style_data['bg-color2'] ) ? sprintf( 'background-image:linear-gradient(%1$s, %2$s, %3$s)', 
			!empty( $header_style_data['bg-grad-angle'] ) ? sprintf( '%ddeg', (int) $header_style_data['bg-grad-angle'] ) : '0deg',						
			!empty( $header_style_data['bg-color'] ) ? $header_style_data['bg-color']  : 'transparent',
			!empty( $header_style_data['bg-color2'] ) ? $header_style_data['bg-color2']  : 'transparent'
		) : '';
	}
	if ( !empty( $header_style_css['normal'] ) ) $css[] = sprintf( '.gw-go-col-wrap-%1$s .gw-go-header:before { %2$s; }', $col_index, implode( '; ', $header_style_css['normal'] ) );
	
	// Header style - Hover
	if ( !empty( $header_style_data['bg-color-hover'] ) && empty( $header_style_data['bg-grad'] ) ) $header_style_css['hover'][] = sprintf( 'background-color:%s', $header_style_data['bg-color-hover'] );
	if ( !empty( $header_style_data['bg-grad'] ) ) {
		$header_style_css['hover'][] =  !empty( $header_style_data['bg-color-hover'] ) || !empty( $header_style_data['bg-color2-hover'] ) ? sprintf( 'background-image:linear-gradient(%1$s, %2$s, %3$s)', 
			!empty( $header_style_data['bg-grad-angle'] ) ? sprintf( '%ddeg', (int) $header_style_data['bg-grad-angle'] ) : '0deg',						
			!empty( $header_style_data['bg-color-hover'] ) ? $header_style_data['bg-color-hover']  : 'transparent',
			!empty( $header_style_data['bg-color2-hover'] ) ? $header_style_data['bg-color2-hover']  : 'transparent'
		) : '';
	}
	if ( !empty( $header_style_css['hover'] ) ) $css[] = sprintf( '.gw-go-hover.gw-go-col-wrap-%1$s .gw-go-header:before { %2$s; }', $col_index, implode( '; ', $header_style_css['hover'] ) );
	

	///////////////////////////////////////////////////////////////////	
	// Header media (icon / image)
	///////////////////////////////////////////////////////////////////
	
	$header_media = !empty( $data['col_data']['media'] ) && is_string( $data['col_data']['media'] ) ? GW_GoPricing_Helper::parse_data( $data['col_data']['media'] ) : array();		
	$header_media_html = '';
	$media_css = array();	
	
	if ( !empty( $header_media ) && !empty( $header_media['type'] ) ) {
	
		$media_data = !empty( $header_media['media'] ) ? $header_media['media']  : '';
		$media_type = !empty( $header_media['type'] ) ? $header_media['type'] : '';

		if ( !empty( $media_data['padding'] ) ) {
			foreach ( $media_data['padding'] as $key => $radius ) {
				if ( (int)$radius != 0 ) { $media_data['padding'][$key] = $media_data['padding'][$key].'px'; }
			}
			$media_css[] = sprintf( 'padding:%s', implode( ' ', $media_data['padding'] ) );

		}
		
		// Icon type
		if ( $media_type == 'icon' && isset( $media_data[$media_type] ) && $media_data[$media_type] != '' ) {

			if ( !empty( $media_data['color'] ) ) $media_css[] = sprintf( 'color:%s', $media_data['color'] );
			if ( !empty( $media_data['font-size'] ) ) $media_css[] = sprintf( 'font-size:%spx' , (int)$media_data['font-size'] );
			
			$header_media_html = sprintf( '<div class="gw-go-header-image">%s</div>', $media_data[$media_type] );
			
		}

		// Image
		if ( $media_type == 'image' && isset( $media_data['img']['data'] ) && $media_data['img']['data'] != '' ) {

			$header_media_html = sprintf( 
				'<div class="gw-go-header-image"><img src="%1$s" alt="%2$s"%3$s%4$s%5$s></div>',
				$media_data['img']['data'],
				isset( $media_data['img']['alt'] ) ? $media_data['img']['alt'] : '',
				!empty( $media_data['img']['responsive'] ) ? ' class="gw-go-responsive-img"' : '',
				!empty( $media_data['img']['width'] ) ? ' width="' . (int)$media_data['img']['width'] . '"' : '',
				!empty( $media_data['img']['height'] ) ? ' height="' . (int)$media_data['img']['height'] . '"' : ''
			);
		}
		
		if ( !empty( $media_css ) ) $css[] = sprintf( '.gw-go-col-wrap-%1$s .gw-go-header-image { %2$s; }', $col_index, implode( '; ', $media_css ) );
		if ( !empty( $media_data['hover-color'] ) ) $css[] = sprintf( '.gw-go-hover.gw-go-col-wrap-%1$s .gw-go-header-image { %2$s; }', $col_index, 'color:' . $media_data['hover-color'] );			
		
	}
	

	///////////////////////////////////////////////////////////////////	
	// Header top (title & subtitle)
	///////////////////////////////////////////////////////////////////	
	
	$header_top_css = array();
	$header_top = !empty( $data['col_data']['title'] ) ? $data['col_data']['title'] : array();
	
	if ( !isset( $header_top['subtitle']['content'] ) )	$header_top['subtitle']['content'] = '';
	
	$header_top_html = isset( $header_top['title']['content'] ) && isset( $header_top['subtitle']['content'] ) && ( $header_top['title']['content'] != '' || $header_top['subtitle']['content'] != '' ) ? 
		sprintf( 
			'<div class="gw-go-header-top">%1$s%2$s</div>',
			$header_top['title']['content'] != '' ? '<div class="gw-go-header-title">' . $header_top['title']['content'] . '</div>'  : '',
			$header_top['subtitle']['content'] != '' ? '<div class="gw-go-header-subtitle">' . $header_top['subtitle']['content'] . '</div>'  : ''
	) : '';
	
	// General styling
	if ( !empty( $header_top['title']['padding'] ) ) {
		foreach ( $header_top['title']['padding'] as $key => $radius ) {
			if ( (int)$radius != 0 ) { $header_top['title']['padding'][$key] = $header_top['title']['padding'][$key].'px'; }
		}
		$header_top_css['general'][] = sprintf( 'padding:%s', implode( ' ', $header_top['title']['padding'] ) );

	}
	
	if ( !empty( $header_top_css['general'] ) ) $css[] = sprintf( '.gw-go-col-wrap-%1$s .gw-go-header-top { %2$s; }', $col_index, implode( '; ', $header_top_css['general'] ) );
	
	// Title normal styling
	if ( !empty( $header_top['title']['color'] ) ) $header_top_css['title'][] = sprintf( 'color:%s', $header_top['title']['color'] );
	if ( !empty( $header_top['title']['font-size'] ) ) $header_top_css['title'][] = sprintf( 'font-size:%spx' , (int)$header_top['title']['font-size'] );
	if ( !empty( $header_top['title']['line-height'] ) ) $header_top_css['title'][] = sprintf( 'line-height:%spx' , (int)$header_top['title']['line-height'] );
	
	if ( !empty( $header_top['title']['font-style']['bold'] ) ) $header_top_css['title'][] = 'font-weight:600 !important';
	if ( !empty( $header_top['title']['font-style']['italic'] ) ) $header_top_css['title'][] = 'font-style:italic !important';
	if ( !empty( $header_top['title']['font-style']['strikethrough'] ) ) $header_top_css['title'][] = 'text-decoration:line-through !important';	

	$google_font = '';

	if ( !empty( $header_top['title']['font-family'] ) && $header_top['title']['font-family'] != $default_font ) {
		foreach( (array)$go_pricing['fonts'] as $fonts ) {
			
			if ( !empty( $fonts['group_name'] ) && !empty( $fonts['group_data'] ) ) {
				foreach( (array)$fonts['group_data'] as $font ) {
					if ( !empty( $font['value'] ) && $font['value'] == $header_top['title']['font-family'] ) {
						if ( !empty( $font['name'] ) && !empty( $font['url'] ) ) {
						
							$font_url_params = array();

							/* Google Font */
							if ( preg_match( '/fonts.googleapis.com/', $font['url'] ) ) {
								$font_url_params[] = '400';
								if ( !empty( $header_top['title']['font-style']['bold'] ) ) $font_url_params[] = 'b';
								if ( !empty( $header_top['title']['font-style']['italic'] ) ) $font_url_params[] = 'i';
								$font['url'] .= sprintf( ':%s', implode( ',', $font_url_params ) );
							}
						}
						
						if ( !empty( $font['url'] ) && !empty( $font_url_params ) ) {
							$google_font = sprintf( '@import url(%s)', $font['url'], $font_url_params );
							if ( !in_array( $google_font, (array)$google_fonts ) ) $google_fonts[] = $google_font;
						}

						if ( !empty( $font['value'] ) ) $header_top_css['title'][] = sprintf( 'font-family:%s !important' , $font['value'] );
						
					}

				}
			}
			
		}
		
	}
	
	if ( !empty( $header_top_css['title'] ) ) $css[] = sprintf( '.gw-go-col-wrap-%1$s .gw-go-header-top .gw-go-header-title { %2$s; }', $col_index, implode( '; ', $header_top_css['title'] ) );	
	
	// Title hover styling
	if ( !empty( $header_top['title']['color-active'] ) ) $header_top_css['title-hover'][] = sprintf( 'color:%s', $header_top['title']['color-active'] );
	if ( !empty( $header_top_css['title-hover'] ) ) $css[] = sprintf( '.gw-go-hover.gw-go-col-wrap-%1$s .gw-go-header-top .gw-go-header-title { %2$s; }', $col_index, implode( '; ', $header_top_css['title-hover'] ) );	
	
	// Subtitle normal styling
	if ( !empty( $header_top['subtitle']['color'] ) ) $header_top_css['subtitle'][] = sprintf( 'color:%s', $header_top['subtitle']['color'] );
	if ( !empty( $header_top['subtitle']['font-size'] ) ) $header_top_css['subtitle'][] = sprintf( 'font-size:%spx' , (int)$header_top['subtitle']['font-size'] );
	if ( !empty( $header_top['subtitle']['line-height'] ) ) $header_top_css['subtitle'][] = sprintf( 'line-height:%spx' , (int)$header_top['subtitle']['line-height'] );
	
	if ( !empty( $header_top['subtitle']['font-style']['bold'] ) ) $header_top_css['subtitle'][] = 'font-weight:600 !important';
	if ( !empty( $header_top['subtitle']['font-style']['italic'] ) ) $header_top_css['subtitle'][] = 'font-style:italic !important';
	if ( !empty( $header_top['subtitle']['font-style']['strikethrough'] ) ) $header_top_css['subtitle'][] = 'text-decoration:line-through !important';

	$google_font = '';

	if ( !empty( $header_top['subtitle']['font-family'] ) && $header_top['subtitle']['font-family'] != $default_font ) {
		foreach( (array)$go_pricing['fonts'] as $fonts ) {
			
			if ( !empty( $fonts['group_name'] ) && !empty( $fonts['group_data'] ) ) {
				foreach( (array)$fonts['group_data'] as $font ) {
					if ( !empty( $font['value'] ) && $font['value'] == $header_top['subtitle']['font-family'] ) {
						if ( !empty( $font['name'] ) && !empty( $font['url'] ) ) {
						
							$font_url_params = array();

							/* Google Font */
							if ( preg_match( '/fonts.googleapis.com/', $font['url'] ) ) {
								$font_url_params[] = '400';
								if ( !empty( $header_top['subtitle']['font-style']['bold'] ) ) $font_url_params[] = 'b';
								if ( !empty( $header_top['subtitle']['font-style']['italic'] ) ) $font_url_params[] = 'i';
								$font['url'] .= sprintf( ':%s', implode( ',', $font_url_params ) );
							}
						}
						
						if ( !empty( $font['url'] ) && !empty( $font_url_params ) ) {
							$google_font = sprintf( '@import url(%s)', $font['url'], $font_url_params );
							if ( !in_array( $google_font, (array)$google_fonts ) ) $google_fonts[] = $google_font;							
						}

						if ( !empty( $font['value'] ) ) $header_top_css['subtitle'][] = sprintf( 'font-family:%s !important' , $font['value'] );
					}

				}
			}
			
		}
		
	}
	
	if ( !empty( $header_top_css['subtitle'] ) ) $css[] = sprintf( '.gw-go-col-wrap-%1$s .gw-go-header-top .gw-go-header-subtitle { %2$s; }', $col_index, implode( '; ', $header_top_css['subtitle'] ) );	
	
	// Subtitle hover styling
	if ( !empty( $header_top['subtitle']['color-active'] ) ) $header_top_css['subtitle-hover'][] = sprintf( 'color:%s', $header_top['subtitle']['color-active'] );
	if ( !empty( $header_top_css['subtitle-hover'] ) ) $css[] = sprintf( '.gw-go-hover.gw-go-col-wrap-%1$s .gw-go-header-top .gw-go-header-subtitle { %2$s; }', $col_index, implode( '; ', $header_top_css['subtitle-hover'] ) );	

	///////////////////////////////////////////////////////////////////	
	// Header price 
	///////////////////////////////////////////////////////////////////
		
	$header_price_css = array();
	$header_price_classes = array();	
	$header_price = !empty( $data['col_data']['price'] ) ? GW_GoPricing_Helper::parse_data( $data['col_data']['price'] ) : array();
	
	$instance = GW_GoPricing_Yet::instance();
	$plugin_prefix = !empty( $instance['core']['plugin_prefix'] ) ? $instance['core']['plugin_prefix'] : '';
	$general_settings = get_option( $plugin_prefix . '_table_settings' );	
	$price_type = isset( $header_price['type'] ) ? $header_price['type'] : '';
	$price_format = !empty( $general_settings['currency'][0]['position'] ) && $general_settings['currency'][0]['position'] == 'left' ? '<span data-id="price" data-currency="%1$s" data-price="%4$s"><span data-id="currency">%2$s</span><span data-id="amount">%3$s</span></span>' : '<span data-id="price" data-currency="%1$s" data-price="%4$s"><span data-id="amount">%3$s</span><span data-id="currency">%2$s</span></span>';
	
	// General styling
	if ( !empty( $header_price['general-style']['padding'] ) ) {
		foreach ( $header_price['general-style']['padding'] as $key => $radius ) {
			if ( (int)$radius != 0 ) { $header_price['general-style']['padding'][$key] = $header_price['general-style']['padding'][$key].'px'; }
		}
		$header_price_css['general'][] = sprintf( 'padding:%s', implode( ' ', $header_price['general-style']['padding'] ) );

	}
	
	if ( !empty( $header_price['general-style']['bg-color'] ) && empty( $header_price['general-style']['bg-grad'] ) ) $header_price_css['general'][] = sprintf( 'background-color:%s', $header_price['general-style']['bg-color'] );
	if ( !empty( $header_price['general-style']['bg-color'] ) ) $header_price_css['general'][] = sprintf( 'border-color:%s', $header_price['general-style']['bg-color'] );		
	
	if ( !empty( $header_price['general-style']['bg-grad'] ) ) {
		$header_price_css['general'][] =  !empty( $header_price['general-style']['bg-color'] ) || !empty( $header_price['general-style']['bg-color2'] ) ? sprintf( 'background-image:linear-gradient(%1$s, %2$s, %3$s)', 
			!empty( $header_price['general-style']['bg-grad-angle'] ) ? sprintf( '%ddeg', (int) $header_price['general-style']['bg-grad-angle'] ) : '0deg',						
			!empty( $header_price['general-style']['bg-color'] ) ? $header_price['general-style']['bg-color']  : 'transparent',
			!empty( $header_price['general-style']['bg-color2'] ) ? $header_price['general-style']['bg-color2']  : 'transparent'
		) : '';
	}	
	
	if ( !empty( $header_price_css['general'] ) ) $css[] = sprintf( '.gw-go-col-wrap-%1$s .gw-go-header-bottom { %2$s; }', $col_index, implode( '; ', $header_price_css['general'] ) );
	
	// hover styling
	if ( !empty( $header_price['general-style']['bg-color-hover'] ) && empty( $header_price['general-style']['bg-grad'] ) ) $header_price_css['general-hover'][] = sprintf( 'background-color:%s', $header_price['general-style']['bg-color-hover'] );
	if ( !empty( $header_price['general-style']['bg-color-hover'] ) ) $header_price_css['general-hover'][] = sprintf( 'border-color:%s', $header_price['general-style']['bg-color-hover'] );		
	
	if ( !empty( $header_price['general-style']['bg-grad'] ) ) {
		$header_price_css['general-hover'][] =  !empty( $header_price['general-style']['bg-color-hover'] ) || !empty( $header_price['general-style']['bg-color2-hover'] ) ? sprintf( 'background-image:linear-gradient(%1$s, %2$s, %3$s)', 
			!empty( $header_price['general-style']['bg-grad-angle'] ) ? sprintf( '%ddeg', (int) $header_price['general-style']['bg-grad-angle'] ) : '0deg',						
			!empty( $header_price['general-style']['bg-color-hover'] ) ? $header_price['general-style']['bg-color-hover']  : 'transparent',
			!empty( $header_price['general-style']['bg-color2-hover'] ) ? $header_price['general-style']['bg-color2-hover']  : 'transparent'
		) : '';
	}	
		
	
	if ( !empty( $header_price_css['general-hover'] ) ) $css[] = sprintf( '.gw-go-hover.gw-go-col-wrap-%1$s .gw-go-header-bottom { %2$s; }', $col_index, implode( '; ', $header_price_css['general-hover'] ) );

	
	// Price normal styling
	if ( !empty( $header_price['price-style']['color'] ) ) $header_price_css['price'][] = sprintf( 'color:%s', $header_price['price-style']['color'] );
	if ( !empty( $header_price['price-style']['font-size'] ) ) $header_price_css['price'][] = sprintf( 'font-size:%spx' , (int)$header_price['price-style']['font-size'] );
	if ( !empty( $header_price['price-style']['line-height'] ) ) $header_price_css['price'][] = sprintf( 'line-height:%spx' , (int)$header_price['price-style']['line-height'] );
	
	if ( !empty( $header_price['price-style']['font-style']['bold'] ) ) $header_price_css['price'][] = 'font-weight:bold !important';
	if ( !empty( $header_price['price-style']['font-style']['italic'] ) ) $header_price_css['price'][] = 'font-style:italic !important';
	if ( !empty( $header_price['price-style']['font-style']['strikethrough'] ) ) $header_price_css['price'][] = 'text-decoration:line-through !important';	

	$google_font = '';

	if ( !empty( $header_price['price-style']['font-family'] ) && $header_price['price-style']['font-family'] != $default_font ) {
		foreach( (array)$go_pricing['fonts'] as $fonts ) {
			
			if ( !empty( $fonts['group_name'] ) && !empty( $fonts['group_data'] ) ) {
				foreach( (array)$fonts['group_data'] as $font ) {
					if ( !empty( $font['value'] ) && $font['value'] == $header_price['price-style']['font-family'] ) {
						if ( !empty( $font['name'] ) && !empty( $font['url'] ) ) {
						
							$font_url_params = array();

							/* Google Font */
							if ( preg_match( '/fonts.googleapis.com/', $font['url'] ) ) {
								$font_url_params[] = '400';
								if ( !empty( $header_price['price-style']['font-style']['bold'] ) ) $font_url_params[] = 'b';
								if ( !empty( $header_price['price-style']['font-style']['italic'] ) ) $font_url_params[] = 'i';
								$font['url'] .= sprintf( ':%s', implode( ',', $font_url_params ) );
							}
						}
						
						if ( !empty( $font['url'] ) && !empty( $font_url_params ) ) {
							$google_font = sprintf( '@import url(%s)', $font['url'], $font_url_params );
							if ( !in_array( $google_font, (array)$google_fonts ) ) $google_fonts[] = $google_font;							
						}

						if ( !empty( $font['value'] ) ) $header_price_css['price'][] = sprintf( 'font-family:%s !important' , $font['value'] );
					}

				}
			}
			
		}
		
	}
	
	if ( !empty( $header_price_css['price'] ) ) $css[] = sprintf( '.gw-go-col-wrap-%1$s .gw-go-header-bottom .gw-go-price-wrap > span { %2$s; }', $col_index, implode( '; ', $header_price_css['price'] ) );	
	
	// Price hover styling
	if ( !empty( $header_price['price-style']['color-hover'] ) ) $header_price_css['price-hover'][] = sprintf( 'color:%s', $header_price['price-style']['color-hover'] );
	if ( !empty( $header_price_css['price-hover'] ) ) $css[] = sprintf( '.gw-go-hover.gw-go-col-wrap-%1$s .gw-go-header-bottom .gw-go-price-wrap > span  { %2$s; }', $col_index, implode( '; ', $header_price_css['price-hover'] ) );	
	
	// Payment normal styling
	if ( !empty( $header_price['payment']['color'] ) ) $header_price_css['payment'][] = sprintf( 'color:%s', $header_price['payment']['color'] );
	if ( !empty( $header_price['payment']['font-size'] ) ) $header_price_css['payment'][] = sprintf( 'font-size:%spx' , (int)$header_price['payment']['font-size'] );
	if ( !empty( $header_price['payment']['line-height'] ) ) $header_price_css['payment'][] = sprintf( 'line-height:%spx' , (int)$header_price['payment']['line-height'] );
	
	if ( !empty( $header_price['payment']['font-style']['bold'] ) ) $header_price_css['payment'][] = 'font-weight:bold !important';
	if ( !empty( $header_price['payment']['font-style']['italic'] ) ) $header_price_css['payment'][] = 'font-style:italic !important';
	if ( !empty( $header_price['payment']['font-style']['strikethrough'] ) ) $header_price_css['payment'][] = 'text-decoration:line-through !important';

	$google_font = '';

	if ( !empty( $header_price['payment']['font-family'] ) && $header_price['payment']['font-family'] != $default_font ) {
		foreach( (array)$go_pricing['fonts'] as $fonts ) {
			
			if ( !empty( $fonts['group_name'] ) && !empty( $fonts['group_data'] ) ) {
				foreach( (array)$fonts['group_data'] as $font ) {
					if ( !empty( $font['value'] ) && $font['value'] == $header_price['payment']['font-family'] ) {
						if ( !empty( $font['name'] ) && !empty( $font['url'] ) ) {
						
							$font_url_params = array();

							/* Google Font */
							if ( preg_match( '/fonts.googleapis.com/', $font['url'] ) ) {
								$font_url_params[] = '400';
								if ( !empty( $header_price['payment']['font-style']['bold'] ) ) $font_url_params[] = 'b';
								if ( !empty( $header_price['payment']['font-style']['italic'] ) ) $font_url_params[] = 'i';
								$font['url'] .= sprintf( ':%s', implode( ',', $font_url_params ) );
							}
						}
						
						if ( !empty( $font['url'] ) && !empty( $font_url_params ) ) {
							$google_font = sprintf( '@import url(%s)', $font['url'], $font_url_params );
							if ( !in_array( $google_font, (array)$google_fonts ) ) $google_fonts[] = $google_font;							
						}

						if ( !empty( $font['value'] ) ) $header_price_css['payment'][] = sprintf( 'font-family:%s !important' , $font['value'] );
					}

				}
			}
			
		}
		
	}
	
	if ( !empty( $header_price_css['payment'] ) ) $css[] = sprintf( '.gw-go-col-wrap-%1$s .gw-go-header-bottom small { %2$s; }', $col_index, implode( '; ', $header_price_css['payment'] ) );	
	
	// Subtitle hover styling
	if ( !empty( $header_price['payment']['color-hover'] ) ) $header_price_css['payment-hover'][] = sprintf( 'color:%s', $header_price['payment']['color-hover'] );
	if ( !empty( $header_price_css['payment-hover'] ) ) $css[] = sprintf( '.gw-go-hover.gw-go-col-wrap-%1$s .gw-go-header-bottom small { %2$s; }', $col_index, implode( '; ', $header_price_css['payment-hover'] ) );
	
	
	if ( !empty( $header_price['general-style']['triangle'] ) ) $header_price_classes[] = 'gw-go-header-triangle';
	if ( !empty( $header_price['general-style']['text-shadow'] ) ) $header_price_classes[] = 'gw-go-header-text-shadow';	
	if ( !empty( $header_price['general-style']['shadow'] ) ) $header_price_classes[] = 'gw-go-' . $header_price['general-style']['shadow'];
	
	switch( $price_type ) {
		
		case 'price-html' :
			$price = sprintf( '<span>%s</span>', isset( $header_price['price-html']['content'] ) ?  $header_price['price-html']['content'] : ''  );
			$payment = isset( $header_price['payment']['content'] ) ?  $header_price['payment']['content'] : '';
			break;
		
		case 'price' :
			
			$decimals = isset( $general_settings['currency'][0]['decimal-no'] ) ? (int)$general_settings['currency'][0]['decimal-no'] : 2;
			$currency_symbol = '';
			foreach ( (array)$go_pricing['currency'] as $currency ) {
				if ( !empty( $currency['id'] ) && !empty( $currency['symbol'] ) && !empty( $general_settings['currency'][0]['currency'] ) && $currency['id'] == $general_settings['currency'][0]['currency'] ) $currency_symbol = $currency['symbol'];
				if ( isset( $general_settings['currency'][0]['symbol'] ) && trim( $general_settings['currency'][0]['symbol'] ) !== '' ) $currency_symbol = trim( $general_settings['currency'][0]['symbol'] );

			}
			
			if ( isset( $header_price['price'][0]['amount'][0] ) && $header_price['price'][0]['amount'][0] != '' ) {
				
				if ( empty( $general_settings['currency'][0]['trailing-zero'] ) ) {
				
					$dec = explode ( '.', (float)$header_price['price'][0]['amount'][0] );
					if ( !empty( $dec[1] ) ) {
						if ( strlen( $dec[1] ) < $decimals ) $decimals = strlen( $dec[1] );
					} else {
						$decimals = 0;
					}
				}				
				
				$price = sprintf( $price_format, 
					isset( $general_settings['currency'][0] ) ? esc_attr( json_encode( $general_settings['currency'][0] ) ) : '',
					$currency_symbol,
					number_format( 
						(float)$header_price['price'][0]['amount'][0], 
						$decimals, 
						isset( $general_settings['currency'][0]['decimal-sep'] ) ? $general_settings['currency'][0]['decimal-sep'] : '.',
						isset( $general_settings['currency'][0]['thousand-sep'] ) ? $general_settings['currency'][0]['thousand-sep'] : ',' 
					),
					isset( $header_price['price'][0]['amount'][0] ) ? number_format( (float)$header_price['price'][0]['amount'][0], $decimals, '.', '' ) : 0
				
					
				);				
				
				
			}
			
			$payment = isset( $header_price['price'][0]['name'] ) ?  $header_price['price'][0]['name'] : '';
			break;
	}					

	$header_price_html = sprintf( 
		'<div class="gw-go-header-bottom%1$s">%2$s<div class="gw-go-price-wrap">%3$s%4$s</div></div>',
		!empty( $header_price_classes ) ? ' ' .  implode( ' ', $header_price_classes ) : '',
		isset( $data['sign_html'] ) ? GW_GoPricing_Helper::clean_esc_sprint( $data['sign_html'] ) : '',
		isset( $price ) ? $price : '',
		isset( $payment ) ? '<small>' . $payment . '</small>' : ''
	);		
	

	$html = sprintf( '<div class="gw-go-header">%1$s%2$s</div>%3$s',
		$header_media_html,
		$header_top_html,
		$header_price_html
	);
	
	
	///////////////////////////////////////////////////////////////////	
	// Body
	///////////////////////////////////////////////////////////////////
	
	return array( 
		'html' => $html,
		'css' => $css,
		'google_fonts' => $google_fonts
	);
		
}

?>