Skip to content

Commit e528bb0

Browse files
committed
MediaEmbed: added ConfigurableHostInterface
1 parent 5a32f54 commit e528bb0

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

docs/Plugins/MediaEmbed/Federated_sites.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,4 +97,35 @@ echo $html;
9797
```
9898
```html
9999
<iframe data-s9e-mediaembed="xenforo" allowfullscreen="" loading="lazy" onload="let c=new MessageChannel;c.port1.onmessage=e=&gt;this.style.height=e.data+'px';this.contentWindow.postMessage('s9e:init','*',[c.port2])" scrolling="no" style="border:0;height:300px;width:100%" src="https://s9e.github.io/iframe/2/xenforo.min.html#https://xenforo.com/community/threads/217381"></iframe>
100+
```
101+
102+
## Any other sites
103+
104+
```php
105+
use s9e\TextFormatter\Plugins\MediaEmbed\Configurator\SiteHelpers\ConfigurableHostInterface;
106+
$configurator = new s9e\TextFormatter\Configurator;
107+
108+
// Add whichever sites you like, here we add all the default sites
109+
foreach ($configurator->MediaEmbed->defaultSites as $siteId => $siteConfig)
110+
{
111+
$configurator->MediaEmbed->add($siteId);
112+
}
113+
114+
foreach ($configurator->MediaEmbed->getSites() as $siteId => $siteConfig)
115+
{
116+
if (!isset($siteConfig['helper']))
117+
{
118+
continue;
119+
}
120+
if (is_a($siteConfig['helper'], ConfigurableHostInterface::class, true))
121+
{
122+
echo $siteConfig['name'], " is configurable via getSiteHelper('$siteId')->setHosts()\n";
123+
}
124+
}
125+
```
126+
```html
127+
Bluesky is configurable via getSiteHelper('bluesky')->setHosts()
128+
Mastodon is configurable via getSiteHelper('mastodon')->setHosts()
129+
PeerTube is configurable via getSiteHelper('peertube')->setHosts()
130+
XenForo is configurable via getSiteHelper('xenforo')->setHosts()
100131
```

src/Plugins/MediaEmbed/Configurator/SiteHelpers/AbstractConfigurableHostHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
use function array_keys, sort, strtolower;
1111

12-
abstract class AbstractConfigurableHostHelper extends AbstractSiteHelper
12+
abstract class AbstractConfigurableHostHelper extends AbstractSiteHelper implements ConfigurableHostInterface
1313
{
1414
public function addHost(string $host): void
1515
{

0 commit comments

Comments
 (0)