Table of Contents

clean

API Package Subpackage Class Method Reference Last reviewed Doc status
API Home Package Joomla.Framework Subpackage FileSystem Class JPath Method clean Reference clean() Never Work in Progress

This method strips additional / or \ in a path name. It can also add a trailing slash if desired. It will also change the slashes to the system appropriate folder separator (eg. \ on Microsoft Windows systems, but / on Unix systems).

Syntax

string clean ( $p_path, $p_addtrailingslash )

$p_path string is a string containing the path to clean.
$p_addtrailingslash boolean is a flag which specifies whether the method should add a trailing slash. This parameter is optional and if omitted defaults to true.

Examples

Example

jimport( 'joomla.filesystem.path' );

echo "Cleaned path: " . JPath::clean( '//..//..//..\\test.html' );

might produce:

Result

Cleaned path: \..\..\..\test.html\