'none', // none | recaptcha_v2 | recaptcha_v3 | hcaptcha | turnstile. 'recaptcha_v2' => array( 'site' => '', 'secret' => '' ), 'recaptcha_v3' => array( 'site' => '', 'secret' => '', 'threshold' => 0.5 ), 'hcaptcha' => array( 'site' => '', 'secret' => '' ), 'turnstile' => array( 'site' => '', 'secret' => '', 'theme' => 'auto' ), 'akismet' => false, 'trust_proxy' => true, 'async_feeds' => false, 'google_maps_key' => '', 'email' => array( 'from_name' => get_bloginfo( 'name' ), 'from_email' => '', 'template' => 'styled', // styled | plain. 'logo' => '', 'color' => '#2563eb', 'footer' => sprintf( /* translators: %s site name */ __( 'Sent from %s', 'fieldwren' ), get_bloginfo( 'name' ) ), 'design_template' => '', // '' = classic layout; a template id from Forms → Email templates. ), 'currency' => 'USD', 'retention_days' => 0, 'delete_on_uninstall' => false, 'integrations' => array(), 'payments' => array(), 'tracking' => array( 'datalayer' => true, 'ga4' => true, 'meta_pixel' => false, 'linkedin' => '' ), ) ); } /** @return array All settings. */ public static function all() { if ( null === self::$cache ) { $saved = get_option( self::OPTION, array() ); self::$cache = Form::merge( self::defaults(), is_array( $saved ) ? $saved : array() ); } return self::$cache; } /** * One setting; dot notation (recaptcha_v3.site). * * @param string $key Key. * @param mixed $default Default. * @return mixed */ public static function get( $key, $default = null ) { $v = self::all(); foreach ( explode( '.', $key ) as $k ) { if ( ! is_array( $v ) || ! array_key_exists( $k, $v ) ) { return $default; } $v = $v[ $k ]; } return $v; } /** Save (merged over current). */ public static function save( array $settings ) { $all = Form::merge( self::all(), $settings ); update_option( self::OPTION, $all, false ); self::$cache = null; } /** Credentials of an integration / gateway. */ public static function credentials( $group, $slug ) { $all = self::get( $group, array() ); return isset( $all[ $slug ] ) && is_array( $all[ $slug ] ) ? $all[ $slug ] : array(); } /** Save credentials of an integration / gateway. */ public static function save_credentials( $group, $slug, array $creds ) { $all = self::get( $group, array() ); $all[ $slug ] = $creds; $cur = get_option( self::OPTION, array() ); $cur = is_array( $cur ) ? $cur : array(); $cur[ $group ] = $all; update_option( self::OPTION, $cur, false ); self::$cache = null; } }