phpBB2Refugees.com Logo
Not affiliated with or endorsed by the phpBB Group

Register •  Login 

Continue the legacy...

Welcome to all phpBB2 Refugees!Wave Smilie

This site is intended to continue support for the legacy 2.x line of the phpBB2 bulletin board package. If you are a fan of phpBB2, please, by all means register, post, and help us out by offering your suggestions. We are primarily a community and support network. Our secondary goal is to provide a phpBB2 MOD Author and Styles area.

bbcode.php


 
Search this topic... | Search MOD Development... | Search Box
Register or Login to Post    Index » MOD Development  Previous TopicPrint TopicNext Topic
Author Message
JLA
Board Member



Joined: 30 Apr 2009

Posts: 298
Location: U.S.A


flag
PostPosted: Fri Jul 29, 2011 6:42 pm 
Post subject: bbcode.php

Have some code that takes certain links and changes them

For example if a link is entered into a post as

http://www.yahoo.com

The normal bbcode.php will change this to a clickable link.

Our code goes further by appending the link and making that clickable

http://xxxx.com/linker.php?url=http://www.yahoo.com

Code:
$ret = preg_replace("#(^|[\n ])([\w]+?://[\w\#$%&~/.\-;:=,?@\[\]+]*)#sie", "'\\1<a href=\"{$phpbb_root_path}linker.' . $phpEx . '?url=' . urlencode( $function('\\2') ). '\" target=\"_blank\" rel=\"nofollow\">\\2</a>'", $ret);


Code based off an external link mod

What we are now looking to do is the following

Take the following (and similar variations with things such as rel="nofollow" or target="blank") if it appears in a post

<a href="http://www.yahoo.com">Text<a>

and have it changed to a clickable link just as the code above does.

Other things to consider

It can keep the link text if it exists
Do not want to do anything with other links in the post that have already been changed - so this should be processed before the other link changing code

Comments?

_________________
http://www.jlaforums.com
Back to top
Display posts from previous:   
Register or Login to Post    Index » MOD Development  Previous TopicPrint TopicNext Topic
Page 1 of 1 All times are GMT
 
Jump to:  

Index • About • FAQ • Rules • Privacy • Search •  Register •  Login 
Not affiliated with or endorsed by the phpBB Group
Powered by phpBB2 © phpBB Group
Generated in 0.0079 seconds using 16 queries. (SQL 0.0017 Parse 0.0002 Other 0.0061)
phpBB Customizations by the phpBBDoctor.com
Template Design by DeLFlo and MomentsOfLight.com Moments of Light Logo