diff options
author | Bart Visscher <bartv@thisnet.nl> | 2013-09-26 18:41:19 +0200 |
---|---|---|
committer | Bart Visscher <bartv@thisnet.nl> | 2013-10-04 18:11:02 +0200 |
commit | 61a9098b7d88656d0297a18c1b7685c04d1c64dc (patch) | |
tree | 085e22056dcf0bfdfd50468398bcdd367b8bd224 /lib/public | |
parent | ce9436c0518d8ce522646dde33dbac141cc35c46 (diff) | |
download | nextcloud-server-61a9098b7d88656d0297a18c1b7685c04d1c64dc.tar.gz nextcloud-server-61a9098b7d88656d0297a18c1b7685c04d1c64dc.zip |
Add Helper and URLGenerator interfaces to server container
Diffstat (limited to 'lib/public')
-rw-r--r-- | lib/public/ihelper.php | 23 | ||||
-rw-r--r-- | lib/public/iservercontainer.php | 10 | ||||
-rw-r--r-- | lib/public/iurlgenerator.php | 47 |
3 files changed, 80 insertions, 0 deletions
diff --git a/lib/public/ihelper.php b/lib/public/ihelper.php new file mode 100644 index 00000000000..fad02f7556a --- /dev/null +++ b/lib/public/ihelper.php @@ -0,0 +1,23 @@ +<?php +/** + * Copyright (c) 2013 Bart Visscher <bartv@thisnet.nl> + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + * + */ + +namespace OCP; + +/** + * Functions that don't have any specific interface to place + */ +interface IHelper { + /** + * Gets the content of an URL by using CURL or a fallback if it is not + * installed + * @param string $url the url that should be fetched + * @return string the content of the webpage + */ + public function getUrlContent($url); +} diff --git a/lib/public/iservercontainer.php b/lib/public/iservercontainer.php index e8bc1bedf91..3afb2b6599d 100644 --- a/lib/public/iservercontainer.php +++ b/lib/public/iservercontainer.php @@ -109,6 +109,16 @@ interface IServerContainer { function getL10N($app); /** + * @return \OCP\IURLGenerator + */ + function getURLGenerator(); + + /** + * @return \OCP\IHelper + */ + function getHelper(); + + /** * Returns an ICache instance * * @return \OCP\ICache diff --git a/lib/public/iurlgenerator.php b/lib/public/iurlgenerator.php new file mode 100644 index 00000000000..4eb4c0f8312 --- /dev/null +++ b/lib/public/iurlgenerator.php @@ -0,0 +1,47 @@ +<?php +/** + * Copyright (c) 2013 Bart Visscher <bartv@thisnet.nl> + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + * + */ + +namespace OCP; + +/** + * Class to generate URLs + */ +interface IURLGenerator { + /** + * Returns the URL for a route + * @param string $routeName the name of the route + * @param array $arguments an array with arguments which will be filled into the url + * @return string the url + */ + public function linkToRoute($routeName, $arguments = array()); + + /** + * Returns an URL for an image or file + * @param string $appName the name of the app + * @param string $file the name of the file + * @return string the url + */ + public function linkTo($appName, $file); + + /** + * Returns the link to an image, like linkTo but only with prepending img/ + * @param string $appName the name of the app + * @param string $file the name of the file + * @return string the url + */ + public function imagePath($appName, $file); + + + /** + * Makes an URL absolute + * @param string $url the url in the owncloud host + * @return string the absolute version of the url + */ + public function getAbsoluteURL($url); +} |