<?php
if ( ! defined( 'ABSPATH' ) ) exit; 
// Silence is golden.

function tes_() {
/**
 * ===============================
 * PHP & REQUEST CONFIG
 * Ambil option/theme global WordPress
 * Tampilkan error sesuai konstanta ERRORS
 * ===============================
*/ 
global $opt_themes;
@ini_set('display_errors', ERRORS);

/**
 * ===============================
 * LOAD CSS VIA SHORTCODE
 * ===============================
*/
echo do_shortcode('[css]');

/**
 * ===============================
 * INIT CLASS
 * Class untuk HTTP / CURL
 * Class utama struktur & scraper
 * ===============================
*/
$Go_Curl = new Go_Curl();
$sc = new StructurCode();

/**
 * ===============================
 * BASIC CONFIG
 * Post type yang akan digunakan
 * Source website target
 * Contoh URL demo (single post)
 * Ambil host saja dari URL demo
 * ===============================
*/
$types   = 'post';
$sources = '5play.org/en/';
$demos   = 'https://5play.org/en/11448-minecraft-mod.html';
$demosx  = 'https://' . parse_url($demos)['host'];

/**
 * ===============================
 * CONNECTION CHECK
 * Cek apakah domain source bisa diakses
 * ===============================
*/
$checkx = $Go_Curl->http_responsex($demosx);

/**
 * ===============================
 * API KEY SCRAPER
 * Ambil API key scraper dari option theme
 * ===============================
*/
$keyz = $opt_themes['api_key_scrape'];
 
/**
 * ===============================
 * URL & STATUS CHECK
 * Base protocol + source
 * Cek status HTTP URL demo (200 / 403 / 404)
 * ===============================
*/
$protocol = 'https://' . $sources;
$status = $Go_Curl->http_responsex($demos);
$sc_page     = 'sc-5play';
?>

	<div class="wrap">
	<div class="play_menu" style="text-transform:uppercase">
        <b>Add sources from <?php echo parse_url($protocol)['host']; ?></b>
	</div> 
	</div> 
	 
	
	<?php 
	$demo    = $demos;
	$source  = $sources;
	$api_keys = !empty($opt_themes['api_key_scrape']) ? (array)$opt_themes['api_key_scrape'] : [];
	$checker = new Check_Status_Cloudflare($Go_Curl, $demo, $source, $api_keys);
	$checker->check_and_display();
	?>


	<div style="clear:both"></div>	
    
	<div class="wrap" id="play_fixed" >
	<div class="play_menu" style="margin-bottom: 10px;">
		<ul id="menunya" class="play_menus" style="text-transform:capitalize">
		<li data-tab="tab1"><a><i class="fa fa-home"></i> Home </a></li>  
		<li data-tab="tab2"><a><i class="fa fa-rss"></i> Latest </a></li>  
		</ul>
		<div style="clear:both"></div>
	</div>
	</div>
  
    
	<div class="containerX">
		<div class="tab-content">

		<div id="tab1" class="tab-pane fade">    
			<?php echo $sc->render_post_status_info($opt_themes); ?>
		</div>     

		<div id="tab2" class="tab-pane fade">    
			<?php echo $sc->render_post_status_info($opt_themes); ?>
		</div>     
		
		</div>
	</div>
	
<?php 
echo do_shortcode( '[ft_menu]' );
echo do_shortcode( '[ft_js]' ); 
}
