Security Helper

The Security Helper file contains security related functions.

Loading this Helper

This helper is loaded using the following code:

  1. helper('security');

Available Functions

The following functions are available:

  • sanitizefilename($filename_)

Parameters:

  • $filename (string) – FilenameReturns:Sanitized file nameReturn type:string

Provides protection against directory traversal.

This function is an alias for \CodeIgniter\Security::sanitize_filename().For more info, please see the Security Librarydocumentation.

  • stripimage_tags($str_)

Parameters:

  • $str (string) – Input stringReturns:The input string with no image tagsReturn type:string

This is a security function that will strip image tags from a string.It leaves the image URL as plain text.

Example:

  1. $string = strip_image_tags($string);
  • encodephp_tags($str_)

Parameters:

  • $str (string) – Input stringReturns:Safely formatted stringReturn type:string

This is a security function that converts PHP tags to entities.

Example:

  1. $string = encode_php_tags($string);