function _drupal_get_cookie_domain
Derive the cookie domain to use for session cookies.
Parameters
$host: The value of the HTTP host name.
Return value
The string to use as a cookie domain.
2 calls to _drupal_get_cookie_domain()
- drupal_settings_initialize in includes/
bootstrap.inc - Sets the base URL, cookie domain, and session name from configuration.
- SessionUnitTestCase::testCookieDomain in modules/
simpletest/ tests/ session.test
File
-
includes/
bootstrap.inc, line 853
Code
function _drupal_get_cookie_domain($host) {
$cookie_domain = $host;
// Strip leading periods and port numbers from cookie domain.
$cookie_domain = ltrim($cookie_domain, '.');
$cookie_domain = explode(':', $cookie_domain);
$cookie_domain = '.' . $cookie_domain[0];
return $cookie_domain;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.