<?php
 
// SET CHILD THEME FLAG
define('WLT_CHILDTHEME', 1);
 
// ENABLE ELEMENTOR AUTO INSTALL
define('WLT_ELEMENTOR_AUTO_INSTALL', 1);
 
$CHILDTHEME	= new childtheme_directory_premium;
 
class childtheme_directory_premium {

	function __construct(){ 
		
		// language
		load_child_theme_textdomain( 'premiumpress-childtheme', get_stylesheet_directory() . '/languages' );	
	 
		// IMAGES
		add_action('hook_admin_2_homeedit', array($this, '_hook_admin_2_homeedit' ) );	

	 
		if(is_admin()){		
			 
			// ADD DEFAULT ELEMENTOR TEMPLATE TO ADMIN PABEL
			add_filter('hook_v9_admin_elementor_templates', array($this, '_elementor_templates'), 2 );				
			
		}
	 
		// ACTIVATION
		add_action('after_switch_theme', array($this, '_after_switch_theme') );	
		
		//
		if(defined('WLT_DEMOMODE')){	
			
			$GLOBALS['CORE_THEME'] = $this->childtheme_v_changes();	
			 
		} 
	 
		 
	} // end construct	
	
	function _hook_admin_2_homeedit($c){	
	   
		return array(); 
	}
	
	 
 	
	function _elementor_templates($c){
	 
		$c['homepage'] = array(
			//"image" 		=> home_url()."/wp-content/themes/childtheme_elementor_directory_premium/screenshot.png",
			"name" 			=> "Homepage",
			"description" 	=> "This is the homepage template for this child theme. Install and activate to apply to your website.",
			"video" 		=> "",
			"file" 			=> __DIR__ ."/elementor-home.json",
			"homepage"		=> true,
			"page_template"	=> "elementor_header_footer",
		);
		 
			
		return $c;
	}
	
	
	
 
	/*
		this function holds all of the changes
		made to core when the child theme is activated
	*/
	function childtheme_v_changes(){
	
		$core = get_option("core_admin_values"); 
		
		$core['logo_url'] = home_url()."/wp-content/themes/childtheme_elementor_directory_premium/img/logo.png"; 
		$core['light_logo_url'] = home_url()."/wp-content/themes/childtheme_elementor_directory_premium/img/logo1.png";		
		
		// SET THE HEADER/FOOTER		
		$core['header_hometransparent'] = "1";
		
		$core['header_topnav'] 		= 1;		 
		$core['header_topnavstyle'] = 2; 
		$core['header_topnavhome'] 	= 0;
		$core['header_topnavbg'] 	= "bg-dark"; 		
		$core['header_topnavborderbottom'] = "0";
				
		$core['header_style'] 		= 4;		 
		$core['header_shadow'] 		= 1; 
		$core['header_bg'] 			= "bg-white"; 
		$core['header_button'] 		= "0";	
			
		$core['headernav_bg'] 		= "bg-primary"; 		
		$core['breadcrumbs'] 		= "0";
		$core['breadcrumbs_style'] 	= 0;
		
		$core['breadcrumbs_style'] 	= 0;
				 
		$core['color_primary'] 			= "#2b1f68";
		$core['color_secondary'] 		= "#ffa337";
		
		
				
		$core['footer_blockstyle'] 	= "1";
	 	
		//$core['header_button'] 		= "1";
		//$core['header_buttontext'] = "asdasd";
		 
				
		// RETURN CORE
		return $core;		
	} 
	/*
		this function applies changes to core
		when the child theme is activated
	*/
	function _after_switch_theme(){
		// GET DESIGN FROM FUNCTION
		$core_admin_values = $this->childtheme_v_changes();
		// SAVE VALUES
		update_option('core_admin_values',$core_admin_values);
		
		// INSTALL TEMPLATE HERE
			
	} 
	


}
 

?>