summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2018-10-09 20:50:37 +0200
committerGitHub <noreply@github.com>2018-10-09 20:50:37 +0200
commita9f4817b652b636a3b2f8c11b2a3e7526e0be82d (patch)
tree821152e474441aa59c8f4f476bdf91d8e4601fa0 /lib/private
parentab3599155f9b51cc17fca188f48269aeb44f9462 (diff)
parentc97b4274ccdc4fa841b164dedb608fdf351a0412 (diff)
downloadnextcloud-server-a9f4817b652b636a3b2f8c11b2a3e7526e0be82d.tar.gz
nextcloud-server-a9f4817b652b636a3b2f8c11b2a3e7526e0be82d.zip
Merge pull request #11622 from nextcloud/feature/11617
Add function to generate urls for OCS routes
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/URLGenerator.php13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/private/URLGenerator.php b/lib/private/URLGenerator.php
index 6f4f869238c..f4a83138e4c 100644
--- a/lib/private/URLGenerator.php
+++ b/lib/private/URLGenerator.php
@@ -91,6 +91,19 @@ class URLGenerator implements IURLGenerator {
return $this->getAbsoluteURL($this->linkToRoute($routeName, $arguments));
}
+ public function linkToOCSRouteAbsolute(string $routeName, array $arguments = []): string {
+ $route = \OC::$server->getRouter()->generate('ocs.'.$routeName, $arguments, false);
+
+ if (strpos($route, '/index.php') === 0) {
+ $route = substr($route, 10);
+ }
+
+ $route = substr($route, 7);
+ $route = '/ocs/v2.php' . $route;
+
+ return $this->getAbsoluteURL($route);
+ }
+
/**
* Creates an url
* @param string $app app