CreaCaptcha

settings-manager.php

Shared settings-management service.

Export, import, reset and "load defaults" — used by both the backend "Werkzeuge" page and the WP-CLI commands.

Table of Contents

Constants

CREATIONELL_CAPTCHA_EXPORT_SCHEMA  = 1
Schema version of the settings-export format.

Functions

creationell_captcha_list_setting_keys()  : array<int, string>
Setting keys whose value is a list (every `textarea` field).
creationell_captcha_export_settings()  : array<string, mixed>
Builds the settings-export payload.
creationell_captcha_import_settings()  : array<string, mixed>|WP_Error
Validates and applies a settings-export payload.
creationell_captcha_reset_settings()  : void
Full factory reset: writes the complete default settings array, which also empties every list. Secrets, analytics counters and the event log are left untouched.
creationell_captcha_load_default_settings()  : void
Resets every non-list setting to its default while preserving the current list values (IP block/allow, UA block, interceptor paths).

Constants

CREATIONELL_CAPTCHA_EXPORT_SCHEMA

Schema version of the settings-export format.

public mixed CREATIONELL_CAPTCHA_EXPORT_SCHEMA = 1

Functions

creationell_captcha_list_setting_keys()

Setting keys whose value is a list (every `textarea` field).

creationell_captcha_list_setting_keys() : array<int, string>

Derived from the field specification so the list never drifts. "Load defaults" preserves these keys; "reset" clears them.

Return values
array<int, string>

creationell_captcha_export_settings()

Builds the settings-export payload.

creationell_captcha_export_settings() : array<string, mixed>

The HMAC secrets are deliberately excluded — they must never leave the site.

Return values
array<string, mixed>

creationell_captcha_import_settings()

Validates and applies a settings-export payload.

creationell_captcha_import_settings(array<string, mixed> $payload) : array<string, mixed>|WP_Error

The settings array is run through creationell_captcha_sanitize_settings(), so the same guarantees as the settings form apply: whitelisted selects, clamped numbers, bounded lists, unknown keys dropped, missing keys defaulted.

Parameters
$payload : array<string, mixed>

Decoded export payload.

Return values
array<string, mixed>|WP_Error

On success: { imported, version_notice }.

creationell_captcha_reset_settings()

Full factory reset: writes the complete default settings array, which also empties every list. Secrets, analytics counters and the event log are left untouched.

creationell_captcha_reset_settings() : void

creationell_captcha_load_default_settings()

Resets every non-list setting to its default while preserving the current list values (IP block/allow, UA block, interceptor paths).

creationell_captcha_load_default_settings() : void

        
On this page

Search results