You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

app.php 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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. * App 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. * This class provides functions to manage apps in ownCloud
  32. */
  33. class App {
  34. /**
  35. * @brief Makes owncloud aware of this app
  36. * @brief This call is deprecated and not necessary to use.
  37. * @param $data array with all information
  38. * @returns true/false
  39. *
  40. * @deprecated this method is deprecated
  41. * Do not call it anymore
  42. * It'll remain in our public API for compatibility reasons
  43. *
  44. */
  45. public static function register( $data ) {
  46. return true; // don't do anything
  47. }
  48. /**
  49. * @brief adds an entry to the navigation
  50. * @param $data array containing the data
  51. * @returns true/false
  52. *
  53. * This function adds a new entry to the navigation visible to users. $data
  54. * is an associative array.
  55. * The following keys are required:
  56. * - id: unique id for this entry ('addressbook_index')
  57. * - href: link to the page
  58. * - name: Human readable name ('Addressbook')
  59. *
  60. * The following keys are optional:
  61. * - icon: path to the icon of the app
  62. * - order: integer, that influences the position of your application in
  63. * the navigation. Lower values come first.
  64. */
  65. public static function addNavigationEntry( $data ) {
  66. return \OC_App::addNavigationEntry( $data );
  67. }
  68. /**
  69. * @brief marks a navigation entry as active
  70. * @param $id id of the entry
  71. * @returns true/false
  72. *
  73. * This function sets a navigation entry as active and removes the 'active'
  74. * property from all other entries. The templates can use this for
  75. * highlighting the current position of the user.
  76. */
  77. public static function setActiveNavigationEntry( $id ) {
  78. return \OC_App::setActiveNavigationEntry( $id );
  79. }
  80. /**
  81. * @brief Register a Configuration Screen that should appear in the personal settings section.
  82. * @param $app string appid
  83. * @param $page string page to be included
  84. */
  85. public static function registerPersonal( $app, $page ) {
  86. \OC_App::registerPersonal( $app, $page );
  87. }
  88. /**
  89. * @brief Register a Configuration Screen that should appear in the Admin section.
  90. * @param $app string appid
  91. * @param $page string page to be included
  92. */
  93. public static function registerAdmin( $app, $page ) {
  94. \OC_App::registerAdmin( $app, $page );
  95. }
  96. /**
  97. * @brief Read app metadata from the info.xml file
  98. * @param string $app id of the app or the path of the info.xml file
  99. * @param boolean path (optional)
  100. * @returns array
  101. */
  102. public static function getAppInfo( $app, $path=false ) {
  103. return \OC_App::getAppInfo( $app, $path);
  104. }
  105. /**
  106. * @brief checks whether or not an app is enabled
  107. * @param $app app
  108. * @returns true/false
  109. *
  110. * This function checks whether or not an app is enabled.
  111. */
  112. public static function isEnabled( $app ) {
  113. return \OC_App::isEnabled( $app );
  114. }
  115. /**
  116. * @brief Check if the app is enabled, redirects to home if not
  117. * @param $app app
  118. */
  119. public static function checkAppEnabled( $app ) {
  120. \OC_Util::checkAppEnabled( $app );
  121. }
  122. /**
  123. * @brief Get the last version of the app, either from appinfo/version or from appinfo/info.xml
  124. * @param $app app
  125. * @returns true/false
  126. */
  127. public static function getAppVersion( $app ) {
  128. return \OC_App::getAppVersion( $app );
  129. }
  130. }