use anonymous function
This commit is contained in:
parent
3fcf139924
commit
8e8ff0370e
59
_admin.php
59
_admin.php
@ -14,45 +14,30 @@ if (!defined('DC_CONTEXT_ADMIN')) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
# settings namespace
|
|
||||||
dcCore::app()->blog->settings->addNamespace('saba');
|
|
||||||
|
|
||||||
# widget
|
# widget
|
||||||
require_once __DIR__ . '/_widgets.php';
|
require_once __DIR__ . '/_widgets.php';
|
||||||
|
|
||||||
|
# settings namespace
|
||||||
|
dcCore::app()->blog->settings->addNamespace('saba');
|
||||||
|
|
||||||
# behaviors
|
# behaviors
|
||||||
dcCore::app()->addBehavior(
|
dcCore::app()->addBehavior('adminBlogPreferencesFormV2', function ($blog_settings) {
|
||||||
'adminBlogPreferencesFormV2',
|
echo
|
||||||
['adminSaba', 'adminBlogPreferencesForm']
|
'<div class="fieldset">' .
|
||||||
);
|
'<h4 id="saba_params">' . __('Search Across Blog Archive') . '</h4>' .
|
||||||
dcCore::app()->addBehavior(
|
'<p><label class="classic">' .
|
||||||
'adminBeforeBlogSettingsUpdate',
|
form::checkbox('saba_active', '1', (bool) $blog_settings->saba->active) .
|
||||||
['adminSaba', 'adminBeforeBlogSettingsUpdate']
|
__('Enable advanced search on this blog') . '</label></p>' .
|
||||||
);
|
'<p><label class="classic">' .
|
||||||
|
form::checkbox('saba_error', '1', (bool) $blog_settings->saba->error) .
|
||||||
|
__('Enable suggestion for page 404') . '</label></p>' .
|
||||||
|
'<p class="form-note">' .
|
||||||
|
__('This suggests visitors some posts on page 404.') .
|
||||||
|
'</p>' .
|
||||||
|
'</div>';
|
||||||
|
});
|
||||||
|
|
||||||
# add settings to admin blog pref page
|
dcCore::app()->addBehavior('adminBeforeBlogSettingsUpdate', function ($blog_settings) {
|
||||||
class adminSaba
|
$blog_settings->saba->put('active', !empty($_POST['saba_active']));
|
||||||
{
|
$blog_settings->saba->put('error', !empty($_POST['saba_error']));
|
||||||
public static function adminBlogPreferencesForm($blog_settings)
|
});
|
||||||
{
|
|
||||||
echo
|
|
||||||
'<div class="fieldset">' .
|
|
||||||
'<h4 id="saba_params">' . __('Search Across Blog Archive') . '</h4>' .
|
|
||||||
'<p><label class="classic">' .
|
|
||||||
form::checkbox('saba_active', '1', (bool) $blog_settings->saba->active) .
|
|
||||||
__('Enable advanced search on this blog') . '</label></p>' .
|
|
||||||
'<p><label class="classic">' .
|
|
||||||
form::checkbox('saba_error', '1', (bool) $blog_settings->saba->error) .
|
|
||||||
__('Enable suggestion for page 404') . '</label></p>' .
|
|
||||||
'<p class="form-note">' .
|
|
||||||
__('This suggests visitors some posts on page 404.') .
|
|
||||||
'</p>' .
|
|
||||||
'</div>';
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function adminBeforeBlogSettingsUpdate($blog_settings)
|
|
||||||
{
|
|
||||||
$blog_settings->saba->put('active', !empty($_POST['saba_active']));
|
|
||||||
$blog_settings->saba->put('error', !empty($_POST['saba_error']));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user