Exemplo n.º 1
0
function memberful_wp_ensure_user_logged_out_of_memberful()
{
    if (!memberful_wp_is_connected_to_site()) {
        return;
    }
    if (memberful_wp_endpoint_for_request() !== NULL) {
        return;
    }
    wp_safe_redirect(memberful_sign_out_url());
    exit;
}
Exemplo n.º 2
0
/**
 * Listens to all requests and checks to see if the user is trying to access one of
 * the endpoints.
 *
 * If the user is, then the request is dispatched to that endpoint
 */
function memberful_wp_endpoint_filter()
{
    if ($endpoint = memberful_wp_endpoint_for_request()) {
        if (!$endpoint->verify_request($_SERVER['REQUEST_METHOD'])) {
            die('Invalid request');
        }
        header('Cache-Control: private');
        $endpoint->process($_REQUEST, $_SERVER);
        exit;
    }
}