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 9if (!defined('DOKU_INC')) 10 define('DOKU_INC', realpath(dirname(__FILE__) . '/../../') . '/'); 11if (!defined('DOKU_PLUGIN')) 12 define('DOKU_PLUGIN', DOKU_INC . 'lib/plugins/'); 13require_once (DOKU_PLUGIN . 'syntax.php'); 14 15class syntax_plugin_include_editbtn extends DokuWiki_Syntax_Plugin { 16 17 function getInfo() { 18 return array ( 19 'author' => 'Gina Häußge, Michael Klier', 20 'email' => 'dokuwiki@chimeric.de', 21 'date' => @file_get_contents(DOKU_PLUGIN . 'blog/VERSION'), 22 'name' => 'Include Plugin (permalink header component)', 23 'desc' => 'Provides a header instruction which renders a permalink to the included page', 24 'url' => 'http://dokuwiki.org/plugin:include', 25 ); 26 } 27 28 function getType() { 29 return 'formatting'; 30 } 31 32 function getSort() { 33 return 50; 34 } 35 36 function handle($match, $state, $pos, &$handler) { 37 // this is a syntax plugin that doesn't offer any syntax, so there's nothing to handle by the parser 38 } 39 40 /** 41 * Renders an include edit button 42 * 43 * @author Michael Klier <chi@chimeric.de> 44 */ 45 function render($mode, &$renderer, $data) { 46 global $lang; 47 list($page, $sect, $sect_title, $redirect_id) = $data; 48 if ($mode == 'xhtml') { 49 $title = ($sect) ? $sect_title : $page; 50 $params = array('do' => 'edit', 51 'redirect_id' => $redirect_id, 52 'id' => $page); 53 $xhtml .= '<div class="secedit">' . DOKU_LF; 54 $xhtml .= '<form class="button btn_incledit" method="post" action="' . DOKU_SCRIPT . '"><div class="no">' . DOKU_LF; 55 foreach($params as $key => $val) { 56 $xhtml .= '<input type="hidden" name="'.$key.'" '; 57 $xhtml .= 'value="'.htmlspecialchars($val).'" />'; 58 } 59 $xhtml .= '<input type="submit" value="'.htmlspecialchars($lang['btn_secedit']).' (' . $page . ')" class="button" title="'.$title.'"/>' . DOKU_LF; 60 $xhtml .= '</div></form>' . DOKU_LF; 61 $xhtml .= '</div>' . DOKU_LF; 62 $renderer->doc .= $xhtml; 63 return true; 64 } 65 return false; 66 } 67} 68// vim:ts=4:sw=4:et:enc=utf-8: 69