/** * * @param array[int]string $match * @return string * */ private function _filter($match) { $attribute = $match[1]; $open_quote = $match[2]; $prefix = $match[3]; $link = $match[4]; $extension = $match[5]; $params = $match[6]; $close_quote = $match[7]; $location = null; if (self::$ajax && $extension === "js") { return $match[0]; } //if(preg_match("/^background/i", $attribute)) // $proto = self::$proto."://"; //else $proto = "//"; foreach (self::$config->getLocations() as $location) { /* @var CBitrixCloudCDNLocation $location */ if ($location->getProto() === self::$proto) { $server = $location->getServerNameByPrefixAndExtension($prefix, $extension, $link); if ($server !== "") { $filePath = $prefix . $link . $extension; if ($params === '') { $filePath = CUtil::GetAdditionalFileURL($filePath); } //Fix spaces in the link $link = str_replace(" ", "%20", $link); return $attribute . $open_quote . $proto . $server . $filePath . $params . $close_quote; } } } return $match[0]; }
/** * * @param array[int]string $match * @return string * */ private function _filter($match) { $attribute = $match[1]; $open_quote = $match[2]; $prefix = $match[3]; $link = $match[4]; $extension = $match[5]; $params = $match[6]; $close_quote = $match[7]; $location = null; if (self::$ajax && $extension === "js") { return $match[0]; } //if(preg_match("/^background/i", $attribute)) // $proto = self::$proto."://"; //else $proto = "//"; foreach (self::$config->getLocations() as $location) { if ($location->getProto() === self::$proto) { $server = $location->getServerNameByPrefixAndExtension($prefix, $extension, $link); if ($server !== "") { if ($params === '"') { if (file_exists($_SERVER["DOCUMENT_ROOT"] . $prefix . $link . $extension)) { $params = "?" . filemtime($_SERVER["DOCUMENT_ROOT"] . $prefix . $link . $extension) . $params; } } //Fix spaces in the link $link = str_replace(" ", "%20", $link); return $attribute . $open_quote . $proto . $server . $prefix . $link . $extension . $params . $close_quote; } } } return $match[0]; }