$email, 'source' => sanitize_key( $source ) . ( $ref ? '_via_' . $ref : '' ), 'consent_at' => gmdate( 'c' ), ); $optins = get_option( self::OPTION, array() ); if ( ! is_array( $optins ) ) { $optins = array(); } $optins[ md5( $email . '|' . $entry['source'] ) ] = $entry; update_option( self::OPTION, $optins, false ); // Relay to the flat-store endpoint we control (ESP swap comes later). wp_remote_post( 'https://zenplugins.org/subscribe.php', array( 'timeout' => 8, 'body' => array( 'email' => $email, 'source' => 'plugin_' . $entry['source'], 'consent_at' => $entry['consent_at'], ), ) ); return true; } /** * Whether any opt-in has been recorded (hides the dashboard card). * * @return bool */ public static function has_optin() { $optins = get_option( self::OPTION, array() ); return is_array( $optins ) && ! empty( $optins ); } }