[3.2] complete links in postings

Need some custom code changes to the phpBB core simple enough that you feel doesn't require an extension? Then post your request here so that community members can provide some assistance.

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Post Reply
Eddie Felson
Registered User
Posts: 16
Joined: Thu Sep 04, 2014 7:59 pm

[3.2] complete links in postings

Post by Eddie Felson » 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
Last edited by JimA on Sat Sep 16, 2017 5:57 pm, edited 1 time in total.
Reason: Moved from Support to Custom Coding

User avatar
david63
Registered User
Posts: 16318
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Name: David Wood
Contact:

Re: [3.2] complete links in postings

Post by david63 » Sat Sep 16, 2017 5:55 pm

Out of interest why? What difference does it make?
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 as they will be ignored

User avatar
kasimi
Extension Customisations
Extension Customisations
Posts: 3762
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany
Contact:

Re: [3.2] complete links in postings

Post by kasimi » Sat Sep 16, 2017 8:00 pm

  • Open [root]/phpbb/textformatter/s9e/link_helper.php
  • Find

    Code: Select all

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

    Code: Select all

    if (false)

User avatar
JoshyPHP
Code Contributor
Posts: 1006
Joined: Mon Jul 11, 2011 12:28 am

Re: [3.2] complete links in postings

Post by JoshyPHP » Sun Sep 17, 2017 1:22 am

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.
I wrote the thing that does BBCodes in 3.2.

Eddie Felson
Registered User
Posts: 16
Joined: Thu Sep 04, 2014 7:59 pm

Re: [3.2] complete links in postings

Post by Eddie Felson » Sun Sep 17, 2017 2:05 am

Thanks for the support.

I never worked with own extensions before.

Witch path, filename and extention is needed for the code?
Last edited by Eddie Felson on Sun Sep 17, 2017 5:24 pm, edited 1 time in total.

User avatar
Mick
Support Team Member
Support Team Member
Posts: 21302
Joined: Fri Aug 29, 2008 9:49 am
Location: Watching cricket - definitely

Re: [3.2] complete links in postings

Post by Mick » Sun Sep 17, 2017 7:52 am

You can make an extension request if you wish.
"The more connected we get the more alone we become" - Kyle Broflovski

Eddie Felson
Registered User
Posts: 16
Joined: Thu Sep 04, 2014 7:59 pm

Re: [3.2] complete links in postings

Post by Eddie Felson » Sun Sep 17, 2017 10:03 am

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

User avatar
Mick
Support Team Member
Support Team Member
Posts: 21302
Joined: Fri Aug 29, 2008 9:49 am
Location: Watching cricket - definitely

Re: [3.2] complete links in postings

Post by Mick » Sun Sep 17, 2017 10:28 am

No, you need to go to the extensions forums and make a request.
"The more connected we get the more alone we become" - Kyle Broflovski

User avatar
kinerity
Community Team Member
Community Team Member
Posts: 2299
Joined: Mon Sep 01, 2014 1:00 am
Location: sudo rm -rf /
Name: Kailey Truscott
Contact:

Re: [3.2] complete links in postings

Post by kinerity » Sun Sep 17, 2017 3:33 pm

https://github.com/kinerity/fulllinks/releases

Works fine in my (limited) testing. Uses JoshyPHP's code.
Kailey Truscott - Community Team

Eddie Felson
Registered User
Posts: 16
Joined: Thu Sep 04, 2014 7:59 pm

Re: [3.2] complete links in postings

Post by Eddie Felson » Sun Sep 17, 2017 6:14 pm

@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

User avatar
kinerity
Community Team Member
Community Team Member
Posts: 2299
Joined: Mon Sep 01, 2014 1:00 am
Location: sudo rm -rf /
Name: Kailey Truscott
Contact:

Re: [3.2] complete links in postings

Post by kinerity » Wed Nov 29, 2017 6:14 pm

Link has been fixed. Sorry about that folks.
Kailey Truscott - Community Team

WWu777
Registered User
Posts: 555
Joined: Tue Aug 14, 2007 12:40 pm
Contact:

Re: [3.2] complete links in postings

Post by WWu777 » Wed Nov 29, 2017 8:35 pm

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.

Post Reply

Return to “phpBB Custom Coding”