Automattic\WooCommerce\Internal\Font
FontFace::download_file()
Method of the class: FontFace{}
No Hooks.
Return
null
. Nothing (null).
Usage
$result = FontFace::download_file( $file_url );
- $file_url (required)
- -
FontFace::download_file() FontFace::download file code WC 9.3.3
private static function download_file( $file_url ) { if ( ! function_exists( 'download_url' ) ) { require_once ABSPATH . 'wp-admin/includes/file.php'; } $allowed_extensions = array( 'ttf', 'otf', 'woff', 'woff2', 'eot' ); $allowed_extensions = array_map( 'preg_quote', $allowed_extensions ); // Set variables for storage, fix file filename for query strings. preg_match( '/[^\?]+\.(' . implode( '|', $allowed_extensions ) . ')\b/i', $file_url, $matches ); $file_array = array(); $file_array['name'] = wp_basename( $matches[0] ); // Download file to temp location. $file_array['tmp_name'] = download_url( $file_url ); return $file_array; }