CodeIgniter v4.6 API

security_helper.php

This file is part of CodeIgniter 4 framework.

(c) CodeIgniter Foundation admin@codeigniter.com

For the full copyright and license information, please view the LICENSE file that was distributed with this source code.

Table of Contents

Functions

sanitize_filename()  : string
Sanitize Filename
strip_image_tags()  : string
Strip Image Tags
encode_php_tags()  : string
Convert PHP tags to entities

Functions

sanitize_filename()

Sanitize Filename

sanitize_filename(string $filename[, bool $relativePath = false ]) : string

Tries to sanitize filenames in order to prevent directory traversal attempts and other security threats, which is particularly useful for files that were supplied via user input.

If it is acceptable for the user input to include relative paths, e.g. file/in/some/approved/folder.txt, you can set the second optional parameter, $relativePath to TRUE.

Parameters
$filename : string

Input file name

$relativePath : bool = false

Whether to preserve paths

Return values
string

strip_image_tags()

Strip Image Tags

strip_image_tags(string $str) : string
Parameters
$str : string
Return values
string

encode_php_tags()

Convert PHP tags to entities

encode_php_tags(string $str) : string
Parameters
$str : string
Return values
string

        
On this page

Search results