IExtension.php 5.2 KB

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