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

Source for file data.pluginhelp.php

Documentation is available at data.pluginhelp.php

  1. <?php
  2. /**
  3.  * @version  $Revision$
  4.  * @package  liberty
  5.  * @subpackage plugins_data
  6.  */
  7. // +----------------------------------------------------------------------+
  8. // | Copyright (c) 2004, 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: StarRider <starrrider@users.sourceforge.net>
  17. // | Rewritten for bitweaver by Author
  18. // +----------------------------------------------------------------------+
  19. // $Id$
  20.  
  21. /**
  22.  * definitions
  23.  */
  24. define'PLUGIN_GUID_DATAPLUGINHELP''datapluginhelp' );
  25. global $gLibertySystem;
  26. $pluginParams array (
  27.     'tag' => 'PLUGINHELP',
  28.     'auto_activate' => FALSE,
  29.     'requires_pair' => FALSE,
  30.     'load_function' => 'data_pluginhelp',
  31.     'title' => 'PluginHelp',                                                                             // and Remove the comment from the start of this line
  32.     'help_page' => 'DataPluginPluginHelp',
  33.     'description' => tra("This plugin will display the plugin's Help."),
  34.     'help_function' => 'data_pluginhelp_help',
  35.     'syntax' => "{PLUGINHELP plugin= }",
  36.     'plugin_type' => DATA_PLUGIN
  37. );
  38. $gLibertySystem->registerPluginPLUGIN_GUID_DATAPLUGINHELP$pluginParams );
  39. $gLibertySystem->registerDataTag$pluginParams['tag']PLUGIN_GUID_DATAPLUGINHELP );
  40.  
  41. // Help Function
  42. function data_pluginhelp_help({
  43.     $help =
  44.         '<table class="data help">'
  45.             .'<tr>'
  46.                 .'<th>'.tra"Key" ).'</th>'
  47.                 .'<th>'.tra"Type" ).'</th>'
  48.                 .'<th>'.tra"Comments" ).'</th>'
  49.             .'</tr>'
  50.             .'<tr class="odd">'
  51.                 .'<td>plugin</td>'
  52.                 .'<td>'.tra"string").'<br />'.tra("(manditory)").'</td>'
  53.                 .'<td>'.tra"The Name of the Plugin to be displayed.")
  54.                     .'<br />'.tra"There is").' <strong>No</strong> '.tra"Default.")
  55.                 .'</td>'
  56.             .'</tr>'
  57.         .'</table>'
  58.         . tra("Example: "."{PLUGINHELP plugin='pluginhelp' } - Will display the Plugin\'s Help<br />"
  59.         . tra("Example: "."{PLUGINHELP plugin='pluginhelp' showdata=TRUE } - Will display the Plugin\'s PluginParams";
  60.     return $help;
  61. }
  62.  
  63. // Load Function
  64. function data_pluginhelp($data$params{
  65.     global $gLibertySystem;
  66.     extract ($params);
  67.  
  68.     if (!isset($plugin)) {// Exit if the Parameter is not set
  69.         return pluginError('PluginHelp'tra('There was No Plugin Named for').' <strong>PluginHelp</strong> '.tra('to work with.'));
  70.     }
  71.     foreach (array_keys($gLibertySystem->mPluginsas $pluginGuid{
  72.         $pluginParams $gLibertySystem->mPlugins[$pluginGuid];
  73.         if ($pluginParams['plugin_type'== DATA_PLUGIN && isset($pluginParams['description']&& $pluginParams['tag'== strtoupper($plugin))
  74.             $thisGuid $pluginGuid;
  75.     }
  76.     if (!isset($thisGuid)) // The Plugin was not found
  77.         $ret  =
  78.             '<div class="box">'
  79.                 .'<div class="error" style="text-align:center;">'
  80.                     .'<h2>'.tra('Error in the Plugin "').'PluginHelp</h2>'
  81.                 .'</div><hr />'
  82.                 .'<div class="boxcontent">'
  83.                     .tra('The Plugin Name Specified').' <strong>plugin='.$plugin.'</strong> '.tra('does not exist.')
  84.                 .'</div>';
  85.             '</div>';
  86.         return $ret;
  87.     }
  88.  
  89.     $pluginParams $gLibertySystem->mPlugins[$thisGuid];
  90.  
  91.     if (!is_array($pluginParams)) // Something is Wrong - Exit
  92.         return tra('The Plugin Name Given To <strong>PluginHelp "').plugin.tra('"</strong> Either Does Not Exist Or Is Not Active.');
  93.     $runhelp $pluginParams['help_function'];
  94.     $runhelp $runhelp();
  95.     $ret =
  96.         '<table class="data help" style="width: 100%;" border="2" cellpadding="4">'
  97.             .'<caption><strong><big><big>Plugin Data</big></big></strong></caption>'
  98.             .'<tr>'
  99.                 .'<th colspan="4" style="text-align: center;"><strong><big><big>'.$pluginParams['title'].'</big></big></strong></th>'
  100.             .'</tr>'
  101.             .'<tr class="odd">'
  102.                 .'<td title="'.tra('The GUID is a string used to locate the Plugins Data.').'">GUID => '.$thisGuid.'</td>'
  103.                 .'<td title="'.tra('The Tag is the string you add to the text that calls the Plugin.').'">tag => '.$pluginParams['tag'].'</td>'
  104.                 .'<td title="'.tra('Provides a Default value for the Administrator.').'">auto_activate => '.($pluginParams['auto_activate''True' 'False').'</td>'
  105.                 .'<td title="'.tra('The Number of Code Blocks required by the Plugin. Can be 1 or 2').'">requires_pair => '.($pluginParams['requires_pair''True' 'False').'</td>'
  106.             .'</tr>'
  107.             .'<tr class="even">'
  108.                 .'<td colspan="4" title="'.tra('The Description states what the Plugin does.">').'description => '.$pluginParams['description'].'</td>'
  109.             .'</tr>'
  110.             .'<tr class="odd">'
  111.                 .'<td colspan="2" title="'.tra('This function does the work & is called by the Parser when the Tag is found.').'">load_function => '.$pluginParams['load_function'].'</td>'
  112.                 .'<td colspan="2" title="'.tra('This function displays the Extended Help Data for the Plugin.').'">help_function => '.$pluginParams['help_function'].'</td>'
  113.             .'</tr>'
  114.             .'<tr class="even">'
  115.                 .'<td colspan="4" title="'.tra('The Syntax to be inserted into an editor for useage.').'">syntax => '.$pluginParams['syntax'].'</td>'
  116.             .'</tr>'
  117.             .'<tr class="odd">'
  118.                 .'<td colspan="4" title="'.tra('Provides a link to a Help Page on bitweaver.org.').'">help_page => '.$pluginParams['help_page'].'</td>'
  119.             .'</tr>';
  120.     if ($thisGuid != 'datalibrary'$ret .= // This button is not needed by the Plugin Library {LIB}
  121.             '<tr class="even">'
  122.                 .'<td colspan="4" style="text-align: center;" title="'.tra('Click to Visit the Help Page on bitweaver.org in a new window.').'">'
  123.                     .'<input type="button" value="Visit the Help Page" onclick="javascript:BitBase.popUpWin(\'http://bitweaver.org/wiki/index.php?page='.$pluginParams['help_page'].'\',\'standard\',800,800)"></input>'
  124.                 .'</td>'
  125.             .'</tr>';
  126.     $ret .= '</table>'
  127.         .'<div style="text-align: center;"><strong><big><big>'.tra('Parameter Data').'</big></big></strong></div>'
  128.         .'<div class="help box">~np~'.$runhelp.'~/np~</div>';
  129.     return $ret;
  130. }
  131. ?>

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