CBitrixCloudCDN :: _filter: Bitrix method

      
<?php 
//  CBitrixCloudCDN :: _filter()
//  /dist/bitrix/modules/bitrixcloud/classes/general/cdn.php:308

    
private static 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 /*.(CBitrixCloudCDNLocation).*/ 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];
    }