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

Source for file data.agentinfo.php

Documentation is available at data.agentinfo.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 (TikiWiki): Damian Parker <damosoft@users.sourceforge.net>
  17. // | Reworked for Bitweaver (& Undoubtedly Screwed-Up)
  18. // | by: StarRider <starrrider@users.sourceforge.net>
  19. // +----------------------------------------------------------------------+
  20. // $Id$
  21.  
  22. /**
  23.  * definitions
  24.  */
  25. define( 'PLUGIN_GUID_DATAAGENTINFO', 'dataagentinfo' );
  26. global $gLibertySystem;
  27. $pluginParams = array (
  28.     'tag' => 'AGENTINFO',
  29.     'auto_activate' => FALSE,
  30.     'requires_pair' => FALSE,
  31.     'load_function' => 'data_agentinfo',
  32.     'title' => 'AgentInfo',
  33.     'help_page' => 'DataPluginAgentInfo',
  34.     'description' => tra("This plugin will display the viewer's IP address, the Browser they are using, or the info about the site's Server software."),
  35.     'help_function' => 'data_agentinfo_help',
  36.     'syntax' => "{AGENTINFO info= }",
  37.     'plugin_type' => DATA_PLUGIN
  38. );
  39. $gLibertySystem->registerPlugin( PLUGIN_GUID_DATAAGENTINFO, $pluginParams );
  40. $gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATAAGENTINFO );
  41.  
  42. /**
  43.  * Help Function
  44.  */
  45. function data_agentinfo_help() {
  46.     $help =
  47.         '<table class="data help">'
  48.             .'<tr>'
  49.                 .'<th>' . tra( "Key" ) . '</th>'
  50.                 .'<th>' . tra( "Type" ) . '</th>'
  51.                 .'<th>' . tra( "Comments" ) . '</th>'
  52.             .'</tr>'
  53.             .'<tr class="odd">'
  54.                 .'<td>info</td>'
  55.                 .'<td>' . tra( "string") . '<br />' . tra("(optional)") . '</td>'
  56.                 .'<td>' . tra( "Show information about the Browser being used.") . '<br />'
  57.                 .'<strong>ip</strong>: ' . tra( "To get the client\'s IP address (default)" ) . '<br />'
  58.                 .'<strong>browser</strong>: ' . tra( "To get the clients Browser infromation." ) . '<br />'
  59.                 .'<strong>server</strong>: ' . tra( "To get the site\'s server software" ) . '</td>'
  60.             .'</tr>'
  61.         .'</table>'
  62.         . tra("Example: ") . "{AGENTINFO info='browser'}";
  63.     return $help;
  64. }
  65.  
  66. // Load Function
  67. function data_agentinfo($data, $params) {
  68.     $info = 'IP';
  69.     extract ($params, EXTR_SKIP);
  70.     switch (strtoupper ($info)) {
  71.         case 'SVRSW': // To maintain Pre-Clyde Parameters
  72.         case 'SERVER':
  73.               $ret = $_SERVER["SERVER_SOFTWARE"];
  74.               return $ret;
  75.         case 'BROWSER':
  76.               $ret = $_SERVER["HTTP_USER_AGENT"];
  77.               return $ret;
  78.         default:
  79.               $ret = $_SERVER["REMOTE_ADDR"];
  80.               return $ret;
  81.     }
  82.  
  83. }
  84. ?>

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