diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2015-12-18 14:49:55 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-12-18 14:49:55 +0100 |
commit | 50e877330700117ace281236ce7ecc1ae0f9521b (patch) | |
tree | 5ae40fa7903eb2ea05962d87032704b3150316f1 /lib | |
parent | 22d1b1285e970447f532919368ebffeeb8c2ebf7 (diff) | |
parent | 450e2f3bd308388e5df01b2b2ea38e6bf16b1c67 (diff) | |
download | nextcloud-server-50e877330700117ace281236ce7ecc1ae0f9521b.tar.gz nextcloud-server-50e877330700117ace281236ce7ecc1ae0f9521b.zip |
Merge pull request #21280 from owncloud/drop-unused-methods
OC_Helper::makeURLAbsolute is not used anymore
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/helper.php | 54 | ||||
-rw-r--r-- | lib/private/util.php | 8 | ||||
-rw-r--r-- | lib/public/util.php | 11 |
3 files changed, 13 insertions, 60 deletions
diff --git a/lib/private/helper.php b/lib/private/helper.php index c6223d2147a..b4a5d8cddf5 100644 --- a/lib/private/helper.php +++ b/lib/private/helper.php @@ -54,60 +54,6 @@ class OC_Helper { private static $templateManager; /** - * Creates an absolute url - * @param string $app app - * @param string $file file - * @param array $args array with param=>value, will be appended to the returned url - * The value of $args will be urlencoded - * @return string the url - * - * Returns a absolute url to the given app and file. - */ - public static function linkToAbsolute($app, $file, $args = array()) { - return OC::$server->getURLGenerator()->getAbsoluteURL( - OC::$server->getURLGenerator()->linkTo($app, $file, $args) - ); - } - - /** - * Makes an $url absolute - * @param string $url the url - * @return string the absolute url - * @deprecated Use \OC::$server->getURLGenerator()->getAbsoluteURL($url) - * - * Returns a absolute url to the given app and file. - */ - public static function makeURLAbsolute($url) { - return OC::$server->getURLGenerator()->getAbsoluteURL($url); - } - - /** - * Creates an url for remote use - * @param string $service id - * @return string the url - * - * Returns a url to the given service. - */ - public static function linkToRemoteBase($service) { - return OC::$server->getURLGenerator()->linkTo('', 'remote.php') . '/' . $service; - } - - /** - * Creates an absolute url for remote use - * @param string $service id - * @param bool $add_slash - * @return string the url - * - * Returns a absolute url to the given service. - */ - public static function linkToRemote($service, $add_slash = true) { - return OC::$server->getURLGenerator()->getAbsoluteURL( - self::linkToRemoteBase($service) - . (($add_slash && $service[strlen($service) - 1] != '/') ? '/' : '') - ); - } - - /** * Creates an absolute url for public use * @param string $service id * @param bool $add_slash diff --git a/lib/private/util.php b/lib/private/util.php index c63befb3f32..2ecacc53bd4 100644 --- a/lib/private/util.php +++ b/lib/private/util.php @@ -974,7 +974,7 @@ class OC_Util { */ public static function checkAppEnabled($app) { if (!OC_App::isEnabled($app)) { - header('Location: ' . OC_Helper::linkToAbsolute('', 'index.php')); + header('Location: ' . \OCP\Util::linkToAbsolute('', 'index.php')); exit(); } } @@ -988,7 +988,7 @@ class OC_Util { public static function checkLoggedIn() { // Check if we are a user if (!OC_User::isLoggedIn()) { - header('Location: ' . OC_Helper::linkToAbsolute('', 'index.php', + header('Location: ' . \OCP\Util::linkToAbsolute('', 'index.php', [ 'redirect_url' => \OC::$server->getRequest()->getRequestUri() ] @@ -1006,7 +1006,7 @@ class OC_Util { public static function checkAdminUser() { OC_Util::checkLoggedIn(); if (!OC_User::isAdminUser(OC_User::getUser())) { - header('Location: ' . OC_Helper::linkToAbsolute('', 'index.php')); + header('Location: ' . \OCP\Util::linkToAbsolute('', 'index.php')); exit(); } } @@ -1046,7 +1046,7 @@ class OC_Util { } if (!$isSubAdmin) { - header('Location: ' . OC_Helper::linkToAbsolute('', 'index.php')); + header('Location: ' . \OCP\Util::linkToAbsolute('', 'index.php')); exit(); } return true; diff --git a/lib/public/util.php b/lib/public/util.php index da4aa6e9deb..a9fe0e47de6 100644 --- a/lib/public/util.php +++ b/lib/public/util.php @@ -269,7 +269,10 @@ class Util { * @since 4.0.0 - parameter $args was added in 4.5.0 */ public static function linkToAbsolute( $app, $file, $args = array() ) { - return(\OC_Helper::linkToAbsolute( $app, $file, $args )); + $urlGenerator = \OC::$server->getURLGenerator(); + return $urlGenerator->getAbsoluteURL( + $urlGenerator->linkTo($app, $file, $args) + ); } /** @@ -279,7 +282,11 @@ class Util { * @since 4.0.0 */ public static function linkToRemote( $service ) { - return(\OC_Helper::linkToRemote( $service )); + $urlGenerator = \OC::$server->getURLGenerator(); + $remoteBase = $urlGenerator->linkTo('', 'remote.php') . '/' . $service; + return $urlGenerator->getAbsoluteURL( + $remoteBase . (($service[strlen($service) - 1] != '/') ? '/' : '') + ); } /** |