Page 1 of 2

[3.2] complete links in postings

Posted: Sat Sep 16, 2017 5:37 pm
by Eddie Felson
Hi,
to show complete links in postings, I know the folowing code (works fine with 3.1).

includes/functions_content.php:

Find:

Code: Select all

$short_url = (utf8_strlen($url) > 55) ? utf8_substr($url, 0, 39) . ' ... ' . utf8_substr($url, -10) : $url;
Replace:

Code: Select all

$short_url = $url;
Code worked for new or resaved posts

Since the update to 3.21 the code doesn't work.
Does everyone a solution?

Regards

Re: [3.2] complete links in postings

Posted: Sat Sep 16, 2017 5:55 pm
by david63
Out of interest why? What difference does it make?

Re: [3.2] complete links in postings

Posted: Sat Sep 16, 2017 8:00 pm
by kasimi
  • Open [root]/phpbb/textformatter/s9e/link_helper.php
  • Find

    Code: Select all

    if (utf8_strlen($text) > 55)
  • Replace with

    Code: Select all

    if (false)

Re: [3.2] complete links in postings

Posted: Sun Sep 17, 2017 1:22 am
by JoshyPHP
You can implement it as an extension that removes the template that displays the shortened text.

Code: Select all

class listener implements EventSubscriberInterface
{
	public static function getSubscribedEvents()
	{
		return ['core.text_formatter_s9e_configure_after' => 'onConfigure'];
	}
	public static function onConfigure($event)
	{
		unset($event['configurator']->tags['LINK_TEXT']->template);
	}
}
The added bonus of using this method is that it only changes the way links are displayed, not stored. That means you don't need to reparse old posts when the extension is toggled.

Re: [3.2] complete links in postings

Posted: Sun Sep 17, 2017 2:05 am
by Eddie Felson
Thanks for the support.

I never worked with own extensions before.

Witch path, filename and extention is needed for the code?

Re: [3.2] complete links in postings

Posted: Sun Sep 17, 2017 7:52 am
by Mick
You can make an extension request if you wish.

Re: [3.2] complete links in postings

Posted: Sun Sep 17, 2017 10:03 am
by Eddie Felson
Hi,
the code from kasimi works fine. thanks

I think this change are important for some forums,
- to easy copy the text including all links as flat text
- to show the forum reader the complete link, so they can decided by them self, if the links looks safe

@Mick
Please could you create an extension?

Regards

Re: [3.2] complete links in postings

Posted: Sun Sep 17, 2017 10:28 am
by Mick
No, you need to go to the extensions forums and make a request.

Re: [3.2] complete links in postings

Posted: Sun Sep 17, 2017 3:33 pm
by KaileyT
https://github.com/kinerity/fulllinks/releases

Works fine in my (limited) testing. Uses JoshyPHP's code.

Re: [3.2] complete links in postings

Posted: Sun Sep 17, 2017 6:14 pm
by Eddie Felson
@kinerity
Your extension works very well.
When I using the code change, I have to edit all old postings to convert the link format.
With the extension 'fulllinks', the long links appears immediately at all.
For the correct installation was the additional folder /kinerity/ needed.
Full path /ext/kinerity/fulllinks/...

The support here is glorious

thanks

Re: [3.2] complete links in postings

Posted: Wed Nov 29, 2017 6:14 pm
by KaileyT
Link has been fixed. Sorry about that folks.

Re: [3.2] complete links in postings

Posted: Wed Nov 29, 2017 8:35 pm
by WWu777
What if I don't want to show the whole link? I just want to increase the default length at which the link will be shortened. The default is 55 characters right? How do I increase it? I tried to change the 55 number on that code but it didn't seem to work.

Re: [3.2] complete links in postings

Posted: Tue Apr 07, 2020 1:51 am
by WWu777
Eddie Felson wrote:
Sat Sep 16, 2017 5:37 pm
Hi,
to show complete links in postings, I know the folowing code (works fine with 3.1).

includes/functions_content.php:

Find:

Code: Select all

$short_url = (utf8_strlen($url) > 55) ? utf8_substr($url, 0, 39) . ' ... ' . utf8_substr($url, -10) : $url;
Replace:

Code: Select all

$short_url = $url;
Code worked for new or resaved posts

Since the update to 3.21 the code doesn't work.
Does everyone a solution?

Regards
So if the hyperlink is more than 55 characters it gets shortened right? Can I just increase the limit to something above 55? Will this work in phpbb 3.3 too?

Re: [3.2] complete links in postings

Posted: Tue Apr 07, 2020 3:36 am
by KaileyT
WWu777 wrote:
Tue Apr 07, 2020 1:51 am
So if the hyperlink is more than 55 characters it gets shortened right? Can I just increase the limit to something above 55? Will this work in phpbb 3.3 too?
This extension still works in 3.3 https://www.phpbb.com/customise/db/exte ... ull_links/

Re: [3.2] complete links in postings

Posted: Tue Apr 07, 2020 6:53 am
by WWu777
kinerity wrote:
Tue Apr 07, 2020 3:36 am
WWu777 wrote:
Tue Apr 07, 2020 1:51 am
So if the hyperlink is more than 55 characters it gets shortened right? Can I just increase the limit to something above 55? Will this work in phpbb 3.3 too?
This extension still works in 3.3 https://www.phpbb.com/customise/db/exte ... ull_links/
Thanks. But what if the link is so long that it goes off the page? Would it wrap around or go off screen and increase the width of the forum topic page?

I was hoping just to increase the limit of the link shortening, not disable it entirely.