IURLGenerator.php 2.7 KB

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