/** * * Returns the path relative to the FileSystemUtils::getPiolRootPath(). If the path is not child of FileSystemUtils::getPiolRootPath() * an exception in thrown. * * @param string $full_path The path to transform. * @return string the relative path. * @throws \Mbcraft\Piol\IOException If the path is not child of the FileSystemUtils::getPiolRootPath() * * @api */ public static function toRelativePath($full_path) { $full_path1 = str_replace(DS . "..", "", $full_path); //pulizia doppie barre dai percorsi $full_path2 = str_replace("//", DS, $full_path1); if (strpos($full_path2, FileSystemUtils::getPiolRootPath()) !== 0) { throw new IOException("Errore : il path non è relativo alla jail."); } else { $path1 = substr($full_path2, strlen(FileSystemUtils::getPiolRootPath()), strlen($full_path2) - strlen(FileSystemUtils::getPiolRootPath())); $path2 = str_replace("\\", DS, $path1); return $path2; } }