public static correctPath ( string $path ) : string | ||
$path | string | |
return | string |
public static function correctPath($path)
{
// remove trailing slash
if ($path != "/") {
$path = rtrim($path, "/ ");
}
// correct wrong path (root-node problem)
$path = str_replace("//", "/", $path);
if (strpos($path, "%") !== false) {
$path = rawurldecode($path);
}
return $path;
}
/** * @static * @param $path * @return bool */ public static function pathExists($path, $type = null) { $path = Element\Service::correctPath($path); try { $object = new AbstractObject(); if (\Pimcore\Tool::isValidPath($path)) { $object->getDao()->getByPath($path); return true; } } catch (\Exception $e) { } return false; }