[ABD] Local URL To Text

Any abandoned Extensions will be moved to this forum.

WARNING: Extensions in this forum are not currently being supported or maintained by the original Extension author. Proceed at your own risk.
Forum rules
IMPORTANT: Extension Development Forum rules

WARNING: Extensions in this forum are not currently being supported nor updated by the original Extension author. Proceed at your own risk.
User avatar
___Martin
Registered User
Posts: 36
Joined: Wed Aug 27, 2014 3:05 pm
Location: Germany

[ABD] Local URL To Text

Post by ___Martin » Sat Dec 27, 2014 6:45 pm

Extension Name: Local URL To Text
Author: ___Martin

Extension Description: Replaces local URLs (links to forums, topics, posts or member profiles within your board) with a customizable text.

Extension Version: 1.1.0-beta1

Requirements: phpBB 3.1.2 (or newer)

Features:
  • If a user of your board posts a link to a forum, it normally appears as a link like http://yourboard/viewforum.php?f=5.
    With this extension, the link to the forum can rather be displayed as Forum Name.
  • Links to topics can be displayed as Topic Title instead of http://yourboard/viewtopic.php?f=5&t=2.
  • You can also include the name of the forum containing that topic to the link, e.g. Topic Title (Forum Name).
  • Similar text replacements are available for links to posts and to member profile pages.
  • Local links within Custom profile fields can be replaced as well.
  • Supports Pages extension
  • Works with External Links extension
The extension only replaces these links when displaying a message (post, private message, etc.). It does not alter the messages that are stored into the database. So when a topic gets renamed, all links to this topic will display the new topic title automatically.

The text that replaces the local URL links can be customized. The following replacements are available:
  • For forum or category links: forum/category name
  • For topic links: topic title, forum name of containing forum
  • For post links: poster user name, poster user colour, post subject, topic title, forum name, topic title (only if post subject is empty)
  • For member profile links: user name, user colour
  • For links to pages of the Pages extension: page title
  • Option to enable or disable (default) replacement of local links within Custom profile fields
Authorization:
Users will only see content from forums they are authorized to read. E.g. if someone posts a link to a topic that resides in a protected forum, only members with access to this forum will see the title of this topic. Unauthorized members will see the default viewtopic.php?t=xx link.

Screenshots:
Image

Development Repository: https://github.com/Mar-tin-G/LocalUrlToText

Extension Download: Download at the development repository linked above via the "Download ZIP" button.
Create the following folder structure in your board, and extract the files and folders from the downloaded ZIP file there: /ext/martin/localurltotext.
Activate the extension in the Admin Control Panel (ACP) on the Customise > Manage Extensions page.
Set up the text replacements in the ACP on the Extensions > Local URL To Text > Settings page.

Caution: This extension is still in beta status. Please do not use this extension on production boards without testing.
Last edited by ___Martin on Thu Dec 17, 2015 9:12 pm, edited 4 times in total.

User avatar
HiFiKabin
Community Team Member
Community Team Member
Posts: 1947
Joined: Wed May 14, 2014 9:10 am
Name: James
Contact:

Re: [BETA] Local URL To Text

Post by HiFiKabin » Sat Dec 27, 2014 7:05 pm

Looks good. I'm following

Nully
Registered User
Posts: 436
Joined: Thu Jan 29, 2009 10:11 pm
Location: France
Contact:

Re: [BETA] Local URL To Text

Post by Nully » Sat Dec 27, 2014 7:09 pm

Is it different from Convert Local Url To Link Name?
viewtopic.php?f=456&t=2277841

User avatar
frax
Registered User
Posts: 44
Joined: Thu Dec 11, 2014 4:10 pm
Location: Cosenza
Name: Frax C.
Contact:

Re: [BETA] Local URL To Text

Post by frax » Sat Dec 27, 2014 7:22 pm

Good ext!

User avatar
Raul [ThE KuKa]
Jr. Extension Validator
Posts: 3266
Joined: Mon Dec 08, 2003 9:24 pm
Location: Spain
Name: Raul Arroyo
Contact:

Re: [BETA] Local URL To Text

Post by Raul [ThE KuKa] » Sat Dec 27, 2014 8:34 pm

I like this ext. ;)
If you like my styles, translations, etc. and want to show some appreciation, then feel free to Donate with Image
phpBB International Support Team (Spanish - Español) :flag_es: Online Since 2003
🎨phpBB Professional Premium Themes🔥
Author Translations (Spanish - Spain) :two_hearts:

:warning: I don't support those without the copyright Spanish translation. :warning:

lavachapi
Registered User
Posts: 49
Joined: Sat Nov 01, 2014 8:12 am

Re: [BETA] Local URL To Text

Post by lavachapi » Sat Dec 27, 2014 8:59 pm

Wow, real SEO !

User avatar
david63
Jr. Extension Validator
Posts: 12322
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Name: David Wood
Contact:

Re: [BETA] Local URL To Text

Post by david63 » Sat Dec 27, 2014 9:22 pm

Can I just point out that upper case characters are not allowed in vendor or namespace
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email or as they will be ignored

User avatar
Zaishen
Registered User
Posts: 189
Joined: Sat Dec 18, 2010 6:08 am

Re: [BETA] Local URL To Text

Post by Zaishen » Sun Dec 28, 2014 1:01 am

great, make it final

User avatar
___Martin
Registered User
Posts: 36
Joined: Wed Aug 27, 2014 3:05 pm
Location: Germany

Re: [BETA] Local URL To Text

Post by ___Martin » Sun Dec 28, 2014 9:07 am

Thank you for your feedback! :)
Nully wrote:Is it different from Convert Local Url To Link Name?
viewtopic.php?f=456&t=2277841
Yes. HAMMER663's extension converts the local URL links when submitting a message to the database, e.g. when posting a reply, so the posting of the member is modified. My extension does not alter the messages, but rather replaces the local URL links when viewing the message.

This implies that while HAMMER663's extension is called only once when submitting messages, my extension is called for every view of a message. To reduce the load, my extension tries to minimize database queries.

This also implies that the link texts that HAMMER663's extension creates could be out of date. Imagine a topic that someone posts a link to, but then a while later the topic is renamed. The link texts of HAMMER663's extension will still contain the old topic title, while the link texts of my extension will display the new title.

Another difference would be that in the current version of HAMMER663's extension you (as board admin) are not able to customize the way the text links are created.

david63 wrote:Can I just point out that upper case characters are not allowed in vendor or namespace
Whoops, thank you for pointing that out. I will fix this in the next release.

User avatar
HiFiKabin
Community Team Member
Community Team Member
Posts: 1947
Joined: Wed May 14, 2014 9:10 am
Name: James
Contact:

Re: [BETA] Local URL To Text

Post by HiFiKabin » Sun Dec 28, 2014 9:39 am

I don't know if its a bug, or just the way things happen (similar to smilies)

Let me explain:-

Image
imgurl

If you quote a post with the link as the first item, it does not appear as text, if its preceeded by text it shows correctly.

User avatar
___Martin
Registered User
Posts: 36
Joined: Wed Aug 27, 2014 3:05 pm
Location: Germany

Re: [BETA] Local URL To Text

Post by ___Martin » Sun Dec 28, 2014 10:13 am

Thanks HiFiKabin. I can confirm this behaviour: if a local URL link is posted within a BBCode tag (be it quote, b, list) without any whitespace between the closing square bracket ("]") and the link itself, phpBB does not recognize this as a link and does not automatically parse this URL.

Unfortunately the same behaviour can be seen when posting smilies, as you mentioned. Since the extension relies on phpBB to identify and parse local URLs, I currently don't know how to workaround this.

See this screenshot: neither a local URL link is recognized when immediately following a quote or b BBCode, nor is a smiley recognized. If there is any whitespace or text preceding the link/smiley, they are parsed.
Image


Unfortunately the phpBB bug tracker and Area51 are down at the moment, but I will try to research if this behaviour is intended when they come back online.

EDIT: found a topic describing the same problem: viewtopic.php?f=466&t=2281816

User avatar
HiFiKabin
Community Team Member
Community Team Member
Posts: 1947
Joined: Wed May 14, 2014 9:10 am
Name: James
Contact:

Re: [BETA] Local URL To Text

Post by HiFiKabin » Sun Dec 28, 2014 10:25 am

Yes, I thought it must be the way that phpBB worked.

No problem, its a great extension.

User avatar
___Martin
Registered User
Posts: 36
Joined: Wed Aug 27, 2014 3:05 pm
Location: Germany

Re: [BETA] Local URL To Text

Post by ___Martin » Sun Dec 28, 2014 11:51 am

With these code modifications the parse "bug" could be fixed. They add the closing square bracket ("]") as a valid character that preceeds a magic URL or a smiley, enabling parsing of magic URLs and smilies following the "]" character directly.

Warning: do NOT modify your core phpBB files!
I post these modifications here only as a reminder to post a request to improve the message parser of phpBB. As these modifications could have side effects that I am not aware of, do NOT use them in your phpBB board!

Changes in includes\functions.content line 791: (first line is the old code, second line the new code)

Code: Select all

'#(^|[\n\t (>.])(' . preg_quote($server_url, '#') . ')/(' . get_preg_expression('relative_url_inline') . ')#iu',
'#(^|[\n\t (>.\]])(' . preg_quote($server_url, '#') . ')/(' . get_preg_expression('relative_url_inline') . ')#iu',
Changes in includes\message_parser.php line 1441:

Code: Select all

$num_matches = preg_match_all('#(?<=^|[\n .])(?:' . implode('|', $match) . ')(?![^<>]*>)#u', $this->message, $matches);
$num_matches = preg_match_all('#(?<=^|[\n .\]])(?:' . implode('|', $match) . ')(?![^<>]*>)#u', $this->message, $matches);
Changes in includes\message_parser.php line 1455:

Code: Select all

$this->message = trim(preg_replace(explode(chr(0), '#(?<=^|[\n .])' . implode('(?![^<>]*>)#u' . chr(0) . '#(?<=^|[\n .])', $match) . '(?![^<>]*>)#u'), $replace, $this->message));
$this->message = trim(preg_replace(explode(chr(0), '#(?<=^|[\n .\]])' . implode('(?![^<>]*>)#u' . chr(0) . '#(?<=^|[\n .\]])', $match) . '(?![^<>]*>)#u'), $replace, $this->message));

User avatar
M.Gaetan89
Registered User
Posts: 39
Joined: Sun Apr 21, 2013 12:36 pm
Location: Divonne-les-Bains
Name: Gaëtan
Contact:

Re: [BETA] Local URL To Text

Post by M.Gaetan89 » Sun Dec 28, 2014 1:04 pm

Nice extension!
When replacing a link to a user profile, would it be possible to colorized the link with the user's group color?

Schtorsch
Registered User
Posts: 48
Joined: Tue Aug 12, 2008 8:49 am

Re: [BETA] Local URL To Text

Post by Schtorsch » Sun Dec 28, 2014 1:23 pm

Hm, I tested the extension and get the correct result at my first post.
From the second post it doesn´t work for me. At preview it looks correct - but if I send the posting the link is the URL and not the topic title...

Whats going wrong?

EDIT: Seems to be an extension for external links. Disabled -> now the mod works fine. :)
I have to search a better mod for external links...

Locked

Return to “Abandoned Extensions”

Who is online

Users browsing this forum: Tbot [Bot] and 5 guests