[PHPBB3-14775] Enable Media Embedding in posts (via s9e TextFormatter)

Discuss requests for comments/changes posted in the Issue Tracker for the development of phpBB. Upcoming releases are 3.2/Rhea and 3.3.
User avatar
JoshyPHP
Registered User
Posts: 349
Joined: Fri Jul 08, 2011 9:43 pm

Re: [PHPBB3-14775] Enable Media Embedding in posts (via s9e TextFormatter)

Post by JoshyPHP » Thu Sep 08, 2016 5:55 pm

DavidIQ wrote:
Thu Sep 08, 2016 5:32 pm
how complex is such an extension actually going to be for that line?
As complex as you want it to be, I guess? If you enable it by default though, someone will ask for a switch to disable it. If you disable it, you'll need to clear the cache with $phpbb_container->get('text_formatter.cache')->invalidate(). There's a chance that having it as an extension would actually require less code because you don't have to have a switch for it (users can disable the extension) and the cache gets cleared when it's toggled.

Having new features as extensions lets you update them more often than the base installation too.

Finally, if it's enabled by default you'll want to have a way to configure which sites get auto-embedded. Otherwise you'll have a bunch of reports from people complaining that Amazon links disappear, or maybe that Facebook links disappear. That's because many users run adblockers by default and they tend to hide embedded Amazon products. Firefox is going gung-ho with privacy tracking and it could start interfering with Facebook embeds or tweets in the future.

User avatar
DavidIQ
Customisations Team Leader
Customisations Team Leader
Posts: 1731
Joined: Thu Mar 02, 2006 4:29 pm
Location: Earth
Contact:

Re: [PHPBB3-14775] Enable Media Embedding in posts (via s9e TextFormatter)

Post by DavidIQ » Thu Sep 08, 2016 6:13 pm

Ah so that's where the suggestion for making it an official extension comes from. That might be a better approach, but for that to be the way we go with all new features we really need a way to download and install extensions from within the ACP. I think that should be the main focus for the next version instead of adding features here and there. Features could then be easily added by the user.
Image

Nicofuma
3.2 Release Manager
3.2 Release Manager
Posts: 297
Joined: Sun Apr 13, 2014 1:40 am
Location: Paris

Re: [PHPBB3-14775] Enable Media Embedding in posts (via s9e TextFormatter)

Post by Nicofuma » Thu Sep 08, 2016 7:54 pm

Actually a such feature is already in code review and ready to be tested/merged in 3.3
Member of the phpBB Development-Team
No Support via PM

User avatar
VSE
Extension Customisations
Extension Customisations
Posts: 670
Joined: Mon Mar 08, 2010 9:18 am

Re: [PHPBB3-14775] Enable Media Embedding in posts (via s9e TextFormatter)

Post by VSE » Sun Sep 11, 2016 8:06 am

JoshyPHP wrote:
Thu Sep 08, 2016 5:55 pm
DavidIQ wrote:
Thu Sep 08, 2016 5:32 pm
how complex is such an extension actually going to be for that line?
As complex as you want it to be, I guess? If you enable it by default though, someone will ask for a switch to disable it. If you disable it, you'll need to clear the cache with $phpbb_container->get('text_formatter.cache')->invalidate(). There's a chance that having it as an extension would actually require less code because you don't have to have a switch for it (users can disable the extension) and the cache gets cleared when it's toggled.

Having new features as extensions lets you update them more often than the base installation too.

Finally, if it's enabled by default you'll want to have a way to configure which sites get auto-embedded. Otherwise you'll have a bunch of reports from people complaining that Amazon links disappear, or maybe that Facebook links disappear. That's because many users run adblockers by default and they tend to hide embedded Amazon products. Firefox is going gung-ho with privacy tracking and it could start interfering with Facebook embeds or tweets in the future.
Can you please help guide us with this?
https://github.com/phpbb-extensions/mediaembed
Has an irascible disposition.

User avatar
JoshyPHP
Registered User
Posts: 349
Joined: Fri Jul 08, 2011 9:43 pm

Re: [PHPBB3-14775] Enable Media Embedding in posts (via s9e TextFormatter)

Post by JoshyPHP » Sun Sep 11, 2016 8:19 am

@VSE Is there something in particular you need help with? Otherwise it's as you said, just enable the plugin and add all the sites you want. That's how I do it in my extension:

Code: Select all

$configurator = $event['configurator'];
foreach ($configurator->MediaEmbed->defaultSites->getIds() as $siteId)
{
	$configurator->MediaEmbed->add($siteId);
}

User avatar
VSE
Extension Customisations
Extension Customisations
Posts: 670
Joined: Mon Mar 08, 2010 9:18 am

Re: [PHPBB3-14775] Enable Media Embedding in posts (via s9e TextFormatter)

Post by VSE » Sun Sep 11, 2016 10:56 pm

JoshyPHP wrote:
Sun Sep 11, 2016 8:19 am
@VSE Is there something in particular you need help with? Otherwise it's as you said, just enable the plugin and add all the sites you want. That's how I do it in my extension:

Code: Select all

$configurator = $event['configurator'];
foreach ($configurator->MediaEmbed->defaultSites->getIds() as $siteId)
{
	$configurator->MediaEmbed->add($siteId);
}
Yes!!

1. Even though I don't allow individual bbcodes, if you have custom bbcodes, like [youtube], you get a fatal error that [youtube] already exists. So that's not good.

2. Is there a way to get the bbcode button to show on the posting page? If you look at my PR I just hardcoded [media] into a template event.

Feel free to participate in the PRs.
Has an irascible disposition.

User avatar
JoshyPHP
Registered User
Posts: 349
Joined: Fri Jul 08, 2011 9:43 pm

Re: [PHPBB3-14775] Enable Media Embedding in posts (via s9e TextFormatter)

Post by JoshyPHP » Mon Sep 12, 2016 10:34 am

About the button, I don't know but you may want to use the core.display_custom_bbcodes_modify_row event to add the BBCode to the list.

About duplicate tags/BBCodes, that can happen because BBCodes and media sites share the same namespace. I don't know what the best solution is.

You can test for the existence of a tag of the same name with isset($configurator->tags['youtube']) (the name is case-insensitive) and you can unset() it before adding yours. Same with isset($configurator->BBCodes['youtube']), although the plugin does not create individual BBCodes for each site by default. That's something you can toggle with $configurator->MediaEmbed->createIndividualBBCodes = true but I wouldn't recommend creating a BBCode for each and every site unless they're actually going to be used.

Another potential issue with BBCodes is that the attributes of a custom, user-made YouTube BBCode may not match the attributes of a BBCode created by this plugin. That means that videos posted using the custom BBCode before may work with the BBCode created by the plugin. That's an issue that would be fixed by reparsing the old posts.

User avatar
VSE
Extension Customisations
Extension Customisations
Posts: 670
Joined: Mon Mar 08, 2010 9:18 am

Re: [PHPBB3-14775] Enable Media Embedding in posts (via s9e TextFormatter)

Post by VSE » Mon Sep 12, 2016 4:17 pm

JoshyPHP wrote:
Mon Sep 12, 2016 10:34 am
About duplicate tags/BBCodes, that can happen because BBCodes and media sites share the same namespace. I don't know what the best solution is.
I think this may be the best solution for now (is working for me):

So users of existing bbcodes can continue to use them. Media Embed won't work for those sites, but the admin can delete the bbcodes themselves if they want to switch over to media embed handling them.

Although the best solution IMO would be internally in Media Embed plugin if it were possible for it to not consider these bbbcodes exist (when create individual bbcodes is false), so that user created custom ones, like [youtube] would be able to co-exist with Media Embed.
Has an irascible disposition.

User avatar
3Di
Registered User
Posts: 694
Joined: Tue Nov 01, 2005 9:50 pm
Location: Milano (I) Frankfurt (D)
Contact:

Re: [PHPBB3-14775] Enable Media Embedding in posts (via s9e TextFormatter)

Post by 3Di » Thu Sep 15, 2016 2:50 am

DavidIQ wrote:
Thu Sep 08, 2016 6:13 pm
Ah so that's where the suggestion for making it an official extension comes from. That might be a better approach, but for that to be the way we go with all new features we really need a way to download and install extensions from within the ACP. I think that should be the main focus for the next version instead of adding features here and there. Features could then be easily added by the user.
+1
Nicofuma wrote:
Thu Sep 08, 2016 7:54 pm
Actually a such feature is already in code review and ready to be tested/merged in 3.3
+1

Everything's clear. Thanks. :)
Want to compensate me for my interest? Don't ask me, just do it
I'm available for custom phpBB jobs, you can PM me the details.
New: my Live Board, Extensions and Tools for phpBB - Men at works.

Post Reply