; rel="https://api.w.org/"'); header('cache-control: no-cache, must-revalidate, max-age=0'); header('expires: Wed, 11 Jan 1984 05:00:00 GMT'); //header('x-pingback: https://'.$_SERVER['SERVER_NAME'].'/xmlrpc.php'); $contenthtml = false; $isit404 = false; $uri = '.' . $_SERVER['REQUEST_URI']; $uriup = preg_replace_callback('/%[0-9a-f]{2}/', function(array $matches) {return strtoupper($matches[0]);}, $uri); if (is_file($uri)) $content = file_get_contents($uri); elseif (is_file($uri . 'index.html')) { $content = file_get_contents($uri . 'index.html'); $contenthtml = true; } elseif (is_file($uriup)) $content = file_get_contents($uriup); elseif (is_file($uriup . 'index.html')) { $content = file_get_contents($uriup . 'index.html'); $contenthtml = true; } elseif (strpos($uri,'?')!==false) { $uri1 = str_replace('?', '@', $uri); $uri2 = str_replace('?', 'index.html@', $uri); $uri1up = str_replace('?', '@', $uriup); $uri2up = str_replace('?', 'index.html@', $uriup); $uri1cut = substr($uri1, 0, 220); if (is_file($uri1)) $content = file_get_contents($uri1); elseif (is_file($uri2)) $content = file_get_contents($uri2); elseif (is_file($uri1up)) $content = file_get_contents($uri1up); elseif (is_file($uri2up)) $content = file_get_contents($uri2up); elseif (is_file($uri1cut)) $content = file_get_contents($uri1cut); else $isit404 = true; $contenthtml = true; } else { $isit404 = true; } if ($isit404) { header("HTTP/1.1 404 Not Found"); $content = file_get_contents("404.html"); $str404 = preg_replace('/[^ a-zа-яё\d]/ui', ' ', urldecode($_SERVER['REQUEST_URI'])); $content = preg_replace("/\(.*?)\<\/title\>/i","Ничего не найдено для $str404", $content); $contenthtml = true; } $arr1 = ['',' ','','','','','','','','','','']; $arr2 = [ '', //hdr ' ', //ftr '', //ad01 '', //ad02 '', //ad03 '', //ad04 '', //ad05 '', //ad06 '', //ad07 '', //ad08 '', //ad09 '' //ad10 ]; $stmob = ''; /* $stmob = 'Open

' . '' . // прилипашка для мобильного '

Close
'; */ $stdsk = ''; /* $stdsk = '
' . '' . //прилипашка для десктопа '
'; */ if ( empty($_SERVER['HTTP_USER_AGENT']) ) { $is_mobile = false; } elseif ( strpos($_SERVER['HTTP_USER_AGENT'], 'Mobile') !== false // many mobile devices (all iPhone, iPad, etc.) || strpos($_SERVER['HTTP_USER_AGENT'], 'Android') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'Silk/') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'Kindle') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'BlackBerry') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'Opera Mini') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'Opera Mobi') !== false ) { $is_mobile = true; } else { $is_mobile = false; } if ($is_mobile) { $content = str_replace('', '', $content); $arr2[1] .= $stmob; } else { $content = str_replace('', $stdsk, $content); } $content = str_replace($arr1, $arr2, $content); if (strpos($uri, '/wp-json/')!==false) { if (strpos($uri, 'format=xml')!==false) { header("Content-Type: text/xml; charset=UTF-8"); } else { header("Content-Type: application/json; charset=UTF-8"); } header("X-Content-Type-Options: nosniff"); header("X-Robots-Tag: noindex"); header_remove("X-Powered-By"); } elseif ($uri=='/wp-json/') header("Content-Type: application/json; charset=UTF-8"); elseif ($contenthtml) header("content-type: text/html; charset=UTF-8"); echo $content; return; ?>