Advertisement:

Author Topic: Automatically Code a Link  (Read 20979 times)

kat

  • Guest
Re: Automatically Code a Link
« Reply #20 on: July 02, 2009, 05:45:59 PM »
Well, they're clever in here, so you might just get lucky.  :)

Offline Rohan_

  • Sophist Member
  • *****
  • Posts: 1,328
  • Gender: Male
  • I Love SMF :)
Re: Automatically Code a Link
« Reply #21 on: July 02, 2009, 06:08:27 PM »
thanx very much . i m waiting here 4 someone ;D
Proud To Be An Indian

Offline Rohan_

  • Sophist Member
  • *****
  • Posts: 1,328
  • Gender: Male
  • I Love SMF :)
Re: Automatically Code a Link
« Reply #22 on: July 04, 2009, 05:46:38 PM »
 :( :( :( :(
Proud To Be An Indian

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,375
    • StoryBB/StoryBB on GitHub
Re: Automatically Code a Link
« Reply #23 on: July 04, 2009, 06:09:06 PM »
If you're using 2.0, find Sources/Subs.php, and find this block:

Code: [Select]
if (!isset($disabled['url']) && (strpos($data, '://') !== false || strpos($data, 'www.') !== false))
{
// Switch out quotes really quick because they can cause problems.
$data = strtr($data, array(''' => '\'', '&nbsp;' => $context['utf8'] ? "\xC2\xA0" : "\xA0", '&quot;' => '>">', '"' => '<"<', '&lt;' => '<lt<'));
$data = preg_replace(array('~(?<=[\s>\.(;\'"]|^)((?:http|https|ftp|ftps)://[\w\-_%@:|]+(?:\.[\w\-_%]+)*(?::\d+)?(?:/[\w\-_\~%\.@,\?&;=#+:\'\\\\]*|[\(\{][\w\-_\~%\.@,\?&;=#(){}+:\'\\\\]*)*[/\w\-_\~%@\?;=#}\\\\]?)~i', '~(?<=[\s>(\'<]|^)(www(?:\.[\w\-_]+)+(?::\d+)?(?:/[\w\-_\~%\.@,\?&;=#+:\'\\\\]*|[\(\{][\w\-_\~%\.@,\?&;=#(){}+:\'\\\\]*)*[/\w\-_\~%@\?;=#}\\\\])~i'), array('[url]$1[/url]', '[url=http://$1]$1[/url]'), $data);
$data = strtr($data, array('\'' => ''', $context['utf8'] ? "\xC2\xA0" : "\xA0" => '&nbsp;', '>">' => '&quot;', '<"<' => '"', '<lt<' => '&lt;'));
}

Replace it with:
Code: [Select]
if (!isset($disabled['url']) && (strpos($data, '://') !== false || strpos($data, 'www.') !== false))
{
// Switch out quotes really quick because they can cause problems.
$data = strtr($data, array(''' => '\'', '&nbsp;' => $context['utf8'] ? "\xC2\xA0" : "\xA0", '&quot;' => '>">', '"' => '<"<', '&lt;' => '<lt<'));
$data = preg_replace(array('~(?<=[\s>\.(;\'"]|^)((?:http|https|ftp|ftps)://[\w\-_%@:|]+(?:\.[\w\-_%]+)*(?::\d+)?(?:/[\w\-_\~%\.@,\?&;=#+:\'\\\\]*|[\(\{][\w\-_\~%\.@,\?&;=#(){}+:\'\\\\]*)*[/\w\-_\~%@\?;=#}\\\\]?)~i', '~(?<=[\s>(\'<]|^)(www(?:\.[\w\-_]+)+(?::\d+)?(?:/[\w\-_\~%\.@,\?&;=#+:\'\\\\]*|[\(\{][\w\-_\~%\.@,\?&;=#(){}+:\'\\\\]*)*[/\w\-_\~%@\?;=#}\\\\])~i'), array('[CODEBBC]$1[/CODEBBC]', '[CODEBBC]$1[/CODEBBC]'), $data);
$data = strtr($data, array('\'' => ''', $context['utf8'] ? "\xC2\xA0" : "\xA0" => '&nbsp;', '>">' => '&quot;', '<"<' => '"', '<lt<' => '&lt;'));
}

Note you have to edit CODEBBC and make that code instead otherwise it doesn't get posted correctly.
« Last Edit: July 04, 2009, 07:09:53 PM by Arantor »
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Rohan_

  • Sophist Member
  • *****
  • Posts: 1,328
  • Gender: Male
  • I Love SMF :)
Re: Automatically Code a Link
« Reply #24 on: July 04, 2009, 06:16:04 PM »
i am using 1.1.8 ......

please read my post in this topic that what i want
Proud To Be An Indian

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,375
    • StoryBB/StoryBB on GitHub
Re: Automatically Code a Link
« Reply #25 on: July 04, 2009, 07:11:35 PM »
First up, don't use 1.1.8, it has a security hole. Secondly I'm sorry I didn't read every single post in this thread, I thought I'd just try and answer it quickly for you.

However if you checked Subs.php you'd actually find that the code is the same. I did fix the posting error in my post above which would make it easier for you.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Rohan_

  • Sophist Member
  • *****
  • Posts: 1,328
  • Gender: Male
  • I Love SMF :)
Re: Automatically Code a Link
« Reply #26 on: July 05, 2009, 04:27:41 AM »
is that do like this ..

 if someone posts links without hitting enter after every link like this

www.a.com
www.a.com

these are the links  without space so i want them in single code block  like this
Code: [Select]
www.a.com
www.a.com

and if someone post link with hitting enter like this

www.a.com

www.a.com

there is space after every link so i want them in different code blocks like this
Code: [Select]
www.a.com
Code: [Select]
www.a.com
Proud To Be An Indian

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,375
    • StoryBB/StoryBB on GitHub
Re: Automatically Code a Link
« Reply #27 on: July 05, 2009, 05:21:09 AM »
That's not what you asked for earlier on unless I really really misread you.

And is a *lot* more work.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Rohan_

  • Sophist Member
  • *****
  • Posts: 1,328
  • Gender: Male
  • I Love SMF :)
Re: Automatically Code a Link
« Reply #28 on: July 05, 2009, 05:39:51 AM »
is this possible :( ..

my friend have a vb forum and if i post a link there so it automatically changes in codes like i said earlier
Proud To Be An Indian

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,375
    • StoryBB/StoryBB on GitHub
Re: Automatically Code a Link
« Reply #29 on: July 05, 2009, 05:40:44 AM »
Oh it's possible, but is an awful lot of work. And I do mean a *lot* of work.

I don't have time right now to sit and write the code to come up with this.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Rohan_

  • Sophist Member
  • *****
  • Posts: 1,328
  • Gender: Male
  • I Love SMF :)
Re: Automatically Code a Link
« Reply #30 on: July 05, 2009, 05:49:42 AM »
hmm okay ill wait for ur time ... whenever u get time do this for me .. i am waiting :)

and thanks a ton for helping me in my lot of topics
Proud To Be An Indian

Offline [SiNaN]

  • SMF Super Hero
  • *******
  • Posts: 11,526
  • Young and Foolish
    • SimplePortal
Re: Automatically Code a Link
« Reply #31 on: July 14, 2009, 04:57:54 AM »
They are each different links, no matter there is a space, line break or something different. You need to spend a reasonable amount of time to achieve it and I -personally- don't think it is worth to it. You may want to try Help Wanted (not for support) board.
Former SMF Core Developer | My Mods | SimplePortal

Offline Rohan_

  • Sophist Member
  • *****
  • Posts: 1,328
  • Gender: Male
  • I Love SMF :)
Re: Automatically Code a Link
« Reply #32 on: July 14, 2009, 05:20:01 AM »
ok so i updated to 1.1.9 now .. any other way to get this option or we have to leave it ??
Proud To Be An Indian

Offline [SiNaN]

  • SMF Super Hero
  • *******
  • Posts: 11,526
  • Young and Foolish
    • SimplePortal
Re: Automatically Code a Link
« Reply #33 on: July 15, 2009, 09:47:13 AM »
Read my post above. ;)
Former SMF Core Developer | My Mods | SimplePortal

Offline Rohan_

  • Sophist Member
  • *****
  • Posts: 1,328
  • Gender: Male
  • I Love SMF :)
Re: Automatically Code a Link
« Reply #34 on: September 02, 2009, 01:20:00 PM »
Please help me .. now i am really in need for this feature .. i am giving a example again .. please help me

example .. if i post www.abc.com so it must be coded in single code box like this
Code: [Select]
www.abc.com
if i post www.abc.com
www.abc.com
www.abc.com
so i want these 3 links in single box too like this
Code: [Select]
www.abc.com
www.abc.com
www.abc.com

and if i post like
www.abc.com
and mirror
www.abc.com

so now the links got a text between then now i want them in diff boxes but and mirror not to be coded .. like this
Code: [Select]
www.abc.comand mirror
Code: [Select]
www.abc.com
There are lot of SMF users who wants this feature .. so dont think you are doing this only for me .. i promise you will get a big thanks from a lot of people
Proud To Be An Indian

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,375
    • StoryBB/StoryBB on GitHub
Re: Automatically Code a Link
« Reply #35 on: September 02, 2009, 01:24:23 PM »
This would be a big job to do reliably.

I may take a look at this - but NOT for a while, please do not bump me about it because if I do it, it will probably be a paid-for mod, given how much work I think will be involved in doing it.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Rohan_

  • Sophist Member
  • *****
  • Posts: 1,328
  • Gender: Male
  • I Love SMF :)
Re: Automatically Code a Link
« Reply #36 on: September 02, 2009, 01:37:47 PM »
Arantor Please Please do this for me .. u do a lot of work here .. this is the big thing that i needed in my forum i really need this .. just do this for me i dont want any other helps about my forum .. i will not disturb u again .. and i am very sorry i really can't pay because i dont have any way to pay online . there are a lot of SMF users who want this feature not only me.. PLease Do this PLEASE i Beg you
Proud To Be An Indian

Offline Joshua Dickerson

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 12,777
  • Gender: Male
    • joshuaadickerson on GitHub
    • joshuaadickerson on LinkedIn
Re: Automatically Code a Link
« Reply #37 on: September 02, 2009, 01:39:00 PM »
Wow, www.php.net start there.
Need help? See the wiki. Want to help SMF? See the wiki!

Did you know you can help develop SMF? See us on Github.

How have you bettered the world today?

Offline Rohan_

  • Sophist Member
  • *****
  • Posts: 1,328
  • Gender: Male
  • I Love SMF :)
Re: Automatically Code a Link
« Reply #38 on: September 02, 2009, 08:44:05 AM »
Proud To Be An Indian

Offline Rohan_

  • Sophist Member
  • *****
  • Posts: 1,328
  • Gender: Male
  • I Love SMF :)
Re: Automatically Code a Link
« Reply #39 on: September 02, 2009, 09:05:18 AM »
Arantor .. You helped me a lot .. just this one more .. i am starting to add ads and donation system in my site and my site is getting popular .. whenever i get money i promise i will give you 100$ .. its my promise for all your help :) Please do this
Proud To Be An Indian