template.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <?php
  2. /**
  3. * ownCloud
  4. *
  5. * @author Frank Karlitschek
  6. * @copyright 2012 Frank Karlitschek frank@owncloud.org
  7. *
  8. * This library is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
  10. * License as published by the Free Software Foundation; either
  11. * version 3 of the License, or any later version.
  12. *
  13. * This library is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
  17. *
  18. * You should have received a copy of the GNU Affero General Public
  19. * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. /**
  23. * Public interface of ownCloud for apps to use.
  24. * Template Class
  25. *
  26. */
  27. // use OCP namespace for all classes that are considered public.
  28. // This means that they should be used by apps instead of the internal ownCloud classes
  29. namespace OCP;
  30. /**
  31. * @brief make OC_Helper::imagePath available as a simple function
  32. * @param $app app
  33. * @param $image image
  34. * @returns link to the image
  35. *
  36. * For further information have a look at OC_Helper::imagePath
  37. */
  38. function image_path( $app, $image ) {
  39. return(\image_path( $app, $image ));
  40. }
  41. /**
  42. * @brief make OC_Helper::mimetypeIcon available as a simple function
  43. * Returns the path to the image of this file type.
  44. * @param $mimetype mimetype
  45. * @returns link to the image
  46. */
  47. function mimetype_icon( $mimetype ) {
  48. return(\mimetype_icon( $mimetype ));
  49. }
  50. /**
  51. * @brief make OC_Helper::humanFileSize available as a simple function
  52. * Makes 2048 to 2 kB.
  53. * @param $bytes size in bytes
  54. * @returns size as string
  55. */
  56. function human_file_size( $bytes ) {
  57. return(\human_file_size( $bytes ));
  58. }
  59. /**
  60. * @brief Return the relative date in relation to today. Returns something like "last hour" or "two month ago"
  61. * @param $timestamp unix timestamp
  62. * @returns human readable interpretation of the timestamp
  63. */
  64. function relative_modified_date($timestamp) {
  65. return(\relative_modified_date($timestamp));
  66. }
  67. /**
  68. * @brief Return a human readable outout for a file size.
  69. * @param $byte size of a file in byte
  70. * @returns human readable interpretation of a file size
  71. */
  72. function simple_file_size($bytes) {
  73. return(\simple_file_size($bytes));
  74. }
  75. /**
  76. * @brief Generate html code for an options block.
  77. * @param $options the options
  78. * @param $selected which one is selected?
  79. * @param $params the parameters
  80. * @returns html options
  81. */
  82. function html_select_options($options, $selected, $params=array()) {
  83. return(\html_select_options($options, $selected, $params));
  84. }
  85. /**
  86. * This class provides the template system for owncloud. You can use it to load
  87. * specific templates, add data and generate the html code
  88. */
  89. class Template extends \OC_Template {
  90. }