Example #1
0
function data_pluginhelp($data, $params)
{
    global $gLibertySystem;
    extract($params);
    if (!isset($plugin)) {
        // Exit if the Parameter is not set
        return pluginError('PluginHelp', tra('There was No Plugin Named for') . ' <strong>PluginHelp</strong> ' . tra('to work with.'));
    }
    foreach (array_keys($gLibertySystem->mPlugins) as $pluginGuid) {
        $pluginParams = $gLibertySystem->mPlugins[$pluginGuid];
        if ($pluginParams['plugin_type'] == DATA_PLUGIN && isset($pluginParams['description']) && $pluginParams['tag'] == strtoupper($plugin)) {
            $thisGuid = $pluginGuid;
        }
    }
    if (!isset($thisGuid)) {
        // The Plugin was not found
        $ret = '<div class="box">' . '<div class="error" style="text-align:center;">' . '<h2>' . tra('Error in the Plugin "') . 'PluginHelp</h2>' . '</div><hr />' . '<div class="boxcontent">' . tra('The Plugin Name Specified') . ' <strong>plugin=' . $plugin . '</strong> ' . tra('does not exist.') . '</div>';
        '</div>';
        return $ret;
    }
    $pluginParams = $gLibertySystem->mPlugins[$thisGuid];
    if (!is_array($pluginParams)) {
        // Something is Wrong - Exit
        return tra('The Plugin Name Given To <strong>PluginHelp "') . plugin . tra('"</strong> Either Does Not Exist Or Is Not Active.');
    }
    $runhelp = $pluginParams['help_function'];
    $runhelp = $runhelp();
    $ret = '<table class="data help" style="width: 100%;" border="2" cellpadding="4">' . '<caption><strong><big><big>Plugin Data</big></big></strong></caption>' . '<tr>' . '<th colspan="4" style="text-align: center;"><strong><big><big>' . $pluginParams['title'] . '</big></big></strong></th>' . '</tr>' . '<tr class="odd">' . '<td title="' . tra('The GUID is a string used to locate the Plugins Data.') . '">GUID => ' . $thisGuid . '</td>' . '<td title="' . tra('The Tag is the string you add to the text that calls the Plugin.') . '">tag => ' . $pluginParams['tag'] . '</td>' . '<td title="' . tra('Provides a Default value for the Administrator.') . '">auto_activate => ' . ($pluginParams['auto_activate'] ? 'True' : 'False') . '</td>' . '<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>' . '</tr>' . '<tr class="even">' . '<td colspan="4" title="' . tra('The Description states what the Plugin does.">') . 'description => ' . $pluginParams['description'] . '</td>' . '</tr>' . '<tr class="odd">' . '<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>' . '<td colspan="2" title="' . tra('This function displays the Extended Help Data for the Plugin.') . '">help_function => ' . $pluginParams['help_function'] . '</td>' . '</tr>' . '<tr class="even">' . '<td colspan="4" title="' . tra('The Syntax to be inserted into an editor for useage.') . '">syntax => ' . $pluginParams['syntax'] . '</td>' . '</tr>' . '<tr class="odd">' . '<td colspan="4" title="' . tra('Provides a link to a Help Page on bitweaver.org.') . '">help_page => ' . $pluginParams['help_page'] . '</td>' . '</tr>';
    if ($thisGuid != 'datalibrary') {
        $ret .= '<tr class="even">' . '<td colspan="4" style="text-align: center;" title="' . tra('Click to Visit the Help Page on bitweaver.org in a new window.') . '">' . '<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>' . '</td>' . '</tr>';
    }
    $ret .= '</table>' . '<div style="text-align: center;"><strong><big><big>' . tra('Parameter Data') . '</big></big></strong></div>' . '<div class="help box">~np~' . $runhelp . '~/np~</div>';
    return $ret;
}
Example #2
0
function data_GeshiData($data, $params)
{
    if (!file_exists(UTIL_PKG_PATH . 'geshi/geshi.php')) {
        // Exit - Unable to display the code.
        return pluginError('GeshiData', tra('The Plugin GeshiData Can Not Function Without The GeSHi Code!'));
    }
    include_once UTIL_PKG_PATH . 'geshi/geshi.php';
    extract($params);
    // 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
    $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
    $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
    $infoKeyWordArray = array('comment', 'comment1', 'comment2');
    // Used by a Key-word test
    $lang = isset($lang) && in_array(trim(strtolower($lang)), $langKeyWordArray) ? trim(strtolower($lang)) : 'php';
    $info = isset($info) && in_array(trim(strtolower($info)), $infoKeyWordArray) ? trim(strtolower($info)) : '';
    if (-(!isset($doall))) {
        if (in_array($info, $infoKeyWordArray)) {
            $obj = new GeSHi('Function code(){ }', $lang, UTIL_PKG_PATH . 'geshi/geshi');
            switch ($info) {
                case 'comment':
                    $datArr = $obj->language_data['COMMENT_SINGLE'];
                    $ret = count($datArr) > 0 ? $datArr[key($datArr)] : '';
                    return $ret;
                case 'comment1':
                    $datArr = $obj->language_data['COMMENT_MULTI'];
                    $ret = count($datArr) > 0 ? key($datArr) : '';
                    return $ret;
                case 'comment2':
                    $datArr = $obj->language_data['COMMENT_MULTI'];
                    $ret = count($datArr) > 0 ? $datArr[key($datArr)] : '';
                    return $ret;
            }
        }
        return pluginError('GeshiData', tra('The value placed in the parameter') . ' <strong>$info=' . $info . '</strong> ' . tra("was not a valid Key-word."));
    } else {
        $ret = '<div class="box">';
        $ret .= '<div class="error" style="text-align:center;">';
        // The Header
        $ret .= '<big><big><strong>' . tra('Language Properties') . '</strong></big></big>';
        $ret .= '</div><hr />';
        $ret .= '<div class="boxcontent">';
        // The Body
        $cnt = 0;
        foreach ($langKeyWordArray as $i) {
            $obj = new GeSHi('Function code(){ }', $i, UTIL_PKG_PATH . 'geshi/geshi');
            $ret .= '<table class="data help" style="width: 100%;" border="2" cellpadding="4">';
            $ret .= '<tr>';
            $ret .= '<th colspan="3" style="text-align: center;"><strong><large>' . $obj->language_data['LANG_NAME'] . '</large></strong></th>';
            $ret .= '</tr>';
            $ret .= '<tr>';
            $ret .= '<th style="text-align: center;"><strong><large>' . tra("Line Comment") . '</large></strong></th>';
            $ret .= '<th style="text-align: center;"><strong><large>' . tra("Block Comment Start") . '</large></strong></th>';
            $ret .= '<th style="text-align: center;"><strong><large>' . tra("Block Comment End") . '</large></strong></th>';
            $ret .= '</tr>';
            $ret .= !($cnt % 2) ? '<tr class="odd">' : '<tr class="even">';
            $datArr = $obj->language_data['COMMENT_SINGLE'];
            $ret .= '<td style="text-align: center;">';
            $ret .= count($datArr) > 0 ? $datArr[key($datArr)] : 'None';
            $ret .= '</td>';
            $datArr = $obj->language_data['COMMENT_MULTI'];
            $ret .= '<td style="text-align: center;">';
            if ($i != 'html4strict') {
                $ret .= count($datArr) > 0 ? key($datArr) : 'None';
            } else {
                $ret .= '&lt;!--';
            }
            $ret .= '</td>';
            $ret .= '<td style="text-align: center;">';
            if ($i != 'html4strict') {
                $ret .= count($datArr) > 0 ? $datArr[key($datArr)] : 'None';
            } else {
                $ret .= '--&gt;';
            }
            $ret .= '</td>';
            $ret .= '</tr>';
            $ret .= '</table>';
            $cnt++;
        }
        // foreach
        $ret .= '</div>';
        $ret .= '</div>';
    }
    return $ret;
}