In Subs.php, I'm trying to add rel="nofollow" to all links that don't possess my URL ($boardurl).
For example, if I linked cnn.com, the html would be <a rel="nofollow" href="cnn.com", whereas if I linked my own site MYURL.com, the html wouldn't contain rel="nofollow".
Can someone tell me how to accomplish this? This is what I've achieved so far, but it's causing all links to contain rel="nofollow"
global $boardurl;
if(strpos($message, '<a href') !== false)
$message = preg_replace('~(<a)( href="(?!' . preg_quote($boardurl) . ')(?:[^"]*?)"(?:[^>]*?)\>(?:.*?)</a>)~i', '$1 rel="nofollow"$2 ', $message);
This is going near the end of function parse_bbc. This is for 1.1.19.
Any suggestions?
Actually I'm pretty sure that a mod for this did exist. If only I could find it...
You mean like this one:
http://custom.simplemachines.org/mods/index.php?mod=1236
And
http://custom.simplemachines.org/mods/index.php?mod=1237
http://custom.simplemachines.org/mods/index.php?mod=1236
That's for all links.
http://custom.simplemachines.org/mods/index.php?mod=1237
That's a BBCode
I should have made it clear that I want it to occur automatically :-\
I checked now, there was really an unapproved mod. :(
Lainaus käyttäjältä: margarett - huhtikuu 21, 2014, 05:35:23 AP
I checked now, there was really an unapproved mod. :(
Can you provide the link?
if its un-aproved a link wont work
i think he was talking about http://www.simplemachines.org/community/index.php?topic=510778.0 which became a mod and the author and mod are now gone.
Exactly :)
What a shame.