function gp_populate_notices() { GP::$redirect_notices = array(); $prefix = '_gp_notice_'; foreach ($_COOKIE as $key => $value) { if (gp_startswith($key, $prefix) && ($suffix = substr($key, strlen($prefix)))) { GP::$redirect_notices[$suffix] = $value; backpress_set_cookie($key, '', 0, gp_url_path()); } } }
/** * Deletes all of the cookies associated with authentication * * @since 2.5 */ function clear_auth_cookie() { do_action('clear_auth_cookie'); foreach ($this->cookies as $_scheme => $_scheme_cookies) { foreach ($_scheme_cookies as $_cookie) { backpress_set_cookie($_cookie['name'], ' ', time() - 31536000, $_cookie['path'], $_cookie['domain']); } unset($_cookie); } unset($_scheme, $_scheme_cookies); }
/** * Sets the authentication cookies based User ID * * The $remember parameter increases the time that the cookie will * be kept. The default the cookie is kept without remembering is * two days. When $remember is set, the cookies will be kept for * 14 days or two weeks. * * @since 2.5 * * @param int $user_id User ID * @param int $expiration the UNIX time after which the cookie's authentication token is no longer valid * @param int $expire the UNIX time at which the cookie expires * @param int $scheme name of the */ function set_auth_cookie($user_id, $expiration = 0, $expire = 0, $scheme = 'auth') { if (!isset($this->cookies[$scheme])) { return; } if (!($expiration = absint($expiration))) { $expiration = time() + 172800; // 2 days } $expire = absint($expire); foreach ($this->cookies[$scheme] as $_cookie) { $cookie = $this->generate_auth_cookie($user_id, $expiration, $scheme); if (is_wp_error($cookie)) { return $cookie; } do_action('set_' . $scheme . '_cookie', $cookie, $expire, $expiration, $user_id, $scheme); $domain = $_cookie['domain']; $secure = isset($_cookie['secure']) ? (bool) $_cookie['secure'] : false; // Set httponly if the php version is >= 5.2.0 if (version_compare(phpversion(), '5.2.0', 'ge')) { backpress_set_cookie($_cookie['name'], $cookie, $expire, $_cookie['path'], $domain, $secure, true); } else { $domain = empty($domain) ? $domain : $domain . '; HttpOnly'; backpress_set_cookie($_cookie['name'], $cookie, $expire, $_cookie['path'], $domain, $secure); } } unset($_cookie); }