Back to Folder class

Method makeSafe

public static string
makeSafe
(mixed $path)
Makes path name safe to use.
Parameters
  • string $path The full path to sanitise.
Returns
  • string The sanitised string.
Since
  • 1.7.0
Class: Folder
Project: Joomla

Method makeSafe - Source code

/**
 * Makes path name safe to use.
 *
 * @param   string  $path  The full path to sanitise.
 *
 * @return  string  The sanitised string.
 *
 * @since   1.7.0
 */
public static function makeSafe($path)
{
    $regex = array('#[^A-Za-z0-9_\\\\/\\(\\)\\[\\]\\{\\}\\#\\$\\^\\+\\.\'~`!@&=;,-]#');
    return preg_replace($regex, '', $path);
}