Guest
Public paste!

fris

By: a guest | Mar 22nd, 2010 | Syntax: PHP | Size: 0.24 KB | Hits: 81 | Expires: Never
Copy text to clipboard
  1. // add nofollow to all external links
  2.  
  3. function change_links($text) {
  4.     $host = str_replace('.','\.',getenv("HTTP_HOST"));
  5.     return preg_replace('/href=["|\']?(http:\/\/(?!'.$host.')([^"\']*))["|\']?/ui','href="$1" rel="nofollow"',$text);
  6. }