Exemple #1
0
function phorum_mod_smileys_editor_tool_plugin()
{
    $PHORUM = $GLOBALS['PHORUM'];
    $lang = $PHORUM["DATA"]["LANG"]["mod_smileys"];
    // Register the smiley tool button for the message body.
    if (!empty($PHORUM['mod_smileys']['smileys_tool_enabled'])) {
        editor_tools_register_tool('smiley', $lang['smiley'], "./mods/smileys/icon.gif", "editor_tools_handle_smiley()", NULL, NULL, 'body');
    }
    // Register the smiley tool button for the message subject.
    if (!empty($PHORUM['mod_smileys']['subjectsmileys_tool_enabled'])) {
        editor_tools_register_tool('subjectsmiley', $lang['subjectsmiley'], "./mods/smileys/icon.gif", "editor_tools_handle_subjectsmiley()", NULL, NULL, 'subject');
    }
    $description = isset($lang['smileys help']) ? $lang['smileys help'] : 'smileys help';
    // Register the smileys help page.
    editor_tools_register_help($description, phorum_api_url(PHORUM_ADDON_URL, 'module=smileys', 'action=help'));
}
Exemple #2
0
function phorum_mod_bbcode_editor_tool_plugin()
{
    global $PHORUM;
    $lang = $PHORUM['DATA']['LANG']['mod_bbcode'];
    $nr_of_enabled_tags = 0;
    $enabled = isset($PHORUM['mod_bbcode']['enabled']) ? $PHORUM['mod_bbcode']['enabled'] : array();
    $builtin = $PHORUM['MOD_BBCODE']['BUILTIN'];
    // Register the tool buttons.
    foreach ($PHORUM['mod_bbcode_parser']['taginfo'] as $id => $taginfo) {
        // Skip tool if no editor tools button is implemented.
        if (!$taginfo[BBCODE_INFO_HASEDITORTOOL]) {
            continue;
        }
        // Check if the editor tool should be shown. If not, then skip
        // to the next tag. If there are no settings saved yet for the
        // module, then use the settings from the builtin tag list.
        if (isset($enabled[$id]) && $enabled[$id] != 2 || !isset($PHORUM['mod_bbcode']['enabled'][$id]) && isset($builtin[$id]) && $builtin[$id][BBCODE_INFO_DEFAULTSTATE] != 2) {
            continue;
        }
        // Keep track of the number of enabled tags.
        $nr_of_enabled_tags++;
        // Determine the description to use for the tool. If we can find
        // a description in the language strings, then we use that one.
        // Otherwise, we simply fall back to the less descriptive feature id.
        $description = isset($lang[$id]) ? $lang[$id] : $id;
        // Register the tool button with the Editor Tools module.
        editor_tools_register_tool($id, $description, "./mods/bbcode/icons/{$id}.gif", "editor_tools_handle_{$id}()");
    }
    // Register the bbcode help page, unless no tags were enabled at all.
    if ($nr_of_enabled_tags > 0) {
        $description = isset($lang['bbcode help']) ? $lang['bbcode help'] : 'BBcode help';
        editor_tools_register_help($description, phorum_get_url(PHORUM_ADDON_URL, 'module=bbcode', 'action=help'));
    }
    // Make language strings available for the editor tools javascript code.
    editor_tools_register_translations($lang);
}