IAM

OPENSOURCEFAN STUDYING
STUDYINGCOMPUTERSCIENCEANDMATH COMPUTERSCIENCE

Check out the latest superpixel benchmark — Superpixel Benchmark (2016) — and let me know your opinion! @david_stutz
27thNOVEMBER2016

SNIPPET

Protect mail addresses using Wordpress’ antispambot function. The mail addresses are still displayed but spambots have a harder time …

functions.php
/**
 * More spam resistent mails.
 *
 * @param type $attributes
 * @return type $contents 
 */
function hide_mail($attributes, $content = NULL) {
    extract(shortcode_atts(array(
        'mail' => '',
        'class' => '',
    ), $attributes));
    
    if (!empty($mail)) {
        return '<a class="' . $class . '" href="mailto:' . antispambot($mail) . '">' . antispambot($mail) . '</a>';
    }
}

add_shortcode('hide_mail', array($this, 'hide_mail'));

What is your opinion on the code snippet? Is it working? Let me know your thoughts in the comments below or using the following platforms: