<?php 
if ( ! defined( 'ABSPATH' ) ) exit;
function get_linkz($url){
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, $url);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
	$ip = rand(0,255).'.'.rand(0,255).'.'.rand(0,255).'.'.rand(0,255); 
	curl_setopt($ch, CURLOPT_HTTPHEADER, array("REMOTE_ADDR: $ip", "HTTP_X_FORWARDED_FOR: $ip"));
	//curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/".rand(3,5).".".rand(0,3)." (Windows NT ".rand(3,5).".".rand(0,2)."; rv:2.0.1) Gecko/20100101 Firefox/".rand(3,5).".0.1");
	curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:56.0) Gecko/20100101 Firefox/56.0");
	curl_setopt($ch, CURLOPT_REFERER, "http://www.google.com");
	curl_setopt($ch, CURLOPT_AUTOREFERER, true);
	$html = curl_exec($ch);
	curl_close($ch);
	return $html;
}
function warna_rgbs($hex, $asString = true) {
	if (0 === strpos($hex, '#')) {
	$hex		= substr($hex, 1);
	} else if (0 === strpos($hex, '&H')) {
	$hex		= substr($hex, 2);
	}      
	$cutpoint	= ceil(strlen($hex) / 2)-1;
	$rgb		= explode(':', wordwrap($hex, $cutpoint, ':', $cutpoint), 3);
	$rgb[0]		= (isset($rgb[0]) ? hexdec($rgb[0]) : 0);
	$rgb[1]		= (isset($rgb[1]) ? hexdec($rgb[1]) : 0);
	$rgb[2]		= (isset($rgb[2]) ? hexdec($rgb[2]) : 0);
	return ($asString ? "rgba({$rgb[0]},{$rgb[1]},{$rgb[2]}, .8)" : $rgb);
} 
 
define('BY', EXTHEMES_AUTHOR);
define('FB', EXTHEMES_FACEBOOK_URL);
define('TW', EXTHEMES_TWITTER_URL);
define('IG', EXTHEMES_INSTAGRAM_URL);
define('YT', EXTHEMES_YOUTUBE_URL);
define('webs', EXTHEMES_API_URL);
define('setting_opt','_options&tab=1');
define('options_setting','_options&tab=1'); 
define('stylex', '/libs/addons/libs/style');
define('postnow', 'Get Now');
define('postnow2', postnow);
define('colors', '#000000');
define('colors_2', '#ffffff');
define('colors_rgb', warna_rgbs(colors));
define('colors_url', warna_rgbs(colors));
define('colors2', warna_rgbs(colors_2));
define('font_size', '2.5rem');
define('font_size_alt', '1.1em');
define('font_size_alts', '1.7rem');
define('NO_ID', '<h1 style="text-align: center;">Sorry.... <u style="color: '.colors.';">ID Play Store</u> No Found</h1><h3 style="text-align: center;">Please Refresh Agains</h3>');
define('NOIMAGES', EX_THEMES_URI.'/libs/addons/assets/img/playstore.png' );
// ~~~~~~~~~~~~~~~~~~~~~ EX_THEMES ~~~~~~~~~~~~~~~~~~~~~~~~ \\
add_action( 'admin_menu', 'menu_apk_extractors');
function menu_apk_extractors() {
    add_menu_page(
        'Extractor APK', 
		'Extractor APK',
        'manage_options',
        'wp_apk_mod_menu',
        'wp_docs',
        //'dashicons-buddicons-replies',
        EX_THEMES_URI.'/libs/addons/assets/img/playstore.png',
        100
    );
    add_submenu_page( 'wp_apk_mod_menu', 'play.google.com', 'PLAY STORE', 'manage_options', 'wp_apk_googleplay', 'wp_googleplay' ); 
    add_submenu_page( 'wp_apk_mod_menu', 'apkgody.com', 'APKGODY', 'manage_options', 'wp_apk_apkgodycc', 'wp_apkgodycc' );
    /* add_submenu_page( 'wp_apk_mod_menu', 'apkmody.COM', 'APKMODY', 'manage_options', 'wp_apk_apkmody', 'wp_apkmody_errors' ); */
	add_submenu_page( 'wp_apk_mod_menu', 'getmodsapk.COM', 'GETMODSAPK', 'manage_options', 'wp_apk_getmodsapk', 'wp_getmodsapk' );
    add_submenu_page( 'wp_apk_mod_menu', 'happymod.COM', 'HAPPYMOD', 'manage_options', 'wp_apk_happymod', 'wp_happymod' );
    add_submenu_page( 'wp_apk_mod_menu', 'modcombo.COM', 'MODCOMBO', 'manage_options', 'wp_apk_modcombo', 'wp_modcombo' );
    add_submenu_page( 'wp_apk_mod_menu', 'modfyp.com', 'MODFYP <span class="awaiting-mod">new</span>', 'manage_options', 'wp_apk_modfyp', 'wp_modfyp' ); 
    add_submenu_page( 'wp_apk_mod_menu', 'techbigs.COM', 'TECHBIGS', 'manage_options', 'wp_apk_techbigs', 'wp_techbigs' );
    add_submenu_page( 'wp_apk_mod_menu', 'zmodapk.net', 'ZMODAPK ', 'manage_options', 'wp_apk_zmodapk', 'wp_zmodapk' ); 
    
    /*
    <span class="awaiting-mod">new</span>
    add_submenu_page( 'wp_apk_mod_menu', 'coffeeapps.IR', 'COFFEEAPPS (for RTL)', 'manage_options', 'wp_apk_coffeeapps', 'wp_coffeeapps' );
    add_submenu_page( 'wp_apk_mod_menu', 'farsroid.COM', 'FARSROID', 'manage_options', 'wp_apk_farsroid', 'wp_farsroid' );
    add_submenu_page( 'wp_apk_mod_menu', '5play.RU', '5PLAY', 'manage_options', 'wp_apk_play5', 'wp_play5' );
    */
    add_submenu_page( 'wp_apk_mod_menu', 'setting', 'SETTING', 'manage_options', setting_opt, 'wpwm_settings' );
}
require_once EX_THEMES_DIR.'/libs/addons/includes/techbigs.php';
require_once EX_THEMES_DIR.'/libs/addons/includes/apkgody.php';  
require_once EX_THEMES_DIR.'/libs/addons/includes/modcombo.php'; 
require_once EX_THEMES_DIR.'/libs/addons/includes/getmodsapk.php';
require_once EX_THEMES_DIR.'/libs/addons/includes/happymod.php';
require_once EX_THEMES_DIR.'/libs/addons/includes/googleplay.php';
require_once EX_THEMES_DIR.'/libs/addons/includes/zmodapk.php'; 
require_once EX_THEMES_DIR.'/libs/addons/includes/modfyp.php'; 
require_once EX_THEMES_DIR.'/libs/addons/includes/docs.php';
require_once EX_THEMES_DIR.'/libs/addons/includes/dom.php';
require_once EX_THEMES_DIR.'/libs/addons/includes/core.php'; 
require EX_THEMES_DIR.'/libs/addons/libs/addscript.php'; 
// ~~~~~~~~~~~~~~~~~~~~~ EX_THEMES ~~~~~~~~~~~~~~~~~~~~~~~~ \\ 
//enable upload for webp image files.
function webps_upload_mimes($existing_mimes) {
    $existing_mimes['webp'] = 'image/webp';
    return $existing_mimes;
}
add_filter('mime_types', 'webps_upload_mimes');

//enable preview / thumbnail for webp image files.
function webps_is_displayable($result, $path) {
    if ($result === false) {
        $displayable_image_types = array( IMAGETYPE_WEBP );
        $info = @getimagesize( $path );

        if (empty($info)) {
            $result = false;
        } elseif (!in_array($info[2], $displayable_image_types)) {
            $result = false;
        } else {
            $result = true;
        }
    }

    return $result;
}
add_filter('file_is_displayable_image', 'webps_is_displayable', 10, 2);


function ex_themes_notices_php() {
if (!(PHP_VERSION_ID >= 70400)) {
     printf('<div class="notice notice-error is-dismissible"><p><b>'.strtoupper(THEMES_NAMES).'</b> require a PHP version 7.4 or UP. You site running '.PHP_VERSION.'. please update your PHP</p></div> ');
}
}
add_action( 'admin_notices', 'ex_themes_notices_php' ); 