25 public static function path($str)
28 $str = preg_replace_callback(
'#<script[^<>]+src\s*=\s*(\'|")([^/]+[^\'"]+)(\'|")[^>]*>#',
function ($matches) use ($assets_path) {
29 if (preg_match(
'#^http(s|):#', $matches[2]) || strlen($matches[0]) > 500)
return $matches[0];
30 return str_replace($matches[2], $assets_path . $matches[2] .
'?' . filemtime(
$_SERVER[
'DOCUMENT_ROOT'] . $assets_path . $matches[2]), $matches[0]);
32 $str = preg_replace_callback(
'#<img[^<>]+src\s*=\s*(\'|")([^/]+[^\'"]+)(\'|")[^>]*>#',
function ($matches) use ($assets_path) {
33 if (preg_match(
'#^http(s|):#', $matches[2]) || strlen($matches[0]) > 500)
return $matches[0];
34 return str_replace($matches[2], $assets_path . $matches[2] .
'?' . filemtime(
$_SERVER[
'DOCUMENT_ROOT'] . $assets_path . $matches[2]), $matches[0]);
36 $str = preg_replace_callback(
'#<link[^<>]+href\s*=\s*(\'|")([^/]+[^\'"]+)(\'|")[^>]*>#',
function ($matches) use ($assets_path) {
37 if (preg_match(
'#^http(s|):#', $matches[2]) || strlen($matches[0]) > 500)
return $matches[0];
38 return str_replace($matches[2], $assets_path . $matches[2] .
'?' . filemtime(
$_SERVER[
'DOCUMENT_ROOT'] . $assets_path . $matches[2]), $matches[0]);
40 $str = preg_replace_callback(
'#<a[^<>]+href\s*=\s*(\'|")([^/]+[^\'"]+\.(jpg|png|jpeg))(\'|")[^>]*>#',
function ($matches) use ($assets_path) {
41 if (preg_match(
'#^http(s|):#', $matches[2]) || strlen($matches[0]) > 500)
return $matches[0];
42 return str_replace($matches[2], $assets_path . $matches[2] .
'?' . filemtime(
$_SERVER[
'DOCUMENT_ROOT'] . $assets_path . $matches[2]), $matches[0]);
44 $str = preg_replace_callback(
'#<[^<>]+background-image:\s*url\(([^\(\)]+)\);[^<>]*>#',
function ($matches) use ($assets_path) {
45 if (preg_match(
'#^http(s|):#', $matches[1]) || strlen($matches[0]) > 500)
return $matches[0];
46 return str_replace($matches[1], $assets_path . $matches[1] .
'?' . filemtime(
$_SERVER[
'DOCUMENT_ROOT'] . $assets_path . $matches[1]), $matches[0]);
48 $str = preg_replace_callback(
'#<[^<>]+background-image:\s*url\("([^\(\)"]+)"\);[^<>]*>#',
function ($matches) use ($assets_path) {
49 if (preg_match(
'#^http(s|):#', $matches[1]) || strlen($matches[0]) > 500)
return $matches[0];
50 return str_replace($matches[1], $assets_path . $matches[1] .
'?' . filemtime(
$_SERVER[
'DOCUMENT_ROOT'] . $assets_path . $matches[1]), $matches[0]);
52 $str = preg_replace_callback(
'#<[^<>]+background-image:\s*url\(\'([^\(\)\']+)\'\);[^<>]*>#',
function ($matches) use ($assets_path) {
53 if (preg_match(
'#^http(s|):#', $matches[1]) || strlen($matches[0]) > 500)
return $matches[0];
54 return str_replace($matches[1], $assets_path . $matches[1] .
'?' . filemtime(
$_SERVER[
'DOCUMENT_ROOT'] . $assets_path . $matches[1]), $matches[0]);
56 $str = preg_replace_callback(
'#<[^<>]+data-setbg="([^\(\)"]+)"[^<>]*>#',
function ($matches) use ($assets_path) {
57 if (preg_match(
'#^http(s|):#', $matches[1]) || strlen($matches[0]) > 500)
return $matches[0];
58 return str_replace($matches[1], $assets_path . $matches[1] .
'?' . filemtime(
$_SERVER[
'DOCUMENT_ROOT'] . $assets_path . $matches[1]), $matches[0]);
Assets класс преобразует относительные пути в шаблонах
setcookie('FROM_UID', $uid, [ 'expires'=> time()+31536000, 'path'=> '/', 'domain'=> $_SERVER['HTTP_HOST'], 'secure'=> Wrong\Start\Env::$e->IS_SECURE, 'httponly'=> false, 'samesite'=> Wrong\Start\Env::$e->IS_SECURE ? 'None' :'Lax']) or setcookie('FROM_UID' $_SERVER['HTTP_HOST']