Skip to content

Instantly share code, notes, and snippets.

@felipelavinz
Created April 20, 2010 01:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save felipelavinz/371875 to your computer and use it in GitHub Desktop.
Save felipelavinz/371875 to your computer and use it in GitHub Desktop.
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