fix nullsafe warning

master
Jean-Christian Paul Denis 2023-04-21 02:10:54 +02:00
parent ec12058099
commit 1f819070ce
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
13 changed files with 87 additions and 61 deletions

View File

@ -34,6 +34,7 @@ class Backend extends dcNsProcess
{ {
static::$init = defined('DC_CONTEXT_ADMIN') static::$init = defined('DC_CONTEXT_ADMIN')
&& My::phpCompliant() && My::phpCompliant()
&& !is_null(dcCore::app()->auth) && !is_null(dcCore::app()->blog)
&& dcCore::app()->auth->check(dcCore::app()->auth->makePermissions([ && dcCore::app()->auth->check(dcCore::app()->auth->makePermissions([
dcCore::app()->auth::PERMISSION_CONTENT_ADMIN, dcCore::app()->auth::PERMISSION_CONTENT_ADMIN,
]), dcCore::app()->blog->id); ]), dcCore::app()->blog->id);
@ -50,10 +51,10 @@ class Backend extends dcNsProcess
# Admin menu # Admin menu
dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem( dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem(
My::name(), My::name(),
dcCore::app()->adminurl->get('admin.plugin.' . My::id()), dcCore::app()->adminurl?->get('admin.plugin.' . My::id()),
dcPage::getPF(My::id() . '/icon.svg'), dcPage::getPF(My::id() . '/icon.svg'),
preg_match('/' . preg_quote(dcCore::app()->adminurl->get('admin.plugin.' . My::id())) . '(&.*)?$/', $_SERVER['REQUEST_URI']), preg_match('/' . preg_quote((string) dcCore::app()->adminurl?->get('admin.plugin.' . My::id())) . '(&.*)?$/', $_SERVER['REQUEST_URI']),
dcCore::app()->auth->check(dcCore::app()->auth->makePermissions([dcCore::app()->auth::PERMISSION_CONTENT_ADMIN]), dcCore::app()->blog->id) dcCore::app()->auth?->check(dcCore::app()->auth->makePermissions([dcCore::app()->auth::PERMISSION_CONTENT_ADMIN]), dcCore::app()->blog?->id)
); );
dcCore::app()->addBehaviors([ dcCore::app()->addBehaviors([
@ -61,10 +62,10 @@ class Backend extends dcNsProcess
'adminDashboardFavoritesV2' => function (dcFavorites $favs): void { 'adminDashboardFavoritesV2' => function (dcFavorites $favs): void {
$favs->register(My::id(), [ $favs->register(My::id(), [
'title' => My::name(), 'title' => My::name(),
'url' => dcCore::app()->adminurl->get('admin.plugin.' . My::id()), 'url' => dcCore::app()->adminurl?->get('admin.plugin.' . My::id()),
'small-icon' => dcPage::getPF(My::id() . '/icon.svg'), 'small-icon' => dcPage::getPF(My::id() . '/icon.svg'),
'large-icon' => dcPage::getPF(My::id() . '/icon.svg'), 'large-icon' => dcPage::getPF(My::id() . '/icon.svg'),
'permissions' => dcCore::app()->auth->makePermissions([dcCore::app()->auth::PERMISSION_CONTENT_ADMIN]), 'permissions' => dcCore::app()->auth?->makePermissions([dcCore::app()->auth::PERMISSION_CONTENT_ADMIN]),
]); ]);
}, },
# Preference form # Preference form
@ -85,7 +86,7 @@ class Backend extends dcNsProcess
'<p class="form-note">' . '<p class="form-note">' .
__('This enable public widgets and contents filter.') . __('This enable public widgets and contents filter.') .
'</p>' . '</p>' .
'<p><a href="' . dcCore::app()->adminurl->get('admin.plugin.' . My::id()) . '">' . '<p><a href="' . dcCore::app()->adminurl?->get('admin.plugin.' . My::id()) . '">' .
__('Set content filters') . '</a></p>' . __('Set content filters') . '</a></p>' .
'</div>' . '</div>' .
'<div class="col">' . '<div class="col">' .

View File

@ -17,11 +17,10 @@ namespace Dotclear\Plugin\enhancePostContent;
use adminGenericFilterV2; use adminGenericFilterV2;
use adminGenericListV2; use adminGenericListV2;
use dcPager; use dcPager;
use Dotclear\Helper\Date;
use Dotclear\Helper\Html\Form\Checkbox; use Dotclear\Helper\Html\Form\Checkbox;
use Dotclear\Helper\Html\Html; use Dotclear\Helper\Html\Html;
use dt;
/** /**
* @ingroup DC_PLUGIN_PERIODICAL * @ingroup DC_PLUGIN_PERIODICAL
* @brief Periodical - admin pager methods. * @brief Periodical - admin pager methods.
@ -79,7 +78,7 @@ class BackendList extends adminGenericListV2
'check' => '<td class="nowrap">' . (new Checkbox(['epc_id[]'], $checked))->value($this->rs->epc_id)->render() . '</td>', 'check' => '<td class="nowrap">' . (new Checkbox(['epc_id[]'], $checked))->value($this->rs->epc_id)->render() . '</td>',
'key' => '<td class="nowrap">' . Html::escapeHTML($this->rs->epc_key) . '</td>', 'key' => '<td class="nowrap">' . Html::escapeHTML($this->rs->epc_key) . '</td>',
'value' => '<td class="maximal">' . Html::escapeHTML($this->rs->epc_value) . '</td>', 'value' => '<td class="maximal">' . Html::escapeHTML($this->rs->epc_value) . '</td>',
'date' => '<td class="nowrap count">' . dt::dt2str(__('%Y-%m-%d %H:%M'), $this->rs->epc_upddt) . '</td>', 'date' => '<td class="nowrap count">' . Date::dt2str(__('%Y-%m-%d %H:%M'), $this->rs->epc_upddt) . '</td>',
]; ];
return return

View File

@ -56,7 +56,7 @@ class Epc
public static function blogAllowedTplValues(): array public static function blogAllowedTplValues(): array
{ {
$rs = json_decode(dcCore::app()->blog->settings->get(My::id())->get('allowedtplvalues')); $rs = json_decode((string) dcCore::app()->blog?->settings->get(My::id())->get('allowedtplvalues'), true);
return is_array($rs) ? $rs : self::defaultAllowedTplValues(); return is_array($rs) ? $rs : self::defaultAllowedTplValues();
} }
@ -103,12 +103,12 @@ class Epc
public static function blogAllowedPubPages(): array public static function blogAllowedPubPages(): array
{ {
$rs = json_decode(dcCore::app()->blog->settings->get(My::id())->get('allowedpubpages')); $rs = json_decode((string) dcCore::app()->blog?->settings->get(My::id())->get('allowedpubpages'), true);
return is_array($rs) ? $rs : self::defaultAllowedPubPages(); return is_array($rs) ? $rs : self::defaultAllowedPubPages();
} }
public static function getFilters(): ?array public static function getFilters(): array
{ {
if (empty(self::$default_filters)) { if (empty(self::$default_filters)) {
$final = $sort = []; $final = $sort = [];
@ -137,7 +137,7 @@ class Epc
public static function testContext(string $tag, array $args, EpcFilter $filter): bool public static function testContext(string $tag, array $args, EpcFilter $filter): bool
{ {
return in_array(dcCore::app()->ctx->current_tpl, $filter->pubPages) return in_array((string) dcCore::app()->ctx?->__get('current_tpl'), $filter->pubPages)
&& in_array($tag, $filter->tplValues) && in_array($tag, $filter->tplValues)
&& $args[0] != '' //content && $args[0] != '' //content
&& empty($args['encode_xml']) && empty($args['encode_xml'])
@ -163,11 +163,12 @@ class Epc
# Plural # Plural
$x = $filter->plural ? $p . 's|' . $p : $p; $x = $filter->plural ? $p . 's|' . $p : $p;
# Mark words # Mark words
$s = preg_replace('#(' . $before . ')(' . $x . ')(' . $after . ')#su' . $i, '$1ççççç$2ççççç$3', $s, -1, $count); $ret = preg_replace('#(' . $before . ')(' . $x . ')(' . $after . ')#su' . $i, '$1ççççç$2ççççç$3', $s, -1, $count);
# Nothing to parse # Nothing to parse
if (!$count) { if (!is_string($ret) || !$count) {
return $s; return $s;
} }
$s = $ret;
# Remove words that are into unwanted html tags # Remove words that are into unwanted html tags
$tags = ''; $tags = '';
$ignore_tags = array_merge(self::decodeTags($filter->htmltag), self::decodeTags($filter->notag)); $ignore_tags = array_merge(self::decodeTags($filter->htmltag), self::decodeTags($filter->notag));
@ -175,16 +176,30 @@ class Epc
$tags = implode('|', $ignore_tags); $tags = implode('|', $ignore_tags);
} }
if (!empty($tags)) { if (!empty($tags)) {
$s = preg_replace_callback('#(<(' . $tags . ')[^>]*?>)(.*?)(</\\2>)#s', [self::class, 'removeTags'], $s); $ret = preg_replace_callback('#(<(' . $tags . ')[^>]*?>)(.*?)(</\\2>)#s', [self::class, 'removeTags'], $s);
if (is_string($ret)) {
$s = $ret;
}
} }
# Remove words inside html tag (class, title, alt, href, ...) # Remove words inside html tag (class, title, alt, href, ...)
$s = preg_replace('#(ççççç(' . $p . '(s|))ççççç)(?=[^<]+>)#s' . $i, '$2$4', $s); $ret = preg_replace('#(ççççç(' . $p . '(s|))ççççç)(?=[^<]+>)#s' . $i, '$2$4', $s);
if (is_string($ret)) {
$s = $ret;
}
# Replace words by what you want (with limit) # Replace words by what you want (with limit)
$s = preg_replace('#ççççç(' . $p . '(s|))ççççç#s' . $i, $r, $s, $limit, $count); $ret = preg_replace('#ççççç(' . $p . '(s|))ççççç#s' . $i, $r, $s, $limit, $count);
if (is_string($ret)) {
$s = $ret;
}
# update limit # update limit
self::$epcFilterLimit[$filter->id() . '_' . $p] = $limit - $count; self::$epcFilterLimit[$filter->id() . '_' . $p] = $limit - $count;
# Clean rest # Clean rest
return $s = preg_replace('#ççççç(.*?)ççççç#s', '$1', $s); $ret = preg_replace('#ççççç(.*?)ççççç#s', '$1', $s);
if (is_string($ret)) {
$s = $ret;
}
return $s;
} }
public static function matchString(string $p, string $r, string $s, EpcFilter $filter, string $before = '\b', string $after = '\b'): array public static function matchString(string $p, string $r, string $s, EpcFilter $filter, string $before = '\b', string $after = '\b'): array
@ -286,13 +301,13 @@ class Epc
public static function widgetContentEntryExcerpt(?WidgetsElement $w = null): string public static function widgetContentEntryExcerpt(?WidgetsElement $w = null): string
{ {
if (!dcCore::app()->ctx->exists('posts')) { if (is_null(dcCore::app()->ctx) || !dcCore::app()->ctx->exists('posts')) {
return ''; return '';
} }
$res = ''; $res = '';
while (dcCore::app()->ctx->posts->fetch()) { while (dcCore::app()->ctx->__get('posts')?->fetch()) {
$res .= dcCore::app()->ctx->posts->f('post_excerpt'); $res .= dcCore::app()->ctx->__get('posts')->f('post_excerpt');
} }
return $res; return $res;
@ -300,13 +315,13 @@ class Epc
public static function widgetContentEntryContent(): string public static function widgetContentEntryContent(): string
{ {
if (!dcCore::app()->ctx->exists('posts')) { if (is_null(dcCore::app()->ctx) || !dcCore::app()->ctx->exists('posts')) {
return ''; return '';
} }
$res = ''; $res = '';
while (dcCore::app()->ctx->posts->fetch()) { while (dcCore::app()->ctx->__get('posts')?->fetch()) {
$res .= dcCore::app()->ctx->posts->f('post_content'); $res .= dcCore::app()->ctx->__get('posts')->f('post_content');
} }
return $res; return $res;
@ -314,15 +329,15 @@ class Epc
public static function widgetContentCommentContent(): string public static function widgetContentCommentContent(): string
{ {
if (!dcCore::app()->ctx->exists('posts')) { if (is_null(dcCore::app()->ctx) || !dcCore::app()->ctx->exists('posts')) {
return ''; return '';
} }
$res = ''; $res = '';
$post_ids = []; $post_ids = [];
while (dcCore::app()->ctx->posts->fetch()) { while (dcCore::app()->ctx->__get('posts')?->fetch()) {
$comments = dcCore::app()->blog->getComments(['post_id' => dcCore::app()->ctx->posts->f('post_id')]); $comments = dcCore::app()->blog?->getComments(['post_id' => dcCore::app()->ctx->__get('posts')->f('post_id')]);
while ($comments->fetch()) { while ($comments?->fetch()) {
$res .= $comments->getContent(); $res .= $comments->getContent();
} }
} }

View File

@ -52,7 +52,7 @@ abstract class EpcFilter
} }
// get blog settings // get blog settings
$s = json_decode((string) dcCore::app()->blog->settings->get(My::id())->get($this->id), true); $s = json_decode((string) dcCore::app()->blog?->settings->get(My::id())->get($this->id), true);
if (empty($s)) { if (empty($s)) {
$s = []; $s = [];
} }
@ -110,13 +110,13 @@ abstract class EpcFilter
return $this->id; return $this->id;
} }
final public function records(): ?dcRecord final public function records(): dcRecord
{ {
if ($this->records === null && $this->has_list) { if ($this->records === null && $this->has_list) {
$this->records = EpcRecord::getRecords(['epc_filter' => $this->id()]); $this->records = EpcRecord::getRecords(['epc_filter' => $this->id()]);
} }
return $this->records; return $this->records ?? dcRecord::newFromArray([]);
} }
public function publicContent(string $tag, array $args): void public function publicContent(string $tag, array $args): void

View File

@ -41,7 +41,7 @@ class EpcRecord
$strReq .= $params['from'] . ' '; $strReq .= $params['from'] . ' ';
} }
$strReq .= "WHERE E.blog_id = '" . dcCore::app()->con->escapeStr((string) dcCore::app()->blog->id) . "' "; $strReq .= "WHERE E.blog_id = '" . dcCore::app()->con->escapeStr((string) dcCore::app()->blog?->id) . "' ";
if (isset($params['epc_type'])) { if (isset($params['epc_type'])) {
if (is_array($params['epc_type']) && !empty($params['epc_type'])) { if (is_array($params['epc_type']) && !empty($params['epc_type'])) {
@ -105,7 +105,7 @@ class EpcRecord
try { try {
$cur->setField('epc_id', self::getNextId()); $cur->setField('epc_id', self::getNextId());
$cur->setField('blog_id', dcCore::app()->blog->id); $cur->setField('blog_id', (string) dcCore::app()->blog?->id);
$cur->setField('epc_upddt', date('Y-m-d H:i:s')); $cur->setField('epc_upddt', date('Y-m-d H:i:s'));
self::getCursor($cur); self::getCursor($cur);
@ -133,7 +133,7 @@ class EpcRecord
$cur->setField('epc_upddt', date('Y-m-d H:i:s')); $cur->setField('epc_upddt', date('Y-m-d H:i:s'));
$cur->update('WHERE epc_id = ' . $id . " AND blog_id = '" . dcCore::app()->con->escapeStr((string) dcCore::app()->blog->id) . "' "); $cur->update('WHERE epc_id = ' . $id . " AND blog_id = '" . dcCore::app()->con->escapeStr((string) dcCore::app()->blog?->id) . "' ");
self::trigger(); self::trigger();
# --BEHAVIOR-- enhancePostContentAfterUpdRecord : cursor, int # --BEHAVIOR-- enhancePostContentAfterUpdRecord : cursor, int
@ -161,7 +161,7 @@ class EpcRecord
dcCore::app()->con->execute( dcCore::app()->con->execute(
'DELETE FROM ' . dcCore::app()->prefix . My::TABLE_NAME . ' ' . 'DELETE FROM ' . dcCore::app()->prefix . My::TABLE_NAME . ' ' .
'WHERE epc_id = ' . $id . ' ' . 'WHERE epc_id = ' . $id . ' ' .
"AND blog_id = '" . dcCore::app()->con->escapeStr((string) dcCore::app()->blog->id) . "' " "AND blog_id = '" . dcCore::app()->con->escapeStr((string) dcCore::app()->blog?->id) . "' "
); );
self::trigger(); self::trigger();
@ -194,6 +194,6 @@ class EpcRecord
private static function trigger(): void private static function trigger(): void
{ {
dcCore::app()->blog->triggerBlog(); dcCore::app()->blog?->triggerBlog();
} }
} }

View File

@ -58,7 +58,7 @@ class EpcFilterTag extends EpcFilter
while ($metas->fetch()) { while ($metas->fetch()) {
$args[0] = Epc::replaceString( $args[0] = Epc::replaceString(
$metas->f('meta_id'), $metas->f('meta_id'),
sprintf($this->replace, dcCore::app()->blog->url . dcCore::app()->url->getBase('tag') . '/' . $metas->f('meta_id'), '\\1'), sprintf($this->replace, dcCore::app()->blog?->url . dcCore::app()->url->getBase('tag') . '/' . $metas->f('meta_id'), '\\1'),
$args[0], $args[0],
$this $this
); );
@ -76,7 +76,7 @@ class EpcFilterTag extends EpcFilter
while ($metas->fetch()) { while ($metas->fetch()) {
$list[] = Epc::matchString( $list[] = Epc::matchString(
$metas->f('meta_id'), $metas->f('meta_id'),
sprintf($this->widget, dcCore::app()->blog->url . dcCore::app()->url->getBase('tag') . '/' . $metas->f('meta_id'), '\\1'), sprintf($this->widget, dcCore::app()->blog?->url . dcCore::app()->url->getBase('tag') . '/' . $metas->f('meta_id'), '\\1'),
$content, $content,
$this $this
); );

View File

@ -33,20 +33,18 @@ class Frontend extends dcNsProcess
return false; return false;
} }
if (!dcCore::app()->blog->settings->get(My::id())->get('active')) { if (!dcCore::app()->blog?->settings->get(My::id())->get('active')) {
return false; return false;
} }
dcCore::app()->addBehaviors([ dcCore::app()->addBehaviors([
// add CSS URL to header // add CSS URL to header
'publicHeadContent' => function (): void { 'publicHeadContent' => function (): void {
echo dcUtils::cssLoad(dcCore::app()->blog->url . dcCore::app()->url->getURLFor('epccss')); echo dcUtils::cssLoad(dcCore::app()->blog?->url . dcCore::app()->url->getURLFor('epccss'));
}, },
// Filter template blocks content // Filter template blocks content
'publicBeforeContentFilterV2' => function (string $tag, array $args): void { 'publicBeforeContentFilterV2' => function (string $tag, array $args): void {
$filters = Epc::getFilters(); foreach (Epc::getFilters() as $id => $filter) {
foreach ($filters as $id => $filter) {
if (!Epc::testContext($tag, $args, $filter)) { if (!Epc::testContext($tag, $args, $filter)) {
continue; continue;
} }

View File

@ -62,7 +62,10 @@ class Install extends dcNsProcess
self::growUp(); self::growUp();
// Settings // Settings
$s = dcCore::app()->blog->settings->get(My::id()); $s = dcCore::app()->blog?->settings->get(My::id());
if (is_null($s)) {
return false;
}
$s->put('active', false, 'boolean', 'Enable enhancePostContent', false, true); $s->put('active', false, 'boolean', 'Enable enhancePostContent', false, true);
$s->put('list_sortby', 'epc_key', 'string', 'Admin records list field order', false, true); $s->put('list_sortby', 'epc_key', 'string', 'Admin records list field order', false, true);
@ -72,8 +75,7 @@ class Install extends dcNsProcess
$s->put('allowedpubpages', json_encode(Epc::defaultAllowedPubPages()), 'string', 'List of allowed template pages', false, true); $s->put('allowedpubpages', json_encode(Epc::defaultAllowedPubPages()), 'string', 'List of allowed template pages', false, true);
// Filters settings // Filters settings
$filters = Epc::getFilters(); foreach (Epc::getFilters() as $id => $filter) {
foreach ($filters as $id => $filter) {
// Only editable options // Only editable options
$opt = [ $opt = [
'nocase' => $filter->nocase, 'nocase' => $filter->nocase,
@ -162,7 +164,7 @@ class Install extends dcNsProcess
$cur->setField('epc_filter', strtolower($record->f('epc_filter'))); $cur->setField('epc_filter', strtolower($record->f('epc_filter')));
$cur->update('WHERE epc_id = ' . $record->f('epc_id') . ' '); $cur->update('WHERE epc_id = ' . $record->f('epc_id') . ' ');
dcCore::app()->blog->triggerBlog(); dcCore::app()->blog?->triggerBlog();
} }
} }

View File

@ -43,6 +43,7 @@ class Manage extends dcNsProcess
{ {
static::$init = defined('DC_CONTEXT_ADMIN') static::$init = defined('DC_CONTEXT_ADMIN')
&& My::phpCompliant() && My::phpCompliant()
&& !is_null(dcCore::app()->auth) && !is_null(dcCore::app()->blog)
&& dcCore::app()->auth->check(dcCore::app()->auth->makePermissions([ && dcCore::app()->auth->check(dcCore::app()->auth->makePermissions([
dcCore::app()->auth::PERMISSION_CONTENT_ADMIN, dcCore::app()->auth::PERMISSION_CONTENT_ADMIN,
]), dcCore::app()->blog->id); ]), dcCore::app()->blog->id);
@ -56,6 +57,10 @@ class Manage extends dcNsProcess
return false; return false;
} }
if (is_null(dcCore::app()->blog) || is_null(dcCore::app()->adminurl)) {
return false;
}
$current = ManageVars::init(); $current = ManageVars::init();
if (dcCore::app()->error->flag()) { if (dcCore::app()->error->flag()) {
@ -163,6 +168,10 @@ class Manage extends dcNsProcess
return; return;
} }
if (is_null(dcCore::app()->blog) || is_null(dcCore::app()->adminurl)) {
return;
}
$current = ManageVars::init(); $current = ManageVars::init();
# -- Prepare page -- # -- Prepare page --

View File

@ -33,14 +33,15 @@ class ManageVars
$_filters = Epc::getFilters(); $_filters = Epc::getFilters();
$filters_id = $filters_combo = []; $filters_id = $filters_combo = [];
foreach ($_filters as $id => $filter) { if (!empty($_filters)) {
$filters_id[$id] = $filter->name; foreach ($_filters as $id => $filter) {
$filters_combo[$filter->name] = $id; $filters_id[$id] = $filter->name;
$filters_combo[$filter->name] = $id;
}
} }
$part = $_REQUEST['part'] ?? key($filters_id); $part = $_REQUEST['part'] ?? key($filters_id);
if (!isset($filters_id[$part])) { if (!isset($_filters[$part])) {
throw new Exception(__('no filters')); throw new Exception(__('no filters'));
} }

View File

@ -49,6 +49,9 @@ class Prepend extends dcNsProcess
function (string $args): void { function (string $args): void {
$css = []; $css = [];
$filters = Epc::getFilters(); $filters = Epc::getFilters();
if (empty($filters)) {
return;
}
foreach ($filters as $id => $filter) { foreach ($filters as $id => $filter) {
if ('' == $filter->class || '' == $filter->style) { if ('' == $filter->class || '' == $filter->style) {

View File

@ -22,7 +22,7 @@ class Uninstall extends dcNsProcess
{ {
public static function init(): bool public static function init(): bool
{ {
static::$init = defined('DC_RC_PATH'); static::$init = defined('DC_CONTEXT_ADMIN');
return static::$init; return static::$init;
} }

View File

@ -51,9 +51,8 @@ class Widgets
'text' 'text'
); );
# Type # Type
$filters = Epc::getFilters(); $types = [];
$types = []; foreach (Epc::getFilters() as $id => $filter) {
foreach ($filters as $id => $filter) {
if ($filter->widget != '') { if ($filter->widget != '') {
$types[$filter->name] = $id; $types[$filter->name] = $id;
} }
@ -66,8 +65,7 @@ class Widgets
$types $types
); );
# Content # Content
$contents = Epc::defaultAllowedWidgetValues(); foreach (Epc::defaultAllowedWidgetValues() as $k => $v) {
foreach ($contents as $k => $v) {
$w->epclist->setting( $w->epclist->setting(
'content' . $v['id'], 'content' . $v['id'],
sprintf(__('Enable filter on %s'), __($k)), sprintf(__('Enable filter on %s'), __($k)),
@ -101,8 +99,8 @@ class Widgets
} }
# Page # Page
if (!dcCore::app()->blog->settings->get(My::id())->get('active') if (!dcCore::app()->blog?->settings->get(My::id())->get('active')
|| !in_array(dcCore::app()->ctx->current_tpl, ['post.html', 'page.html']) || !in_array(dcCore::app()->ctx?->__get('current_tpl'), ['post.html', 'page.html'])
) { ) {
return ''; return '';
} }