<?php
/**
 * The template for displaying the footer.
 *
 * Contains the closing of the #content div and all content after
 *
 * @package thim
 */
$theme_options_data = theme_options_data();
$ft_wave            = '';
if ( isset( $theme_options_data['thim_hidden_wave_footer'] ) && $theme_options_data['thim_hidden_wave_footer'] == '1' ) {
	$ft_wave = 'no-wave';
}
?>

</div><!--end main-content-->
<footer id="footer" class="site-footer">
	<?php if ( is_active_sidebar( 'sidebar-bottom-left' ) || is_active_sidebar( 'sidebar-bottom-right' ) ) : ?>
		<div class="sidebar-bottom">
			<div class="container">
				<div class="row">
					<?php if ( is_active_sidebar( 'sidebar-bottom-left' ) ) : ?>

						<div class="col-md-8 ">
							<?php dynamic_sidebar( 'sidebar-bottom-left' ); ?>
						</div>

					<?php endif; ?>
					<?php if ( is_active_sidebar( 'sidebar-bottom-right' ) ) : ?>

						<div class="col-md-4 ">
							<?php dynamic_sidebar( 'sidebar-bottom-right' ); ?>
						</div>
					<?php endif; ?>
				</div>
			</div>
		</div>
	<?php endif; ?>
	<?php if ( is_active_sidebar( 'footer-bottom-1' ) || is_active_sidebar( 'footer-bottom-2' ) || is_active_sidebar( 'footer-bottom-3' ) || is_active_sidebar( 'footer-bottom-4' ) ) : ?>
		<div class="footer-sidebars ">
			<div class="wrap_content <?php echo esc_attr( $ft_wave ); ?>">
				<div class="container">
					<div class="row">
						<?php
						$wd_column = array( "4", "4", "4", "4" );
						if ( isset( $theme_options_data['thim_width_column'] ) ) {
							$width     = preg_replace( '/\s+/', '', $theme_options_data['thim_width_column'] );
							$wd_column = explode( '+', $width );
						}
						if ( isset( $theme_options_data['thim_footer_column'] ) ) {
							$column_footer = $theme_options_data['thim_footer_column'];
						} else {
							$column_footer = '4';
						}
						?>
						<?php
						for ( $i = 1; $i <= $column_footer; $i ++ ) {
							$widget_footer = "footer-bottom-" . $i;
							?>
							<?php if ( is_active_sidebar( $widget_footer ) ) : ?>
								<?php echo '<div class="col-sm-' . $wd_column[$i - 1] . '">' ?>
								<?php dynamic_sidebar( $widget_footer ); ?>
								<?php echo '</div>' ?>
							<?php endif; ?>
						<?php } ?>
					</div>
				</div>
			</div>
		</div>
	<?php endif; ?>
	<!--==============================powered=====================================-->
	<?php if ( isset( $theme_options_data['thim_copyright_text'] ) || is_active_sidebar( 'copyright' ) ) { ?>
		<div id="powered">
			<div class="container">
				<?php
				if ( isset( $theme_options_data['thim_copyright_text'] ) ) {
					echo '<div class="copyright row">';
					echo ent2ncr($theme_options_data['thim_copyright_text']);
					echo '</div>';
				}
				?>
			</div>
		</div>
	<?php } ?>
</footer><!-- #colophon -->

<?php if ( isset( $theme_options_data['thim_show_to_top'] ) && $theme_options_data['thim_show_to_top'] == 1 ) { ?>
	<a id='back-to-top' class="scrollup show" title="<?php esc_attr_e( 'Go To Top', 'cakeart' ); ?>"></a>
<?php } ?>


</div></div><!-- .wrapper-container -->


<?php wp_footer(); ?>
</body>
</html>