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.

Post New Thread Reply

Register GFY Rules Calendar Mark Forums Read
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 03-19-2005, 05:18 PM   #1
Wolfy
Confirmed User
 
Wolfy's Avatar
 
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>.
The only problem is that text stripped from an email automatically has this added to the url - <http://www.link.com>. I need those brackets stripped from the text so it displays correctly.

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()
Wolfy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-19-2005, 05:26 PM   #2
Wolfy
Confirmed User
 
Wolfy's Avatar
 
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...
Wolfy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-19-2005, 05:28 PM   #3
pornguy
Too lazy to set a custom title
 
pornguy's Avatar
 
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!
pornguy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-19-2005, 05:28 PM   #4
boner 2.0
Too lazy to set a custom title
 
Join Date: Jul 2004
Posts: 10,970
:tongue

Quote:
cig whore
Her name is Monica
__________________
boner 2.0 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-19-2005, 05:39 PM   #5
Wolfy
Confirmed User
 
Wolfy's Avatar
 
Industry Role:
Join Date: Dec 2003
Location: Wisconsin
Posts: 3,574
Quote:
Originally Posted by boner 2.0
Her name is Monica
Wolfy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-19-2005, 05:47 PM   #6
psyko514
See sig. Join Epic Cash.
 
Join Date: Oct 2002
Location: Montreal, Quebec. ICQ: 214702014
Posts: 22,366
Quote:
Originally Posted by pornguy
Cool. Looks like it could be something to play with.
did you even read his post?
__________________

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
psyko514 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-19-2005, 05:48 PM   #7
psyko514
See sig. Join Epic Cash.
 
Join Date: Oct 2002
Location: Montreal, Quebec. ICQ: 214702014
Posts: 22,366
Quote:
Originally Posted by Wolfy
$text = preg_replace("#<((Link: http://|www)http://|www\.)(.*)>#","\\1\\2",$text);

didn't work. That leaves the closing bracket intact...

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
psyko514 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-19-2005, 05:56 PM   #8
Wolfy
Confirmed User
 
Wolfy's Avatar
 
Industry Role:
Join Date: Dec 2003
Location: Wisconsin
Posts: 3,574
Quote:
Originally Posted by psyko514
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...
there's a tiny bit more to it - with that line added, it formats www.link.com to a clickable "http://.link.com/" <- there's an extra "." in the url it outputs. Also, it screws up a url written with "http://"


My php is pretty limited too, I mostly end up with s
Wolfy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-19-2005, 06:26 PM   #9
teksonline
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
teksonline is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-19-2005, 06:30 PM   #10
Wolfy
Confirmed User
 
Wolfy's Avatar
 
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!
Wolfy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-19-2005, 06:32 PM   #11
teksonline
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+
teksonline is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-19-2005, 06:33 PM   #12
Wolfy
Confirmed User
 
Wolfy's Avatar
 
Industry Role:
Join Date: Dec 2003
Location: Wisconsin
Posts: 3,574
: to Cyborg for the help lol

Wolfy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-19-2005, 06:41 PM   #13
Wolfy
Confirmed User
 
Wolfy's Avatar
 
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 *******.
Wolfy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks
Thread Tools



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.