<?php	

if(route(1)){		
	$url = route(1);		
	$blog = $db->from('blog')->where('blog_url', $url)->first();		
	if($blog){			
		$title = $blog['blog_title'];			
		$blog_content = $blog['blog_content'];			
		$blog_date = $blog['blog_date'];
		$meta = [
			"title" => $blog['blog_seotitle'],
			"desc" 	=> $blog['blog_seodesc'],
			"keyw" 	=> $blog['blog_seokeyw']
		];
	}else{			
		header('Location:' . site($siteLinks['blog']['url']));		
	}	
}else{		
	$blogs = $db->from('blog')->orderby('blog_date', 'DESC')->all();		
	$title = "{NAVBAR_BLOG}";	
}	
$integration = "";	
foreach($plugins as $plugin){		
	if ($plugin['app_id'] !== 1 && $plugin['app_id'] !== 2 && $plugin['app_id'] !== 3 && $plugin['app_id'] !== 4 && $plugin['app_id'] !== 5) {			
		@$data = json_decode($plugin['app_data'], true);			
		if(@$data['visibility'] == 0){				
			@$integration .= $data['code'];			
		}elseif(@$data['visibility'] == 1){				
			@$integration .= $data['code'];			
		}elseif(@$data['visibility'] == 2){				
			@$integration .= $data['code'];			
		}		
	}	
}	

require view("blog");	
$output = ob_get_clean();	
$extra = [		"{INTEGRATIONS}" => $integration	];	
echo replace($output, $extra);