/backend/core/js/tiny_mce/plugins/filemanager/classes/ManagerPlugin.php

https://github.com/kmikzjh/forkcms · PHP · 246 lines · 58 code · 20 blank · 168 comment · 0 complexity · 8beca535c92ae9a78b26d58f674116d2 MD5 · raw file

  1. <?php
  2. /**
  3. * $Id: ManagerPlugin.php 663 2009-02-09 13:03:11Z spocke $
  4. *
  5. * @package ManagerEngine
  6. * @author Moxiecode
  7. * @copyright Copyright � 2007, Moxiecode Systems AB, All rights reserved.
  8. */
  9. /**
  10. * Base class for all manager plugins. This class should be extended by all plugins, the default implementations of all these methods
  11. * return true or null.
  12. *
  13. * @package ManagerEngine
  14. */
  15. class Moxiecode_ManagerPlugin {
  16. /**#@+
  17. * @access public
  18. */
  19. /**
  20. * Gets called on a authenication request. This method should check sessions or simmilar to
  21. * verify that the user has access to the backend.
  22. *
  23. * This method should return true if the current request is authenicated or false if it's not.
  24. *
  25. * @param ManagerEngine $man ManagerEngine reference that the plugin is assigned to.
  26. * @return bool true/false if the user is authenticated.
  27. */
  28. function onAuthenticate(&$man) {
  29. return true;
  30. }
  31. /**
  32. * Gets executed before the ManagerEngine is initialized. This method should only be implemeneted
  33. * by core plugins.
  34. *
  35. * @param ManagerEngine $man ManagerEngine reference that the plugin is assigned to.
  36. * @param string $prefix Specified prefix, use this to resolve config and language pack location.
  37. * @return bool true/false if the execution of the event chain should continue.
  38. */
  39. function onPreInit(&$man, $prefix) {
  40. return true;
  41. }
  42. /**
  43. * Gets called after any authenication is performed and verified. This method can be used
  44. * to override config options or add custom filesystems.
  45. *
  46. * @param ManagerEngine $man ManagerEngine reference that the plugin is assigned to.
  47. * @return bool true/false if the execution of the event chain should continue.
  48. */
  49. function onInit(&$man) {
  50. return true;
  51. }
  52. /**
  53. * Gets called when a user has logged in to the system. This event should be dispatched from the login page.
  54. * These events is not fired internaly and should be fired/dispatched externally.
  55. *
  56. * @param ManagerEngine $man ManagerEngine reference that the plugin is assigned to.
  57. * @return bool true/false if the execution of the event chain should continue.
  58. */
  59. function onLogin(&$man) {
  60. return true;
  61. }
  62. /**
  63. * Gets called when a user has logged out from the system. This event should be dispatched from the logout page.
  64. * These events is not fired internaly and should be fired/dispatched externally.
  65. *
  66. * @param ManagerEngine $man ManagerEngine reference that the plugin is assigned to.
  67. * @return bool true/false if the execution of the event chain should continue.
  68. */
  69. function onLogout(&$man) {
  70. return true;
  71. }
  72. /**
  73. * Gets called before a file action occurs for example before a rename or copy.
  74. *
  75. * @param ManagerEngine $man ManagerEngine reference that the plugin is assigned to.
  76. * @param int $action File action constant for example DELETE_ACTION.
  77. * @param BaseFile $file1 File object 1 for example from in a copy operation.
  78. * @param BaseFile $file2 File object 2 for example to in a copy operation. Might be null in for example a delete.
  79. * @return bool true/false if the execution of the event chain should continue.
  80. */
  81. function onBeforeFileAction(&$man, $action, $file1, $file2) {
  82. return true;
  83. }
  84. /**
  85. * Gets called after a file action was perforem for example after a rename or copy.
  86. *
  87. * @param ManagerEngine $man ManagerEngine reference that the plugin is assigned to.
  88. * @param int $action File action constant for example DELETE_ACTION.
  89. * @param BaseFile $file1 File object 1 for example from in a copy operation.
  90. * @param BaseFile $file2 File object 2 for example to in a copy operation. Might be null in for example a delete.
  91. * @return bool true/false if the execution of the event chain should continue.
  92. */
  93. function onFileAction(&$man, $action, $file1, $file2) {
  94. return true;
  95. }
  96. /**
  97. * Gets called before a RPC command is handled.
  98. *
  99. * @param ManagerEngine $man ManagerEngine reference that the plugin is assigned to.
  100. * @param string $cmd RPC Command to be executed.
  101. * @param object $input RPC input object data.
  102. * @return bool true/false if the execution of the event chain should continue.
  103. */
  104. function onBeforeRPC(&$man, $cmd, $input) {
  105. return null;
  106. }
  107. /**
  108. * Gets executed when a RPC command is to be executed.
  109. *
  110. * @param ManagerEngine $man ManagerEngine reference that the plugin is assigned to.
  111. * @param string $cmd RPC Command to be executed.
  112. * @param object $input RPC input object data.
  113. * @return object Result data from RPC call or null if it should be passed to the next handler in chain.
  114. */
  115. function onRPC(&$man, $cmd, $input) {
  116. return null;
  117. }
  118. /**
  119. * Gets called before data is streamed to client.
  120. *
  121. * @param ManagerEngine $man ManagerEngine reference that the plugin is assigned to.
  122. * @param string $cmd Stream command that is to be performed.
  123. * @param string $input Array of input arguments.
  124. * @return bool true/false if the execution of the event chain should continue.
  125. */
  126. function onBeforeStream(&$man, $cmd, $input) {
  127. return true;
  128. }
  129. /**
  130. * Gets called when data is streamed to client. This method should setup
  131. * HTTP headers, content type etc and simply send out the binary data to the client and the return false
  132. * ones that is done.
  133. *
  134. * @param ManagerEngine $man ManagerEngine reference that the plugin is assigned to.
  135. * @param string $cmd Stream command that is to be performed.
  136. * @param string $input Array of input arguments.
  137. * @return bool true/false if the execution of the event chain should continue.
  138. */
  139. function onStream(&$man, $cmd, $input) {
  140. return true;
  141. }
  142. /**
  143. * Gets called after data was streamed to client.
  144. *
  145. * @param ManagerEngine $man ManagerEngine reference that the plugin is assigned to.
  146. * @param string $cmd Stream command that is to was performed.
  147. * @param string $input Array of input arguments.
  148. * @return bool true/false if the execution of the event chain should continue.
  149. */
  150. function onAfterStream(&$man, $cmd, $input) {
  151. return true;
  152. }
  153. /**
  154. * Gets called before data is streamed/uploaded from client.
  155. *
  156. * @param ManagerEngine $man ManagerEngine reference that the plugin is assigned to.
  157. * @param string $cmd Upload command that is to be performed.
  158. * @param string $input Array of input arguments.
  159. * @return bool true/false if the execution of the event chain should continue.
  160. */
  161. function onBeforeUpload(&$man, $cmd, $input) {
  162. return true;
  163. }
  164. /**
  165. * Gets called when data is streamed/uploaded from client. This method should take care of
  166. * any uploaded files and move them to the correct location.
  167. *
  168. * @param ManagerEngine $man ManagerEngine reference that the plugin is assigned to.
  169. * @param string $cmd Upload command that is to be performed.
  170. * @param string $input Array of input arguments.
  171. * @return object Result object data or null if the event wasn't handled.
  172. */
  173. function onUpload(&$man, $cmd, $input) {
  174. return null;
  175. }
  176. /**
  177. * Gets called before data is streamed/uploaded from client.
  178. *
  179. * @param ManagerEngine $man ManagerEngine reference that the plugin is assigned to.
  180. * @param string $cmd Upload command that is to was performed.
  181. * @param string $input Array of input arguments.
  182. * @return bool true/false if the execution of the event chain should continue.
  183. */
  184. function onAfterUpload(&$man, $cmd, $input) {
  185. return true;
  186. }
  187. /**
  188. * Gets called when custom data is to be added for a file custom data can for example be
  189. * plugin specific name value items that should get added into a file listning.
  190. *
  191. * @param ManagerEngine $man ManagerEngine reference that the plugin is assigned to.
  192. * @param BaseFile $file File reference to add custom info/data to.
  193. * @param string $type Where is the info needed for example list or info.
  194. * @param Array $custom Name/Value array to add custom items to.
  195. * @return bool true/false if the execution of the event chain should continue.
  196. */
  197. function onCustomInfo(&$man, &$file, $type, &$custom) {
  198. return true;
  199. }
  200. /**
  201. * Gets called when the user selects a file and inserts it into TinyMCE or a form or similar.
  202. *
  203. * @param ManagerEngine $man ManagerEngine reference that the plugin is assigned to.
  204. * @param BaseFile $file Implementation of the BaseFile class that was inserted/returned to external system.
  205. * @return bool true/false if the execution of the event chain should continue.
  206. */
  207. function onInsertFile(&$man, &$file) {
  208. return true;
  209. }
  210. /**
  211. * Gets called when resources are requested like JS or CSS files. This event enables a plugin to add resources dynamically.
  212. *
  213. * @param ManagerEngine $man ManagerEngine reference that the plugin is assigned to.
  214. * @param string $theme Resource type CSS or JS.
  215. * @param string $package Resource type CSS or JS.
  216. * @param string $type Resource type CSS or JS.
  217. * @param string $content_type Resource type CSS or JS.
  218. * @param Moxiecode_ClientResources $resources Resources class that is used to handle client resources.
  219. * @return bool true/false if the execution of the event chain should continue.
  220. */
  221. function onRequestResources(&$man, $theme, $package, $type, $content_type, &$resources) {
  222. return true;
  223. }
  224. /**#@-*/
  225. }
  226. ?>