• Welcome to Simple Machines Community Forum. Please login or sign up.

Descriptive Links

Started by Spuds, March 06, 2012, 12:02:27 PM

Previous topic - Next topic

Spuds

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

4Kstore


¡¡NEW MOD: Sparkles User Names!!!

Eclipse16V

Thanks for this Mod

Nice work
I worked with:
SMF 2 in German

Shop:
SID Giessen

Gryzor

March 10, 2012, 04:01:40 AM #3 Last Edit: March 10, 2012, 04:09:46 AM by Gryzor
Really nice!!! Just installed it, runs very well!

EDIT Oops, I found a small issue: when I post a plain url in a tag, like [code] http://www.blahblah.com the mod should not touch it, yet it replaces it with the full tagged url, namely [url=http://www.blahblah.com]BlahBlah[/url]. Can it be fixed?

Spuds

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.

Gryzor

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 :)

Gryzor

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

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)?

NanoSector

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."

Spuds

Quote from: Yoshi2889 on March 28, 2012, 11:25:26 AM
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. 

Quote from: Gryzor on March 28, 2012, 03:25:46 AM
Ok, here's a strange one. Why won't the following URL work?

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.

Gryzor

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!

NanoSector

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."

Gryzor

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!!

Nitesh Kunnath

@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:

[url=http://your_domain.com][/url]

Hence, this above link displays a blank post.

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


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

Gryzor

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.

Nitesh Kunnath

Quote from: Gryzor 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.
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 :)

bdtcomp

This works great. But I only find the disable for individual posts when I log in as administrator!  :)

TheListener

bdtcomp

Have you checked the permissions?

bdtcomp

I have they are all enabled.

TheListener

Quote from: bdtcomp on May 01, 2012, 09:49:43 PM
I have they are all enabled.

want me to have a quick peep?

I can't promise anything though.

bdtcomp

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.

Advertisement: