Slashdot style urls

Started by Cccddd, March 09, 2004, 01:22:31 PM

Previous topic - Next topic

Cccddd

Link to Mod

This mod is designed to make all links that appear in the message board posts to have a slashdot style [website.com] tag after the link, allowing the reader to know where the link is going so they dont feel maliciously redirected.

shads

its not working on my site
are there any requirements for it to run?
i inserted it in the subs.php but nothing happen
help me pls

Cccddd

this wasnt developed for SMF 1.0. I will work on a new version in a few days.

shads


Cccddd

I just installed it on my site (http://nrrds.com) and it worked just fine. copy and paste your subs.php in code tags WITH the mod installed please

example: http://nrrds.com/forum/index.php?topic=2.0

shads

Quote// Do the code if necessary.
   if (strstr($message, '[') || strstr($message, '://') || strstr($message, '@') || strstr($message, '/me'))
   {
      $shadow_directions = array('left' => '270', 'right' => '90', 'top' => '0', 'bottom' => '180');

      $message = preg_replace($codefromcache, $codetocache, $message);
                $message = preg_replace('/<a href="http\:\/\/([-a-z0-9\.]+)[^>]*>([^<]+)<\/a>/i','$0 [$1]',$message);

      // Tables need to be done twice or they won't work properly.
      if (strpos($message, '<table>') !== false)
      {
         for ($i = 0; $i < 2; $i++)
            $message = preg_replace(
               array(
                  '~((?:<table>|</tr>|\[/tr\])(?:\s|\xA0|<br />|&nbsp;)*(?:<tr>|\[tr\])|</td>|\[/td\])(?:\s|\xA0|<br />|&nbsp;)*\[td\](?:\s|\xA0|<br />|&nbsp;)*(.*?)(?:\s|\xA0|<br />|&nbsp;)*\[/td\](?:\s|\xA0|<br />|&nbsp;)*((?:</tr>|\[/tr\])(?:\s|\xA0|<br />|&nbsp;)*(?:<tr>|\[tr\]|</table>)|<td(?: valign="top")?>|\[td\])~i',
                  '~(<table>|</tr>|\[/tr\])(?:\s|\xA0|<br />|&nbsp;)*\[tr\](?:\s|\xA0|<br />|&nbsp;)*(.*?)(?:\s|\xA0|<br />|&nbsp;)*\[/tr\](?:\s|\xA0|<br />|&nbsp;)*(</table>|<tr>|\[tr\])~i'
               ),
               array(
                  '$1<td valign="top">$2</td>$3',
                  '$1<tr>$2</tr>$3'
               ), $message
            );
      }
   }

Thats a part my subs.php with the mod installed.
I think nothing happen when I installed it. No errors too.
Would this make urls more spiderable?

Cccddd

no idea if it makes it more spiderable. look at my example page, and look at the link for smf. it just takes the domain out of the url and puts it next to the link.

shads

Thanks cheschire its now working  8)

Cccddd


Advertisement: