<?php
// login page 
function logingpower_loginpage_style() {
		if ( !empty(get_option('logingpower_settings')['logingpower_loginpage_bgcolor'] )):
			$logingpower_style ="body {  background-color:". esc_attr( get_option('logingpower_settings')['logingpower_loginpage_bgcolor'])."!important; }";
			wp_add_inline_style('login',$logingpower_style);
		endif;
		if ( !empty(get_option('logingpower_settings')['logingpower_loginpage_bgimg_show']) ) :	
		 $logingpower_style="body{ background-image:url(". esc_url( get_option('logingpower_settings')['logingpower_loginpage_bgimg'] ) ." )!important;}";
		wp_add_inline_style('login',$logingpower_style);
		endif; 
		// Background image
		$loginpage_bgimg_style='auto';
		if (!empty(get_option('logingpower_settings')['logingpower_loginpage_bgimg_size'])) 
			$loginpage_bgimg_size=sanitize_text_field( get_option('logingpower_settings')['logingpower_loginpage_bgimg_size']);
			switch ($loginpage_bgimg_size) {
				case 'auto':
				 	$loginpage_bgimg_style='auto';
					break;
				case 'width':
				 $loginpage_bgimg_style='100%  auto';
					break;
				case 'height':
					$loginpage_bgimg_style='auto 100%';
					break;
				case 'both':
				 $loginpage_bgimg_style='100%  100%';
					break;
				default:
					$loginpage_bgimg_style='auto';
					break;
			}
		
		$logingpower_loginpage_bgimg_repeat='no-repeat';
		if(!empty(get_option('logingpower_settings')[ 'logingpower_loginpage_bgimg_repeat' ]))
		$logingpower_loginpage_bgimg_repeat=get_option('logingpower_settings')[ 'logingpower_loginpage_bgimg_repeat' ];
		$logingpower_style="body{ background-position: center top !important;
				background-repeat: ".esc_attr($logingpower_loginpage_bgimg_repeat)."!important;
		  	display:block;   
		  	background-attachment: fixed !important; 
		  	background-size:". esc_attr($loginpage_bgimg_style)." !important; }";
		wp_add_inline_style('login',$logingpower_style);
	}add_action( 'login_enqueue_scripts', 'logingpower_loginpage_style' );
	//}add_action( 'login_head', 'logingpower_loginpage_style') ;	