![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
Confirmed User
Industry Role:
Join Date: Dec 2003
Location: Wisconsin
Posts: 3,574
|
coders, check this out
This is a plugin for wordpress that makes urls clickable. Example - it will turn the text http://www.link.com into
Code:
<a href="http://www.link.com" title="http://www.link.com" target="_blank">http://www.link.com</a>. I'm sure it can be done with no more than 4 lines of code, can anyone tell me how to fix it? I'll throw in a few bucks if you want it. (that hahahaha is 2 of these =) Code:
function c2c_truncate_link ($url, $mode='0', $trunc_before='', $trunc_after='...') { if (1 hahahaha $mode) { $url = preg_replace("/(([a-z]+?):\\/\\/[A-Za-z0-9\-\.]+).*/i", "$1", $url); $url = $trunc_before . preg_replace("/([A-Za-z0-9\-\.]+\.(com|org|net|gov|edu|us|info|biz|ws|name|tv)).*/i", "$1", $url) . $trunc_after; } elseif (($mode > 10) && (strlen($url) > $mode)) { $url = $trunc_before . substr($url, 0, $mode) . $trunc_after; } return $url; } //end c2c_truncate_link() // mode: 0=full url; 1=host-only ;11+=number of characters to truncate after function c2c_hyperlink_urls ($text, $mode='0', $trunc_before='', $trunc_after='...', $open_in_new_window=true) { $text = ' ' . $text . ' '; $new_win_txt = ($open_in_new_window) ? ' target="_blank"' : ''; // Hyperlink Class B domains *.(com|org|net|gov|edu|us|info|biz|ws|name|tv)(/*) $text = preg_replace("#([\s{}\(\)\[\]])([A-Za-z0-9\-\.]+)\.(com|org|net|gov|edu|us|info|biz|ws|name|tv)((?:/[^\s{}\(\)\[\]]*[^\.,\s{}\(\)\[\]]?)?)#ie", "'$1<a href=\"http://$2.$3$4\" title=\"http://$2.$3$4\"$new_win_txt>' . c2c_truncate_link(\"$2.$3$4\", \"$mode\", \"$trunc_before\", \"$trunc_after\") . '</a>'", $text); // Hyperlink anything with an explicit protocol $text = preg_replace("#([\s{}\(\)\[\]])(([a-z]+?)://([A-Za-z_0-9\-]+\.([^\s{}\(\)\[\]]+[^\s,\.\;{}\(\)\[\]])))#ie", "'$1<a href=\"$2\" title=\"$2\"$new_win_txt>' . c2c_truncate_link(\"$4\", \"$mode\", \"$trunc_before\", \"$trunc_after\") . '</a>'", $text); // Hyperlink e-mail addresses $text = preg_replace("#([\s{}\(\)\[\]])([A-Za-z0-9\-_\.]+?)@([^\s,{}\(\)\[\]]+\.[^\s.,{}\(\)\[\]]+)#ie", "'$1<a href=\"mailto:$2@$3\" title=\"mailto:$2@$3\">' . c2c_truncate_link(\"$2@$3\", \"$mode\", \"$trunc_before\", \"$trunc_after\") . '</a>'", $text); return substr($text,1,strlen($text)-2); } //end c2c_hyperlink_urls() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
Confirmed User
Industry Role:
Join Date: Dec 2003
Location: Wisconsin
Posts: 3,574
|
$text = preg_replace("#<((Link: http://|www)http://|www\.)(.*)>#","\\1\\2",$text);
didn't work. That leaves the closing bracket intact... |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
Too lazy to set a custom title
Industry Role:
Join Date: Mar 2003
Location: Homeless
Posts: 62,911
|
Cool. Looks like it could be something to play with.
__________________
PornGuy skype me pornguy_epic AmateurDough The Hottes Shemales online! TChicks.com | Angeles Cid | Mariana Cordoba | MAILERS WELCOME! |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 | |
Too lazy to set a custom title
Join Date: Jul 2004
Posts: 10,970
|
![]() Quote:
![]() |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 | |
Confirmed User
Industry Role:
Join Date: Dec 2003
Location: Wisconsin
Posts: 3,574
|
Quote:
![]() ![]() |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 | |
See sig. Join Epic Cash.
Join Date: Oct 2002
Location: Montreal, Quebec. ICQ: 214702014
Posts: 22,366
|
Quote:
__________________
![]() Bad Girl Bucks - 50% Revshare through CCBill. Promote BrandyDDD, Pixie's Pillows, Action Allie and more! Phoenix Forum Pics | Webmaster Access Montreal pics email: psyko514(a)gmail.com | icq: 214-702-014 |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#7 | |
See sig. Join Epic Cash.
Join Date: Oct 2002
Location: Montreal, Quebec. ICQ: 214702014
Posts: 22,366
|
Quote:
can't you run the line twice? once to remove the opening bracket and once to remove the closing bracket? my PHP knowledge is limited...
__________________
![]() Bad Girl Bucks - 50% Revshare through CCBill. Promote BrandyDDD, Pixie's Pillows, Action Allie and more! Phoenix Forum Pics | Webmaster Access Montreal pics email: psyko514(a)gmail.com | icq: 214-702-014 |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#8 | |
Confirmed User
Industry Role:
Join Date: Dec 2003
Location: Wisconsin
Posts: 3,574
|
Quote:
My php is pretty limited too, I mostly end up with ![]() ![]() |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#9 |
So Fucking Banned
Join Date: Jan 2005
Location: At My Desk
Posts: 2,904
|
in your character class your backslashing your . before the @ i dont think you want to do that. but i havent looked at this much, i have headache, hit me up on aim and tell me exact problme i can give you the answer
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#10 |
Confirmed User
Industry Role:
Join Date: Dec 2003
Location: Wisconsin
Posts: 3,574
|
it's simple, :P
$text=str_replace("<", "", $text); $text=str_replace(">", "", $text); I win! |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#11 |
So Fucking Banned
Join Date: Jan 2005
Location: At My Desk
Posts: 2,904
|
also I see alot of this A-Za-z0-9 which can be substituded with /w+
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#12 |
Confirmed User
Industry Role:
Join Date: Dec 2003
Location: Wisconsin
Posts: 3,574
|
![]() ![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#13 |
Confirmed User
Industry Role:
Join Date: Dec 2003
Location: Wisconsin
Posts: 3,574
|
Dammit I killed Sarah Connor!! WHO WAS THAT MASKED MAN?!!!
Sorry for the confusion, I'm just passing it on. This thread is dead, somebody post *******. |
![]() |
![]() ![]() ![]() ![]() ![]() |