* License: GPL2 * */ if ( !defined( 'DOKU_INC' ) ) die(); if ( !defined( 'DOKU_PLUGIN' ) ) define( 'DOKU_PLUGIN', DOKU_INC . 'lib/plugins/' ); require_once( DOKU_PLUGIN . 'action.php' ); class action_plugin_textmodule extends DokuWiki_Action_Plugin { public function register(Doku_Event_Handler $controller) { $controller->register_hook('HTML_EDITFORM_OUTPUT', 'BEFORE', $this,'handle_editform_output'); } /* Create the div-containers for the textmodules */ function _format_modules() { if (file_exists('data/meta/modules.txt')) { $t = file_get_contents('data/meta/modules.txt'); $t = explode("\n[TEXT MODULE DELIMITER]\n",$t); $r = ''; foreach ($t as $m) { $m = explode(PHP_EOL,trim($m)); if (count($m)>1) { $title = trim($m[0]); if (strlen($title)==0) $title = $this->getLang("text module"); $r .= '
'; $r.= '
'.$title.'
'; for ($c=1;$c'.$t1.' '; } $r .= '
'; } } return $r; } } /* Create the additional fields for the edit form. */ function handle_editform_output( &$event, $param ) { $pos = $event->data->findElementByAttribute( 'type', 'submit' ); if ( !$pos ){ return; } $out = '
'; $out .= $this->_format_modules(); $out .= '
'; $event->data->insertElement( $pos++, $out ); } }