IURLGenerator.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Bart Visscher <bartv@thisnet.nl>
  6. * @author Joas Schilling <coding@schilljs.com>
  7. * @author Julius Härtl <jus@bitgrid.net>
  8. * @author Morris Jobke <hey@morrisjobke.de>
  9. * @author Thomas Müller <thomas.mueller@tmit.eu>
  10. *
  11. * @license AGPL-3.0
  12. *
  13. * This code is free software: you can redistribute it and/or modify
  14. * it under the terms of the GNU Affero General Public License, version 3,
  15. * as published by the Free Software Foundation.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU Affero General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU Affero General Public License, version 3,
  23. * along with this program. If not, see <http://www.gnu.org/licenses/>
  24. *
  25. */
  26. /**
  27. * Public interface of ownCloud for apps to use.
  28. * URL generator interface
  29. *
  30. */
  31. // use OCP namespace for all classes that are considered public.
  32. // This means that they should be used by apps instead of the internal ownCloud classes
  33. namespace OCP;
  34. /**
  35. * Class to generate URLs
  36. * @since 6.0.0
  37. */
  38. interface IURLGenerator {
  39. /**
  40. * Returns the URL for a route
  41. * @param string $routeName the name of the route
  42. * @param array $arguments an array with arguments which will be filled into the url
  43. * @return string the url
  44. * @since 6.0.0
  45. */
  46. public function linkToRoute($routeName, $arguments = array());
  47. /**
  48. * Returns the absolute URL for a route
  49. * @param string $routeName the name of the route
  50. * @param array $arguments an array with arguments which will be filled into the url
  51. * @return string the absolute url
  52. * @since 8.0.0
  53. */
  54. public function linkToRouteAbsolute($routeName, $arguments = array());
  55. /**
  56. * Returns an URL for an image or file
  57. * @param string $appName the name of the app
  58. * @param string $file the name of the file
  59. * @param array $args array with param=>value, will be appended to the returned url
  60. * The value of $args will be urlencoded
  61. * @return string the url
  62. * @since 6.0.0
  63. */
  64. public function linkTo($appName, $file, $args = array());
  65. /**
  66. * Returns the link to an image, like linkTo but only with prepending img/
  67. * @param string $appName the name of the app
  68. * @param string $file the name of the file
  69. * @return string the url
  70. * @since 6.0.0
  71. */
  72. public function imagePath($appName, $file);
  73. /**
  74. * Makes an URL absolute
  75. * @param string $url the url in the ownCloud host
  76. * @return string the absolute version of the url
  77. * @since 6.0.0
  78. */
  79. public function getAbsoluteURL($url);
  80. /**
  81. * @param string $key
  82. * @return string url to the online documentation
  83. * @since 8.0.0
  84. */
  85. public function linkToDocs($key);
  86. /**
  87. * @return string base url of the current request
  88. * @since 13.0.0
  89. */
  90. public function getBaseUrl();
  91. }