settings; dcCore::app()->addBehaviors([ // posts record 'coreBlogGetPosts' => function (MetaRecord $rs): void { RsExtPosts::$brother_extensions = $rs->extensions(); $rs->extend(RsExtPosts::class); }, // breadcrumb 'publicBreadcrumb' => function (string $context, string $separator): string { return $context == 'zoneclearFeedsPage' ? __('List of feeds') : ''; }, // widgets registration 'initWidgets' => [Widgets::class, 'init'], ]); // Register template blocks foreach (My::TPL_BLOCKS as $block) { dcCore::app()->tpl->addBlock('zc' . $block, [Template::class, $block]); } // Register template values foreach (My::TPL_VALUES as $value) { dcCore::app()->tpl->addValue('zc' . $value, [Template::class, $value]); } // module not active if (!$s->active) { return true; } // feeds update methods if (1 == $s->bhv_pub_upd) { dcCore::app()->addBehavior('publicBeforeDocumentV2', function (): void { if (in_array(dcCore::app()->url->type, ['default', 'feed'])) { try { ZoneclearFeedServer::instance()->checkFeedsUpdate(); } catch (Exception $e) { } }; }); } elseif (2 == $s->bhv_pub_upd) { dcCore::app()->addBehavior('publicAfterDocumentV2', function (): void { try { ZoneclearFeedServer::instance()->checkFeedsUpdate(); } catch (Exception $e) { } }); } elseif (3 == $s->bhv_pub_upd) { dcCore::app()->addBehavior('publicHeadContent', function (): void { if (is_null(dcCore::app()->blog) || dcCore::app()->url->type != 'default') { return; } $blog_url = Html::escapeJS( dcCore::app()->blog->url . dcCore::app()->url->getBase('zoneclearFeedsPage') . '/zcfsupd' ); $blog_id = Html::escapeJS(dcCore::app()->blog->id); echo "\n \n" . dcUtils::jsLoad(dcCore::app()->blog->url . dcCore::app()->url->getBase('zoneclearFeedsPage') . '/zcfsupd.js') . "\n"; }); } return true; } }