Skip to content

Commit ddf55b4

Browse files
committed
Try to use Icon() for phpBB4, fallback to <i> for phpBB3
1 parent 7d44072 commit ddf55b4

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@
3131
],
3232
"require": {
3333
"php": ">=7.1.3",
34-
"composer/installers": "~1.0"
34+
"composer/installers": "^1.0 || ^2.0"
3535
},
3636
"require-dev": {
3737
"phing/phing": "~2.4"
3838
},
3939
"extra": {
4040
"display-name": "phpBB Media Embed PlugIn",
4141
"soft-require": {
42-
"phpbb/phpbb": ">=3.3.2,<4.0.0@dev"
42+
"phpbb/phpbb": ">=3.3.2"
4343
},
4444
"version-check": {
4545
"host": "www.phpbb.com",
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
{% if S_BBCODE_MEDIA %}
22
<button type="button" class="button button-icon-only bbcode-media" accesskey="m" name="addmedia" value="Media" onclick="bbfontstyle('[media]', '[/media]');" title="{{ lang('BBCODE_MEDIA_HELP') }}">
3-
<i class="icon fa-television fa-fw" aria-hidden="true"></i>
3+
{% if constant('PHPBB_VERSION') starts with '4' %}
4+
{{ include('@phpbb_mediaembed/media_embed_bbcode_icon.html') }}
5+
{% else %}
6+
<i class="icon fa-television fa-fw" aria-hidden="true"></i>
7+
{% endif %}
48
</button>
59
{% endif %}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{# This template will be used in phpBB 4 #}
2+
{{ Icon('font', 'tv', '', true, 'fas c-button-icon') }}

tests/functional/media_embed_test.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,12 @@ public function test_posting_media_bbcode()
2929
{
3030
$this->login();
3131

32-
$post = $this->create_topic(2, 'Media Embed Test Topic 1', "[media]https://youtu.be/$this->youtubeId[/media]");
32+
$forum_id = 2;
33+
34+
$crawler = self::request('GET', "posting.php?mode=post&f={$forum_id}&sid={$this->sid}");
35+
self::assertCount(1, $crawler->filter('button[name="addmedia"]'));
36+
37+
$post = $this->create_topic($forum_id, 'Media Embed Test Topic 1', "[media]https://youtu.be/$this->youtubeId[/media]");
3338
$crawler = self::request('GET', "viewtopic.php?t={$post['topic_id']}&sid=$this->sid");
3439
self::assertStringContainsString("//www.youtube-nocookie.com/embed/$this->youtubeId", $crawler->filter("#post_content{$post['topic_id']} iframe")->attr('src'));
3540
}

0 commit comments

Comments
 (0)