addBehavior('initWidgets', ['sabaWidget', 'setWidget']); class sabaWidget { public static function setWidget($w) { global $core; $w ->create( 'saba', __('Advanced search'), array('sabaWidget', 'getWidget'), null, __('Add more search options on public side') ) ->addTitle(__('Search')) ->setting( 'saba_filter_types', __('Disable filter on post types'), 0, 'check' ) ->setting('saba_remove_types', __('Hidden types:'), '') ->setting( 'saba_filter_options', __('Disable filter on post options'), 0, 'check' ) ->setting('saba_remove_options', __('Hidden options:'), '') ->setting( 'saba_filter_categories', __('Disable filter on categories'), 0, 'check' ) ->setting('saba_remove_categories', __('Hidden categories:'), '') ->setting( 'saba_filter_authors', __('Disable filter on authors'), 0, 'check' ) ->setting('saba_remove_authors', __('Hidden authors:'), '') ->setting( 'saba_filter_orders', __('Disable filter on order'), 0, 'check' ) ->setting( 'saba_filter_ages', __('Disable filter on age'), 0, 'check' ) ->addContentOnly() ->addClass() ->addOffline(); } public static function getWidget($w) { global $core, $_ctx; $core->blog->settings->addNamespace('saba'); if (!$core->blog->settings->saba->active) { return; } if (!$core->blog->settings->saba->error && $core->url->type == '404') { return; } if ($w->offline) { return; } $q = $_ctx->saba_otpion ?? ''; # title and search $res = ($w->title ? $w->renderTitle('') : '') . '
'; return $w->renderDiv($w->content_only, $w->class, 'id="search"', $res); } }