Collections functions
General functions
Node functions
Render functions
Theme permission functions
User functions
Resource functions

is_banned_extension()

Description

Is the given extension in the list of blocked extensions?
Also ensures extension is no longer than 10 characters due to resource.file_extension database column limit

Parameters

ColumnTypeDefaultDescription
$extension: string
10}$/'
$extension string - file extension to check
array_map'mb_strtolower'
$GLOBALS['banned_extensions'] ""

Location

include/file_functions.php lines 249 to 255

Definition

 
function is_banned_extension(string $extension): bool
{
    return !(
        
preg_match('/^[a-zA-Z0-9_-]{1,10}$/'$extension) === 1
        
&& !in_array(mb_strtolower($extension), array_map('mb_strtolower'$GLOBALS['banned_extensions']))
    );
}

This article was last updated 18th May 2024 21:35 Europe/London time based on the source file dated 17th May 2024 11:30 Europe/London time.