<?php
/**
 * The template for displaying the footer.
 *
 * Contains the closing of the id=main div and all content after
 *
 * @package shrk
 */
?>


    <div class="main-content-bottom-holder"></div>
</div><!-- close .main-content -->

<?php 

global $shrk_theme_info; 
$footer_layout	= shrk_get_theme_option( 'footer_layout', 'none' );
$footer_columns	= shrk_get_theme_option( 'footer_columns', 0 );

switch ($footer_columns) {
	case 1:
		$col_class = 'col-sm-12';
		break;
	case 2:
		$col_class = 'col-sm-6';
		break;
	case 3:
		$col_class = 'col-sm-4';
		break;
	case 4:
		$col_class = 'col-sm-3';
		break;
	case 6:
		$col_class = 'col-sm-2';
		break;
	default:
		$col_class = 'col-sm-3';
		break;
}

if ( shrk_get_theme_option('footer_pre_sections') ) {
	shrk_get_sections( shrk_get_theme_option('footer_pre_sections') );
}

if ( $footer_layout != 'none' ) {
	?>
	<footer id="site-footer" class="site-footer">
		<?php if ( $footer_layout == 'footer_socket' || $footer_layout == 'footer') { ?>

			<div class="<?php echo esc_attr( apply_filters('shrk_footer_widgets_class', 'site-footer-widgets') ); ?>">
			
			<?php if ( shrk_get_theme_option('footer_widgets_sections') ) : ?>
			<?php shrk_get_sections( shrk_get_theme_option('footer_widgets_sections') ); ?>
			<?php endif; ?>
			
			<?php if ( $footer_columns != 0 ) : ?>
				<div class="container">
					<div class="row">
						<div class="col-12 col-sm-12">
							<div class="row">
								<?php 
								for ($i = 1; $i <= $footer_columns; $i++) {
									echo "<div class='" . esc_attr( $col_class ) . "'>";
									if ( function_exists( 'dynamic_sidebar' ) && is_active_sidebar( 'footer-column-'.$i ) ) {
										dynamic_sidebar( 'footer-column-'.$i );
									}
									echo "</div>";
								} ?> 
							</div>
						</div>	
					</div>
				</div><!-- close .container -->
			<?php endif; ?>
			</div>

		<?php } ?>

		<?php if ( $footer_layout == 'footer_socket' || $footer_layout == 'socket') { ?>
		<div class="<?php echo esc_attr( apply_filters('shrk_footer_socket_class', 'site-footer-socket') ); ?>">
			<?php if ( shrk_get_theme_option('footer_socket_sections') ) : ?>
			<?php shrk_get_sections( shrk_get_theme_option('footer_socket_sections') ); ?>
			<?php endif; ?>	
			<div class="container">
				<div class="row">
					<div class="col-12 col-sm-12">
						<div class="site-info">
							<?php do_action( 'shrk_credits' ); ?>
							<?php if ( !shrk_get_theme_option('footer_socket_html') && !shrk_get_theme_option('footer_socket_sections') ) : ?>
								<div class="default-site-info">
									<?php printf( esc_html__( 'Theme: %1$s by %2$s', 'ux-shop' ), esc_html( $shrk_theme_info['Name'] ), wp_kses( $shrk_theme_info['Author'], shrk_kses_allowed() ) ); ?>
									<span class="sep"> | </span>
									<a href="http://wordpress.org/" title="<?php esc_attr_e( 'A Semantic Personal Publishing Platform', 'ux-shop' ); ?>" rel="generator"><?php esc_html_e( 'Proudly powered by WordPress', 'ux-shop' ); ?></a>
								</div>
							<?php else : ?>
							<?php echo wp_kses_post( do_shortcode( shrk_get_theme_option('footer_socket_html') ) ); ?>
							<?php endif; ?>
						</div><!-- close .site-info -->
					</div>	
				</div>
			</div><!-- close .container -->
		</div>
		<?php } ?>

	</footer><!-- close #site-footer -->
	<?php 
}
?>
<?php wp_footer(); ?>

</body>
</html>
