[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: 58
Joined: Wed Aug 27, 2014 3:05 pm
Location: Germany

[ABD] Local URL To Text

Post by ___Martin »

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.1 (release candidate, submitted to extension database: https://www.phpbb.com/customise/db/exte ... l_to_text/)

Requirements: phpBB 3.2

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, or use this direct link: https://github.com/Mar-tin-G/LocalUrlTo ... /1.1.1.zip
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 Sun Mar 11, 2018 12:00 pm, edited 7 times in total.
User avatar
HiFiKabin
Community Team Member
Community Team Member
Posts: 6799
Joined: Wed May 14, 2014 9:10 am
Location: Swearing at the PC, UK
Name: James

Re: [BETA] Local URL To Text

Post by HiFiKabin »

Looks good. I'm following
Nully
Registered User
Posts: 453
Joined: Thu Jan 29, 2009 10:11 pm
Location: France

Re: [BETA] Local URL To Text

Post by Nully »

Is it different from Convert Local Url To Link Name?
viewtopic.php?f=456&t=2277841
User avatar
frax
Registered User
Posts: 45
Joined: Thu Dec 11, 2014 4:10 pm
Location: Cosenza
Name: Frax C.

Re: [BETA] Local URL To Text

Post by frax »

Good ext!
User avatar
Raul [ThE KuKa]
Style Customisations
Style Customisations
Posts: 11138
Joined: Mon Dec 08, 2003 9:24 pm
Location: Spain
Name: Raul Arroyo

Re: [BETA] Local URL To Text

Post by Raul [ThE KuKa] »

I like this ext. ;)
All unsolicited PMs will be ignored.
:warning: Knowledge Base | Documentation | Board rules | phpBB Styles Rules & Policies | Styles Queue Stats :warning:


If you like my styles, translations, etc. and want to show some appreciation, then feel free to Donate.
:flag_es: phpBB Spain - Online Since 2003 :heart:


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

Re: [BETA] Local URL To Text

Post by lavachapi »

Wow, real SEO !
User avatar
david63
Registered User
Posts: 20646
Joined: Thu Dec 19, 2002 8:08 am

Re: [BETA] Local URL To Text

Post by david63 »

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!

I now no longer support any of my extensions but they will start to become available here
User avatar
Zaishen
Registered User
Posts: 199
Joined: Sat Dec 18, 2010 6:08 am

Re: [BETA] Local URL To Text

Post by Zaishen »

great, make it final
User avatar
___Martin
Registered User
Posts: 58
Joined: Wed Aug 27, 2014 3:05 pm
Location: Germany

Re: [BETA] Local URL To Text

Post by ___Martin »

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: 6799
Joined: Wed May 14, 2014 9:10 am
Location: Swearing at the PC, UK
Name: James

Re: [BETA] Local URL To Text

Post by HiFiKabin »

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: 58
Joined: Wed Aug 27, 2014 3:05 pm
Location: Germany

Re: [BETA] Local URL To Text

Post by ___Martin »

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: 6799
Joined: Wed May 14, 2014 9:10 am
Location: Swearing at the PC, UK
Name: James

Re: [BETA] Local URL To Text

Post by HiFiKabin »

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

No problem, its a great extension.
User avatar
___Martin
Registered User
Posts: 58
Joined: Wed Aug 27, 2014 3:05 pm
Location: Germany

Re: [BETA] Local URL To Text

Post by ___Martin »

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

Re: [BETA] Local URL To Text

Post by M.Gaetan89 »

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: 52
Joined: Tue Aug 12, 2008 8:49 am

Re: [BETA] Local URL To Text

Post by Schtorsch »

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

Return to “Abandoned Extensions”