Beispiel #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'));
}
Beispiel #2
0
/**
 * Adds the javascript and CSS for the editor tools to the page header.
 * Sets up internal datastructures for the editor tools module.
 * Allows other modules to register their editor tool buttons.
 */
function phorum_mod_editor_tools_common()
{
    $lang = $GLOBALS["PHORUM"]["DATA"]["LANG"]["mod_editor_tools"];
    // Initialize the tool data array.
    $GLOBALS["PHORUM"]["MOD_EDITOR_TOOLS"] = array("DO_TOOLS" => false, "STARTED" => false, "TOOLS" => array(), "JSLIBS" => array(), "HELP_CHAPTERS" => array(), "TRANSLATIONS" => $lang);
    // Add a help tool. We add it as the first tool, so we can
    // shift it nicely to the right side of the page using CSS float.
    if (!empty($GLOBALS["PHORUM"]["mod_editor_tools"]["enable_help"])) {
        editor_tools_register_tool('help', $lang['help']);
    }
    // Give other modules a chance to setup their plugged in
    // editor tools. This is done through a standard hook call.
    if (isset($GLOBALS["PHORUM"]["hooks"]["editor_tool_plugin"])) {
        phorum_hook('editor_tool_plugin');
    }
    // Keep track that the editor tools have been setup. From here
    // on, the API calls for registering tools, javascript libraries
    // help chapters and language strings are no longer allowed.
    $PHORUM["MOD_EDITOR_TOOLS"]["STARTED"] = true;
}
Beispiel #3
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);
}