Skip to content

Instantly share code, notes, and snippets.

@felipelavinz
Created April 20, 2010 01:00
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
A simple plugin to use WordPress' antispambot() function in posts and pages
<?php
/*
Plugin Name: Antispambot Shortcode
Plugin URI: http://yukei.net/proyectos/nospam-sc
Description: A simple plugin to use WordPress' antispambot() function in posts and pages
Version: 1.0
Author: Felipe Lavin Z.
Author URI: http://www.yukei.net
*/
function antispambot_sc($atts, $content = ''){
extract(shortcode_atts(array(
'email' => '',
'link' => ''
), $atts));
if ( empty($link) ) {
$out = '<a href="mailto:'. antispambot($email) .'">'. antispambot($email) .'</a>';
} else {
$out = '<a href="mailto:'. antispambot($email) .'">'. $link .'</a>';
}
return $out;
}
add_shortcode('antispambot', 'antispambot_sc');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment