Source for file data.renderer.php
Documentation is available at data.renderer.php
* @subpackage plugins_data
// +----------------------------------------------------------------------+
// | Copyright (c) 2005, bitweaver.org
// +----------------------------------------------------------------------+
// | All Rights Reserved. See below for details and a complete list of authors.
// | Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details
// | For comments, please use phpdocu.sourceforge.net documentation standards!!!
// | -> see http://phpdocu.sourceforge.net/
// +----------------------------------------------------------------------+
// | Author (TikiWiki): Gustavo Muslera <gmuslera@users.sourceforge.net>
// | Reworked for Bitweaver (& Undoubtedly Screwed-Up)
// | Reworked from: data.articles.php from wikiplugin_articles.php
// +----------------------------------------------------------------------+
global $gBitSystem, $gBitSmarty;
define( 'PLUGIN_GUID_DATARENDERER', 'datarenderer' );
'auto_activate' => FALSE,
'load_function' => 'data_renderer',
'help_function' => 'data_renderer_help',
'help_page' => 'DataPluginRenderer',
'description' => tra( "This plugin will render the given content as described by the content_type given." ),
'syntax' => "{renderer class= format_guid= }.. content ..{/renderer}",
$help = "<table class=\"data help\">
<th>" . tra( "Key" ) . "</th>
<th>" . tra( "Type" ) . "</th>
<th>" . tra( "Comments" ) . "</th>
<td>" . tra( "div id") . '<br />' . tra("(optional)") . "</td>
<td>" . tra( "specify the id of the outputed div") . "</td>
<td>" . tra( "div class") . '<br />' . tra("(optional)") . "</td>
<td>" . tra( "specify the class of the outputed div") . "</td>
<td>" . tra( "string") . '<br />' . tra("(required)") . "</td>
<td>" . tra( "Specify what renderer should be used to render the contents") . "</td>
tra("Example: ") . "{renderer class=abc format_guid=tiki }.. content ..{/renderer}<br />";
function data_renderer($data, $params) { // 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;
if (empty($data)) { // If there is NO data to display - why do anything - get out of here
$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'];
if( $func = $gLibertySystem->getPluginFunction( $formatGuid, 'load_function' ) ) {
$ret = $func( $rendererHash, $this );
$display_result = "<div";
if (!empty($params['id'])) {
$display_result .= " id=\"". $params['id']. "\"";
if (!empty($params['class'])) {
$display_result .= " class=\"". $params['class']. "\"";
$display_result .= ">$ret</div>";
|