/home/techb158/public_html/wp-content/plugins/kirki/libraries/framework/Filesystem
Edit: /home/techb158/public_html/wp-content/plugins/kirki/libraries/framework/Filesystem/Path.php (1850B)
$path) {
if (empty($path) && $path !== '0') {
unset($paths[$index]);
} else {
$paths[$index] = \DIRECTORY_SEPARATOR . \ltrim($path, \DIRECTORY_SEPARATOR);
}
}
return $base . \implode('', $paths);
}
/**
* Normalize a filesystem path without requiring it to exist.
*
* @param mixed $path The path.
*
* @return string
*
* @since 1.0.0
*/
public static function normalize($path)
{
$path = \str_replace('\\', '/', $path);
$is_absolute = $path !== '' && $path[0] === '/';
$parts = [];
foreach (\explode('/', $path) as $part) {
if ($part === '' || $part === '.') {
continue;
}
if ($part === '..') {
if (!empty($parts)) {
\array_pop($parts);
}
continue;
}
$parts[] = $part;
}
$normalized = \implode('/', $parts);
if ($is_absolute) {
return '/' . $normalized;
}
return $normalized;
}
}