<?php
/**
 * File to define functions and hooks related to preloader
 * 
 * @package Ogma
 */

if ( ! function_exists( 'ogma_preloader_items' ) ) :

	/**
	 * function to manage the requested preloader items
	 * 
	 * @since 1.0.0
	 */
	function ogma_preloader_items() {
		$preloader_enable = ogma_get_customizer_option_value( 'preloader_enable' );

		if ( false === $preloader_enable ) {
			return;
		}

		$preloader_style = ogma_get_customizer_option_value( 'preloader_style' );

?>
		<div id="ogma-preloader" class="preloader-background">
			<div class="preloader-wrapper">
				<?php
					switch ( $preloader_style ) {
						case 'three_bounce':
				?>
							<div class="ogma-three-bounce">
	                            <div class="og-child og-bounce1"></div>
	                            <div class="og-child og-bounce2"></div>
	                            <div class="og-child og-bounce3"></div>
	                        </div>
				<?php
							break;

						case 'wave':
				?>
							<div class="ogma-wave">
	                            <div class="og-rect og-rect1"></div>
	                            <div class="og-rect og-rect2"></div>
	                            <div class="og-rect og-rect3"></div>
	                            <div class="og-rect og-rect4"></div>
	                            <div class="og-rect og-rect5"></div>
	                        </div>
				<?php
							break;

						case 'folding_cube':
				?>
							<div class="ogma-folding-cube">
	                            <div class="og-cube1 og-cube"></div>
	                            <div class="og-cube2 og-cube"></div>
	                            <div class="og-cube4 og-cube"></div>
	                            <div class="og-cube3 og-cube"></div>
	                        </div>
				<?php
							break;
						
						default:
				?>
							<div class="ogma-three-bounce">
	                            <div class="og-child og-bounce1"></div>
	                            <div class="og-child og-bounce2"></div>
	                            <div class="og-child og-bounce3"></div>
	                        </div>
				<?php
							break;
					}
				?>
			</div><!-- .preloader-wrapper -->
		</div><!-- #ogma-preloader -->
<?php
	}

endif;

add_action( 'ogma_before_page', 'ogma_preloader_items', 5 );