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.

FileManagerPlugin.php 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. if (!defined('GNUSOCIAL')) {
  3. exit(1);
  4. }
  5. class FileManagerPlugin extends Plugin
  6. {
  7. const VERSION = '0.0.1';
  8. function onRouterInitialized($m)
  9. {
  10. $m->connect(
  11. 'panel/files', array(
  12. 'action' => 'filesadminpanel'
  13. )
  14. );
  15. $m->connect(
  16. 'panel/file/:file/delete',
  17. array('action' => 'deletefileadminpanel'),
  18. array('file' => '[0-9]+')
  19. );
  20. return true;
  21. }
  22. function onEndShowStyles($action) {
  23. $action->cssLink($this->path('css/file-manager.css'));
  24. return true;
  25. }
  26. /**
  27. * If the plugin's installed, this should be accessible to admins
  28. */
  29. function onAdminPanelCheck($name, &$isOK)
  30. {
  31. if ($name === 'files' || $name === 'deletefile') {
  32. $isOK = true;
  33. return false;
  34. }
  35. return true;
  36. }
  37. function onEndAdminPanelNav($nav) {
  38. if (AdminPanelAction::canAdmin('user')) {
  39. $menu_title = _('File Manager');
  40. $action_name = $nav->action->trimmed('action');
  41. $nav->out->menuItem(common_local_url('filesadminpanel'), _m('MENU','File Manager'),
  42. $menu_title, $action_name == 'filesadminpanel', 'files_admin_panel');
  43. }
  44. }
  45. function onPluginVersion(array &$versions)
  46. {
  47. $versions[] = array('name' => 'File Manager',
  48. 'version' => self::VERSION,
  49. 'author' => 'chimo',
  50. 'homepage' => 'https://github.com/chimo/gs-fileManager',
  51. 'description' =>
  52. // TRANS: Plugin description.
  53. _m('Manage files (attachments)'));
  54. return true;
  55. }
  56. }