addBehavior('adminBeforeBlogSettingsUpdate', function (dcSettings $blog_settings) { $s = $blog_settings->addNamespace(basename(__DIR__)); try { $s->put('disclaimer_active', isset($_POST['disclaimer_active'])); $s->put('disclaimer_remember', isset($_POST['disclaimer_remember'])); $s->put('disclaimer_redir', $_POST['disclaimer_redir'] ?? ''); $s->put('disclaimer_title', $_POST['disclaimer_title'] ?? ''); $s->put('disclaimer_text', $_POST['disclaimer_text'] ?? ''); $s->put('disclaimer_bots_unactive', isset($_POST['disclaimer_bots_unactive'])); $s->put('disclaimer_bots_agents', $_POST['disclaimer_bots_agents'] ?? ''); } catch (Exception $e) { $s->drop('disclaimer_active'); $s->put('disclaimer_active', 0); } }); dcCore::app()->addBehavior('adminBlogPreferencesHeaders', function () { $editor = dcCore::app()->auth->getOption('editor'); echo dcCore::app()->callBehavior('adminPostEditor', $editor['xhtml'], 'disclaimer', ['#disclaimer_text'], 'xhtml') . dcPage::jsModuleLoad(basename(__DIR__) . '/js/admin.js'); }); dcCore::app()->addBehavior('adminBlogPreferencesFormV2', function (dcSettings $blog_settings) { $s = $blog_settings->addNamespace(basename(__DIR__)); $disclaimer_bots_agents = $s->get('disclaimer_bots_agents'); if (empty($disclaimer_bots_agents)) { $disclaimer_bots_agents = 'bot;Scooter;Slurp;Voila;WiseNut;Fast;Index;Teoma;' . 'Mirago;search;find;loader;archive;Spider;Crawler'; } echo '
' . form::field( 'disclaimer_title', 30, 255, html::escapeHTML((string) $s->get('disclaimer_title')) ) . '
' . '' . form::field( 'disclaimer_redir', 30, 255, html::escapeHTML((string) $s->get('disclaimer_redir')) ) . '
' . '' . __('Leave blank to redirect to the site Dotclear') . '
' . '' . form::textarea( 'disclaimer_text', 60, 5, [ 'default' => html::escapeHTML((string) $s->get('disclaimer_text')), 'extra_html' => 'lang="' . dcCore::app()->blog->settings->get('system')->get('lang') . '" spellcheck="true"', ] ) . '
' . '' . form::field( 'disclaimer_bots_agents', 120, 255, html::escapeHTML($disclaimer_bots_agents) ) . '
' . '' . '