Settings
Registers the AI settings tab.
The tab is added from the Pro module rather than the shared settings class, so the free plugin carries no AI settings.
Namespace: WebberZone\Better_Search\Pro\AI
Since: 4.5.0
Source: includes/pro/ai/class-settings.php line 24
Methods
__construct()
Constructor.
Line: 45
public function __construct( Provider $provider );
| Type | Name | Description |
|---|---|---|
Provider |
$provider |
Provider detection. |
get_defaults() static
Default values for the AI settings.
Kept free of translation calls so it is safe before init.
Since: 4.5.0
Line: 65
static public function get_defaults( ): array;
Returns: array — Default settings.
get_ranges() static
Numeric settings and their allowed range.
Since: 4.5.0
Line: 95
static public function get_ranges( ): array;
Returns: array — Map of setting ID to array( min, max ).
get_default_fallback_message() static
Default message shown when no answer is found.
Since: 4.5.0
Line: 112
static public function get_default_fallback_message( ): string;
Returns: string — Fallback message.
get_fallback_message() static
Message shown when no answer is found, from the setting or the default.
Since: 4.5.0
Line: 123
static public function get_fallback_message( ): string;
Returns: string — Fallback message.
get_default_unavailable_message() static
Default message shown when the AI provider cannot be reached.
Since: 4.5.0
Line: 136
static public function get_default_unavailable_message( ): string;
Returns: string — Unavailable message.
get_unavailable_message() static
Message shown when the AI provider cannot be reached, from the setting or the default.
Since: 4.5.0
Line: 147
static public function get_unavailable_message( ): string;
Returns: string — Unavailable message.
add_section()
Add the AI tab.
Since: 4.5.0
Line: 161
public function add_section( $sections ): array;
| Type | Name | Description |
|---|---|---|
array |
$sections |
Settings sections. |
Returns: array — Updated sections.
add_defaults()
Add the defaults for the AI settings.
Since: 4.5.0
Line: 175
public function add_defaults( $defaults ): array;
| Type | Name | Description |
|---|---|---|
array |
$defaults |
Default settings. |
Returns: array — Updated defaults.
add_settings()
Add the AI settings fields.
Since: 4.5.0
Line: 187
public function add_settings( $settings ): array;
| Type | Name | Description |
|---|---|---|
array |
$settings |
Registered settings. |
Returns: array — Updated settings.
sanitize()
Clamp the AI settings to their allowed values.
Since: 4.5.0
Line: 399
public function sanitize( $output, $input ): mixed;
| Type | Name | Description |
|---|---|---|
mixed |
$output |
Sanitized settings. |
array |
$input |
Submitted settings. |
Returns: mixed — Updated settings.
provider_notice()
Show the provider status under the AI answers header.
Uses only the cached support check, so ordinary settings page loads never wait on a provider. When nothing is cached, the notice runs a fresh check in the background.
Since: 4.5.0
Line: 490
public function provider_notice( $html, $args ): string;
| Type | Name | Description |
|---|---|---|
string |
$html |
HTML output. |
array |
$args |
Field arguments. |
Returns: string — Updated HTML output.
ajax_check_provider()
Check the provider for the settings page and return the notice to show.
Since: 4.5.0
Line: 516
public function ajax_check_provider( ): void;
Returns: void
print_check_script()
Print the script that runs the background provider check.
Printed in the footer because the settings field output is filtered through kses.
Since: 4.5.0
Line: 548
public function print_check_script( ): void;
Returns: void