Skip to content

Commit 8c52c54

Browse files
committed
fix: add nocookie embled youtube url
1 parent 226a25b commit 8c52c54

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/BBCode.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function addParser(string $name, string $pattern, string $replace, string
5555

5656
return $this;
5757
}
58-
58+
5959
public function addHtmlParser(string $name, string $pattern, string $replace, string $content)
6060
{
6161
$this->htmlParser->addParser($name, $pattern, $replace, $content);

src/Parser/BBCodeParser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ final class BBCodeParser extends Parser
102102
],
103103
'youtube' => [
104104
'pattern' => '/\[youtube\](.*?)\[\/youtube\]/s',
105-
'replace' => '<iframe width="560" height="315" src="//www.youtube.com/embed/$1" frameborder="0" allowfullscreen></iframe>',
105+
'replace' => '<iframe width="560" height="315" src="//www.youtube-nocookie.com/embed/$1" frameborder="0" allowfullscreen></iframe>',
106106
'content' => '$1'
107107
],
108108
'sub' => [

tests/ParserTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ public function testBBCodeReturnsCorrectHtml()
180180
<li>Item 3</li>
181181
</ol>
182182
<code><?php echo \'Hello World\'; ?></code>
183-
<iframe width="560" height="315" src="//www.youtube.com/embed/pnGJXuHDoYw" frameborder="0" allowfullscreen></iframe>
183+
<iframe width="560" height="315" src="//www.youtube-nocookie.com/embed/pnGJXuHDoYw" frameborder="0" allowfullscreen></iframe>
184184
<ul>
185185
<li>Item 1</li>
186186
<li>Item 2</li>

0 commit comments

Comments
 (0)