Amazon_S3_And_CloudFront::decode_filename_in_path PHP Method

decode_filename_in_path() public method

Decode file name.
public decode_filename_in_path ( string $file ) : string
$file string
return string
    public function decode_filename_in_path($file)
    {
        $url = parse_url($file);
        if (!isset($url['path'])) {
            // Can't determine path, return original
            return $file;
        }
        $file_name = basename($url['path']);
        if (false === strpos($file_name, '%')) {
            // File name not encoded, return original
            return $file;
        }
        $decoded_file_name = rawurldecode($file_name);
        return str_replace($file_name, $decoded_file_name, $file);
    }
Amazon_S3_And_CloudFront