<?php
global $wpdb, $post, $wp_query, $opt_themes;
function cst_dw_post_title( $title ) {
	global $opt_themes, $post, $wp_query; 
    if ( isset( $wp_query->query_vars['download'] ) ) {	
	global $opt_themes, $post, $wp_query;
        $the_title	= get_the_title();
		$app_name 	= get_post_meta( $post->ID, 'wp_title_GP', true);
		$app_versi 	= get_post_meta( $post->ID, 'wp_version_GP', true );
		if(get_post_meta( $post->ID, 'wp_mods', true )){
		$app_mod 	= '('.trim(strip_tags(ucwords(get_post_meta( $post->ID, 'wp_mods', true )))).')';
		} else {
		$app_mod 	= '';
		}
		$t_mod_apk 	= $opt_themes['text_18']; 
		$t_download	= $opt_themes['text_19']; 
        $title['title'] = $t_download.' '.$app_name.' '.$t_mod_apk.' v'.$app_versi.' '.$app_mod;
        $title['title'] = esc_html( $title['title'] );
        return $title;
    } else {
        return $title;
    } 
}
add_filter( 'document_title_parts', 'cst_dw_post_title', 9999 ); 
get_header();   
error_reporting(0);
?>

<div id="content post-id-<?php the_ID(); ?>" class="site-content mt-1" > 
  
	
	<?php 
	switch($opt_themes['themes_styles']){
	case 'moddroid':
	?>
	<div class="container" >  
	<?php 
	sp_single_row();
	sp_main();
	sp_article();
	sp_breadcrum();
	
	break; 	
	case 'modyolo':
	?>
	<div class="container" >  
	<?php 
	sp_single_row();
	sp_main();
	sp_article();	
	sp_breadcrum();
	
	break; 	
	case 'reborn':
	?>
	<div class="container" >  
	<?php 
	sp_single_row();
	sp_main();
	sp_article();	
	sp_breadcrum();
	
	break; 	
	case 'liteapks':
	?> 
	<div class="container">
	<div class="row">
	<main id="primary" class="col-12 col-lg-8 col-xl-9 content-area">
	<?php 	
	sp_breadcrum();
	?>
	<article class="bg-white border rounded shadow-sm p-3 mb-4">
	<?php
	break; 	
	default:
	?>
	<div class="container" >  
	<?php 
	sp_breadcrum();
	sp_single_row();
	sp_main();
	sp_article();
	
	break; 
	}
	?>
	
	<?php 
	//if (function_exists('breadcrumbsX')) breadcrumbsX(); 
	switch($opt_themes['themes_styles']){
	 	
	case 'modyolo': 
	get_template_part('include/single/info_apk_mdy_dw');  
	break; 
	
	case 'reborn':
	echo ' ';
	break; 

	} 	 
	switch($opt_themes['themes_styles']){
	case 'moddroid':
	?>
	<div class="mb-3 entry-content">
	<p>
	<?php _e($opt_themes['exthemes_download_thanks'], TEXT_DOMAIN); ?> <em><strong><?php echo ucwords(get_post_meta( $post->ID, 'wp_title_GP', true )); ?></strong></em> <?php _e($opt_themes['exthemes_download_site'], TEXT_DOMAIN); ?>
	</p>
	</div>
	<h2 class="h5 font-weight-semibold mb-3"><?php _e($opt_themes['exthemes_Download'], TEXT_DOMAIN); ?> <?php if($opt_themes['single_appname']){ if(get_post_meta( get_the_ID(), 'wp_title_GP', true)){ echo get_post_meta( get_the_ID(), 'wp_title_GP', true); } else { the_title(); }} else { the_title(); } ?></h2>
	 
	<?php
	break; 
	
	case 'modyolo':
	?>
	<div class="mb-3 entry-content">
	<p>
	<?php _e($opt_themes['exthemes_download_thanks'], TEXT_DOMAIN); ?> <em><strong><?php echo ucwords(get_post_meta( $post->ID, 'wp_title_GP', true )); ?></strong></em> <?php _e($opt_themes['exthemes_download_site'], TEXT_DOMAIN); ?>
	</p>
	</div> 
	
	<?php
	break; 
	
	case 'reborn':
	?>
	
	<?php
	break; 
	
	case 'liteapks':
	?>
	<div class="d-flex align-items-center mb-3">
	<div class="flex-shrink-0 mr-3" style="width: 4.5rem;">
	<img width="72" height="72" src="<?php if (get_the_post_thumbnail( get_the_ID() )) { echo wp_get_attachment_image_src( get_post_thumbnail_id( get_the_ID() ), 'full' )[0]; } elseif(get_post_meta( get_the_ID(), 'wp_poster_GP', true )) { echo get_post_meta( get_the_ID(), 'wp_poster_GP', true ); } else { echo $opt_themes['ex_themes_defaults_no_images_']['url']; } ?>" class=" rounded-lg " alt="<?php the_title(); ?>"> 
	</div>
	<div>
	<h1 class="h5 font-weight-semibold"><?php echo $opt_themes['exthemes_Download']; ?> <?php if($opt_themes['single_appname']){ if(get_post_meta( get_the_ID(), 'wp_title_GP', true)){ echo get_post_meta( get_the_ID(), 'wp_title_GP', true); } else { the_title(); }} else { the_title(); } ?></h1>
	<time class="text-muted d-block"><em>
	<?php the_modified_time('F j, Y'); ?> (<?php echo human_time_diff(get_the_modified_time('U'),current_time('U') ). ' ago '; ?>)</em> 
	</time>
	</div>
	</div>
	<?php 
	get_template_part('include/single/info_mod'); 
	break; 
	
	default:
	?>
	<div class="mb-3 entry-content">
	<p>
	<?php _e($opt_themes['exthemes_download_thanks'], TEXT_DOMAIN); ?> <em><strong><?php echo ucwords(get_post_meta( $post->ID, 'wp_title_GP', true )); ?></strong></em> <?php _e($opt_themes['exthemes_download_site'], TEXT_DOMAIN); ?>
	</p>
	</div>
	<h2 class="h5 font-weight-semibold mb-3"><?php _e($opt_themes['exthemes_Download'], TEXT_DOMAIN); ?> <?php if($opt_themes['single_appname']){ if(get_post_meta( get_the_ID(), 'wp_title_GP', true)){ echo get_post_meta( get_the_ID(), 'wp_title_GP', true); } else { the_title(); }} else { the_title(); } ?></h2>
	<?php
	break;
	} ?> 
	 
	 
	<div class="mb-3">
	<?php ex_themes_banner_single_ads_download(); ?>
	</div> 
	<?php 
	switch($opt_themes['themes_styles']){
	case 'moddroid':
	get_template_part('include/download/list_dw_mdr');
	break; 
	
	case 'modyolo':
	get_template_part('include/download/list_dw_mdy');
	?>
	<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.0/jquery.min.js" integrity="sha512-3gJwYpMe3QewGELv8k/BX9vcqhryRdzRMxVfq6ngyWXwo03GFEzjsUm8Q7RZcHPHksttq7/GFoxjCVUjkjvPdw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
	<script>
	$(function() {
	$("#accordion-versions div.border.rounded div.h6.font-weight-semibold").first().removeClass( "collapsed" );
	$("#accordion-versions div.border.rounded div.collapse").first().addClass( "show" );
	});
	</script>
	<?php 
	break; 
	
	case 'reborn':
	get_template_part('include/single/background'); 
	?>
	<div class="mb-3 entry-content">
	<p>
	<?php _e($opt_themes['exthemes_download_thanks'], TEXT_DOMAIN); ?> <em><strong><?php echo ucwords(get_post_meta( $post->ID, 'wp_title_GP', true )); ?></strong></em> <?php _e($opt_themes['exthemes_download_site'], TEXT_DOMAIN); ?>
	</p>
	</div> 
	<h2 class="h5 font-weight-semibold mb-3"><?php _e($opt_themes['exthemes_Download'], TEXT_DOMAIN); ?> <?php echo the_title(); ?></h2>
	<?php
	get_template_part('include/download/list_dw_reborn');
	?>
	<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.0/jquery.min.js" integrity="sha512-3gJwYpMe3QewGELv8k/BX9vcqhryRdzRMxVfq6ngyWXwo03GFEzjsUm8Q7RZcHPHksttq7/GFoxjCVUjkjvPdw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
	<script>
	$(function() {
	$("#accordion-versions div.border.rounded div.h6.font-weight-semibold").first().removeClass( "collapsed" );
	$("#accordion-versions div.border.rounded div.collapse").first().addClass( "show" );
	});
	</script>
	<?php 
	break; 
	
	case 'liteapks':
	get_template_part('include/download/list_dw_liteapks');
	?>
	<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.0/jquery.min.js" integrity="sha512-3gJwYpMe3QewGELv8k/BX9vcqhryRdzRMxVfq6ngyWXwo03GFEzjsUm8Q7RZcHPHksttq7/GFoxjCVUjkjvPdw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
	<script>
	$(function() {
	$("#accordion-versions div.border.rounded.mb-2 div.h6.font-weight-semibold").first().removeClass( "collapsed" );
	$("#accordion-versions div.border.rounded.mb-2 div.collapse").first().addClass( "show" );
	});
	</script>
	<?php 
	break; 
	 
	
	default:
	get_template_part('include/download/list_dw_mdr');
	break;
	} ?> 

	      
	<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.0/jquery.min.js" integrity="sha512-3gJwYpMe3QewGELv8k/BX9vcqhryRdzRMxVfq6ngyWXwo03GFEzjsUm8Q7RZcHPHksttq7/GFoxjCVUjkjvPdw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
	<script>
	$(function () { 
	  $(".accordion-content.p-3:not(:first-of-type)").css("display", "none"); 
	  $(".js-accordion-title:first-of-type").addClass("open");
	  $(".js-accordion-title").click(function () {
	$(".open").not(this).removeClass("open").next().slideUp(300);
	$(this).toggleClass("open").next().slideToggle(300);
	  });
	});
	</script>
	 
 
	<!--if not put fake download link will using default-->
	<script language="javascript">
	var timeleft = "<?php echo $timers_counts; ?>";
	</script>
	<?php 
	get_template_part('include/telegram');
	ex_themes_banner_single_ads_download_2_();
	?>
	
	 
	<?php
	if($opt_themes['activate_download_notices']){ ?>
	<div class="small mb-3 notice_download">
	<p><?php _e($opt_themes['exthemes_download_times_notice_6'], TEXT_DOMAIN); ?> <strong><em><?php echo ucwords(get_post_meta( $post->ID, 'wp_title_GP', true )); ?></em></strong> <?php _e($opt_themes['exthemes_download_times_notice_7'], TEXT_DOMAIN); ?></p>
	<?php echo $opt_themes['notice_download_pages']; ?>
	</div>  
	<?php } ?>
	
	<?php switch ($opt_themes['themes_styles']) { case 'liteapks': ?>
	</article> 
	<?php break; } ?>
	 
	<?php 
	switch($opt_themes['themes_styles']){
	case 'moddroid':
	get_template_part('template/info.download');	
	break; 
	
	case 'modyolo':
	get_template_part('template/info.download');	
	break; 
	
	case 'reborn':
	get_template_part('template/info.download');	
	break; 
	
	case 'liteapks':
	get_template_part('template/info.download');	
	?> 
	<?php
	break; 
	
	default:
	get_template_part('template/info.download');
	break;
	} 
	?>
	 
	<?php
	sp_close_article();
	
	ex_themes_related_posts_();
	?>
	
	
	</main>
	<?php 
	switch($opt_themes['themes_styles']){
	case 'moddroid':
	do_action('single_sidebar');
	break; 
	
	case 'modyolo':
	do_action('single_sidebar');
	break; 
	
	case 'reborn':
	 
	break; 
	
	default:
	do_action('single_sidebar');
	break;
	}
	?>  
	
	<?php sp_close_single_row(); ?> 
	 
</div>
</div>
 
   
<?php
get_footer(); 