Changeset 49198
- Timestamp:
- 10/18/2020 09:04:33 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/media.php
r49193 r49198 981 981 if ( ! empty( $file ) ) { 982 982 983 $allowed_extensions = array( 'jpg', 'jpeg', 'jpe', 'png', 'gif' ); 984 985 /** 986 * Filters the list of allowed file extensions when sideloading an image from a URL. 987 * 988 * The default allowed extensions are: 989 * 990 * - `jpg` 991 * - `jpeg` 992 * - `jpe` 993 * - `png` 994 * - `gif` 995 * 996 * @since 5.6.0 997 * 998 * @param string[] $allowed_extensions Array of allowed file extensions. 999 * @param string $file The URL of the image to download. 1000 */ 1001 $allowed_extensions = apply_filters( 'image_sideload_extensions', $allowed_extensions, $file ); 1002 $allowed_extensions = array_map( 'preg_quote', $allowed_extensions ); 1003 983 1004 // Set variables for storage, fix file filename for query strings. 984 preg_match( '/[^\?]+\.( jpe?g|jpe|gif|png)\b/i', $file, $matches );1005 preg_match( '/[^\?]+\.(' . implode( '|', $allowed_extensions ) . ')\b/i', $file, $matches ); 985 1006 986 1007 if ( ! $matches ) {
Note: See TracChangeset
for help on using the changeset viewer.