> */ public static function get_providers(): array { return array( 'email' => array( 'label' => __( 'Login / Register form', '4wp-account' ), 'storage' => 'email', 'status' => 'active', 'type' => ProviderSettings::TYPE_FORM, 'blurb' => __( 'Email and password on the account page. No Client ID.', '4wp-account' ), ), 'gmail' => array( 'label' => __( 'Google', '4wp-account' ), 'storage' => 'gmail', 'status' => 'active', 'type' => ProviderSettings::TYPE_OAUTH, 'blurb' => __( 'Google Cloud OAuth. Paste Client ID and Secret, then copy the Redirect URI.', '4wp-account' ), ), 'facebook' => array( 'label' => __( 'Facebook', '4wp-account' ), 'storage' => 'facebook', 'status' => 'soon', 'type' => ProviderSettings::TYPE_OAUTH, 'blurb' => __( 'Meta app review blocked — later (YaKulinar).', '4wp-account' ), ), 'github' => array( 'label' => __( 'GitHub', '4wp-account' ), 'storage' => 'github', 'status' => 'active', 'type' => ProviderSettings::TYPE_OAUTH, 'blurb' => __( 'GitHub OAuth App. Paste Client ID and Secret, then copy the callback URL.', '4wp-account' ), ), 'tiktok' => array( 'label' => __( 'TikTok', '4wp-account' ), 'storage' => 'tiktok', 'status' => 'active', 'type' => ProviderSettings::TYPE_OAUTH, 'blurb' => __( 'TikTok Login Kit. Paste Client Key and Secret, then copy the Redirect URI.', '4wp-account' ), ), 'x' => array( 'label' => __( 'X', '4wp-account' ), 'storage' => 'x', 'status' => 'soon', 'type' => ProviderSettings::TYPE_OAUTH, 'blurb' => __( 'Feature — not available yet.', '4wp-account' ), ), ); } /** * Render tab content. */ public static function render(): void { $wc_integration = get_option( 'forwp_account_woocommerce_integration', '0' ); $wc_active = class_exists( 'WooCommerce' ); $providers = self::get_providers(); $open_provider = self::get_request_provider(); ?>

$provider Provider row from get_providers(). */ private static function render_provider_card( array $provider ): void { $storage_key = (string) ( $provider['storage'] ?? '' ); $is_active = ( 'active' === ( $provider['status'] ?? '' ) ); $is_enabled = $is_active && ProviderSettings::is_enabled( $storage_key ); $label = (string) ( $provider['label'] ?? '' ); $blurb = (string) ( $provider['blurb'] ?? '' ); $classes = 'forwp-account-provider-card'; if ( $is_enabled ) { $classes .= ' is-enabled'; } ?>

$provider Provider row from get_providers(). */ private static function render_provider_detail( array $provider ): void { $storage_key = (string) ( $provider['storage'] ?? '' ); $is_active = ( 'active' === ( $provider['status'] ?? '' ) ); $type = (string) ( $provider['type'] ?? ProviderSettings::TYPE_OAUTH ); $enabled = ProviderSettings::is_enabled( $storage_key ); $blurb = (string) ( $provider['blurb'] ?? '' ); ?>

' . esc_html__( 'Settings → General', '4wp-account' ) . '' ); ?>

%s

', wp_kses( sprintf( /* translators: 1: credential label, 2: link URL, 3: console name */ __( 'Get your %1$s from %3$s.', '4wp-account' ), esc_html( $credential_label ), esc_url( $url ), esc_html( $console_label ) ), array( 'a' => array( 'href' => array(), 'target' => array(), 'rel' => array(), ), ) ) ); } /** * Google OAuth fields (legacy option keys: forwp_account_gmail_*). */ private static function render_google_fields(): void { ?>
$post Raw POST. */ public static function save( array $post ): void { $providers = self::get_providers(); foreach ( $providers as $provider ) { $storage_key = (string) ( $provider['storage'] ?? '' ); if ( $storage_key === '' ) { continue; } $option = 'forwp_account_provider_enabled_' . $storage_key; $is_active = ( 'active' === ( $provider['status'] ?? '' ) ); $is_enabled = $is_active && ! empty( $post[ $option ] ); update_option( $option, $is_enabled ? '1' : '0' ); } if ( isset( $post['forwp_account_gmail_client_id'] ) ) { update_option( 'forwp_account_gmail_client_id', sanitize_text_field( $post['forwp_account_gmail_client_id'] ) ); } if ( isset( $post['forwp_account_gmail_client_secret'] ) ) { update_option( 'forwp_account_gmail_client_secret', sanitize_text_field( $post['forwp_account_gmail_client_secret'] ) ); } if ( isset( $post['forwp_account_github_client_id'] ) ) { update_option( 'forwp_account_github_client_id', sanitize_text_field( $post['forwp_account_github_client_id'] ) ); } if ( isset( $post['forwp_account_github_client_secret'] ) ) { update_option( 'forwp_account_github_client_secret', sanitize_text_field( $post['forwp_account_github_client_secret'] ) ); } if ( isset( $post['forwp_account_tiktok_client_key'] ) ) { update_option( 'forwp_account_tiktok_client_key', sanitize_text_field( $post['forwp_account_tiktok_client_key'] ) ); } if ( isset( $post['forwp_account_tiktok_client_secret'] ) ) { update_option( 'forwp_account_tiktok_client_secret', sanitize_text_field( $post['forwp_account_tiktok_client_secret'] ) ); } update_option( 'forwp_account_woocommerce_integration', ! empty( $post['forwp_account_woocommerce_integration'] ) ? '1' : '0' ); } }