WC_Download_Handler::derive_filename_from_file_path
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() 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;
}