define_constants();
// Add Raas Popup Tab to Raas Settings Page
add_filter( 'add_raas_tab', array( $this, 'add_raas_tab') );
add_filter( 'add_raas_tab_body', array( $this, 'add_raas_tab_body' ) );
// Exit if Raas popup is disabled
if( empty( $lr_raas_settings['popup_forms_enable'] ) ) {
return;
}
$this->load_dependencies();
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
add_action('wp_footer', array( $this, 'popup_forms' ) );
}
public function add_raas_tab( ) {
?>
';
}
/**
* get_interface.
* Gets Social Login interface
* @global type $loginRadiusObject
* @global array $loginradius_api_settings
* @global type $LR_Raas_Social_Login
* @param type $id ID name of each interface, should be unique
* @return string HTML of interface
*/
public static function get_interface( $id = 'lr-popup-sociallogin-container' ) {
global $loginRadiusObject, $loginradius_api_settings, $LR_Raas_Social_Login;
$loginRadiusApiKey = isset( $loginradius_api_settings['LoginRadius_apikey']) ? trim( $loginradius_api_settings['LoginRadius_apikey']) : '';
$loginRadiusSecret = isset( $loginradius_api_settings['LoginRadius_secret']) ? trim( $loginradius_api_settings['LoginRadius_secret']) : '';
if ( empty( $loginRadiusApiKey ) ) {
return "LoginRadius Social Login Plugin is not configured!
To activate your plugin, navigate to LoginRadius > API Settings section in your WordPress admin panel and insert LoginRadius API Key & Secret. Follow this document to learn how to get API Key & Secret.
";
} elseif ( ! $loginRadiusObject->loginradius_is_valid_guid( $loginRadiusApiKey ) || ! $loginRadiusObject->loginradius_is_valid_guid( $loginRadiusSecret ) ) {
return "Your LoginRadius API key or secret is not valid, please correct it or contact LoginRadius support at www.LoginRadius.com
";
} else {
return self::raas_forms( 'sociallogin', $id ) . '';
}
}
static function popup_forms() {
global $LR_Raas_Social_Login;
$message = '';
ob_start();
$html = self::js_response();
$html .= '';
$html .= '
';
$html .= $LR_Raas_Social_Login->login_script();
if ( ! is_user_logged_in() ) {
$html .= '';
$html .= '';
$html .= '';
$html .= '
';
echo $html . ob_get_clean();
} else{
$db_message = get_user_meta(get_current_user_id(), 'lr_message_text', true);
if ( ! empty( $db_message ) ) {
delete_user_meta( get_current_user_id(), 'lr_message_text' );
}
$html .= '';
$html .= '';
echo $html . ob_get_clean();
}
}
}
new LR_Raas_Popup();
}