see http://phpdocu.sourceforge.net/ // +----------------------------------------------------------------------+ // | Author (TikiWiki): Gustavo Muslera // | Reworked for Bitweaver (& Undoubtedly Screwed-Up) // | by: wjames5 // | Reworked from: data.articles.php from wikiplugin_articles.php // +----------------------------------------------------------------------+ // $Id$ /** * definitions */ global $gBitSystem, $gBitSmarty; define( 'PLUGIN_GUID_DATARENDERER', 'datarenderer' ); global $gLibertySystem; $pluginParams = [ 'tag' => 'renderer', 'auto_activate' => false, 'requires_pair' => true, 'load_function' => '\data_renderer', 'help_function' => '\data_renderer_help', 'title' => 'Renderer', 'help_page' => 'DataPluginRenderer', 'description' => KernelTools::tra( "This plugin will render the given content as described by the content_type given." ), 'syntax' => "{renderer class= format_guid= }.. content ..{/renderer}", 'plugin_type' => DATA_PLUGIN, ]; $gLibertySystem->registerPlugin( PLUGIN_GUID_DATARENDERER, $pluginParams ); $gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATARENDERER ); // Help Routine function data_renderer_help() { $help ="
" . KernelTools::tra( "Key" ) . " " . KernelTools::tra( "Type" ) . " " . KernelTools::tra( "Comments" ) . "
id " . KernelTools::tra( "div id") . '
' . KernelTools::tra("(optional)") . "
" . KernelTools::tra( "specify the id of the outputed div") . "
class " . KernelTools::tra( "div class") . '
' . KernelTools::tra("(optional)") . "
" . KernelTools::tra( "specify the class of the outputed div") . "
format_guid " . KernelTools::tra( "string") . '
' . KernelTools::tra("(required)") . "
" . KernelTools::tra( "Specify what renderer should be used to render the contents") . "
". KernelTools::tra("Example: ") . "{renderer class=abc format_guid=tiki }.. content ..{/renderer}
"; return $help; } // Executable Routine function data_renderer( $data, $params, $object = null ) { // No change in the parameters with Clyde // The next 2 lines allow access to the $pluginParams given above and may be removed when no longer needed global $gLibertySystem, $gBitSmarty, $gBitSystem; $data = trim($data); if (empty($data)) { // If there is NO data to display - why do anything - get out of here return " "; } $rendererHash = []; $rendererHash['content_id'] = 0; $rendererHash['format_guid'] = empty($params['format_guid']) ? $gBitSystem->getConfig('default_format') : $params['format_guid']; $rendererHash['data'] = $data; $formatGuid=$rendererHash['format_guid']; $ret = ""; if( $func = $gLibertySystem->getPluginFunction( $formatGuid, 'load_function' ) ) { $ret = $func( $rendererHash, $object ); } $display_result = "