/** * Display "Are You Sure" message to confirm the action being taken. * * If the action has the nonce explain message, then it will be displayed * along with the "Are you sure?" message. * * @since 0.0.1 * * @param string $action The nonce action. */ function hq_nonce_ays($action) { if ('log-out' == $action) { $html = sprintf(__('You are attempting to log out of %s'), get_bloginfo('name')) . '</p><p>'; $redirect_to = isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : ''; $html .= sprintf(__("Do you really want to <a href='%s'>log out</a>?"), hq_logout_url($redirect_to)); } else { $html = __('Are you sure you want to do this?'); if (hq_get_referer()) { $html .= "</p><p><a href='" . esc_url(remove_query_arg('updated', hq_get_referer())) . "'>" . __('Please try again.') . "</a>"; } } hq_die($html, __('HiveQueen Failure Notice'), 403); }
/** * Display the Log In/Out link. * * Displays a link, which allows users to navigate to the Log In page to log in * or log out depending on whether they are currently logged in. * * @since 0.0.1 * * @param string $redirect Optional path to redirect to on login/logout. * @param bool $echo Default to echo and not return the link. * @return string|void String when retrieving. */ function hq_loginout($redirect = '', $echo = true) { if (!is_user_logged_in()) { $link = '<a href="' . esc_url(hq_login_url($redirect)) . '">' . __('Log in') . '</a>'; } else { $link = '<a href="' . esc_url(hq_logout_url($redirect)) . '">' . __('Log out') . '</a>'; } if ($echo) { /** * Filter the HTML output for the Log In/Log Out link. * * @since 0.0.1 * * @param string $link The HTML link content. */ echo apply_filters('loginout', $link); } else { /** This filter is documented in hq-includes/general-template.php */ return apply_filters('loginout', $link); } }