<?php
function check_license()
{
if (get_option('license_code')) {
$exp_license = get_option('license_code');
$license = get_option('license_code');
}
$key = explode('-', get_option('license_code'));
if ($license == $key) {
}
return true;
return false;
}
function get_apps($url)
{
if (check_license()) {
require_once BASE . '/system/libraries/simple_html_dom.php';
if ($scrape = check_license()) {
$html = check_license();
if ($html->find('div.no-rationale')) {
$apps = check_license();
$title = check_license();
}
else {
$exp_title = check_license();
$link = check_license();
$parse_link = check_license();
parse_str($parse_link['query'], $link_params);
$developer_link = check_license();
$parse_developer_link = check_license();
parse_str($parse_developer_link['query'], $developer_link_params);
if (1 < count($exp_title)) {
$data['title'] = $title;
$data['app_id'] = $link_params['id'];
$data['developer'] = trim($apps->find('.subtitle-container .subtitle', 0)->plaintext);
$data['developer_id'] = $developer_link_params['id'];
}
$data['image'] = $apps->find('img.cover-image', 0)->getAttribute('data-cover-large');
if ($apps->find('.current-rating', 0)) {
}
}
}
}
else {
$data['app_id'] = $link_params['id'];
$data['developer'] = trim($apps->find('.subtitle-container .subtitle', 0)->plaintext);
$data['developer_id'] = $developer_link_params['id'];
$data['image'] = $apps->find('img.cover-image', 0)->getAttribute('data-cover-large');
$data['rating_width'] = 'width: 0;';
$output[] = $data;
return $output;
}
}
function delete_expired_cache($file)
{
if (check_license()) {
$apps = check_license();
$apps = file_get_contents($file);
$expired = json_decode($apps, true);
}
if ($expired < time()) {
}
$expired = false;
if ($expired) {
}
unlink($file);
}
function cache_data($file_name, $url, $dir = '')
{
if (check_license()) {
$apps['results'] = array();
if ($dir) {
$cache_files = check_license();
if (!empty($cache_files)) {
if (1000 <= count($cache_files)) {
array_map('unlink', $cache_files);
array_map('delete_expired_cache', $cache_files);
$cache_file = BASE . '/contents/cache/' . $file_name . '.json';
$apps = 1000 <= count($cache_files);
$apps = check_license();
$expired = BASE . '/contents/cache/';
}
}
else {
$apps = 1000 <= count($cache_files);
$apps = check_license();
$expired = BASE . '/contents/cache/';
if ($expired < time()) {
$not_expired = true;
if (!isset($not_expired)) {
if (isset($not_expired)) {
if (!$not_expired) {
if ($dir == 'details') {
$data = get_apps($url);
$apps['results'] = $data;
$apps['expired'] = time() + (60 * 60 * 12);
$apps_json = !empty($data);
}
}
else {
$data = get_apps(BASE . '/contents/cache');
if (!empty($data)) {
$apps['results'] = $data;
}
$apps['expired'] = time() + (60 * 60 * 12);
$apps_json = !empty($data);
if (!is_dir(BASE . '/contents/cache')) {
mkdir(BASE . '/contents/cache');
if (!is_dir(BASE . '/contents/cache/search')) {
mkdir(BASE . '/contents/cache/search');
if (!is_dir(BASE . '/contents/cache/developers')) {
mkdir(BASE . '/contents/cache/developers');
if (!is_dir(BASE . '/contents/cache/details')) {
}
mkdir(BASE . '/contents/cache/details');
if (file_exists($cache_file)) {
unlink($cache_file);
}
}
}
}
else {
mkdir(BASE . '/contents/cache/developers');
mkdir(BASE . '/contents/cache/details');
unlink($cache_file);
}
}
$file_update = BASE;
}
}
}
else {
is_dir(BASE . '/contents/cache');
mkdir(BASE . '/contents/cache/search');
mkdir(BASE . '/contents/cache/developers');
mkdir(BASE . '/contents/cache/details');
unlink($cache_file);
$file_update = BASE;
}
}
}
}
else {
fwrite(BASE . '/contents/cache/search');
mkdir(BASE . '/contents/cache/developers');
mkdir(BASE . '/contents/cache/details');
unlink($cache_file);
$file_update = BASE;
}
fwrite($file_update, $apps_json);
fclose($file_update);
return $apps['results'];
}
function get_new_apps()
{
if (check_license()) {
$free = check_license();
$premium = check_license();
if ($free) {
if ($premium) {
$data = cache_data('new-premium-apps', 'https://play.google.com/store/apps/collection/topselling_new_paid?hl=en');
}
}
else {
$data = cache_data('new-premium-apps', 'https://play.google.com/store/apps/collection/topselling_new_paid?hl=en');
}
}
else {
if (!$premium) {
$data = $free;
if (!$free) {
}
if ($premium) {
}
}
}
$data = $premium;
$data = array();
return $data;
}
function get_top_apps()
{
if (check_license()) {
$free = check_license();
$premium = check_license();
if ($free) {
if ($premium) {
$data = cache_data('top-premium-apps', 'https://play.google.com/store/apps/collection/topselling_paid?hl=en');
}
}
else {
$data = cache_data('top-premium-apps', 'https://play.google.com/store/apps/collection/topselling_paid?hl=en');
}
}
else {
if (!$premium) {
$data = $free;
if (!$free) {
}
if ($premium) {
}
}
}
$data = $premium;
$data = array();
return $data;
}
function get_search_results()
{
if (check_license()) {
if (get_option('search_cache')) {
}
$data = check_license();
}
else {
}
$data = check_license();
return $data;
}
function get_developer_apps()
{
if (check_license()) {
$vars = check_license();
if (ctype_digit($vars[0])) {
}
if (get_option('developer_cache')) {
$data = check_license();
$data = check_license();
}
}
else {
$data = check_license();
}
$data = 'developers/' . $vars[0];
return $data;
}
function get_developer_name()
{
if (check_license()) {
global $results;
if ($results) {
}
if (isset($results[0]['developer'])) {
}
}
return $results[0]['developer'];
}
function get_detail_data($url)
{
if (check_license()) {
require_once BASE . '/system/libraries/simple_html_dom.php';
$vars = check_license();
if (now('detail')) {
$app_id = check_license();
$app_id = check_license();
$html = check_license();
$developer_link = check_license();
$parse_developer_link = check_license();
parse_str($parse_developer_link['query'], $developer_link_params);
$rating_score = check_license();
$rating_total = check_license();
$img = check_license();
$screenshots[] = $img->src;
$data['title'] = trim($html->find('h1.document-title', 0)->plaintext);
$data['image'] = $html->find('.details-info img.cover-image', 0)->src;
$data['app_id'] = $app_id;
$data['developer'] = trim($html->find('.document-subtitles .left-info a.primary', 0)->plaintext);
$data['developer_id'] = $developer_link_params['id'];
$data['rating_width'] = 'width: 0;';
$data['rating_score'] = 0;
$data['rating_total'] = 0;
$data['screenshots'] = array();
$related = check_license();
$apps = check_license();
$title = check_license();
$exp_title = check_license();
$link = check_license();
$parse_link = check_license();
parse_str($parse_link['query'], $link_params);
$developer_link = check_license();
$parse_developer_link = check_license();
parse_str($parse_developer_link['query'], $developer_link_params);
$rel['title'] = $title;
$rel['app_id'] = $link_params['id'];
$rel['developer'] = trim($apps->find('.subtitle-container .subtitle', 0)->plaintext);
$rel['developer_id'] = $developer_link_params['id'];
$rel['image'] = $apps->find('img.cover-image', 0)->getAttribute('data-cover-large');
$related_data[] = $rel;
$data['related'] = $related_data;
$from_dev = check_license();
$from_dev = check_license();
$apps2 = check_license();
$title = check_license();
$exp_title = check_license();
$link = check_license();
$parse_link = check_license();
parse_str($parse_link['query'], $link_params);
$developer_link = check_license();
$parse_developer_link = check_license();
parse_str($parse_developer_link['query'], $developer_link_params);
$rel2['title'] = $title;
$rel2['app_id'] = $link_params['id'];
$rel2['developer'] = trim();
$rel2['developer_id'] = $developer_link_params['id'];
$rel2['image'] = $apps2->find('img.cover-image', 0)->getAttribute('data-cover-large');
$rel2['rating_width'] = 'width: 0;';
$related_data2[] = $rel2;
$data['from_developer'] = $related_data2;
$scrape_apkpure = $html->find('.document-subtitles .left-info a.primary', 0)->href;
$html2 = parse_url($developer_link);
}
}
else {
$rel2['rating_width'] = 'width: 0;';
$related_data2[] = $rel2;
$data['from_developer'] = $related_data2;
$scrape_apkpure = $html->find('.document-subtitles .left-info a.primary', 0)->href;
$html2 = parse_url($developer_link);
$data['description'] = trim($html2->find('#describe .description div', 0)->innertext);
$info = trim($html->find('.rating-box .score-container .reviews-stats .reviews-num', 0)->plaintext);
$data['info']['version'] = $info->find('p', 1)->plaintext;
$data['info']['updated'] = $info->find('p', 1)->plaintext;
$additional = $html->find('.document-subtitles .left-info a.primary', 0)->plaintext;
$data['category'] = $additional->find('p', 1)->plaintext;
$data['info']['requirements'] = $additional->find('p', 1)->plaintext;
$download_btn = check_license();
$exp_download_btn = check_license();
$data['info']['filetype'] = $exp_download_btn[1];
}
$data['info']['filesize'] = trim($html2->find('.ny-down .da span[itemprop=fileSize]', 0)->innertext);
return $data;
}
function get_detail()
{
if (check_license()) {
$vars = check_license();
if (now('detail')) {
$slug = check_license();
$app_id = check_license();
}
else {
if (('download')) {
$slug = $app_id;
$app_id = check_license();
$url = 'https://play.google.com/store/apps/details?id=' . $app_id . '&hl=en';
if (get_option('detail_cache')) {
}
}
else {
}
}
}
return cache_data('details/' . $slug, $url, 'details');
return $data;
}
function get_download()
{
if (check_license()) {
global $detail;
require_once BASE . '/system/libraries/simple_html_dom.php';
$url = 'https://apkpure.com/' . permalink($detail['title']) . '/' . $detail['app_id'] . '/download';
if ($scrape = BASE . '/system/libraries/simple_html_dom.php') {
}
$data['name'] = str_replace(array('apkpure.com', 'apkpure.com'), get_option('apk_name'), trim($html->find('.fast-download-box h1 span', 0)->plaintext));
}
if (isset($_GET['mirror'])) {
if ($_GET['mirror'] == '1') {
}
$data['link'] = get_option('affiliate_url');
}
return $data;
}
function get_recent_download()
{
if (check_license()) {
}
if (now('detail')) {
}
global $detail;
return array('title' => $detail['title'], 'app_id' => $detail['app_id'], 'developer' => $detail['developer'], 'developer_id' => $detail['developer_id'], 'image' => $detail['image'], 'rating_width' => $detail['rating_width']);
}
function get_recent_download_all()
{
if (check_license()) {
$file = BASE . '/contents/cache/recent-download.json';
if (file_exists($file)) {
}
}
$recent_download = file_get_contents($file);
if ($recent_download) {
}
return $recent_download;
}
function build_download_link($url)
{
if (check_license()) {
$dl = check_license();
$dl_exp = check_license();
$dl_q = check_license();
}
$q['_fn'] = base64_encode(str_replace('apkpure.com', get_option('apk_name'), base64_decode($q['_fn'])));
unset($q['_p']);
unset($q['c']);
$link = $dl_exp['scheme'] . '://' . $dl_exp['host'] . $dl_exp['path'] . '?' . http_build_query($q);
return $link;
}
function detect_browser()
{
if (check_license()) {
if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false) {
return 'Internet explorer';
if (strpos($_SERVER['HTTP_USER_AGENT'], 'Trident') !== false) {
return 'Internet explorer';
if (strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox') !== false) {
return 'Mozilla Firefox';
if (strpos($_SERVER['HTTP_USER_AGENT'], 'Chrome') !== false) {
return 'Google Chrome';
if (strpos($_SERVER['HTTP_USER_AGENT'], 'Opera Mini') !== false) {
return 'Opera Mini';
if (strpos($_SERVER['HTTP_USER_AGENT'], 'Opera') !== false) {
return 'Opera';
}
}
}
else {
}
}
}
else {
return 'Google Chrome';
return 'Opera Mini';
}
}
}
else {
return 'Google Chrome';
return 'Opera Mini';
return 'Opera';
}
if (strpos($_SERVER['HTTP_USER_AGENT'], 'Safari') !== false) {
return 'Safari';
return 'Something else';
}
}
function curl($url)
{
if (check_license()) {
$ch = check_license();
}
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, check_license(), 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept-Language: en-US;q=0.6,en;q=0.4'));
curl_setopt($ch, CURLOPT_REFERER, 'https://apkpure.com');
$data = CURLOPT_FOLLOWLOCATION;
curl_close($ch);
return $data;
}
?>