<?php

if ( ! defined( 'ABSPATH' ) ) { return; }
if ( ! shortcode_exists( 'membership_gf' ) ) { return; } 

$wrapper = function_exists( 'get_block_wrapper_attributes' )
	? get_block_wrapper_attributes( array( 'class' => 'aieo-professional-signup' ) )
	: 'class="aieo-professional-signup"';

$inner = do_shortcode( '[membership_gf]' );

if ( ! is_user_logged_in() ) {
	$aieo_sso_dir = ( defined( 'AIEO_DIR' ) ? AIEO_DIR : WP_PLUGIN_DIR . '/ai-eshop-optimizer/' ) . 'includes/social-login/';
	if ( ! class_exists( 'AIEO_SSO_Buttons_Data' ) && is_readable( $aieo_sso_dir . 'class-aieo-sso-buttons-data.php' ) ) {
		require_once $aieo_sso_dir . 'class-aieo-sso-buttons-data.php';
	}
	if ( ! class_exists( 'AIEO_SSO_Buttons' ) && is_readable( $aieo_sso_dir . 'class-aieo-sso-buttons.php' ) ) {
		require_once $aieo_sso_dir . 'class-aieo-sso-buttons.php';
	}
	if ( class_exists( 'AIEO_SSO_Buttons' ) ) {
		$inner .= AIEO_SSO_Buttons::render( 'register', array(
			'intro' => __( 'Ή σύνδεση μέσω', 'ai-eshop-optimizer' ),
		) );
	}
}

echo '<div ' . $wrapper . '>' . $inner . '</div>';
