*/ function loginstylo_get_options() { $defaults = array( 'enabled' => 1, 'logo_url' => '', 'logo_link_url' => home_url( '/' ), 'logo_link_text' => get_bloginfo( 'name' ), 'logo_width_percent' => 60, 'background_color' => '#f0f2f5', 'background_image' => '', 'layout_mode' => 'full', 'ready_layout' => 'custom', 'split_image_side' => 'right', 'split_image_width' => 50, 'style_preset' => 'card', 'form_background' => '#ffffff', 'form_width' => 320, 'primary_color' => '#2271b1', 'text_color' => '#1d2327', 'button_text_color' => '#ffffff', 'border_radius' => 12, 'font_family' => 'system', 'font_size' => 14, 'label_font_size' => 14, 'button_font_size' => 14, 'message_font_size' => 14, 'font_weight' => 400, 'button_full_width' => 0, 'custom_message' => '', 'username_label' => '', 'password_label' => '', 'remember_label' => '', 'login_button_text' => '', 'lost_password_label' => '', 'register_label' => '', 'hide_logo' => 0, 'hide_remember' => 0, 'hide_lost_password' => 0, 'hide_register' => 0, 'hide_back_to_site' => 0, 'hide_language' => 0, 'hide_privacy' => 0, 'recaptcha_enabled' => 0, 'recaptcha_site_key' => '', 'recaptcha_secret' => '', 'recaptcha_threshold' => 0.5, 'recaptcha_fail_open' => 1, 'protect_login' => 1, 'protect_register' => 1, 'protect_lost' => 1, ); $options = get_option( 'loginstylo_options', array() ); return wp_parse_args( is_array( $options ) ? $options : array(), $defaults ); } /** * Adds a direct settings link to the Plugins screen. * * @param array $links Existing action links. * @return array */ function loginstylo_action_links( $links ) { $settings_link = sprintf( '%s', esc_url( admin_url( 'options-general.php?page=loginstylo' ) ), esc_html__( 'Settings', 'loginstylo' ) ); array_unshift( $links, $settings_link ); return $links; } add_filter( 'plugin_action_links_' . plugin_basename( LOGINSTYLO_FILE ), 'loginstylo_action_links' ); /** * Adds suggested privacy-policy text for sites that enable Google reCAPTCHA. */ function loginstylo_add_privacy_policy_content() { if ( ! function_exists( 'wp_add_privacy_policy_content' ) ) { return; } $content = wp_kses_post( __( 'When Google reCAPTCHA is enabled, the login, registration, and password-recovery screens may load scripts from Google and send a verification token to Google for validation. Google may process technical data such as the visitor\'s IP address and browser information according to its privacy policy.', 'loginstylo' ) ); wp_add_privacy_policy_content( 'LoginStylo', wpautop( $content ) ); } add_action( 'admin_init', 'loginstylo_add_privacy_policy_content' ); /** * Migrates settings from the private pre-release build, if present. */ function loginstylo_maybe_migrate_options() { if ( false !== get_option( 'loginstylo_options', false ) ) { return; } $legacy_options = get_option( 'loginmint_options', false ); if ( ! is_array( $legacy_options ) ) { $legacy_options = get_option( 'login_canvas_options', false ); } if ( ! is_array( $legacy_options ) ) { $legacy_options = get_option( 'amec_login_studio_options', false ); } if ( ! is_array( $legacy_options ) ) { $legacy_options = get_option( 'lsr_options', false ); } if ( is_array( $legacy_options ) ) { add_option( 'loginstylo_options', $legacy_options, '', false ); } } add_action( 'plugins_loaded', static function () { loginstylo_maybe_migrate_options(); if ( is_admin() ) { new LoginStylo_Admin(); } new LoginStylo_Login(); } );