Validates a path

@param string $path path

@return bool
197501
protected function validatePath($path)
    {
        if (empty($path)) {
            return false;
        }

        // we are always operating from root directory
        // so forbid relative paths
        if (false !== strpos($path, '..')) {
            return false;
        }

        return true;
    }
111167
public function validatePath($path = null)
    {
        if ($path === null) {
            $path = $this->_path;
        }

        // If the path is empty, then it is considered valid
        if (strlen($path) === 0) {
            return true;
        }

        // Determine whether the path is well-formed
        $pattern = '/^' . $this->_regex['path'] . '$/';
        $status  = @preg_match($pattern, $path);
        if ($status === false) {
            require_once 'Zend/Uri/Exception.php';
            throw new Zend_Uri_Exception('Internal error: path validation failed');
        }

        return (boolean) $status;
    }
1353980
public function validate_path( $path ) {
		$result = null;

		$path = (string) $path;

		// Empty values are not valid.
		if ( empty( $path ) ) {
			return 'Empty path is not allowed';
		}

		// Path must not end in slash.
		// As per https://codex.wordpress.org/Function_Reference/register_theme_directory .
		if ( DIRECTORY_SEPARATOR === substr( $path, -1, 1 ) ) {
			return "Path ends in slash [$path]";
		}

		return $result;
	}
327152
private static function checkSavePath($path) {
            if (is_string($path)) {
                $dir = dirname($path);

                return file_exists($dir) && is_writeable($dir);
            } elseif (is_resource($path)) {
                return true;
            }

            return false;
        }
671326
protected function is_valid_path($path)
	{
		if(strpos($path, $this->rootWrapperPath) !== 0) {
			return false;
		}

		$needleList = ['..', './'];
		foreach($needleList as $needle) {
			if (strpos($path, $needle) !== false) {
				return false;
			}
		}

		return true;
	}
471543
private function checkPathPatterns($path)
    {
        foreach ($this->pathPatterns as $pattern) {
            if (preg_match('/^' . $pattern . '$/D', $path)) {
                return true;
            }
        }

        return false;
    }
1208640
public static function checkFolderPath($path){
      $path = substr($path,strpos($path,'/')+1);
      $path = explode('/',trim($path,'/'));
        foreach ( $path as $dir ){
          if ( !empty($dir) && !CKFinder_Connector_Utils_FileSystem::checkFolderName($dir) ){
            return false;
          }
        }

        return true;
    }
1273136
private function validateExcludeRegex(string $path): bool
    {
        $excludeRegex = $this->config->getExcludeRegex();
        return $excludeRegex === null || Validator::regex($excludeRegex)->validate($path) !== true;
    }
1032123
protected function isLocalPath(string $path): bool
    {
        if (Str::startsWith($path, ['https://', 'http://', '//'])) {
            return false;
        }

        return \filter_var($path, FILTER_VALIDATE_URL) === false;
    }
185393
public static function is_absolute($path)
    {
        if (empty($path)) {
            return false;
        }
        if ($path[0] == '/' || $path[0] == '\\') {
            return true;
        }
        return preg_match('/^[a-zA-Z]:[\\\\\/]/', $path) == 1;
    }
31342
public function checkIsHiddenPath($path)
    {
        $_clientPathParts = explode("/", trim($path, "/"));
        if ($_clientPathParts) {
            foreach ($_clientPathParts as $_part) {
                if ($this->checkIsHiddenFolder($_part)) {
                    return true;
                }
            }
        }

        return false;
    }
927337
public function matchesPath($path)
    {
        if ($this->_data['path'] === '/' || $this->_data['path'] === $path) {
            return true;
        }

        if (strpos($path, $this->_data['path']) !== 0) {
            return false;
        }

        if (substr($this->_data['path'], -1, 1) === '/') {
            return true;
        }

        return substr($path, strlen($this->_data['path']), 1) === '/';
    }
1132009
public static function isAbsolute($path)
    {
        if ('' === $path) {
            return false;
        }

        Assert::string($path, 'The path must be a string. Got: %s');

        // Strip scheme
        if (false !== ($pos = strpos($path, '://'))) {
            $path = substr($path, $pos + 3);
        }

        // UNIX root "/" or "\" (Windows style)
        if ('/' === $path[0] || '\\' === $path[0]) {
            return true;
        }

        // Windows root
        if (strlen($path) > 1 && ctype_alpha($path[0]) && ':' === $path[1]) {
            // Special case: "C:"
            if (2 === strlen($path)) {
                return true;
            }

            // Normal case: "C:/ or "C:\"
            if ('/' === $path[2] || '\\' === $path[2]) {
                return true;
            }
        }

        return false;
    }
829436
private static function isAbsolute($path)
    {
        $path = trim($path);

        if ($path === '') {
            return false;
        }

        $length = strcspn($path, '/\\');

        return $length === 0 || $path[$length - 1] === ':';
    }
697895
private function validatePath($path)
    {
        if (is_readable($path) && is_writable($path)) {
            return true;
        }

        throw new InvalidArgumentException(sprintf('Invalid path "%s".', $path));

    }
811666
private function validatePath($path)
    {
        $last = strlen($path)-1;
        if ($path[$last] == '/') {
            $path = substr($path, 0, -1);
        }
        return $path;
    }
746424
public function validate(): bool
    {
        $valid = true;
        $this->_errors = [];
        foreach ($this->_paths as $key => $path) {
            if ($path === null) {
                continue;
            }
            if (!$path->validate()) {
                $valid = false;
            }
            if (strpos($key, '/') !== 0) {
                $this->_errors[] = "Path must begin with /: $key";
            }
        }
        return $valid && empty($this->_errors);
    }