16a1594b7SMichael Klier<?php 26a1594b7SMichael Klier/** 36a1594b7SMichael Klier * Include plugin (editbtn header component) 46a1594b7SMichael Klier * 56a1594b7SMichael Klier * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 66a1594b7SMichael Klier * @author Michael Klier <chi@chimeric.de> 76a1594b7SMichael Klier */ 86a1594b7SMichael Klier 96a1594b7SMichael Klierclass syntax_plugin_include_editbtn extends DokuWiki_Syntax_Plugin { 106a1594b7SMichael Klier 116a1594b7SMichael Klier function getType() { 126a1594b7SMichael Klier return 'formatting'; 136a1594b7SMichael Klier } 146a1594b7SMichael Klier 156a1594b7SMichael Klier function getSort() { 166a1594b7SMichael Klier return 50; 176a1594b7SMichael Klier } 186a1594b7SMichael Klier 194aa23dc0SGerrit Uitslag function handle($match, $state, $pos, Doku_Handler $handler) { 206a1594b7SMichael Klier // this is a syntax plugin that doesn't offer any syntax, so there's nothing to handle by the parser 216a1594b7SMichael Klier } 226a1594b7SMichael Klier 236a1594b7SMichael Klier /** 246a1594b7SMichael Klier * Renders an include edit button 256a1594b7SMichael Klier * 266a1594b7SMichael Klier * @author Michael Klier <chi@chimeric.de> 276a1594b7SMichael Klier */ 284aa23dc0SGerrit Uitslag function render($mode, Doku_Renderer $renderer, $data) { 29*1a02160cSMichael Hamann list($title, $hid) = $data; 306a1594b7SMichael Klier if ($mode == 'xhtml') { 319986c3adSMichael Hamann if (defined('SEC_EDIT_PATTERN')) { // for DokuWiki Greebo and more recent versions 32*1a02160cSMichael Hamann $renderer->startSectionEdit(0, array('target' => 'plugin_include_editbtn', 'name' => $title, 'hid' => $hid)); 339986c3adSMichael Hamann } else { 34d2cd3b4cSMichael Hamann $renderer->startSectionEdit(0, 'plugin_include_editbtn', $title); 359986c3adSMichael Hamann } 369986c3adSMichael Hamann 37d2cd3b4cSMichael Hamann $renderer->finishSectionEdit(); 386a1594b7SMichael Klier return true; 396a1594b7SMichael Klier } 406a1594b7SMichael Klier return false; 416a1594b7SMichael Klier } 426a1594b7SMichael Klier} 432524d407SMichael Hamann// vim:ts=4:sw=4:et: 44