Replace calls for App:::getThemeInfoValue() with AppHelper

This commit is contained in:
Art4 2024-11-08 23:23:01 +00:00
parent 536234a9c6
commit 7de79fc753
4 changed files with 20 additions and 19 deletions

View file

@ -48,11 +48,11 @@ class OEmbed
{
$embedurl = trim($embedurl, '\'"');
$a = DI::app();
$appHelper = DI::apphelper();
$cache_key = 'oembed:' . $a->getThemeInfoValue('videowidth') . ':' . $embedurl;
$cache_key = 'oembed:' . $appHelper->getThemeInfoValue('videowidth') . ':' . $embedurl;
$condition = ['url' => Strings::normaliseLink($embedurl), 'maxwidth' => $a->getThemeInfoValue('videowidth')];
$condition = ['url' => Strings::normaliseLink($embedurl), 'maxwidth' => $appHelper->getThemeInfoValue('videowidth')];
$oembed_record = DBA::selectFirst('oembed', ['content'], $condition);
if (DBA::isResult($oembed_record)) {
$json_string = $oembed_record['content'];
@ -88,7 +88,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::httpClient()->get($href . '&maxwidth=' . $a->getThemeInfoValue('videowidth'), HttpClientAccept::DEFAULT, [HttpClientOptions::REQUEST => HttpClientRequest::SITEINFO]);
$result = DI::httpClient()->get($href . '&maxwidth=' . $appHelper->getThemeInfoValue('videowidth'), HttpClientAccept::DEFAULT, [HttpClientOptions::REQUEST => HttpClientRequest::SITEINFO]);
if ($result->isSuccess()) {
$json_string = $result->getBodyString();
break;
@ -109,7 +109,7 @@ class OEmbed
if (!empty($oembed->type) && $oembed->type != 'error') {
DBA::insert('oembed', [
'url' => Strings::normaliseLink($embedurl),
'maxwidth' => $a->getThemeInfoValue('videowidth'),
'maxwidth' => $appHelper->getThemeInfoValue('videowidth'),
'content' => $json_string,
'created' => DateTimeFormat::utcNow()
], Database::INSERT_UPDATE);