<?php
/**
 * The template for displaying the footer
 */

global $post, $restorator_options;

$restorator_postId = ( isset( $post->ID ) ? get_the_ID() : NULL );

$restorator_options_enable_prefooter = isset( $restorator_options['enable_prefooter'] ) ? $restorator_options['enable_prefooter'] : 'hide';
$restorator_enable_prefooter = ( get_post_meta( $restorator_postId, 'restorator_enable_prefooter', true ) ? get_post_meta( $restorator_postId, 'restorator_enable_prefooter', true ) : $restorator_options_enable_prefooter );
$restorator_options_footer = isset( $restorator_options['footer'] ) ? $restorator_options['footer'] : 'show';
$restorator_enable_footer = ( get_post_meta( $restorator_postId, 'restorator_footer', true ) ? get_post_meta( $restorator_postId, 'restorator_footer', true ) : $restorator_options_footer );

if ( !is_404() && !is_search() ) {
	$restorator_options_footer_layout = isset( $restorator_options['footer_layout'] ) ? $restorator_options['footer_layout'] : 'boxed';
	$restorator_footer_layout = ( get_post_meta( $post->ID, 'restorator_footer_layout', true ) ? get_post_meta( $post->ID, 'restorator_footer_layout', true ) : $restorator_options_footer_layout );
} else {
	$restorator_footer_layout = isset( $restorator_options['footer_layout'] ) ? $restorator_options['footer_layout'] : 'boxed';
}

$restorator_footer_class = $restorator_footer_layout;
?>
		
		</div><!-- //page-content -->
		
		<footer class="<?php echo esc_html( $restorator_footer_class ); ?>">
		
			<!-- Prefooter Area -->
			<?php if( $restorator_enable_prefooter == 'show' ) { ?>
				<div id="prefooter_area">
					<div class="container">
						<div class="row">
							<?php
								$restorator_widgets_grid = isset( $restorator_options['prefooter_col'] ) ? $restorator_options['prefooter_col'] : '4-4-4';
								$i = 1;
								foreach (explode('-', $restorator_widgets_grid) as $restorator_widgets_g) {
									echo '<div class="col-md-' . esc_html( $restorator_widgets_g ) . ' col-' . esc_html( $i ) . '">';
										dynamic_sidebar("footer-area-$i");
									echo '</div>';
									$i++;
								}
							?>
						</div>
					</div>
				</div>
			<?php } ?>
			
			<!-- Footer Area -->
			<?php if( $restorator_enable_footer == 'show' ) { ?>
				<div id="footer_bottom">
					<div class="container">
						<div class="row">
							<div class="col-sm-6 copyright_wrap">
								<?php $restorator_footer_copyright = isset( $restorator_options['footer_copyright'] ) ? $restorator_options['footer_copyright'] : 'Copyright © 2018 Restorator. All Rights Reserved.'; ?>
								<?php if(!empty( $restorator_footer_copyright ) ) { echo '<div class="copyright">' . esc_attr( $restorator_footer_copyright ) . '</div>'; } ?>
							</div>
							<div class="col-sm-6 social_links_wrap text-right">
								<?php echo restorator_social_links(); ?>
							</div>
						</div>
					</div>
				</div>
			<?php } ?>
			
		</footer>
		
	</div><!-- //Page Wrap -->
	
<?php wp_footer(); ?>

</body>
</html>