editbtn.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. * Include plugin (editbtn header component)
  4. *
  5. * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
  6. * @author Michael Klier <chi@chimeric.de>
  7. */
  8. class syntax_plugin_include_editbtn extends DokuWiki_Syntax_Plugin {
  9. function getType() {
  10. return 'formatting';
  11. }
  12. function getSort() {
  13. return 50;
  14. }
  15. function handle($match, $state, $pos, Doku_Handler $handler) {
  16. // this is a syntax plugin that doesn't offer any syntax, so there's nothing to handle by the parser
  17. }
  18. /**
  19. * Renders an include edit button
  20. *
  21. * @author Michael Klier <chi@chimeric.de>
  22. */
  23. function render($mode, Doku_Renderer $renderer, $data) {
  24. list($title, $hid) = $data;
  25. if ($mode == 'xhtml') {
  26. if (defined('SEC_EDIT_PATTERN')) { // for DokuWiki Greebo and more recent versions
  27. $renderer->startSectionEdit(0, array('target' => 'plugin_include_editbtn', 'name' => $title, 'hid' => $hid));
  28. } else {
  29. $renderer->startSectionEdit(0, 'plugin_include_editbtn', $title);
  30. }
  31. $renderer->finishSectionEdit();
  32. return true;
  33. }
  34. return false;
  35. }
  36. }
  37. // vim:ts=4:sw=4:et: