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 Klierif (!defined('DOKU_INC')) 106a1594b7SMichael Klier define('DOKU_INC', realpath(dirname(__FILE__) . '/../../') . '/'); 116a1594b7SMichael Klierif (!defined('DOKU_PLUGIN')) 126a1594b7SMichael Klier define('DOKU_PLUGIN', DOKU_INC . 'lib/plugins/'); 136a1594b7SMichael Klierrequire_once (DOKU_PLUGIN . 'syntax.php'); 146a1594b7SMichael Klier 156a1594b7SMichael Klierclass syntax_plugin_include_editbtn extends DokuWiki_Syntax_Plugin { 166a1594b7SMichael Klier 176a1594b7SMichael Klier function getType() { 186a1594b7SMichael Klier return 'formatting'; 196a1594b7SMichael Klier } 206a1594b7SMichael Klier 216a1594b7SMichael Klier function getSort() { 226a1594b7SMichael Klier return 50; 236a1594b7SMichael Klier } 246a1594b7SMichael Klier 254aa23dc0SGerrit Uitslag function handle($match, $state, $pos, Doku_Handler $handler) { 266a1594b7SMichael Klier // this is a syntax plugin that doesn't offer any syntax, so there's nothing to handle by the parser 276a1594b7SMichael Klier } 286a1594b7SMichael Klier 296a1594b7SMichael Klier /** 306a1594b7SMichael Klier * Renders an include edit button 316a1594b7SMichael Klier * 326a1594b7SMichael Klier * @author Michael Klier <chi@chimeric.de> 336a1594b7SMichael Klier */ 344aa23dc0SGerrit Uitslag function render($mode, Doku_Renderer $renderer, $data) { 35d2cd3b4cSMichael Hamann list($title) = $data; 366a1594b7SMichael Klier if ($mode == 'xhtml') { 37*9986c3adSMichael Hamann if (defined('SEC_EDIT_PATTERN')) { // for DokuWiki Greebo and more recent versions 38*9986c3adSMichael Hamann $renderer->startSectionEdit(0, array('target' => 'plugin_include_editbtn', 'name' => $title)); 39*9986c3adSMichael Hamann } else { 40d2cd3b4cSMichael Hamann $renderer->startSectionEdit(0, 'plugin_include_editbtn', $title); 41*9986c3adSMichael Hamann } 42*9986c3adSMichael Hamann 43d2cd3b4cSMichael Hamann $renderer->finishSectionEdit(); 446a1594b7SMichael Klier return true; 456a1594b7SMichael Klier } 466a1594b7SMichael Klier return false; 476a1594b7SMichael Klier } 486a1594b7SMichael Klier} 492524d407SMichael Hamann// vim:ts=4:sw=4:et: 50