JFolder/makeSafe: Difference between revisions
From Joomla! Documentation
m clean up |
m preparing for archive only |
||
| Line 42: | Line 42: | ||
===Examples=== | ===Examples=== | ||
=== Code Examples === | |||
<dpl> | <dpl> | ||
noresultsheader=\n | noresultsheader=\n | ||
category=makeSafe | category=makeSafe | ||
category=JFolder | category=JFolder | ||
namespace=CodeExample | |||
category=MethodExample | category=MethodExample | ||
include=* | include=* | ||
Latest revision as of 01:40, 25 March 2017
Description
Makes path name safe to use.
<! removed transcluded page call, red link never existed >
Syntax
makeSafe($path)
| Parameter Name | Default Value | Description |
|---|---|---|
| $path | The full path to sanitise. |
Returns
string The sanitised string.
Defined in
libraries/joomla/filesystem/folder.php
Importing
jimport( 'joomla.filesystem.folder' );
Source Body
function makeSafe($path)
{
//$ds = (DS == '\\') ? '\\' . DS : DS;
$regex = array('#[^A-Za-z0-9:_\\\/-]#');
return preg_replace($regex, '', $path);
}
<! removed transcluded page call, red link never existed >
Examples
Code Examples