Collections functions
Encryption functions
General functions
Render functions
Theme permission functions
Video functions
Resource functions

safe_file_name()

Parameters

ColumnTypeDefaultDescription
$name

Location

include/file_functions.php lines 8 to 28

Definition

 
function safe_file_name($name)
    {
    
// Returns a file name stripped of all non alphanumeric values
    // Spaces are replaced with underscores
    
$alphanum 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-';
    
$name str_replace(' ''_'$name);
    
$newname '';

    for(
$n 0$n strlen($name); $n++)
        {
        
$c substr($name$n1);
        if(
strpos($alphanum$c) !== false)
            {
            
$newname .= $c;
            }
        }

    
$newname mb_substr($newname050);

    return 
$newname;
    }

This article was last updated 26th November 2020 03:35 Europe/London time based on the source file dated 13th November 2020 16:50 Europe/London time.