Lines Matching refs:path

11  * A dokuwiki path has the same structure than a windows path with a drive and a path
13 * The drive being a local path on the local file system
15 * Ultimately, this path is the application path and should be used everywhere.
24 * A Wiki Path can be just a wrapper around every local path)
80 const CANONICAL = "wiki-path";
90 * @var string the path id passed to function (cleaned)
110 * @var string - the absolute path (we use it for now to handle directory by adding a separator at the end)
117 * A path for the Dokuwiki File System
119 * @param string $path - the path (may be relative)
123 * Thee path should be a qualified/absolute path because in Dokuwiki, a link to a {@link MarkupPath}
132 protected function __construct(string $path, string $drive, string $rev = null)
139 * the path may be not normalized
141 $path = self::normalizeWikiPath($path);
143 if (trim($path) === "") {
145 $path = WikiPath::getContextPath()->toAbsoluteId();
147 throw new ExceptionRuntimeInternal("The context path is unknwon. The empty path string needs it.");
154 $this->absolutePath = $path;
155 $firstCharacter = substr($path, 0, 1);
157 $parts = preg_split('/' . WikiPath::NAMESPACE_SEPARATOR_DOUBLE_POINT . '/', $path);
165 // Root case: the relative path is in the root
167 LogUtility::error("The current relative path ({$this->absolutePath}) returns an error: {$e->getMessage()}", self::CANONICAL);
179 LogUtility::error("The parent relative path ({$this->absolutePath}) returns an error: {$e->getMessage()}", self::CANONICAL);
186 * just a relative name path
192 // is relative directory path ?
220 $lastPosition = StringUtility::lastIndexOf($path, ".");
251 * For a Markup drive path, a file path should have an extension
256 * @param string $parameterPath - the path in a wiki form that may be relative - if the path is blank, it's the current markup (the requested markup)
258 * @return WikiPath - the wiki path
259 * @throws ExceptionBadArgument - if a relative path is given and the context path does not have any parent
272 * Not a relative path
277 * A relative path
287 throw new ExceptionBadArgument("The context path ($contextPath) does not have a grand parent, therefore the relative path ($parameterPath) is invalid.", $e);
296 LogUtility::internalError("A context path is a page and should therefore have a parent", $e);
344 * Return the non-existen default wiki path
352 static function createMediaPathFromPath($path, $rev = null): WikiPath
354 return new WikiPath($path, WikiPath::MEDIA_DRIVE, $rev);
374 * @param $url - a URL path http://whatever/hello/my/lord (The canonical)
420 * Return an path from a id
431 function toDokuWikiIdDriveContextual($path): string
436 $id = self::removeRootSepIfPresent($path);
487 $path = $pathAndDrive;
501 $path = substr($pathAndDrive, $locationGreaterThan + 1);
503 return new WikiPath(":$path", $drive, $rev);
519 * it's added (ie to transform an id to a path)
520 * @param string $path
523 static function addRootSeparatorIfNotPresent(string &$path)
525 $firstCharacter = substr($path, 0, 1);
527 $path = WikiPath::NAMESPACE_SEPARATOR_DOUBLE_POINT . $path;
533 * @return string - a dokuwiki path (replacing the windows or linux path separator to the dokuwiki separator)
543 * @param $path - a manual path value
544 * @return string - a valid path
547 static function toValidAbsolutePath($path): string
549 $path = cleanID($path);
550 WikiPath::addRootSeparatorIfNotPresent($path);
551 return $path;
564 * @param $path - relative or absolute path
570 static function createWikiPath($path, $drive, string $rev = ''): WikiPath
572 return new WikiPath($path, $drive, $rev);
598 * @throws ExceptionBadArgument - if the path is not a local path or is not in a known drive
601 static function createFromPathObject(Path $path): WikiPath
603 if ($path instanceof WikiPath) {
604 return $path;
606 if (!($path instanceof LocalPath)) {
607 throw new ExceptionBadArgument("The path ($path) is not a local path and cannot be converted to a wiki path");
614 $relativePath = $path->relativize($drivePath);
618 * (not the path)
625 $relativePath = $path->relativize($drivePath);
627 // not a relative path
632 if (FileSystems::isDirectory($path)) {
639 throw new ExceptionBadArgument("The local path ($path) is not inside a wiki path drive");
660 * Wiki path system cannot make the difference between a txt file
692 throw new ExceptionBadSyntax("The path ($namespacePath) is not a namespace path");
697 * Add a end separator to the wiki path to pass the fact that this is a directory/namespace
712 * @param string $path - path or id
718 static function createFromPath(string $path, string $drive, string $rev = null): WikiPath
720 return new WikiPath($path, $drive, $rev);
740 * as an {@link WikiPath::getWikiId() id} is a validated absolute path without root character
755 * @param $path
756 * @return string with the root path
759 static function removeRootSepIfPresent($path): string
761 $id = $path;
770 * The last part of the path
782 throw new ExceptionNotFound("This path ($this) does not have any last name");
795 * Case of only one string without path separator
839 * with id of the form :path:*
854 * @return string - the wiki id is the absolute path
861 * The id is a validated absolute path without any root character.
916 * @throws ExceptionNotFound - if the revision is not set and the path does not exist
934 * This is the local absolute path WITH the root separator.
969 * Return the path relative to the base directory
1013 * The absolute path for a wiki path
1028 * The parent path is a directory (namespace)
1029 * The root path throw an errors
1042 throw new ExceptionNotFound("The path `{$this}` does not have any parent");
1047 $path = implode(WikiPath::NAMESPACE_SEPARATOR_DOUBLE_POINT, $names);
1054 $path = "$sep$path$sep";
1055 return new WikiPath($path, $this->drive, $this->rev);
1083 // Directory path have already separator at the end, don't add it
1085 $path = $this->absolutePath . WikiPath::NAMESPACE_SEPARATOR_DOUBLE_POINT . $name;
1087 $path = $this->absolutePath . $name;
1089 return new WikiPath($path, $this->getDrive());
1144 * File path
1190 LogUtility::internalError("For a markup path file, the extension should have been set. This is not the case for ($this)");
1217 throw new ExceptionCast("The drive ($this->drive) is unknown, the local file system path could not be found");