daily pastebin goal
38%
SHARE
TWEET

Untitled

a guest Dec 19th, 2018 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function noFollowLinks($str, $nofollow, $userId){
  2.     if(true) {
  3.         if(strpos($str, "rel")){
  4.             $pattern = '/(?!<<a)rel=.?\".*?\"/';
  5.             $replace = "rel=\"$nofollow\"";
  6.         }
  7.         else {
  8.             $pattern = "/<a /";
  9.             $replace = "<a rel=\"$nofollow\" ";
  10.         }
  11.         return preg_replace($pattern, $replace, $str);
  12.     }
  13.     return $str;
  14. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top