WC_Download_Handler::derive_filename_from_file_path │ private static │ WC 1.0

Derive a download filename from the file path or URL it will be served from.

Method of the class: WC_Download_Handler{}

No Hooks.

Returns

string.

Usage

$result = WC_Download_Handler::derive_filename_from_file_path( $file_path );
$file_path(string) (required)
File path or URL.

WC_Download_Handler::derive_filename_from_file_path() code WC 11.1.2

private static function derive_filename_from_file_path( $file_path ) {
	$filename = basename( $file_path );

	if ( strstr( $filename, '?' ) ) {
		$filename = current( explode( '?', $filename ) );
	}

	return $filename;
}