<?php
/**
 * Template for header
 *
 * Displays everything up till <div id="main-content">
 *
 * @since BlogCentral 1.0.0
 *
 * @package BlogCentral
 * @subpackage header.php
 */
?>
<!DOCTYPE html>
<!--[if IE 7]>
<html class="ie ie7" <?php language_attributes(); ?>>
<![endif]-->
<!--[if IE 8]>
<html class="ie ie8" <?php language_attributes(); ?>>
<![endif]-->
<!--[if !(IE 7) | !(IE 8) ]><!-->
<html <?php language_attributes(); ?>>
<!--<![endif]-->
<head>
	<meta charset="<?php bloginfo( 'charset' ); ?>">
	<meta name="viewport" content="width=device-width">
	<link rel="profile" href="http://gmpg.org/xfn/11">
	<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
	<!--[if lt IE 9]>
	<script src="<?php echo get_template_directory_uri(); ?>/js/html5shiv.min.js"></script>
	<![endif]-->
<?php
	wp_head(); 
?>
</head>
<body <?php body_class(); ?>>
<?php
	// Get saved theme options.
	global $blogcentral_opts;
	
	$logo_frag = $contact_frag = $email_frag = $phone_frag = $url_frag = $social_frag = $share_frag = $back_img_style = '';	
	
	/*
	 * Using the options set on the theme's options page, construct all of the html fragments to display the logo, 
	 * contact information, and navigation menu.
	 */
	 
	// Construct logo
	if ( isset( $blogcentral_opts['logo'] ) ) {
		$width = isset( $blogcentral_opts['logo_width'] ) ? ' width="' . esc_attr( $blogcentral_opts['logo_width'] ) . '"' : '';
		$height = isset( $blogcentral_opts['logo_height'] ) ? ' height="' . esc_attr( $blogcentral_opts['logo_height'] ) . '"' : '';
		$alt = isset( $blogcentral_opts['logo_alt'] ) ? ' alt="' . esc_attr( $blogcentral_opts['logo_alt'] ) . '"' : '';
		
		$logo_frag = '<div id="logo"><img src="' . esc_url( $blogcentral_opts['logo'] ) . '"' . $width . $height . $alt . ' />';
		
		$logo_frag .= '<i class="fa fa-list"></i></div>';
	}
	
	// Construct main menu
	$menu_frag = '<nav id="access"><a class="screen-reader-txt skip-link" href="#content" ' .
		'title="' . __( 'Читать далее', BLOGCENTRAL_TXT_DOMAIN ) . '">' .
		__( 'Читать далее', BLOGCENTRAL_TXT_DOMAIN ) . '</a>';
		
	ob_start();
	
	wp_nav_menu( array( 
		'theme_location' => 'primary', 
		) );
		
	$menu_frag .= ob_get_clean() . '</nav>';
				
	$atts = '';
	$style = '';
	$sep = '';
	$content_frag = '';
	$contact_array = array();
	
	global $bcswp_plugin;
	
	if ( isset( $bcswp_plugin ) && method_exists( $bcswp_plugin->bcswp_shortcodes, 'contact_info' ) ) {
			if ( isset( $blogcentral_opts['show_contact'] ) && $blogcentral_opts['show_contact'] ) {
				$content_frag = $bcswp_plugin->bcswp_shortcodes->contact_info( $blogcentral_opts['contact_info'] );
			}
	} // End if plugin exists
	?>
	<div id="main-div"> 
		<header id="header" class="site-header layout1" role="banner">
		<?php
		
		if ( $content_frag ) {
			echo '<div id="header-top">';
			echo $content_frag . '</div>';
		}
		echo '<div id="header-mid">' . $logo_frag;
		
		if ( is_active_sidebar( 'header-widget' ) ) { 
			echo '<div id="header-widget">';
			dynamic_sidebar( 'header-widget' );
			echo '</div>';
		}
			
		echo '</div><div id="header-btm">' . $menu_frag . '</div>';
			
		?>
		</header> <!-- End of header-->