Advertisement:

Author Topic: Descriptive Links  (Read 20192 times)

Offline Spuds

  • SMF Hero
  • ******
  • Posts: 1,798
  • Gender: Male
Descriptive Links
« on: March 06, 2012, 12:02:27 PM »
Link to Mod


Descriptive Links v1.0
By Spuds


License
o This Modifications Source Code is subject to the terms of the Mozilla Public License version 2.0 (the "License"). You can obtain a copy of the License at http://mozilla.org/MPL/2.0/.

Introduction
o Adds capability to automatically update links in posts to display the links page title instead of the default url.
o Converts internal links to show the topic subject or board name as appropriate, external links to website title
o Optional length and generic name protection to avoid changing links to things like Login, welcome, etc
o Optionaly convert links contained inside of BBC URL codes
o Permissions to allow users to disable link conversion on a per post basis (under post additional options)
o Only converts links when the post is saved or modified, ensuring no performance impact during normal message viewing.

Original mods
Based on the concept from :
- "Titled Links" (by SlammedDime - http://custom.simplemachines.org/mods/index.php?mod=835)

There are admin settings available with this mod, go to configuration -> modification settings -> dlinks 
Here you can disable/enable various features of the modificaiton.

Installation
Simply install the package to install this modification on the SMF Default Curve theme.

This mod is compatible with SMF 2.0x

Support
Please use the Descriptive Link modification thread for support with this modification.

Changelog
1.0 - 15 January 2012
o + Initial release

Offline 4Kstore

  • SMF Hero
  • ******
  • Posts: 4,317
  • Gender: Male
    • agustintari on Facebook
    • @agustintarifa on Twitter
    • SSIMPLE TEAM PAGE
Re: Descriptive Links
« Reply #1 on: March 07, 2012, 02:48:47 AM »
Nice work!
Thanks
¡¡NEW MOD: Sparkles User Names!!!

Offline Eclipse16V

  • Sophist Member
  • *****
  • Posts: 1,070
  • Gender: Male
  • Tornado Map
    • Eclipse16V on Facebook
    • @Eclipse16V on Twitter
    • Tornado Map
Re: Descriptive Links
« Reply #2 on: March 07, 2012, 04:53:30 AM »
Thanks for this Mod

Nice work
I worked with:
SMF 2 in German

My Shop:
Das Lieschen

Offline Gryzor

  • Sr. Member
  • ****
  • Posts: 783
  • Gender: Male
  • CPCwiki.eu - The Amstrad CPC Encyclopaedia!
    • CPCWiki
Re: Descriptive Links
« Reply #3 on: March 10, 2012, 04:01:40 AM »
Really nice!!! Just installed it, runs very well!

EDIT Oops, I found a small issue: when I post a plain url in a
Code: [Select]
tag, like [code] http://www.blahblah.com the mod should not touch it, yet it replaces it with the full tagged url, namely
Code: [Select]
[url=http://www.blahblah.com]BlahBlah[/url]. Can it be fixed?
« Last Edit: March 10, 2012, 04:09:46 AM by Gryzor »

Offline Spuds

  • SMF Hero
  • ******
  • Posts: 1,798
  • Gender: Male
Re: Descriptive Links
« Reply #4 on: March 10, 2012, 08:17:35 AM »
Thats the way it works, it finds all links in a message irrespective of other tags it might be nested it.  You have the option to turn off the feature on a per message basis however (under advanced) for those times when you don't want it to mess around in a message.

Offline Gryzor

  • Sr. Member
  • ****
  • Posts: 783
  • Gender: Male
  • CPCwiki.eu - The Amstrad CPC Encyclopaedia!
    • CPCWiki
Re: Descriptive Links
« Reply #5 on: March 10, 2012, 12:38:59 PM »
Yes, I know this is how it's supposed to work. I'm just saying that the CODE tag is supposed to be absolute - nothing should be parsed inside it otherwise it loses its meaning.

That said, I know it's not a big problem, it's not often you put a url in a CODE tag after all :)

Offline Gryzor

  • Sr. Member
  • ****
  • Posts: 783
  • Gender: Male
  • CPCwiki.eu - The Amstrad CPC Encyclopaedia!
    • CPCWiki
Re: Descriptive Links
« Reply #6 on: March 28, 2012, 03:25:46 AM »
Ok, here's a strange one. Why won't the following URL work?

Code: [Select]
http://www.zxsoftware.co.uk/8bitgamer/?cat=36
At least in my forum it returns an empty line...

Also, I had a report from a user of mine that when linking to a zip file directly, apparently the script tries to download the entire file before deciding what to do with it. Shouldn't it
a.ignore such files, or maybe just display their filenames directly and
b.just parse the first few bytes where the title is located (in the case of a page)?

Offline NanoSector

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 10,499
  • Gender: Male
  • VC321xb47@aperture:~#
    • Yoshi2889 on GitHub
Re: Descriptive Links
« Reply #7 on: March 28, 2012, 11:25:26 AM »
Very nice mod, been looking for something like this for a moment already :)

Though I must agree with Gryzor, the [nobbc] and [code] tags should not be included in the parsing process of this mod.
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Offline Spuds

  • SMF Hero
  • ******
  • Posts: 1,798
  • Gender: Male
Re: Descriptive Links
« Reply #8 on: March 28, 2012, 12:39:36 PM »
Though I must agree with Gryzor, the [nobbc] and [code] tags should not be included in the parsing process of this mod.
Well I did release it as open source ... feel free to make those changes  ;)  The issue as I see it is that in order to do that you need to tie in to parse_bbc, which implys the link lookup happens then and on every page load, which would be bad for page load performance or could be under some conditions.  Thats why the mod does its check outside of that function, and only does the title lookup during the saving of the post, not during the rendering of the post (which happens on every page load).  So not saying you could not find a way to do that smartly, just thats not the direction I chose at that time. 

Ok, here's a strange one. Why won't the following URL work?

Code: [Select]
http://www.zxsoftware.co.uk/8bitgamer/?cat=36
At least in my forum it returns an empty line...
Don't know, I'll have to take a look and see why its doing that
Quote
Also, I had a report from a user of mine that when linking to a zip file directly, apparently the script tries to download the entire file before deciding what to do with it. Shouldn't it
a.ignore such files, or maybe just display their filenames directly and
b.just parse the first few bytes where the title is located (in the case of a page)?
It should probably skip over those type of links ... no convenient (e.g. built in to smf) way to just grab the first x bits of a page to see if you got what you want or if you asked for enough really.

Offline Gryzor

  • Sr. Member
  • ****
  • Posts: 783
  • Gender: Male
  • CPCwiki.eu - The Amstrad CPC Encyclopaedia!
    • CPCWiki
Re: Descriptive Links
« Reply #9 on: March 28, 2012, 12:46:17 PM »
I can live it with parsing all links, it doesn't cause any major problems for my site (though I can see it screwing up things in others.

If you could take a look at that specific link it could help, though!

As for my other request, if there's no easy way, then at least have an extension blacklist (like all the archive files) that it won't parse...?

Thanks again for a great mod!

Offline NanoSector

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 10,499
  • Gender: Male
  • VC321xb47@aperture:~#
    • Yoshi2889 on GitHub
Re: Descriptive Links
« Reply #10 on: March 29, 2012, 01:43:28 AM »
Please, DO take a backup before you do that :P
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Offline Gryzor

  • Sr. Member
  • ****
  • Posts: 783
  • Gender: Male
  • CPCwiki.eu - The Amstrad CPC Encyclopaedia!
    • CPCWiki
Re: Descriptive Links
« Reply #11 on: March 29, 2012, 02:15:23 AM »
Thanks, will try it this evening when I get home.

I wonder what in my server's config could cause that blank... it's weird, isn't it?

Thanks for your help!!

Offline die2mrw007

  • Jr. Member
  • **
  • Posts: 266
    • GizmoLord on Facebook
    • @Gizmo_Lord on Twitter
    • GizmoLord
Re: Descriptive Links
« Reply #12 on: April 24, 2012, 08:47:43 AM »
@Spuds: Very nice mod. I been using this mod from many days, but had to remove it recently following a bug.

Some Urls didnt parse properly. I mean, it displays a blank post.

When investigated, I found out the reason:

Some links dont have a title assigned and hence descriptive mod parse it this way:

Code: [Select]
[url=http://your_domain.com][/url]
Hence, this above link displays a blank post.

While, a proper descriptive link should be like this:
Code: [Select]
[url=http://your_domain.com]Your_Domain_Title[/url]

This bug happens with only some of the links.... Please have a look into this.

Offline Gryzor

  • Sr. Member
  • ****
  • Posts: 783
  • Gender: Male
  • CPCwiki.eu - The Amstrad CPC Encyclopaedia!
    • CPCWiki
Re: Descriptive Links
« Reply #13 on: April 24, 2012, 08:53:26 AM »
I guess it's similar to what I described above? Indeed, it does give some blanks, though I had no problem because it's rather rare. I hope it gets fixed though...

If the problem is, indeed, lack of a title, then I guess the script should keep the url as the name of the link. Or maybe keep the domain name, such as www.testsite.com/testdir/filename.html is rendered as www.testsite.com.

Offline die2mrw007

  • Jr. Member
  • **
  • Posts: 266
    • GizmoLord on Facebook
    • @Gizmo_Lord on Twitter
    • GizmoLord
Re: Descriptive Links
« Reply #14 on: April 24, 2012, 10:07:24 AM »
I guess it's similar to what I described above? Indeed, it does give some blanks, though I had no problem because it's rather rare. I hope it gets fixed though...

If the problem is, indeed, lack of a title, then I guess the script should keep the url as the name of the link. Or maybe keep the domain name, such as www.testsite.com/testdir/filename.html is rendered as www.testsite.com.
Exactly....something should be done.... I am running a forum where links are exchanged on regular basis. So this bug occurs often. Something needs to be done. Hope Spuds will help us here :)

Offline bdtcomp

  • Jr. Member
  • **
  • Posts: 103
Re: Descriptive Links
« Reply #15 on: May 01, 2012, 09:44:40 PM »
This works great. But I only find the disable for individual posts when I log in as administrator!  :)

TheListener

  • Guest
Re: Descriptive Links
« Reply #16 on: May 01, 2012, 09:46:15 PM »
bdtcomp

Have you checked the permissions?

Offline bdtcomp

  • Jr. Member
  • **
  • Posts: 103
Re: Descriptive Links
« Reply #17 on: May 01, 2012, 09:49:43 PM »
I have they are all enabled.

TheListener

  • Guest
Re: Descriptive Links
« Reply #18 on: May 01, 2012, 09:59:56 PM »
I have they are all enabled.

want me to have a quick peep?

I can't promise anything though.

Offline bdtcomp

  • Jr. Member
  • **
  • Posts: 103
Re: Descriptive Links
« Reply #19 on: May 01, 2012, 10:38:56 PM »
Thanks Old Fossil, I think I will just leave it. I will just have people edit the URLs to say what they want, as I believe most will be happy with the way it works, magically putting a more meaningful name to the links.