Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function noFollowLinks($str, $nofollow, $userId){
- if(true) {
- if(strpos($str, "rel")){
- $pattern = '/(?!<<a)rel=.?\".*?\"/';
- $replace = "rel=\"$nofollow\"";
- }
- else {
- $pattern = "/<a /";
- $replace = "<a rel=\"$nofollow\" ";
- }
- return preg_replace($pattern, $replace, $str);
- }
- return $str;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement