mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-10 00:54:27 +02:00
theme infos are now bundled in a single array
This commit is contained in:
parent
0551648399
commit
c52b8595e8
9 changed files with 22 additions and 21 deletions
|
@ -73,9 +73,9 @@ class OEmbed
|
|||
|
||||
$a = DI::app();
|
||||
|
||||
$cache_key = 'oembed:' . $a->videowidth . ':' . $embedurl;
|
||||
$cache_key = 'oembed:' . $a->theme_info['videowidth'] . ':' . $embedurl;
|
||||
|
||||
$condition = ['url' => Strings::normaliseLink($embedurl), 'maxwidth' => $a->videowidth];
|
||||
$condition = ['url' => Strings::normaliseLink($embedurl), 'maxwidth' => $a->theme_info['videowidth']];
|
||||
$oembed_record = DBA::selectFirst('oembed', ['content'], $condition);
|
||||
if (DBA::isResult($oembed_record)) {
|
||||
$json_string = $oembed_record['content'];
|
||||
|
@ -111,7 +111,7 @@ class OEmbed
|
|||
// but their OEmbed endpoint is only accessible by HTTPS ¯\_(ツ)_/¯
|
||||
$href = str_replace(['http://www.youtube.com/', 'http://player.vimeo.com/'],
|
||||
['https://www.youtube.com/', 'https://player.vimeo.com/'], $href);
|
||||
$result = DI::httpRequest()->fetchFull($href . '&maxwidth=' . $a->videowidth);
|
||||
$result = DI::httpRequest()->fetchFull($href . '&maxwidth=' . $a->theme_info['videowidth']);
|
||||
if ($result->getReturnCode() === 200) {
|
||||
$json_string = $result->getBody();
|
||||
break;
|
||||
|
@ -132,7 +132,7 @@ class OEmbed
|
|||
if (!empty($oembed->type) && $oembed->type != 'error') {
|
||||
DBA::insert('oembed', [
|
||||
'url' => Strings::normaliseLink($embedurl),
|
||||
'maxwidth' => $a->videowidth,
|
||||
'maxwidth' => $a->theme_info['videowidth'],
|
||||
'content' => $json_string,
|
||||
'created' => DateTimeFormat::utcNow()
|
||||
], Database::INSERT_UPDATE);
|
||||
|
|
|
@ -1729,7 +1729,7 @@ class BBCode
|
|||
$text = preg_replace("/\[youtube\]https?:\/\/youtu.be\/(.*?)\[\/youtube\]/ism", '[youtube]$1[/youtube]', $text);
|
||||
|
||||
if ($try_oembed) {
|
||||
$text = preg_replace("/\[youtube\]([A-Za-z0-9\-_=]+)(.*?)\[\/youtube\]/ism", '<iframe width="' . $a->videowidth . '" height="' . $a->videoheight . '" src="https://www.youtube.com/embed/$1" frameborder="0" ></iframe>', $text);
|
||||
$text = preg_replace("/\[youtube\]([A-Za-z0-9\-_=]+)(.*?)\[\/youtube\]/ism", '<iframe width="' . $a->theme_info['videowidth'] . '" height="' . $a->theme_info['videoheight'] . '" src="https://www.youtube.com/embed/$1" frameborder="0" ></iframe>', $text);
|
||||
} else {
|
||||
$text = preg_replace("/\[youtube\]([A-Za-z0-9\-_=]+)(.*?)\[\/youtube\]/ism",
|
||||
'<a href="https://www.youtube.com/watch?v=$1" target="_blank" rel="noopener noreferrer">https://www.youtube.com/watch?v=$1</a>', $text);
|
||||
|
@ -1744,7 +1744,7 @@ class BBCode
|
|||
$text = preg_replace("/\[vimeo\]https?:\/\/vimeo.com\/([0-9]+)(.*?)\[\/vimeo\]/ism", '[vimeo]$1[/vimeo]', $text);
|
||||
|
||||
if ($try_oembed) {
|
||||
$text = preg_replace("/\[vimeo\]([0-9]+)(.*?)\[\/vimeo\]/ism", '<iframe width="' . $a->videowidth . '" height="' . $a->videoheight . '" src="https://player.vimeo.com/video/$1" frameborder="0" ></iframe>', $text);
|
||||
$text = preg_replace("/\[vimeo\]([0-9]+)(.*?)\[\/vimeo\]/ism", '<iframe width="' . $a->theme_info['videowidth'] . '" height="' . $a->theme_info['videoheight'] . '" src="https://player.vimeo.com/video/$1" frameborder="0" ></iframe>', $text);
|
||||
} else {
|
||||
$text = preg_replace("/\[vimeo\]([0-9]+)(.*?)\[\/vimeo\]/ism",
|
||||
'<a href="https://vimeo.com/$1" target="_blank" rel="noopener noreferrer">https://vimeo.com/$1</a>', $text);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue