= $dateiTIME_diff) { $amp_status_cache = false ; } else { $amp_status_cache = true ; } } else { $amp_status_cache = false ; } } else { // Status setzen DIR $amp_status_dir = false ; $amp_status_datei = false ; $amp_status_dtime = false ; $amp_status_cache = false ; // Cache Ordner anlegen mkdir("".$urlCACHEfolder.""); // Nochmal prüfen goto checkdir ; } } else { // Status setzen DIR $amp_status_dir = false ; $amp_status_datei = false ; $amp_status_dtime = false ; $amp_status_cache = false ; } // Cache Datei ausgeben oder URL neu von amp-cloud.de abrufen if($amp_status_cache === true) { // AMP-Cache-Datei ausgeben echo "".file_get_contents("".$urlCACHEdatei."").""; } else { // AMP-Seite von AMP-Cloud.de laden und ausgeben // amp-cloud.de AMP-HTML-Adresse $ampcloud_url = "https://www.amp-cloud.de/amp/amp-plus.php?s=".urlencode("".$urlARTIKEL."").""; // amp-cloud.de Abfrage ini_set("max_execution_time", 300); //echo "
".$ampcloud_url."
".amp_cloud_get_urlaktuell()."
"; //exit; if(function_exists("curl_version")) { $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $ampcloud_url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); $amp_quelltext = curl_exec($curl); curl_close($curl); echo "".$amp_quelltext.""; } if(empty("".$amp_quelltext."")) { $amp_quelltext = file_get_contents("".$ampcloud_url.""); echo "".$amp_quelltext.""; } if(empty("".$amp_quelltext."")) { echo "Please try again in a few minutes!"; } // Aktuelle Version (neu) im Cache speichern if( $amp_status_dir === true AND $amp_status_cache === false AND !empty("".$amp_quelltext."")) { // Prüfen, ob Quellcode AMPHTML von amp-cloud.de ist $searchAMPverification = stripos("".$amp_quelltext."", "ampcloud-site-verification"); if($searchAMPverification !== false) { file_put_contents("".$urlCACHEdatei."", "".$amp_quelltext.""); } } } // Alte Cache-Dateien löschen // Check-Data $urlCHECK_absolute = "".__DIR__."/temp_check_last_cachedatei.txt"; // Prüfen wann alte Cache-Dateien zu letzt gecheckt/gelöscht wurden if(file_exists("".$urlCHECK_absolute."")) { $zeitJEZTZ = time(); $zeitLAST = trim(file_get_contents("".$urlCHECK_absolute."")); $zeitDIFFmax = ( 60 * 60 * 1 ) ; // in Sekunden (jede Stunde) //$zeitDIFFmax = ( 60 * 60 * 24 ) ; // in Sekunden (einmal am Tag) $zeitDIFFist = ( $zeitJEZTZ - $zeitLAST ) ; if($zeitDIFFist >= $zeitDIFFmax) { $delSTATUS = true ; } else { $delSTATUS = false ; } } else { $delSTATUS = true ; } // Alte Cache-Datein löschen if($delSTATUS === true) { $cachefiles = glob("".$urlCACHEfolder."*"); $cachetime_jetzt = time(); $cachetime_diff = ( 60 * 60 * 24 * 1 ); // in Seunden (1 Tag) //$cachetime_diff = ( 60 * 60 * 24 * 7 ); // in Seunden (7 Tage) foreach($cachefiles AS $cachefileIST) { if(is_file("".$cachefileIST."")) { if( ($cachetime_jetzt - filemtime("".$cachefileIST."")) >= $cachetime_diff ) { unlink("".$cachefileIST.""); } } } // Aktuelles Prüfdatum setzen file_put_contents("".$urlCHECK_absolute."", "".time().""); } // Script beenden exit ; } } // amphtml-Tag setzen --------------------------------------------------------------- function amp_cloud_insert_linkreltag() { if(is_single()) { // AMP-Cloud AMP-HTML-Adresse ------------------------------------------- $amp_url = "".amp_cloud_add_query_amp(amp_cloud_get_urlaktuell()).""; echo ""; } } /* // Ads.txt prüfen ------------------------------------------------------------------- function amp_cloud_check_adstxt() { // Check-Data $urlCHECK_absolute = "".__DIR__."/temp_check_last_ads.txt"; $urlADS_absolute = "".ABSPATH."ads.txt"; $searchSTRING = "pub-6257427840544279,"; // Prüfen wann zu letzt gecheckt wurde if(file_exists("".$urlCHECK_absolute."")) { $zeitJEZTZ = time(); $zeitLAST = trim(file_get_contents("".$urlCHECK_absolute."")); $zeitDIFFmax = ( 60 * 60 ) ; // in Sekunden $zeitDIFFist = ( $zeitJEZTZ - $zeitLAST ) ; if($zeitDIFFist >= $zeitDIFFmax) { $checkSTATUS = true ; } else { $checkSTATUS = false ; } } else { $checkSTATUS = true ; } // Ads.txt prüfen if($checkSTATUS === true) { // Check-Datum setzen file_put_contents("".$urlCHECK_absolute."", "".time().""); // Suche PUB ID if(file_exists("".$urlADS_absolute."")) { $adsCONTENT = file("".$urlADS_absolute."", FILE_SKIP_EMPTY_LINES); $adsCONTENT = array_reverse($adsCONTENT); foreach($adsCONTENT AS $zeile) { $searchFIND = stripos("".$zeile."", "".$searchSTRING.""); if($searchFIND !== false) { $searchSTATUS = true; break ; } else { $searchSTATUS = false; } } } else { $searchSTATUS = false; } // Setze PUB ID if($searchSTATUS === false) { $zeileADD = "google.com, ".$searchSTRING." RESELLER, f08c47fec0942fa0"; if(file_exists("".$urlADS_absolute."")) { if(function_exists("file_put_contents")) { $zeileADDSTATUS = file_put_contents("".$urlADS_absolute."", "\r\n".$zeileADD."\r\n", FILE_APPEND); } } else { //$zeileADDSTATUS = file_put_contents("".$urlADS_absolute."", "\r\n".$zeileADD."\r\n"); } } } } // Ads.txt Prüfung ausführen amp_cloud_check_adstxt(); */ // WordPress Befehle ---------------------------------------------------------------------------------------------------------------------- add_action( 'template_redirect', 'amp_cloud_plugin_preview', 0 ); add_action( 'wp_head', 'amp_cloud_insert_linkreltag', 1 ); ?>