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

Source for file data.geshidata.php

Documentation is available at data.geshidata.php

  1. <?php
  2. // $Id$
  3. /**
  4.  * assigned_modules
  5.  *
  6.  * @author   StarRider <starrrider@sourceforge.net>
  7.  * @version  $Revision$
  8.  * @package  liberty
  9.  * @subpackage plugins_data
  10.  * @copyright Copyright (c) 2004, bitweaver.org
  11.  *  All Rights Reserved. See below for details and a complete list of authors.
  12.  * @license Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details.
  13.  */
  14. /******************
  15.  * Initialization *
  16.  ******************/
  17. global $gLibertySystem;
  18. define'PLUGIN_GUID_DATAGESHIDATA','datageshidata' );
  19. global $gLibertySystem;
  20. $pluginParams array (
  21.     'tag' => 'GESHIDATA',
  22.     'auto_activate' => FALSE,
  23.     'requires_pair' => FALSE,
  24.     'load_function' => 'data_GeshiData',
  25.     'title' => 'GeshiData',
  26.     'help_page' => 'DataPluginGeshiData',
  27.     'description' => tra("This plugin is a documentation tool for the bitweaver site. It will display some of information defined in the GeSHi (Generic Syntax Highlighter) package."),
  28.     'help_function' => 'data_help_GeshiData',
  29.     'syntax' => "{GESHIDATA doall= lang= info= }",
  30.     'plugin_type' => DATA_PLUGIN
  31. );
  32. $gLibertySystem->registerPluginPLUGIN_GUID_DATAGESHIDATA$pluginParams );
  33. $gLibertySystem->registerDataTag$pluginParams['tag']PLUGIN_GUID_DATAGESHIDATA );
  34. /*****************
  35.  * Help Function *
  36.  *****************/
  37. function data_help_GeshiData({
  38.     $help =
  39.         '<table class="data help">'
  40.             .'<tr>'
  41.                 .'<th>'.tra"Key" ).'</th>'
  42.                 .'<th>'.tra"Type" ).'</th>'
  43.                 .'<th>'.tra"Comments" ).'</th>'
  44.             .'</tr>'
  45.             .'<tr class="odd">'
  46.                 .'<td>doall</td>'
  47.                 .'<td>'.tra"boolean").'<br />'.tra("(optional)").'</td>'
  48.                 .'<td>'.tra"Provided to display the information for Every Language.")
  49.                     .'<br />'.tra"Default =").' <strong>False</strong> '.tra"- So only specific information is Displayed.")
  50.                 .'</td>'
  51.             .'</tr>'
  52.             .'<tr class="even">'
  53.                 .'<td>lang</td>'
  54.                 .'<td>'.tra"string").'<br />'.tra("(optional)").'</td>'
  55.                 .'<td>'.tra"Specifies the Language to gather the information from. Possible values are:")
  56.                     .'<br /><strong>ActionScript / Ada / Apache Log File=Apache / ASM (NASM based)= Asm / ASP / Bash / C '
  57.                     .'/ C for Macs=C_Mac / AutoCAD DCL=CadDcl / AutoCAD LISP=CadLisp / C++=Cpp / C#=CSharp / CSS / D '
  58.                     .'/ Delphi / Diff Output=Diff / HTML (4.0.1)=Html4Strict / Java / JavaScript / Lisp / Lua / MatLab '
  59.                     .'/ MpAsm / NullSoft Installer=Nsis / Objective C=ObjC / OpenOffice.org Basic=OoBas / Oracle8 '
  60.                     .'/ Pascal / Perl  / Php / Php-Brief / Python / QuickBasic=QBasic / Smarty / SQL / VisualBasic=Vb '
  61.                     .'/ VB.NET=VbNet / VHDL / VisualFoxPro / XML</strong>. '
  62.                     .'<br />'.tra("The Default = ").'<strong> PHP </strong>'
  63.                 .'</td>'
  64.             .'</tr>'
  65.             .'<tr class="odd">'
  66.                 .'<td>info</td>'
  67.                 .'<td>'.tra("key-word").'<br />'.tra("(optional)").'</td>'
  68.                 .'<td>'.tra"Determines the information to be displayed. The Key-words are:")
  69.                     .'<br /><strong>Comment / Comment1 / Comment2</strong>'
  70.                     .'<br /><strong>'.tra("Note:").'</strong> '.tra"With the").' <strong>Comment</strong> '
  71.                     .tra("Key-words - the difference is").' <strong>Comment</strong> '.tra("returns the Line Comment Character / while")
  72.                         .' <strong>Comment1</strong> '.tra("returns the starting Block Comment Character and")
  73.                         .' <strong>Comment2</strong> '.tra("returns the ending Block Comment Character.")
  74.                     .'<br />'.tra"There is <strong>No</strong> Default for this parameter.")
  75.                 .'</td>'
  76.             .'</tr>'
  77.         .'</table>'
  78.         .tra("Example: ")."{GESHIDATA doall='True' }"
  79.         .'<br />'.tra("Example: ")."{GESHIDATA lang='XML' info='Comment' }";
  80.     return $help;
  81. }
  82. /****************
  83. * Load Function *
  84.  ****************/
  85. function data_GeshiData($data$params{
  86.     if !file_existsUTIL_PKG_PATH 'geshi/geshi.php' )) // Exit - Unable to display the code.
  87.         return pluginError('GeshiData'tra('The Plugin GeshiData Can Not Function Without The GeSHi Code!'));
  88.     }
  89.     include_onceUTIL_PKG_PATH.'geshi/geshi.php' );
  90.     extract ($params);
  91. // NOTE: The the order of the next 2 arrays is critical - if you change one of them then change the other in the same way
  92.     $langKeyWordArray =    array('actionscript',    'ada',    'apache',            'asm',                'asp',    'bash',    'c',    'c_mac',        'caddcl',        'cadlisp',        'cpp',    'csharp',    'css',    'd',    'delphi',    'diff',            'html4strict',    'java',    'javascript',    'lisp',    'lua',    'matlab',    'mpasm',    'nsis',                    'objc',            'oobas',                'oracle8',    'pascal',    'perl',    'php',    'php-brief',    'python',    'qbasic',        'smarty',    'sql',    'vb',            'vbnet',    'vhdl',    'visualfoxpro',    'xml')// Used by Key-word test
  93.     $langNames =        array('ActionScript',    'Ada',    'Apache Log File',    'ASM (NASM based)',    'ASP',    'Bash',    'C',    'C for Macs',    'AutoCAD DCL',    'AutoCAD LISP',    'C++',    'C#',        'CSS',    'D',    'Delphi',    'Diff Output',    'HTML (4.0.1)',    'Java',    'JavaScript',    'Lisp',    'Lua',    'MatLab',    'MpAsm',    'NullSoft Installer',    'Objective C',    'OpenOffice.org Basic',    'Oracle8',    'Pascal',    'Perl',    'Php',    'Php_Brief',    'Python',    'QuickBasic',    'Smarty',    'SQL',    'VisualBasic',    'VB.NET',    'VHDL',    'VisualFoxPro',    'XML')// Used when displaying everything
  94.     $infoKeyWordArray array('comment''comment1''comment2')// Used by a Key-word test
  95.  
  96.     $lang (isset($lang&& in_array(trim(strtolower($lang)),$langKeyWordArray)) trim(strtolower($lang)) 'php';
  97.     $info (isset($info&& in_array(trim(strtolower($info)),$infoKeyWordArray)) trim(strtolower($info)) '';
  98.  
  99.     if (-!isset($doall)) {
  100.         if (in_array($info,$infoKeyWordArray)) {
  101.             $obj new GeSHi('Function code(){ }'$langUTIL_PKG_PATH.'geshi/geshi' );
  102.             switch ($info{
  103.                 case 'comment' {
  104.                     $datArr $obj->language_data['COMMENT_SINGLE'];
  105.                     $ret (count($datArr)>0$datArr[key($datArr)'';
  106.                     return $ret;
  107.                 }
  108.                 case 'comment1' {
  109.                     $datArr $obj->language_data['COMMENT_MULTI'];
  110.                     $ret (count($datArr)>0key($datArr'';
  111.                     return $ret;
  112.                 }
  113.                 case 'comment2' {
  114.                     $datArr $obj->language_data['COMMENT_MULTI'];
  115.                     $ret (count($datArr)>0$datArr[key($datArr)'';
  116.                     return $ret;
  117.         }    }    }
  118.         return pluginError('GeshiData'tra('The value placed in the parameter').' <strong>$info='.$info.'</strong> '.tra("was not a valid Key-word."));
  119.     else {
  120.         $ret '<div class="box">';
  121.         $ret .=        '<div class="error" style="text-align:center;">'// The Header
  122.         $ret .=            '<big><big><strong>'.tra('Language Properties').'</strong></big></big>';
  123.         $ret .=        '</div><hr />';
  124.         $ret .=        '<div class="boxcontent">'// The Body
  125.         $cnt 0;
  126.         foreach ($langKeyWordArray as $i{
  127.             $obj new GeSHi('Function code(){ }'$iUTIL_PKG_PATH.'geshi/geshi' );
  128.             $ret .=        '<table class="data help" style="width: 100%;" border="2" cellpadding="4">';
  129.             $ret .=            '<tr>';
  130.             $ret .=                '<th colspan="3" style="text-align: center;"><strong><large>'.$obj->language_data['LANG_NAME'].'</large></strong></th>';
  131.             $ret .=            '</tr>';
  132.             $ret .=            '<tr>';
  133.             $ret .=                '<th style="text-align: center;"><strong><large>'.tra("Line Comment").'</large></strong></th>';
  134.             $ret .=                '<th style="text-align: center;"><strong><large>'.tra("Block Comment Start").'</large></strong></th>';
  135.             $ret .=                '<th style="text-align: center;"><strong><large>'.tra("Block Comment End").'</large></strong></th>';
  136.             $ret .=            '</tr>';
  137.             $ret .= (!($cnt%2)) ?
  138.                             '<tr class="odd">' '<tr class="even">';
  139.             $datArr $obj->language_data['COMMENT_SINGLE'];
  140.             $ret .=             '<td style="text-align: center;">';
  141.             $ret .=                (count($datArr)>0$datArr[key($datArr)'None';
  142.             $ret .=                '</td>';
  143.             $datArr $obj->language_data['COMMENT_MULTI'];
  144.             $ret .=                '<td style="text-align: center;">';
  145.             if ($i != 'html4strict')
  146.                 $ret .=            (count($datArr)>0key($datArr'None';
  147.             else $ret .=        '&lt;!--';
  148.             $ret .=                '</td>';
  149.             $ret .=                '<td style="text-align: center;">';
  150.             if ($i != 'html4strict')
  151.                 $ret .=                    (count($datArr)>0$datArr[key($datArr)'None';
  152.             else $ret .=        '--&gt;';
  153.             $ret .=                '</td>';
  154.             $ret .=            '</tr>';
  155.             $ret .=        '</table>';
  156.             $cnt++;
  157.         // foreach
  158.         $ret .=        '</div>';
  159.         $ret .=    '</div>';
  160.     }
  161.     return $ret;
  162. }
  163. ?>

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