IExtension.php 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Bjoern Schiessle <bjoern@schiessle.org>
  6. * @author Björn Schießle <bjoern@schiessle.org>
  7. * @author Joas Schilling <coding@schilljs.com>
  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. * Activity/IExtension interface
  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\Activity;
  33. /**
  34. * Interface IExtension
  35. *
  36. * @package OCP\Activity
  37. * @since 8.0.0
  38. */
  39. interface IExtension {
  40. const METHOD_STREAM = 'stream';
  41. const METHOD_MAIL = 'email';
  42. const PRIORITY_VERYLOW = 10;
  43. const PRIORITY_LOW = 20;
  44. const PRIORITY_MEDIUM = 30;
  45. const PRIORITY_HIGH = 40;
  46. const PRIORITY_VERYHIGH = 50;
  47. /**
  48. * The extension can return an array of additional notification types.
  49. * If no additional types are to be added false is to be returned
  50. *
  51. * @param string $languageCode
  52. * @return array|false Array "stringID of the type" => "translated string description for the setting"
  53. * or Array "stringID of the type" => [
  54. * 'desc' => "translated string description for the setting"
  55. * 'methods' => [self::METHOD_*],
  56. * ]
  57. * @since 8.0.0 - 8.2.0: Added support to allow limiting notifications to certain methods
  58. */
  59. public function getNotificationTypes($languageCode);
  60. /**
  61. * For a given method additional types to be displayed in the settings can be returned.
  62. * In case no additional types are to be added false is to be returned.
  63. *
  64. * @param string $method
  65. * @return array|false
  66. * @since 8.0.0
  67. */
  68. public function getDefaultTypes($method);
  69. /**
  70. * A string naming the css class for the icon to be used can be returned.
  71. * If no icon is known for the given type false is to be returned.
  72. *
  73. * @param string $type
  74. * @return string|false
  75. * @since 8.0.0
  76. */
  77. public function getTypeIcon($type);
  78. /**
  79. * The extension can translate a given message to the requested languages.
  80. * If no translation is available false is to be returned.
  81. *
  82. * @param string $app
  83. * @param string $text
  84. * @param array $params
  85. * @param boolean $stripPath
  86. * @param boolean $highlightParams
  87. * @param string $languageCode
  88. * @return string|false
  89. * @since 8.0.0
  90. */
  91. public function translate($app, $text, $params, $stripPath, $highlightParams, $languageCode);
  92. /**
  93. * The extension can define the type of parameters for translation
  94. *
  95. * Currently known types are:
  96. * * file => will strip away the path of the file and add a tooltip with it
  97. * * username => will add the avatar of the user
  98. * * email => will add a mailto link
  99. *
  100. * @param string $app
  101. * @param string $text
  102. * @return array|false
  103. * @since 8.0.0
  104. */
  105. public function getSpecialParameterList($app, $text);
  106. /**
  107. * The extension can define the parameter grouping by returning the index as integer.
  108. * In case no grouping is required false is to be returned.
  109. *
  110. * @param array $activity
  111. * @return integer|false
  112. * @since 8.0.0
  113. */
  114. public function getGroupParameter($activity);
  115. /**
  116. * The extension can define additional navigation entries. The array returned has to contain two keys 'top'
  117. * and 'apps' which hold arrays with the relevant entries.
  118. * If no further entries are to be added false is no be returned.
  119. *
  120. * @return array|false
  121. * @since 8.0.0
  122. * @deprecated 11.0.0 - Register an IFilter instead
  123. */
  124. public function getNavigation();
  125. /**
  126. * The extension can check if a customer filter (given by a query string like filter=abc) is valid or not.
  127. *
  128. * @param string $filterValue
  129. * @return boolean
  130. * @since 8.0.0
  131. * @deprecated 11.0.0 - Register an IFilter instead
  132. */
  133. public function isFilterValid($filterValue);
  134. /**
  135. * The extension can filter the types based on the filter if required.
  136. * In case no filter is to be applied false is to be returned unchanged.
  137. *
  138. * @param array $types
  139. * @param string $filter
  140. * @return array|false
  141. * @since 8.0.0
  142. * @deprecated 11.0.0 - Register an IFilter instead
  143. */
  144. public function filterNotificationTypes($types, $filter);
  145. /**
  146. * For a given filter the extension can specify the sql query conditions including parameters for that query.
  147. * In case the extension does not know the filter false is to be returned.
  148. * The query condition and the parameters are to be returned as array with two elements.
  149. * E.g. return array('`app` = ? and `message` like ?', array('mail', 'ownCloud%'));
  150. *
  151. * @param string $filter
  152. * @return array|false
  153. * @since 8.0.0
  154. * @deprecated 11.0.0 - Register an IFilter instead
  155. */
  156. public function getQueryForFilter($filter);
  157. }