protected function up($path, $level = 1, $preserveTrailingSlash = false)
    {
        $postfix = '';

        if (substr($path, -1, 1) === DIRECTORY_SEPARATOR) {
            ++$level;
            if ($preserveTrailingSlash) {
                $postfix = DIRECTORY_SEPARATOR;
            }
        }

        $path = explode(DIRECTORY_SEPARATOR, $path);
        $path = array_slice($path, 0, count($path) - $level);

        return implode(DIRECTORY_SEPARATOR, $path).$postfix;
    }
protected function up($path, $level = 1, $preserveTrailingSlash = false)
    {
        $postfix = '';

        if (substr($path, -1, 1) === DIRECTORY_SEPARATOR) {
            ++$level;
            if ($preserveTrailingSlash) {
                $postfix = DIRECTORY_SEPARATOR;
            }
        }

        $path = explode(DIRECTORY_SEPARATOR, $path);
        $path = array_slice($path, 0, count($path) - $level);

        return implode(DIRECTORY_SEPARATOR, $path).$postfix;
    }
protected function up ( $ path , $ level = 1 , $ preserveTrailingSlash = false ) { $ postfix = '' ; if ( substr ( $ path , - 1 , 1 ) === DIRECTORY_SEPARATOR ) { ++ $ level ; if ( $ preserveTrailingSlash ) { $ postfix = DIRECTORY_SEPARATOR ; } } $ path = explode ( DIRECTORY_SEPARATOR , $ path ) ; $ path = array_slice ( $ path , 0 , count ( $ path ) - $ level ) ; return implode ( DIRECTORY_SEPARATOR , $ path ) . $ postfix ; }
Returns the path n levels up from input.

@param string $path                  Input path
@param int    $level                 Count of levels to move up
@param bool   $preserveTrailingSlash TRUE to preserve trailing slash if exist, FALSE to do not

@author Benjamin Carl <opensource@clickalicious.de>

@return string Path n level up
Returns the path n levels up from input .