Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions event/main_listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ public function __construct(auth $auth, config $config, db_text $config_text, la
*/
public function add_custom_sites($event)
{
$is_phpbb4 = phpbb_version_compare($this->config['version'], '4.0.0-a1', '>=');
$phpbb4_builtins = array_flip([
'applepodcasts', 'bluesky', 'bunny', 'mastodon', 'pastebin', 'threads', 'twitter',
]);
Expand All @@ -114,7 +113,7 @@ public function add_custom_sites($event)
$name = basename($site, ext::YML);

// Skip built-in sites when running phpBB 4
if ($is_phpbb4 && isset($phpbb4_builtins[$name]))
if ($this->is_phpbb4() && isset($phpbb4_builtins[$name]))
{
continue;
}
Expand Down Expand Up @@ -178,7 +177,11 @@ public function modify_tag_templates($event)
{
// force YouTube to use the no cookies until the user starts video playback, and fix referrer policy issues
$tag = $event['configurator']->tags['YOUTUBE'];
$tag->template = str_replace(['www.youtube.com', ' allowfullscreen'], ['www.youtube-nocookie.com', ' referrerpolicy="origin" allowfullscreen'], $tag->template);
$tag->template = str_replace(['www.youtube.com'], 'www.youtube-nocookie.com', $tag->template);
if (!$this->is_phpbb4())
{
$tag->template = str_replace([' allowfullscreen'], ' referrerpolicy="origin" allowfullscreen', $tag->template);
}

$event['configurator']->finalize();
}
Expand Down Expand Up @@ -394,4 +397,12 @@ public function append_agreement()

$this->template->append_var('AGREEMENT_TEXT', $this->language->lang('MEDIA_EMBED_PRIVACY_POLICY', $this->config['sitename']));
}

/**
* @return mixed
*/
private function is_phpbb4()
{
return phpbb_version_compare($this->config['version'], '4.0.0-a1', '>=');
}
}