예제 #1
0
function plugin_tooltip_inline()
{
    $args = func_get_args();
    $glossary = array_pop($args);
    $term = array_shift($args);
    //	$glossary_page = count($args) ? array_shift($args) : '';
    $glossary_page = '';
    if ($glossary == '') {
        $glossary = plugin_tooltip_get_glossary($term, $glossary_page, FALSE);
        // $debug .= "B=$glossary/";
        if ($glossary === FALSE) {
            $glossary = plugin_tooltip_get_page_title($term);
            if ($glossary === FALSE) {
                $glossary = '';
            }
        }
    }
    $s_glossary = htmlspecialchars($glossary);
    $page = strip_bracket($term);
    if (is_page($page)) {
        $url = get_page_uri($page);
        $passage = get_pg_passage($page, FALSE);
        return <<<EOD
<a href="{$url}" class="linktip" title="{$s_glossary}{$passage}">{$term}</a>
EOD;
    } else {
        return <<<EOD
<span class="tooltip" title="{$s_glossary}" onmouseover="javascript:this.style.backgroundColor='#ffe4e1';" onmouseout="javascript:this.style.backgroundColor='transparent';">{$term}</span>
EOD;
    }
}
예제 #2
0
function plugin_tooltip_inline($args)
{
    $args = func_get_args();
    $glossary = array_pop($args);
    $term = array_shift($args);
    if (empty($glossary)) {
        $glossary = Glossary::getGlossary($term);
        // $debug .= "B=$glossary/";
        if ($glossary === FALSE) {
            $glossary = plugin_tooltip_get_page_title($term);
            if ($glossary === FALSE) {
                $glossary = '';
            }
        }
    }
    $s_glossary = Utility::htmlsc($glossary);
    $page = Utility::stripBracket($term);
    $wiki = Factory::Wiki($page);
    if ($wiki->isValied() && $wiki->isReadable()) {
        return '<abbr class="glossary" title="' . $s_glossary . ' ' . $wiki->passage(false, false) . '"><a href="' . $wiki->uri() . '">' . $term . '</a></abbr>';
    }
    return '<abbr title="' . $s_glossary . '">' . $term . '</abbr>';
}
예제 #3
0
function make_tooltips($term, $glossary_page = '')
{
    global $script, $ajax;
    static $tooltip_initialized = FALSE;
    if (!exist_plugin('tooltip')) {
        return FALSE;
    }
    if (!$tooltip_initialized) {
        if (do_plugin_init('tooltip') === FALSE) {
            return FALSE;
        }
        $tooltip_initialized = TRUE;
    }
    $glossary = plugin_tooltip_get_glossary($term, $glossary_page, FALSE);
    if ($glossary === FALSE) {
        $glossary = plugin_tooltip_get_page_title($term);
        if ($glossary === FALSE) {
            $glossary = '';
        }
    }
    $s_term = str_replace("'", "\\'", htmlspecialchars($term));
    $s_glossary = htmlspecialchars($glossary);
    $page = strip_bracket($term);
    if (is_page($page)) {
        $passage = get_pg_passage($page, FALSE);
        return '<a href="' . get_page_uri($page) . '" class="linktip" title="' . $s_glossary . $passage . '">' . $term . '</a>';
    } elseif ($ajax) {
        return '<span class="tooltip"' . ' onmouseover="' . "javascript:this.style.backgroundColor='#ffe4e1';showGlossaryPopup('" . $script . "?plugin=tooltip&amp;q=" . $s_term . "',event,0.2);" . '"' . ' onmouseout="' . "javascript:this.style.backgroundColor='transparent';" . '">' . $term . '</span>';
    } else {
        return '<span class="tooltip" title="' . $s_glossary . '"' . ' onmouseover="javascript:this.style.backgroundColor=\'#ffe4e1\';"' . ' onmouseout="javascript:this.style.backgroundColor=\'transparent\';">' . $term . '</span>';
    }
}