action.php 865 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. /**
  3. * Comment Syntax plugin for DokuWiki; action component
  4. *
  5. * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
  6. * @author Satoshi Sahara <sahara.satoshi@gmail.com>
  7. */
  8. class action_plugin_commentsyntax extends DokuWiki_Action_Plugin
  9. {
  10. /**
  11. * Registers a callback function for a given event
  12. */
  13. public function register(Doku_Event_Handler $controller)
  14. {
  15. if ($this->getConf('toolbar_button')) {
  16. $controller->register_hook(
  17. 'TOOLBAR_DEFINE', 'AFTER', $this, 'handleToolbar'
  18. );
  19. }
  20. }
  21. public function handleToolbar(Doku_Event $event)
  22. {
  23. $event->data[] = [
  24. 'type' => 'toggleCommentBlock',
  25. 'title' => $this->getLang('toolbar_title'),
  26. 'icon' => DOKU_REL.'lib/plugins/commentsyntax/images/comment.png',
  27. ];
  28. }
  29. }