/** * Function to render a {@see launchkey_form} via a WordPress short code * * [id="id-value" class="class-value" style="style-value" hide="true" ] * * A hide value of "true" or the user being logged in will not show the form * * @link https://codex.wordpress.org/Shortcode_API * @since 1.0.0 * * @param array $atts */ public function launchkey_shortcode($atts) { $class = isset($atts['class']) ? addslashes($atts['class']) : ''; $id = isset($atts['id']) ? addslashes($atts['id']) : ''; $style = isset($atts['style']) ? addslashes($atts['style']) : ''; $hide = isset($atts['hide']) ? $atts['hide'] : ''; if ($hide != 'true' && !$this->wp_facade->is_user_logged_in()) { $this->launchkey_form($class, $id, $style); } }
/** * Hearbeat filter to see if a LaunchKey authenticated user has been de-orbited and log them out if that is the case * * @since 1.0.0 */ public function launchkey_still_authenticated_heartbeat() { /** * If the current session */ if ($this->wp_facade->is_user_logged_in()) { // Get the current user $user = $this->wp_facade->wp_get_current_user(); // If they have been de-authorized if (false === $this->get_user_authorized($user->ID)) { // Log out the user $this->wp_facade->wp_logout(); // Reset the LaunchKey auth properties $this->reset_auth($user->ID); } } }