From ddf55b46c521847ced8a8d28ad5b7fe92e1002f6 Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Wed, 8 Oct 2025 13:54:31 -0700 Subject: [PATCH] Try to use Icon() for phpBB4, fallback to for phpBB3 --- composer.json | 4 ++-- .../event/posting_editor_buttons_custom_tags_before.html | 6 +++++- styles/all/template/media_embed_bbcode_icon.html | 2 ++ tests/functional/media_embed_test.php | 7 ++++++- 4 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 styles/all/template/media_embed_bbcode_icon.html diff --git a/composer.json b/composer.json index 26d0388..916fed9 100644 --- a/composer.json +++ b/composer.json @@ -31,7 +31,7 @@ ], "require": { "php": ">=7.1.3", - "composer/installers": "~1.0" + "composer/installers": "^1.0 || ^2.0" }, "require-dev": { "phing/phing": "~2.4" @@ -39,7 +39,7 @@ "extra": { "display-name": "phpBB Media Embed PlugIn", "soft-require": { - "phpbb/phpbb": ">=3.3.2,<4.0.0@dev" + "phpbb/phpbb": ">=3.3.2" }, "version-check": { "host": "www.phpbb.com", diff --git a/styles/all/template/event/posting_editor_buttons_custom_tags_before.html b/styles/all/template/event/posting_editor_buttons_custom_tags_before.html index 16087f7..7f6dfd9 100644 --- a/styles/all/template/event/posting_editor_buttons_custom_tags_before.html +++ b/styles/all/template/event/posting_editor_buttons_custom_tags_before.html @@ -1,5 +1,9 @@ {% if S_BBCODE_MEDIA %} {% endif %} diff --git a/styles/all/template/media_embed_bbcode_icon.html b/styles/all/template/media_embed_bbcode_icon.html new file mode 100644 index 0000000..bf5f0de --- /dev/null +++ b/styles/all/template/media_embed_bbcode_icon.html @@ -0,0 +1,2 @@ +{# This template will be used in phpBB 4 #} +{{ Icon('font', 'tv', '', true, 'fas c-button-icon') }} diff --git a/tests/functional/media_embed_test.php b/tests/functional/media_embed_test.php index 7f7e325..88d6f71 100644 --- a/tests/functional/media_embed_test.php +++ b/tests/functional/media_embed_test.php @@ -29,7 +29,12 @@ public function test_posting_media_bbcode() { $this->login(); - $post = $this->create_topic(2, 'Media Embed Test Topic 1', "[media]https://youtu.be/$this->youtubeId[/media]"); + $forum_id = 2; + + $crawler = self::request('GET', "posting.php?mode=post&f={$forum_id}&sid={$this->sid}"); + self::assertCount(1, $crawler->filter('button[name="addmedia"]')); + + $post = $this->create_topic($forum_id, 'Media Embed Test Topic 1', "[media]https://youtu.be/$this->youtubeId[/media]"); $crawler = self::request('GET', "viewtopic.php?t={$post['topic_id']}&sid=$this->sid"); self::assertStringContainsString("//www.youtube-nocookie.com/embed/$this->youtubeId", $crawler->filter("#post_content{$post['topic_id']} iframe")->attr('src')); }