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 <[email protected]> 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. <[email protected]> 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
>
> > On Tue, Oct 6, 2009 at 8:07 PM, Balazs Koren <[email protected]> wrote:
>
> >> Thanks Markdown is cool, but the problem isn't myself, but the
> >> commenters, who post a link, and it won't display clickable, what they
> >> are used to. It's not a great problem, but would be nice, if there is
> >> a solution for it.
>
> >> Balazs
>
> >> On Tue, Oct 6, 2009 at 2:16 AM, Caius Durling <[email protected]> wrote:
> >> > On 5 Oct 2009, at 11:59, Balazs Koren wrote:
>
> >> > For example I type in my comment http://habariproject.org it will be
> >> > displayed as <a
> >> > href="http://habariproject.org";>http://habariproject.org</a> and I
> >> > don't have to add the anchors myself. Is there a plugin somewhere to
> >> > support this functionality? Thanks.
>
> >> > It adds a lot more than just auto-linking, but if you install the
> >> > markdown
> >> > plugin you can write <http://foo.com> and it'll autolink it for you.
> >> > I'm pretty lazy when it comes to penning things like blog posts, so I
> >> > love
> >> > writing them in markdown[1], makes writing stuff *really* easy, and then
> >> > it
> >> > all displays nicely when you hit publish :)
> >> > [1]:http://daringfireball.net/projects/markdown
> >> > C
> >> > ---
> >> > Caius Durling
> >> > [email protected]
> >> > +44 (0) 7960 268 100
> >> >http://caius.name/
>
> >> --
> >>http://kobak.org
> >>http://fotolog.hu
>
> --http://kobak.orghttp://fotolog.hu
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/habari-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to