<!DOCTYPE html>
<html lang="en" dir="<?= direction();?>">
<head>
	<?php $settings = get_setting(); ?>
	<!-- Required meta tags -->
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

    <?php if(isset($page) && $page!="Profile"): ?>
    	<?php $seo =  json_decode($settings['seo_settings'],true);?>
	    <meta name="type" property="og:type"          content="article" />
	    <meta name="title" property="og:title"         content="<?= isset($seo['title'])?html_escape($seo['title']):'';?>" />
	    <meta name="description"  property="og:description"   content="<?= isset($seo['description'])?html_escape($seo['description']):'';?>" />
	    <meta name="keywords" content="<?= !empty($seo['keywords'])?$seo['keywords']:'' ;?>">
	    <meta name="url" property="og:url"           content="<?= base_url();?>" />
	    <meta name="site_name" property="og:site_name"     content="<?= isset($seo['site_name'])?html_escape($seo['site_name']):'';?>" />
	    
	<?php endif ?>
	
	<!-- facebook share metadata-->
	<?php if(isset($slug) && isset($id) && $page_title!="Blog"): ?>
		<?php $user = get_user_info_by_slug($slug); ?>
		<?php $about_me = single_select_by_user_slug($slug,'home'); ?>
		<?php if(isset($about_me) && !empty($about_me)): ?>
			  <meta property="og:title" content="<?= !empty($about_me['title'])?html_escape($about_me['title']):html_escape($user['username']);?>" />
		    <meta property="og:image" content="<?= !empty($about_me['image'])?html_escape(base_url($about_me['image'])):html_escape(base_url($user['thumb']));?>"/>
		    <meta property="og:url" content="<?=  base_url(html_escape($user['username']));?>" />
		    <meta property="og:type" content="article" />
		    <meta property="og:description" content="<?= strip_tags($about_me['about_me']);?>" />
		<?php endif;?>

		<?php if(isset($s_page) && $s_page=='vCard'): ?> 
			 <meta property="og:title" content="<?= !empty($user['name'])?html_escape($user['name']):html_escape($user['username']);?>" />
		    <meta property="og:image" content="<?= base_url(!empty($user['thumb'])?$user['thumb']:'assets/images/avatar.png');?>"/>
		    <meta property="og:url" content="<?=  base_url(html_escape($user['username']));?>" />
		    <meta property="og:type" content="article" />
		    <meta property="og:description" content="<?= strip_tags(!empty($user['about_me_short'])?$user['about_me_short']:'');?>" />
		<?php endif ?>

		<?php $user_settings = get_user_settings($id); ?>
			<?php if(!empty($seo)): ?>	
				<?php $seo =  json_decode($user_settings['seo_settings'],true);?>
				<!-- SEO -->
				<meta name="title" content="<?= !empty($seo['title'])?$seo['title']:'' ;?>">
				<meta name="description" content="<?= !empty($seo['description'])?$seo['description']:'' ;?>">
				<meta name="keywords" content="<?= !empty($seo['keywords'])?$seo['keywords']:'' ;?>">
			<?php endif;?>
		<!-- SEO -->
	<?php endif ?>

	<?php if(isset($page_title) && $page_title=="Blog"): ?>
		<?php if(isset($posts[0]['title'])): ?>
			<meta property="og:title" content="<?= html_escape($posts[0]['title']);?>" />
		    <meta property="og:image" content="<?= base_url(html_escape($posts[0]['thumb']));?>"/>
		    <meta property="og:url" content="<?=  base_url('post/'.html_escape($slug).'/'.html_escape($posts[0]['slug']));?>" />
		    <meta property="og:type" content="article" />
		    <meta property="og:description" content="<?= strip_tags($posts[0]['overview']);?>" />
		<?php endif ?>
	<?php endif ?>
	<!-- facebook share -->

	<!-- Bootstrap CSS -->
	<link rel="stylesheet" href="<?= base_url(); ?>assets/css/bootstrap.min.css">
	
	<!-- Bootstrap CSS -->
	<?php if(isset($settings) && !empty($settings['g_font_name'])): ?>
  <!-- Google Font -->
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=<?= $settings['g_font_name'];?>:300,400,600,700,300italic,400italic,600italic">
  <style>
  	body, a, span, p{
			font-family: '<?= $settings['g_font_name']; ;?>','sans-serif'!important;
		}

		.main-header .sidebar-toggle, .fa{
		  font-family: fontAwesome!important;
		}
		.far, .fas {
		    font-family: "Font Awesome 5 Free"!important;
		}
  
  </style>
<?php else: ?>
  	<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro|Catamaran|Mitr|DM+Sans|Jura|Roboto+Condensed|Montserrat|Rubik&display=swap" rel="stylesheet">
<?php endif ?>

	<!-- google fonts -->

	<!-- slick slider -->
	<link rel="stylesheet" href="<?= base_url(); ?>assets/plugins/slickSlider/slick.css">
	<!-- slick slider -->

	<!-- JQuery UI -->
	<link rel="stylesheet" href="<?= base_url(); ?>assets/plugins/jquery-ui/jquery-ui.main.css">
	<!-- JQuery UI -->


	<!-- animate css 3.7.2 -->
	<link rel="stylesheet" href="<?php echo base_url(); ?>assets/plugins/animate/animate.css">
	<!-- animate -->

	<!-- lightbox css lightbox css 2.11.1 -->
	<link rel="stylesheet" href="<?php echo base_url(); ?>assets/plugins/fancybox/jquery.fancybox.min.css">
	<!-- lightbox lightbox css 2.11.1-->

	<!--aos-animation -->
	<link rel="stylesheet" href="<?php echo base_url(); ?>assets/plugins/animation/aos-animation.css">
	<!-- animate -->
	
	<!-- fontawsome 4.7 and 5.8.1 -->
	<link href="<?php echo base_url(); ?>assets/css/font-awesome-5.8.1.main.css" rel="stylesheet">
	<link href="<?php echo base_url(); ?>assets/css/font-awesome.min.css" rel="stylesheet">
	<link href="<?php echo base_url(); ?>assets/css/icofont.css" rel="stylesheet">
	
	<!-- fontawsome 4.7 and 5.8.1 -->

	

	<!-- datetimepicker css -->
	<link rel="stylesheet" href="<?= base_url(); ?>assets/plugins/datetime_picker/datetime.css">
	
	<link rel="stylesheet" href="<?= base_url(); ?>assets/plugins/circle_progress/progresscircle.css">
	<link rel="stylesheet" href="<?= base_url(); ?>assets/plugins/country/intelinput.css">
	<!-- datetimepicker css -->



	<?php if(isset($is_vcard) && $is_vcard==1): ?>
		<link rel="stylesheet" href="<?= base_url(); ?>assets/css/vcard.css?v=<?= get_setting()['version'];?>&t=<?= time() ;?>">
		<link rel="stylesheet" href="<?= base_url(); ?>assets/css/vcard_responsive.css?v=<?= get_setting()['version'];?>&t=<?= time() ;?>">
	<?php else: ?>

		<!-- custom css -->
		<link rel="stylesheet" href="<?= base_url(); ?>assets/plugins/loader.css">
		
		<link rel="stylesheet" href="<?= base_url(); ?>assets/css/test.css?v=<?= get_setting()['version'];?>&t=<?= time() ;?>">
	<?php endif; ?>
	<!-- custom css -->
	<link rel="stylesheet" href="<?= base_url(); ?>assets/css/style.css?v=<?= get_setting()['version'];?>&t=<?= time() ;?>">
	<!-- responsive css -->
	<link rel="stylesheet" href="<?= base_url(); ?>assets/css/responsive.css?v=<?= get_setting()['version'];?>&t=<?= time() ;?>">


	<?php if(direction()=='rtl'): ?>
	    <link rel="stylesheet" href="<?= base_url()?>assets/css/bootstrap-rtl.css?v=<?= get_setting()['version'];?>&t=<?= time() ;?>">
	    <link rel="stylesheet" href="<?= base_url()?>assets/css/custom_rtl.css?v=<?= get_setting()['version'];?>&t=<?= time() ;?>">
	<?php endif ?>

<?php if(isset($page) && $page != 'Profile'): ?>
	<!-- Home page pwa -->
			<?php $pwa1 = !empty($settings['pwa_config'])?json_decode($settings['pwa_config']):''; ?>
			<?php if((isset($settings['is_pwa']) && $settings['is_pwa']==1) && (isset($pwa1->is_pwa_active) && $pwa1->is_pwa_active==1)): ?>
			<meta name="mobile-wep-app-capable" content="yes">
			<meta name="apple-mobile-wep-app-capable" content="yes">
			<?php 
				$thumb = !empty($pwa1->logo)? $pwa1->logo:"uploads/pwa/logo.png";
				$Fdata = [
						'img_144' => resize_img($thumb,144,144),
						'img_192' => resize_img($thumb,192,192),
						'img_512' => resize_img($thumb,512,512),
						'theme_color' => !empty($pwa1->theme_color)?$pwa1->theme_color:'FF9800',
						'background_color' => !empty($pwa1->background_color)?$pwa1->background_color:'FF9800',
						'title' => !empty($pwa1->title)?$pwa1->title:$settings['site_name'],
						'url' => base_url(),
						'name' => $settings['site_name'],
				];
				$q = serialize($Fdata);
			 ?>
			    <link rel="icon" href="<?= $Fdata['img_512'] ;?>" type="image/png" sizes="512x512">
					<link rel="apple-touch-icon" href="<?=$Fdata['img_192'] ;?>" type="image/png" sizes="192x192">
					<link rel="icon" href="<?= $Fdata['img_144'] ;?>" type="image/png" sizes="144x144">
					<link rel="manifest" href="<?= base_url(); ?>assets/manifest-2.php?Hdata=<?= urlencode($q);?>&t=<?= time() ;?>" type="text/html">

			<?php endif ?>
				<!-- pwa -->
<?php endif;?>


	<!-- responsive css-->
	<?php if(isset($slug)): ?>
		<?php $u_info = get_user_info_by_slug($slug); ?>
		<?php $u_settings = get_user_settings($u_info['id']); ?>
		<?php if(isset($u_info)): ?>
			<link rel="stylesheet" href="<?= base_url(); ?>assets/css/test.php?color=<?= !empty($u_info['colors'])?$u_info['colors']:'49bcf7';?>&themes=<?= $u_info['themes'];?>&btn_style=<?= $u_info['btn_style'];?>&direction=<?= direction();?>&layout=<?= $u_info['layouts'];?>&home=<?= $u_info['home'];?>&vcard_color=<?= $u_info['vcard_icon_color'];?>&v=<?= get_setting()['version'];?>&t=<?= time() ;?>">
		<?php endif;?>

		<?php  if(isset($u_settings['share_this_key']) && !empty($u_settings['share_this_key'])):?>
			<script type="text/javascript" src="https://platform-api.sharethis.com/js/sharethis.js#property=<?= $u_settings['share_this_key'];?>&product=inline-share-buttons" async="async"></script>
		<?php endif ?>

		<?php $v_settings = !empty($u_settings['vcard_settings'])?json_decode($u_settings['vcard_settings']):'' ?>
			<?php if(isset($v_settings->is_share_this) && $v_settings->is_share_this==1): ?>
			<script type="text/javascript" src="https://platform-api.sharethis.com/js/sharethis.js#property=<?= !empty($v_settings->share_this_key)?$v_settings->share_this_key:'';?>&product=inline-share-buttons" async="async"></script>
		<?php endif ?>

		<?php if(get_user_pricing_by_id($u_info['id'],'pwa')==1 && is_active($u_info['id'],'pwa')==1): ?>
			<!-- User pwa -->
			<?php $pwa = !empty($u_settings['pwa_config'])?json_decode($u_settings['pwa_config']):''; ?>
			<?php if(isset($settings['is_pwa']) && $settings['is_pwa']==1 && (isset($pwa->is_pwa_active) && $pwa->is_pwa_active==1)): ?>
			<meta name="mobile-wep-app-capable" content="yes">
			<meta name="apple-mobile-wep-app-capable" content="yes">
			<?php 
				$thumb = !empty($pwa->logo)? $pwa->logo:"uploads/pwa/avatar.png";
				$Fdata = [
						'img_144' => resize_img($thumb,144,144),
						'img_192' => resize_img($thumb,192,192),
						'img_512' => resize_img($thumb,512,512),
						'theme_color' => !empty($pwa->theme_color)?$pwa->theme_color:'FF9800',
						'background_color' => !empty($pwa->background_color)?$pwa->background_color:'FF9800',
						'title' => !empty($pwa->title)?$pwa->title:$u_info['username'],
						'url' => base_url($u_info['username']),
						'username' => $u_info['username'],
				];
				$q = serialize($Fdata);
			 ?>
			    <link rel="icon" href="<?= $Fdata['img_512'] ;?>" type="image/png" sizes="512x512">
					<link rel="apple-touch-icon" href="<?=$Fdata['img_192'] ;?>" type="image/png" sizes="192x192">
					<link rel="icon" href="<?= $Fdata['img_144'] ;?>" type="image/png" sizes="144x144">
					<link rel="manifest" href="<?= base_url(); ?>assets/manifest.php?Fdata=<?= urlencode($q);?>&t=<?= time() ;?>" type="text/html">

			<?php endif ?>
				<!-- pwa -->


		<?php endif ?>

	<?php endif ?>

	<link rel="icon" href="<?= base_url($settings['favicon']);?>" type="image/*" sizes="16x16">
	<title><?= !empty($settings['site_name'])?$settings['site_name']:'My Portfolio';?> | <?= isset($page_title) && $page_title!=''?$page_title:''; ?></title>
	
	<!-- Google Analytics -->
	<?= isset($settings['analytics']) && !empty($settings['analytics'])?base64_decode($settings['analytics']):'';?>
	<!-- Google Analytics -->

<!-- custom css -->
<?php if(isset($settings) && !empty($settings['custom_css'])): ?>
<style>
	<?= $settings['custom_css'];?>
</style>
<?php endif ?>
<!-- custom css -->
	
	<!-- Facebook share script -->
    <div id="fb-root"></div>
    <script>
        (function(d, s, id) {
          var js, fjs = d.getElementsByTagName(s)[0];
          if (d.getElementById(id)) return;
          js = d.createElement(s); js.id = id;
          js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.7";
          fjs.parentNode.insertBefore(js, fjs);
        }(document, 'script', 'facebook-jssdk'));
    </script>


    


    <script src='https://www.google.com/recaptcha/api.js'></script>
    
    <script src="<?= base_url();?>assets/js/jquery-3.4.1.min.js"></script>
</head>




<?php if(isset($slug) && isset($id)): ?>

	<?php $settings = get_user_settings($id); ?>
	<?php $themes = get_user_info_by_slug($slug) ?>

<?php if(isset($settings['animation']) && $settings['animation']!=1): ?>
	<style>
		body{ 
			height: 100%!important;
		}
	</style>
<?php endif ?>
	<body class="<?= isset($themes['themes']) && $themes['themes']==1 || $themes['themes']==4 ?"dark":(isset($themes['themes']) && $themes['themes']==0 || $themes['themes']==3 || $themes['themes']==5?"light":'gradient gradient_'.$themes['themes']);?> ">
<!-- check preloader activites -->
	<?php if(isset($settings['preloader']) && $settings['preloader']!=0): ?>
		<div id="preloader"><div class="preloader_<?= $settings['preloader'];?> loader_position"><span></span>
    <span></span></div></div>
	<?php endif ?>
<?php else: ?>
	<body class="light">
<?php endif; ?>

