Exemple #1
0
function mandcua_parse_external_links($matches)
{
    if (manduca_get_domain_name_from_uri($matches[3]) != manduca_get_domain_name_from_uri($_SERVER["HTTP_HOST"])) {
        $flag = FALSE;
        foreach ($matches as $key => $match) {
            if (!empty($match)) {
                if (strpos($match, 'class=') !== FALSE) {
                    $matches[$key] = str_replace('class="', 'class="ext-link ', $match);
                    $flag = TRUE;
                }
            }
        }
        if ($flag) {
            $pattern = '<a href="' . $matches[2] . '//' . $matches[3] . '"' . $matches[1] . $matches[4] . '>' . $matches[5] . '<span class="screen-reader-text"> ' . __('external', 'manduca') . '</span></a>';
        } else {
            $pattern = '<a href="' . $matches[2] . '//' . $matches[3] . '"' . $matches[1] . $matches[4] . ' class="ext-link">' . $matches[5] . '<span class="screen-reader-text"> ' . __('external', 'manduca') . '</span></a>';
        }
        return $pattern;
    } else {
        return '<a href="' . $matches[2] . '//' . $matches[3] . '"' . $matches[1] . $matches[4] . '>' . $matches[5] . '</a>';
    }
}
function mandcua_parse_external_links($matches)
{
    if (manduca_get_domain_name_from_uri($matches[3]) != manduca_get_domain_name_from_uri($_SERVER["HTTP_HOST"])) {
        return '<a href="' . $matches[2] . '//' . $matches[3] . '"' . $matches[1] . $matches[4] . ' class="ext-link">' . $matches[5] . '</a>';
    } else {
        return '<a href="' . $matches[2] . '//' . $matches[3] . '"' . $matches[1] . $matches[4] . '>' . $matches[5] . '</a>';
    }
}