cosmetic nullsafe fix

master
Jean-Christian Paul Denis 2023-04-20 20:52:03 +02:00
parent e5f97b7103
commit ae8bb8deba
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
2 changed files with 10 additions and 0 deletions

View File

@ -36,6 +36,11 @@ class Frontend extends dcNsProcess
dcCore::app()->addBehaviors([ dcCore::app()->addBehaviors([
// template path // template path
'publicBeforeDocumentV2' => function (): void { 'publicBeforeDocumentV2' => function (): void {
// nullsafe PHP < 8.0
if (is_null(dcCore::app()->blog)) {
return ;
}
$tplset = dcCore::app()->themes->moduleInfo(dcCore::app()->blog->settings->get('system')->get('theme'), 'tplset'); $tplset = dcCore::app()->themes->moduleInfo(dcCore::app()->blog->settings->get('system')->get('theme'), 'tplset');
if (!empty($tplset) && is_dir(implode(DIRECTORY_SEPARATOR, [My::root(), 'default-templates', $tplset]))) { if (!empty($tplset) && is_dir(implode(DIRECTORY_SEPARATOR, [My::root(), 'default-templates', $tplset]))) {
dcCore::app()->tpl->setPath(dcCore::app()->tpl->getPath(), implode(DIRECTORY_SEPARATOR, [My::root(), 'default-templates', $tplset])); dcCore::app()->tpl->setPath(dcCore::app()->tpl->getPath(), implode(DIRECTORY_SEPARATOR, [My::root(), 'default-templates', $tplset]));

View File

@ -44,6 +44,11 @@ class Widgets
return ''; return '';
} }
// nullsafe PHP < 8.0
if (is_null(dcCore::app()->blog)) {
return '';
}
return $w->renderDiv( return $w->renderDiv(
(bool) $w->content_only, (bool) $w->content_only,
My::id() . ' ' . $w->class, My::id() . ' ' . $w->class,