mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-12 23:08:41 +00:00
fix embed bug
This commit is contained in:
parent
fa3d48bc24
commit
7b90d4eb54
|
|
@ -1252,16 +1252,13 @@ class Markdown
|
||||||
protected function inlineEmbeding(array $excerpt) : ?array
|
protected function inlineEmbeding(array $excerpt) : ?array
|
||||||
{
|
{
|
||||||
if (!($this->options['embeding'] ?? false)
|
if (!($this->options['embeding'] ?? false)
|
||||||
|| (($video = (\preg_match('/\[video.*src="([^"]*)".*\]/', $excerpt['text'], $matches) !== 1))
|
|| (!($video = (\preg_match('/\[video.*src="([^"]*)".*\]/', $excerpt['text'], $matches) === 1))
|
||||||
&& ($audio = (\preg_match('/\[audio.*src="([^"]*)".*\]/', $excerpt['text'], $matches) !== 1)))
|
&& !($audio = (\preg_match('/\[audio.*src="([^"]*)".*\]/', $excerpt['text'], $matches) === 1)))
|
||||||
) {
|
) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$video = !$video;
|
$url = $matches[1];
|
||||||
$audio = !$audio;
|
|
||||||
|
|
||||||
$url = $matches[1];
|
|
||||||
if ($video) {
|
if ($video) {
|
||||||
$type = '';
|
$type = '';
|
||||||
|
|
||||||
|
|
@ -1276,7 +1273,7 @@ class Markdown
|
||||||
case 'youtube':
|
case 'youtube':
|
||||||
$element = 'iframe';
|
$element = 'iframe';
|
||||||
$attributes = [
|
$attributes = [
|
||||||
'src' => preg_replace('/.*\?v=([^\&\]]*).*/', 'https://www.youtube.com/embed/$1', $url),
|
'src' => \preg_replace('/.*\?v=([^\&\]]*).*/', 'https://www.youtube.com/embed/$1', $url),
|
||||||
'frameborder' => '0',
|
'frameborder' => '0',
|
||||||
'allow' => 'autoplay',
|
'allow' => 'autoplay',
|
||||||
'allowfullscreen' => '',
|
'allowfullscreen' => '',
|
||||||
|
|
@ -1286,7 +1283,7 @@ class Markdown
|
||||||
case 'vimeo':
|
case 'vimeo':
|
||||||
$element = 'iframe';
|
$element = 'iframe';
|
||||||
$attributes = [
|
$attributes = [
|
||||||
'src' => preg_replace('/(?:https?:\/\/(?:[\w]{3}\.|player\.)*vimeo\.com(?:[\/\w:]*(?:\/videos)?)?\/([0-9]+)[^\s]*)/', 'https://player.vimeo.com/video/$1', $url),
|
'src' => \preg_replace('/(?:https?:\/\/(?:[\w]{3}\.|player\.)*vimeo\.com(?:[\/\w:]*(?:\/videos)?)?\/([0-9]+)[^\s]*)/', 'https://player.vimeo.com/video/$1', $url),
|
||||||
'frameborder' => '0',
|
'frameborder' => '0',
|
||||||
'allow' => 'autoplay',
|
'allow' => 'autoplay',
|
||||||
'allowfullscreen' => '',
|
'allowfullscreen' => '',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user