liberty
[ class tree: liberty ] [ index: liberty ] [ all elements ]

Source for file data.renderer.php

Documentation is available at data.renderer.php

  1. <?php
  2. /**
  3.  * @version  $Revision$
  4.  * @package  liberty
  5.  * @subpackage plugins_data
  6.  */
  7. // +----------------------------------------------------------------------+
  8. // | Copyright (c) 2005, bitweaver.org
  9. // +----------------------------------------------------------------------+
  10. // | All Rights Reserved. See below for details and a complete list of authors.
  11. // | Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details
  12. // |
  13. // | For comments, please use phpdocu.sourceforge.net documentation standards!!!
  14. // | -> see http://phpdocu.sourceforge.net/
  15. // +----------------------------------------------------------------------+
  16. // | Author (TikiWiki): Gustavo Muslera <gmuslera@users.sourceforge.net>
  17. // | Reworked for Bitweaver (& Undoubtedly Screwed-Up)
  18. // | by: wjames5
  19. // | Reworked from: data.articles.php from wikiplugin_articles.php
  20. // +----------------------------------------------------------------------+
  21. // $Id$
  22.  
  23. /**
  24.  * definitions
  25.  */
  26. global $gBitSystem$gBitSmarty;
  27. define'PLUGIN_GUID_DATARENDERER''datarenderer' );
  28. global $gLibertySystem;
  29. $pluginParams array (
  30.     'tag' => 'renderer',
  31.     'auto_activate' => FALSE,
  32.     'requires_pair' => TRUE,
  33.     'load_function' => 'data_renderer',
  34.     'help_function' => 'data_renderer_help',
  35.     'title' => 'Renderer',
  36.     'help_page' => 'DataPluginRenderer',
  37.     'description' => tra"This plugin will render the given content as described by the content_type given." ),
  38.     'syntax' => "{renderer class= format_guid= }.. content ..{/renderer}",
  39.     'plugin_type' => DATA_PLUGIN
  40. );
  41. $gLibertySystem->registerPluginPLUGIN_GUID_DATARENDERER$pluginParams );
  42. $gLibertySystem->registerDataTag$pluginParams['tag']PLUGIN_GUID_DATARENDERER );
  43.  
  44.     // Help Routine
  45.     function data_renderer_help({
  46.         $help ="<table class=\"data help\">
  47.             <tr>
  48.                 <th>" tra"Key" "</th>
  49.                 <th>" tra"Type" "</th>
  50.                 <th>" tra"Comments" "</th>
  51.             </tr>
  52.             <tr class=\"even\">
  53.                 <td>id</td>
  54.                 <td>" tra"div id"'<br />' tra("(optional)""</td>
  55.                 <td>" tra"specify the id of the outputed div""</td>
  56.             </tr>
  57.             <tr class=\"odd\">
  58.                 <td>class</td>
  59.                 <td>" tra"div class"'<br />' tra("(optional)""</td>
  60.                 <td>" tra"specify the class of the outputed div""</td>
  61.             </tr>
  62.             <tr class=\"even\">
  63.                 <td>format_guid</td>
  64.                 <td>" tra"string"'<br />' tra("(required)""</td>
  65.                 <td>" tra"Specify what renderer should be used to render the contents""</td>
  66.             </tr>
  67.         </table>".
  68.         tra("Example: ""{renderer class=abc format_guid=tiki }.. content ..{/renderer}<br />";
  69.         return $help;
  70.     }
  71.  
  72.     // Executable Routine
  73.     function data_renderer($data$params// No change in the parameters with Clyde
  74.         // The next 2 lines allow access to the $pluginParams given above and may be removed when no longer needed
  75.         global $gLibertySystem$gBitSmarty$gBitSystem;
  76.  
  77.         $data trim($data);
  78.  
  79.         if (empty($data)) // If there is NO data to display - why do anything - get out of here
  80.             return " ";
  81.         }
  82.  
  83.         $rendererHash=array();
  84.         $rendererHash['content_id']=0;
  85.         $rendererHash['format_guid'empty($params['format_guid']$gBitSystem->getConfig('default_format'$params['format_guid'];
  86.         $rendererHash['data'=$data;
  87.  
  88.         $formatGuid=$rendererHash['format_guid'];
  89.         $ret "";
  90.         if$func $gLibertySystem->getPluginFunction$formatGuid'load_function' ) ) {
  91.             $ret $func$rendererHash$this );
  92.         }
  93.  
  94.         $display_result "<div";
  95.         if (!empty($params['id'])) {
  96.             $display_result .= " id=\"".$params['id']."\"";
  97.         }
  98.         if (!empty($params['class'])) {
  99.             $display_result .= " class=\"".$params['class']."\"";
  100.         }
  101.         $display_result .= ">$ret</div>";
  102.  
  103.         return $display_result;
  104.     }
  105. ?>

Documentation generated on Wed, 29 Jul 2015 13:56:21 +0000 by phpDocumentor 1.5.0-lsces