The regex just isn't quite right. Try this:
public function filter_comment_content_out($co ntent){
return preg_replace( '(https?:\/\/\S*)', '<a href="$0" title="Visit
$0">$0</a>', $content );
I've also added a little something so it will recognise http://
S.
On Oct 7, 7:47 am, Balazs Koren <
balazs.ko...@gmail.com> wrote:
> Hey Ali,
>
> thanks, but it does something creepy. I understand it should work, but
> not really that hapends:
>
>
http://screen.kobak.org/8d2c910f.png - original commentshttp://
screen.kobak.org/af046ce3.png - same with the filter activatedhttp://
screen.kobak.org/fe6387e9.png - original sourcehttp://
screen.kobak.org/e7e637c8.png - source with the filter.
>
> The filter is somehow activated even if there is no http:// . Is there
> a failure in my side?
>
> My theme.php :
http://pastie.org/642080
>
> I pasted the code after line 53.
>
> Thanks for an further advice.
>
> Balazs
>
>
>
> On Tue, Oct 6, 2009 at 1:34 PM, Ali B. <
dmond...@gmail.com> wrote:
> > Hey Balazs,
>
> > Add the following to your active theme's theme.php, within the theme class
> > definition
>
> > public function filter_comment_content_out($content){
> > return preg_replace( '([http:\/\/]\S*)', '<a href="$0" title="Visit
> > $0">$0</a>', $content );
> > }
>
> > URLs that start with "http://" will be converted to an anchor pointing to
> > that URL. I hope it's what you need.
>
> > --
> > Ali
> >
http://awhitebox.com
>